# Test info

- Name: Feature case for request-listing >> REQ_010 - Verify when user fill Text Editor in Create new request
- Location: /root/code/portal-automation-test/tests/request/function.spec.ts:259:9

# Error details

```
Error: Timed out 25000ms waiting for expect(locator).toBeVisible()

Locator: locator('//div[@class=\'letter-thumb-image\']').first()
Expected: visible
Received: <element(s) not found>
Call log:
  - expect.toBeVisible with timeout 25000ms
  - waiting for locator('//div[@class=\'letter-thumb-image\']').first()

    at /root/code/portal-automation-test/tests/request/function.spec.ts:344:75
    at /root/code/portal-automation-test/tests/request/function.spec.ts:338:9
```

# Page snapshot

```yaml
- complementary:
  - img
  - link "(Portal-Auto-Lawyer) Portal QA":
    - /url: /
    - paragraph: (Portal-Auto-Lawyer)
    - paragraph: Portal QA
  - list:
    - listitem:
      - link "Home":
        - /url: https://qa.loprx.com
        - img
        - text: Home
    - listitem:
      - link "Case":
        - /url: https://qa.loprx.com/cases
        - img
        - text: Case
    - listitem:
      - link "Request":
        - /url: https://qa.loprx.com/requests
        - img
        - text: Request
    - listitem:
      - link "Client":
        - /url: https://qa.loprx.com/clients
        - img
        - text: Client
    - listitem:
      - button "Business/Contact":
        - img
        - text: Business/Contact
    - listitem:
      - button "Inbox/Sent":
        - img
        - text: Inbox/Sent
    - listitem:
      - button "Settings":
        - img
        - text: Settings
  - list:
    - listitem:
      - link "Shared with me":
        - /url: https://qa.loprx.com/shared/requests
        - img
        - text: Shared with me
- banner:
  - button [disabled]:
    - img
  - button:
    - img
  - img
  - text: Link Case First shared details about Third Party Letter of Protection 1 week ago
  - img
  - text: What did Tri01 Duc say? Their response to Test Request Letter of Protection is waiting. 6 days ago
  - img
  - text: Tri01 Duc shared some information about Test Request Letter of Protection. Find out what it says. 6 days ago
  - img
  - text: What did Tri01 Duc say? Their response to Test Request Letter of Protection is waiting. 6 days ago
  - img
  - img
  - textbox "Search..."
  - img
  - img
  - paragraph: No notifications yet
  - paragraph: When you get notifications, they'll show up here
  - button "Refresh"
  - list:
    - listitem:
      - img
      - paragraph: Pause notifications...
      - list:
        - listitem: For 30 minutes
        - listitem: For 1 hour
        - listitem: For 2 hours
        - listitem: Until tomorrow
    - listitem:
      - img
    - listitem:
      - img
    - listitem:
      - img
    - listitem:
      - img
    - listitem:
      - img
    - listitem:
      - img
  - img
  - button "4 Cart":
    - img
    - text: 4 Cart
  - text: Feedback
  - img
  - link "Open user menu":
    - /url: "#"
    - text: Minh
- img
- text: New Request
- button "Switch to Fast Submission"
- paragraph: "1"
- paragraph: Action
- text: Perform an Action
- paragraph: "2"
- paragraph: Client
- text: Identify the Client
- paragraph: "3"
- paragraph: Business
- text: Identify a Business
- paragraph: "4"
- paragraph: Message
- text: Prepare a message
- paragraph: "5"
- paragraph: Share
- text: Share with recipients Tips
- img
- text: "Ready to Share? It's Fast and Easy! Just like our smart editor that learns with each use, this system helps you send requests in a flash:"
- list:
  - listitem: "Enter Email Address: Simply type in the recipient's email address to get started."
  - listitem: "Smart Suggestions: Know the business you're contacting? Select it in the \"Business\" section. This nifty feature will automatically suggest the most relevant contact person based on your past interactions with the business, saving you time searching."
  - listitem: Pick & Send - You're Done! Review the suggested contact and hit Create & Share. It's that easy!
- text: More... Share
- heading "Notes & Preferences" [level=4]
- text: "To:"
- textbox [disabled]
- text: Cc Bcc
- checkbox "Send email notification" [checked] [disabled]
- text: Send email notification Message
- textbox "Message" [disabled]
- text: Previous Create Only
```

