# Test info

- Name: Feature case for request-listing >> REQ_013 - Verify when create with Step-by-Step
- Location: /root/code/portal-automation-test/tests/request/function.spec.ts:354:9

# Error details

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

Locator: locator('//div[@class=\'list-info-name-pin pin-item\']')
Expected: visible
Received: <element(s) not found>
Call log:
  - expect.toBeVisible with timeout 35000ms
  - waiting for locator('//div[@class=\'list-info-name-pin pin-item\']')

    at /root/code/portal-automation-test/tests/request/function.spec.ts:405:71
    at /root/code/portal-automation-test/tests/request/function.spec.ts:395:9
```

# Page snapshot

```yaml
- complementary:
  - img
  - link "WellCare Pharmacy12321@@@@ Portal QA":
    - /url: /
    - paragraph: WellCare Pharmacy12321@@@@
    - 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 "Patient":
        - /url: https://qa.loprx.com/clients
        - img
        - text: Patient
    - 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:
    - img
  - button:
    - img
  - img
  - text: Minh Phong shared details regarding New Case 123 Letter of Protection. See the information now. 3 days ago
  - img
  - text: "Get the details: Lawyer Phan's response to the Letter of Protection Test Request is now available. 3 days ago"
  - img
  - text: Son HaiBon Phan assigned a request to you 11 hours ago
  - img
  - text: Son HaiBon Phan assigned a case to you 2 hours ago
  - img
  - text: Tri01 Duc shared some information about New Guy 123 Letter of Protection. Find out what it says. 1 week ago
  - img
  - text: "Get the details: Lawyer Phan's response to the Letter of Protection Test Request is now available. 3 days ago"
  - img
  - text: Son HaiBon Phan assigned a request to you 11 hours ago
  - img
  - text: Son HaiBon Phan assigned a case to you 2 hours 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 "0 Cart":
    - img
    - text: 0 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: Patient
- text: Identify the Patient
- paragraph: "3"
- paragraph: Business
- text: Identify a Business
- paragraph: "4"
- paragraph: Message
- text: Prepare a message
- paragraph: "5"
- paragraph: Share
- text: Share with recipients
- img
- text: Share
- heading "Notes & Preferences" [level=4]
- text: "To: Tri01 Duc triducgog0301+1@gmail.com"
- img
- textbox [disabled]
- text: Cc Bcc
- checkbox "Send email notification" [checked] [disabled]
- text: Send email notification Message
- textbox "Message" [disabled]
- text: Previous Create & Share
```

# Test source

```ts
  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 });
  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 });
      |                                                                       ^ Error: Timed out 35000ms waiting for expect(locator).toBeVisible()
  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 () => {
  445 |             await requestPage.dashboardLoc.buttonByText("Add more").click();
  446 |             const listOfCreationRequests = (await requestPage.requestLoc.create.boxCreateMultiRequests.all()).length;
  447 |             expect(listOfCreationRequests).toBe(2);
  448 |         })
  449 |
  450 |         await test.step("Fill data to request", async () => {
  451 |             //Choose Action type
  452 |             await requestPage.requestLoc.create.itemStep(1).first().click();
  453 |             await requestPage.requestLoc.actionLetterOfProtection.first().click();
  454 |
  455 |             //Choose Client
  456 |             await requestPage.requestLoc.create.itemStep(2).first().click();
  457 |             const dataOfOptionsClient = await requestPage.fillDataCreateRequest("Type or select a name", "Name", conf.data.patient);
  458 |             expect(dataOfOptionsClient.infoPatient).toContain(dataOfOptionsClient.address);
  459 |
  460 |             //Choose Business
  461 |             await requestPage.requestLoc.create.itemStep(3).first().click();
  462 |             const dataOfOptionsBusiness = await requestPage.fillDataCreateRequest("Type or select a business", "Business Name", conf.data.business);
  463 |
  464 |             //Fix tạm thời sau cần chỉnh lại dynamic
  465 |             const address = "5718 Westheimer Rd., Ste 1000, Houston";
  466 |             expect(dataOfOptionsBusiness.infoPatient).toContain(address);
  467 |
  468 |             //Fill email member to share
  469 |             await requestPage.requestLoc.create.itemStep(5).first().click();
  470 |             await requestPage.requestLoc.create.inputByPlaceholder("Type or select an email address").first().fill(conf.data.user_recive);
  471 |             await expect(requestPage.requestLoc.create.inputByPlaceholder("Type or select an email address").first()).toHaveValue(conf.data.user_recive);
  472 |             await requestPage.requestLoc.create.dropdownMemberShare(conf.data.user_recive).click();
  473 |
  474 |             // Aplly for all requests
  475 |             const applyAllFields = ["patient", "action", "business", "message", "share"];
  476 |             await requestPage.dashboardLoc.common.spanText("New Request").click();
  477 |             for (let i = 0; i < applyAllFields.length; i++) {
  478 |                 await requestPage.waitForSecond(1);
  479 |                 await requestPage.requestLoc.create.inputCheckAll(applyAllFields[i]).click({ force: true });
  480 |             }
  481 |         })
  482 |
  483 |         await test.step("Verify create multi request", async () => {
  484 |             await requestPage.dashboardLoc.buttonByText("Create").first().click();
  485 |             await expect(requestPage.requestLoc.create.viewRequest.first()).toBeVisible({ timeout: 35_000 });
  486 |             const requestsCreated = await requestPage.requestLoc.create.viewRequest.all();
  487 |             expect(requestsCreated.length).toBe(2);
  488 |             const listRequest: string[] = [];
  489 |             for (let i = 0; i < requestsCreated.length; i++) {
  490 |                 listRequest.push(await requestsCreated[i].innerText());
  491 |             }
  492 |             listRequest.reverse();
  493 |
  494 |             //Verify receive notification from shared user
  495 |             await requestPage.changeUser(conf.data.username_recive, conf.data.password_recive, requestPage.page);
  496 |             await expect(requestPage.dashboardLoc.notification.signalNoti).toBeVisible();
  497 |             await requestPage.checkNotification("New Request");
  498 |             await expect(requestPage.dashboardLoc.notification.requestID(listRequest[0])).toBeVisible();
  499 |             await requestPage.waitForSecond(3);
  500 |
  501 |             const listDesNotifications = await requestPage.dashboardLoc.notification.desNotifications.all();
  502 |             for (let i = 0; i < requestsCreated.length; i++) {
  503 |                 const descriptin = await listDesNotifications[i].textContent();
  504 |                 expect(descriptin).toContain(listRequest[i]);
  505 |                 expect(descriptin).toContain(conf.data.patient);
```