# Test source

```ts
  244 |             await expect(requestPage.requestLoc.messageRepondSucces).toBeVisible({ timeout: 20_000 });
  245 |             await expect(textEditorBody).not.toBeVisible();
  246 |             await requestPage.waitForSecond(5);
  247 |             await expect(requestPage.requestLoc.headerModalNewPost).toBeVisible();
  248 |
  249 |             await requestPage.requestLoc.buttonLeaveIt.click();
  250 |         })
  251 |
  252 |         await test.step("Verify the similarities between Text in Editor and Posted", async () => {
  253 |             await requestPage.requestLoc.thumbImagePosted.first().click();
  254 |             await requestPage.waitForSecond(5)
  255 |             await verifyScreenshot("post-details-snapshot.png", requestPage.requestLoc.detailPostedAttachment, [], 0.02)
  256 |         })
  257 |     })
  258 |
  259 |     test("REQ_010 - Verify when user fill Text Editor in Create new request", {
  260 |         tag: ['@REQ_010', '@request', '@function']
  261 |     }, async ({ conf }) => {
  262 |
  263 |         await test.step("Verify site create new request appear", async () => {
  264 |             await requestPage.gotoCreateRequest("step");
  265 |             await expect(requestPage.dashboardLoc.buttonByText("Switch to Fast Submission")).toBeVisible();
  266 |         })
  267 |
  268 |         await test.step("Verify when choose option in step action, patient, business", async () => {
  269 |             //Choose action type
  270 |             await expect(requestPage.requestLoc.actionLetterOfProtection).toBeVisible();
  271 |             await requestPage.waitForSecond(1);
  272 |             await requestPage.requestLoc.actionLetterOfProtection.click({ force: true });
  273 |             await requestPage.requestLoc.btnNextStep.click();
  274 |
  275 |             //Choose patient
  276 |             await expect(requestPage.requestLoc.listPatientSuggested).toBeVisible();
  277 |             await requestPage.requestLoc.listPatientSuggested.click();
  278 |             await requestPage.requestLoc.btnNextStep.click();
  279 |
  280 |             //Choose business
  281 |             await expect(requestPage.requestLoc.listBusinessSuggested).toBeVisible();
  282 |             await requestPage.requestLoc.listBusinessSuggested.click();
  283 |             await requestPage.requestLoc.btnNextStep.click();
  284 |             await expect(requestPage.requestLoc.textEditorCreateCaseArea).toBeVisible()
  285 |         })
  286 |
  287 |         const textEditor = requestPage.requestLoc.textEditorCreateCaseArea;
  288 |
  289 |         await test.step("Verify when typing first message in editor text", async () => {
  290 |             //Clear text
  291 |             await textEditor.evaluate((el) => (el.innerHTML = ''));
  292 |
  293 |             await textEditor.type(conf.data.first_message, { delay: 20 });
  294 |             await expect(textEditor).toHaveText(conf.data.first_message);
  295 |         })
  296 |
  297 |         await test.step("Verify when typing second message italic in editor text", async () => {
  298 |             await textEditor.press('Enter');
  299 |             await requestPage.requestLoc.btnItalicEditorCreate.click();
  300 |             await textEditor.type(conf.data.second_message, { delay: 20 });
  301 |             await requestPage.requestLoc.btnItalicEditorCreate.click();
  302 |
  303 |             await expect(textEditor).toContainText(conf.data.second_message);
  304 |             await expect(textEditor.locator("//p[2]/em")).toHaveText(conf.data.second_message);
  305 |         })
  306 |
  307 |         await test.step("Verify when typing third message bold in editor text", async () => {
  308 |             await textEditor.press('Enter');
  309 |             await requestPage.requestLoc.btnBoldEditorCreate.click();
  310 |             await textEditor.type(conf.data.third_message, { delay: 20 });
  311 |             await requestPage.requestLoc.btnBoldEditorCreate.click();
  312 |
  313 |             await expect(textEditor).toContainText(conf.data.third_message);
  314 |             await expect(textEditor.locator("//p[3]/strong")).toHaveText(conf.data.third_message);
  315 |         })
  316 |
  317 |         await test.step("Verify when typing list type number in editor text", async () => {
  318 |             await textEditor.press('Enter');
  319 |             await requestPage.requestLoc.btnListNumberTypeCreate.click();
  320 |             await requestPage.rendListTextEditor(conf.data.child_message);
  321 |
  322 |             await expect(textEditor.locator("ol li")).toHaveCount(3);
  323 |             for (let i = 1; i <= 3; i++) {
  324 |                 await expect(textEditor.locator(`ol li:nth-child(${i})`)).toHaveText(conf.data.child_message);
  325 |             }
  326 |         })
  327 |
  328 |         await test.step("Verify when typing list type dot in editor text", async () => {
  329 |             await requestPage.requestLoc.btnListDotTypeCreate.click();
  330 |             await requestPage.rendListTextEditor(conf.data.child_message);
  331 |
  332 |             await expect(textEditor.locator("ul li")).toHaveCount(3);
  333 |             for (let i = 1; i <= 3; i++) {
  334 |                 await expect(textEditor.locator(`ul li:nth-child(${i})`)).toHaveText(conf.data.child_message);
  335 |             }
  336 |         })
  337 |
  338 |         await test.step("Verify when submit create request", async () => {
  339 |             await requestPage.requestLoc.btnNextStep.click();
  340 |             await expect(requestPage.requestLoc.btnCreateOnly).toBeVisible();
  341 |             await requestPage.requestLoc.btnCreateOnly.click({ force: true });
  342 |             await requestPage.waitForSecond(3);
  343 |
> 344 |             await expect(requestPage.requestLoc.thumbImagePosted.first()).toBeVisible({ timeout: 25_000 });
      |                                                                           ^ Error: Timed out 25000ms waiting for expect(locator).toBeVisible()
  345 |         })
  346 |
  347 |         await test.step("Verify the similarities between Text in Editor and Posted", async () => {
  348 |             await requestPage.requestLoc.thumbImagePosted.first().click();
  349 |             await requestPage.waitForSecond(5);
  350 |             await verifyScreenshot("post-details-create-snapshot.png", requestPage.requestLoc.detailPostedAttachment, [], 0.02)
  351 |         })
  352 |     })
  353 |
  354 |     test("REQ_013 - Verify when create with Step-by-Step", {
  355 |         tag: ['@REQ_013', '@request', '@function']
  356 |     }, async ({ conf }) => {
  357 |         test.setTimeout(170_000);
  358 |         let url: string = "";
  359 |         let uniqueBusiness: string = "";
  360 |         await test.step("Goto create new with Step-by-Step", async () => {
  361 |             await requestPage.gotoCreateRequest("step");
  362 |             await expect(requestPage.dashboardLoc.buttonByText("Switch to Fast Submission")).toBeVisible();
  363 |         })
  364 |
  365 |         await test.step("Choose action type and verify next step", async () => {
  366 |             await requestPage.requestLoc.actionLetterOfProtection.click();
  367 |             await requestPage.requestLoc.btnNextStep.click();
  368 |             await expect(requestPage.requestLoc.create.headerInCreateStep("Patient")).toBeVisible();
  369 |         })
  370 |
  371 |         await test.step("Choose client and verify next step", async () => {
  372 |             const dataOfOptions = await requestPage.fillDataCreateRequest("Type or select a name", "Name", conf.data.patient);
  373 |             expect(dataOfOptions.infoPatient).toContain(dataOfOptions.address);
  374 |
  375 |             await requestPage.requestLoc.btnNextStep.click();
  376 |             await expect(requestPage.requestLoc.create.headerInCreateStep("Business")).toBeVisible();
  377 |         })
  378 |
  379 |         await test.step("Choose business and verify next step", async () => {
  380 |             uniqueBusiness = conf.data.business + randomString(8);
  381 |             await requestPage.requestLoc.create.inputByPlaceholder("Type or select a business").first().type(uniqueBusiness, { delay: 100 });
  382 |             await expect(requestPage.requestLoc.create.btnAddNewOption(uniqueBusiness)).toBeVisible();
  383 |             await requestPage.requestLoc.create.btnAddNewOption(uniqueBusiness).click();
  384 |
  385 |             await expect(requestPage.dashboardLoc.modal.headerModal("New Business")).toBeVisible();
  386 |             await expect(requestPage.dashboardLoc.modal.inputByID("autocomplete_name")).toHaveValue(uniqueBusiness);
  387 |
  388 |             await requestPage.dashboardLoc.buttonByText("Create").nth(1).click();
  389 |             await expect(requestPage.dashboardLoc.msgCreateSuccess).toBeVisible();
  390 |             await expect(requestPage.dashboardLoc.modal.inputByID("autocomplete_business_provider_id")).toHaveValue(uniqueBusiness);
  391 |             await requestPage.requestLoc.btnNextStep.click();
  392 |             await expect(requestPage.requestLoc.create.headerInCreateStep("Message")).toBeVisible();
  393 |         })
  394 |
  395 |         await test.step("Verify add message, share request", async () => {
  396 |             await requestPage.requestLoc.btnNextStep.click();
  397 |             await expect(requestPage.requestLoc.create.headerInCreateStep("Share")).toBeVisible();
  398 |             await requestPage.requestLoc.create.inputByPlaceholder("Type or select an email address").type(conf.data.user_recive, { delay: 100 });
  399 |             await expect(requestPage.requestLoc.create.inputByPlaceholder("Type or select an email address")).toHaveValue(conf.data.user_recive);
  400 |             await expect(requestPage.requestLoc.create.dropdownMemberShare(conf.data.user_recive)).toBeVisible();
  401 |             await requestPage.requestLoc.create.dropdownMemberShare(conf.data.user_recive).click({ force: true });
  402 |
  403 |             await requestPage.requestLoc.create.headerInCreateStep("Share").click();
  404 |             await requestPage.requestLoc.create.btnCreateAndShare.click();
  405 |             await expect(requestPage.requestLoc.create.caseIDRequest).toBeVisible({ timeout: 35_000 });
  406 |             url = requestPage.page.url();
  407 |         });
  408 |
  409 |         await test.step("Verify business had suggest in the firsts list", async () => {
  410 |             //Verify showing in case detail
  411 |             const casePage = new CasePage(requestPage.page);
  412 |             await casePage.open();
  413 |             await casePage.getDetailCase("495528");
  414 |             await casePage.dashboardLoc.listBusinesses.last().click();
  415 |             await expect(casePage.dashboardLoc.modal.headerModal("Business")).toBeVisible();
  416 |             const businessFirstRecommend = await casePage.caseLoc.detail.firstSuggestBusiness.innerText();
  417 |             expect(businessFirstRecommend).toBe(uniqueBusiness);
  418 |
  419 |             // Verify showing when create request
  420 |             await requestPage.gotoCreateRequest("multi");
  421 |             await requestPage.requestLoc.create.itemStep(3).first().click();
  422 |             await expect(requestPage.requestLoc.detail.businessFirstRecommend).toHaveText(uniqueBusiness);
  423 |         })
  424 |
  425 |         await test.step("Verify user had recive request", async () => {
  426 |             await requestPage.changeUser(conf.data.username_recive, conf.data.password_recive, requestPage.page);
  427 |
  428 |             await expect(loginPage.baseLoc.dashboardContainer).toBeVisible({ timeout: 15_000 });
  429 |             await requestPage.checkNotification("New Request", true);
  430 |             await expect(requestPage.requestLoc.create.caseIDRequest).toBeVisible();
  431 |             const urlRecive = requestPage.page.url();
  432 |             expect(urlRecive.replace('/shared', '')).toBe(url);
  433 |         })
  434 |     })
  435 |
  436 |     test("REQ_014 - Verify when create with Fast Submission with multiple request", {
  437 |         tag: ['@REQ_014', '@request', '@function']
  438 |     }, async ({ conf }) => {
  439 |         await test.step("Goto create new with Fast Submission", async () => {
  440 |             await requestPage.gotoCreateRequest("multi");
  441 |             await expect(requestPage.dashboardLoc.buttonByText("Switch to Step-by-Step")).toBeVisible();
  442 |         })
  443 |
  444 |         await test.step("Verify when click add more request", async () => {
```