# Test info

- Name: Feature case for request-listing >> REQ_051 - Add more than 20 requests to the cart and create multiple requests
- Location: /root/code/portal-automation-test/tests/request/function.spec.ts:1617:9

# Error details

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

Locator: locator('//button[text()=\'Create Another\']')
Expected: visible
Received: <element(s) not found>
Call log:
  - expect.toBeVisible with timeout 180000ms
  - waiting for locator('//button[text()=\'Create Another\']')

    at /root/code/portal-automation-test/tests/request/function.spec.ts:1650:81
    at /root/code/portal-automation-test/tests/request/function.spec.ts:1637:9
```

# Page snapshot

```yaml
- complementary:
  - img
  - link:
    - /url: /
  - list:
    - listitem:
      - link:
        - /url: https://qa.loprx.com
        - img
    - listitem:
      - link:
        - /url: https://qa.loprx.com/cases
        - img
    - listitem:
      - link:
        - /url: https://qa.loprx.com/requests
        - img
    - listitem:
      - link:
        - /url: https://qa.loprx.com/clients
        - img
    - listitem:
      - button:
        - img
    - listitem:
      - button:
        - img
    - listitem:
      - button:
        - img
  - list:
    - listitem:
      - button:
        - img
- banner:
  - button:
    - img
  - button [disabled]:
    - img
  - img
  - text: Tri01 Duc shared details regarding Not Accept This Request Medical Bill. See the information now. 26 minutes ago
  - img
  - text: "Get the details: Tri01 Duc's response to the Letter of Protection New Patient Test is now available. 12 hours ago"
  - img
  - 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 "24 Cart":
    - img
    - text: 24 Cart
  - text: Feedback
  - img
  - link "Open user menu":
    - /url: "#"
    - text: Minh
- img
- text: New Request
- button "Switch to Step-by-Step"
- text: Tips
- img
- text: Welcome to the Fast Track!
- paragraph: This section allows you to submit multiple requests for one or several clients simultaneously, saving you valuable time. Instead of handling requests individually, you can create them for all your clients at once, streamlining your workflow.
- text: More...
- paragraph: "1"
- text: Select an Action
- paragraph: "2"
- text: Identify Client
- paragraph: "3"
- text: Identify a Business
- paragraph: "4"
- text: Create Message
- paragraph: "5"
- text: Share with Others
- checkbox "Apply all" [checked] [disabled]
- text: Apply all
- checkbox "Apply all" [disabled]
- text: Apply all
- checkbox "Apply all" [disabled]
- text: Apply all
- checkbox "Apply all" [checked] [disabled]
- text: Apply all
- img
- checkbox "Apply all" [disabled]
- text: Apply all Letter of Protection Test Request (Dat Lawyers) Typed Message Email
- img
- text: Delete Letter of Protection Test Request (Dat Lawyers) Typed Message Email
- img
- text: Delete Letter of Protection Test Request (Dat Lawyers) Typed Message Email
- img
- text: Delete Letter of Protection Test Request (Dat Lawyers) Typed Message Email
- img
- text: Delete Letter of Protection Test Request (Dat Lawyers) Typed Message Email
- img
- text: Delete Letter of Protection Test Request (Dat Lawyers) Typed Message Email
- img
- text: Delete Letter of Protection Test Request (Dat Lawyers) Typed Message Email
- img
- text: Delete Letter of Protection Test Request (Dat Lawyers) Typed Message Email
- img
- text: Delete Letter of Protection Test Request The Vu Law Firm Typed Message Email
- img
- text: Delete Letter of Protection Test Request The Vu Law Firm Typed Message Email
- img
- text: Delete Letter of Protection Test Request The Vu Law Firm Typed Message Email
- img
- text: Delete Letter of Protection Test Request The Vu Law Firm Typed Message Email
- img
- text: Delete Letter of Protection Test Request The Vu Law Firm Typed Message Email
- img
- text: Delete Letter of Protection Test Request The Vu Law Firm Typed Message Email
- img
- text: Delete Letter of Protection Test Request The Vu Law Firm Typed Message Email
- img
- text: Delete Letter of Protection Test Request The Vu Law Firm Typed Message Email
- img
- text: Delete Letter of Protection Test Request A Taylor Law Firm Typed Message Email
- img
- text: Delete Letter of Protection Test Request A Taylor Law Firm Typed Message Email
- img
- text: Delete Letter of Protection Test Request A Taylor Law Firm Typed Message Email
- img
- text: Delete Letter of Protection Test Request A Taylor Law Firm Typed Message Email
- img
- text: Delete
- button "Add more" [disabled]
- button "Create"
```

# Test source

```ts
  1550 |             await requestPage.dashboardLoc.buttonByText("Add more").click();
  1551 |             const listOfCreationRequests = (await requestPage.requestLoc.create.boxCreateMultiRequests.all()).length;
  1552 |             expect(listOfCreationRequests).toBe(2);
  1553 |         })
  1554 |
  1555 |         await test.step("Verify add patient, apply all and check DOI in row 2", async () => {
  1556 |             await requestPage.requestLoc.create.itemStep(2).first().click();
  1557 |             await requestPage.fillDataCreateRequest("Type or select a name", "Name", conf.data.patient);
  1558 |             await requestPage.requestLoc.create.inputCheckAll("patient").click();
  1559 |             await requestPage.waitForSecond(2);
  1560 |             await requestPage.requestLoc.create.inputCheckAll("patient").click()
  1561 |             await expect(requestPage.requestLoc.create.itemRow2).toBeVisible();
  1562 |             await requestPage.requestLoc.create.itemRow2.click();
  1563 |             await expect(requestPage.requestLoc.create.inputDOIInStep2).toBeVisible();
  1564 |             await expect(requestPage.requestLoc.create.inputDOIInStep2).toHaveValue("01/01/1992")
  1565 |         })
  1566 |     })
  1567 |
  1568 |     test("REQ_050 - Verify choose message template when create new request", {
  1569 |         tag: ["@REQ_050", "@request", "@function"]
  1570 |     }, async ({ conf }) => {
  1571 |         // Handle missing info popup if it appears
  1572 |         await requestPage.handleMissingInfoPopup();
  1573 |
  1574 |         await test.step("Verify create request with Edit template message", async () => {
  1575 |             await requestPage.initiateRequestCreation(conf.data.patient);
  1576 |
  1577 |             // Select and edit template
  1578 |             await requestPage.requestLoc.create.arrowIcon.click();
  1579 |             await requestPage.dashboardLoc.common.spanText("Template-2 Rxs Pad (Editor)").click();
  1580 |
  1581 |             const textEditor = requestPage.requestLoc.create.textEditorCreateFast.first();
  1582 |             await textEditor.click();
  1583 |             await textEditor.press('ControlOrMeta+a');
  1584 |             await textEditor.press('Delete');
  1585 |             await textEditor.fill(conf.data.message_edit_text);
  1586 |             await requestPage.requestLoc.create.closeModalMessage.click();
  1587 |
  1588 |             await requestPage.submitAndVerifyRequest("post-details-create-template-editor-snapshot.png");
  1589 |         });
  1590 |
  1591 |         await test.step("Verify create request with Form text message", async () => {
  1592 |             await requestPage.initiateRequestCreation(conf.data.patient);
  1593 |
  1594 |             // Select and configure form template
  1595 |             await requestPage.requestLoc.create.arrowIcon.click();
  1596 |             await requestPage.dashboardLoc.common.spanText("Template-3 DME Rx Pad (Form)").click();
  1597 |
  1598 |             const textEditorForm = requestPage.page.locator('iframe[title="iframe-editor"]');
  1599 |             const formContent = textEditorForm.contentFrame();
  1600 |
  1601 |             // Clear existing content and set form options
  1602 |             await formContent.getByText('Dr. Jason Phan').dblclick();
  1603 |             await formContent.locator('body').press('ControlOrMeta+a');
  1604 |             await formContent.locator('body').press('Delete');
  1605 |
  1606 |             // Check all language options
  1607 |             const languageOptions = ['Vietnamese', 'Chinese', 'Spanish'];
  1608 |             for (const lang of languageOptions) {
  1609 |                 await formContent.getByRole('checkbox', { name: `Label in ${lang}` }).check();
  1610 |             }
  1611 |
  1612 |             await requestPage.requestLoc.create.closeModalMessage.click();
  1613 |             await requestPage.submitAndVerifyRequest("post-details-create-template-form-snapshot.png");
  1614 |         });
  1615 |     });
  1616 |
  1617 |     test("REQ_051 - Add more than 20 requests to the cart and create multiple requests", {
  1618 |         tag: ["@REQ_051", "@request", "@function"]
  1619 |     }, async ({ conf, checkCart }) => {
  1620 |         test.setTimeout(280_000);
  1621 |         const businesses = ["(Dat Lawyers)", "The Vu Law Firm", "A Taylor Law Firm"];
  1622 |         await test.step("Add 24 requests by hovering in case id to cart", async () => {
  1623 |             await checkCart.search(conf.data.request);
  1624 |             await expect(checkCart.dashboardLoc.table.itemInRow(conf.data.case)).toBeVisible();
  1625 |             await checkCart.waitForSecond(1);
  1626 |             await checkCart.dashboardLoc.table.itemInRow(conf.data.case).hover();
  1627 |             for (let i = 0; i < businesses.length; i++) {
  1628 |                 await checkCart.requestLoc.detail.cartRequest.optionBusinessInCart(businesses[i]).click();
  1629 |                 for (let j = 0; j < 8; j++) {
  1630 |                     await checkCart.requestLoc.detail.cartRequest.listRequestTypeByHovering.first().click();
  1631 |                 }
  1632 |             }
  1633 |             await checkCart.page.mouse.move(30, 30);
  1634 |             await expect(checkCart.requestLoc.detail.cartRequest.quickSubmitButton("24")).toBeVisible();
  1635 |         })
  1636 |
  1637 |         await test.step("Submit 24 requests, and verify that only 20 are successfully added to the cart, with 4 remaining", async () => {
  1638 |             await requestPage.handleMissingInfoPopup();
  1639 |
  1640 |             await checkCart.requestLoc.detail.cartRequest.quickSubmitButton("24").click();
  1641 |             await requestPage.requestLoc.create.inputCheckAll("action").click();
  1642 |
  1643 |             //Add message
  1644 |             await requestPage.requestLoc.create.itemStep(4).first().click();
  1645 |             await requestPage.requestLoc.textEditorCreateCaseArea.first().waitFor({ state: 'visible' });
  1646 |             await requestPage.requestLoc.textEditorCreateCaseArea.fill("Message");
  1647 |
  1648 |             await requestPage.requestLoc.create.inputCheckAll("message").click();
  1649 |             await checkCart.dashboardLoc.buttonByText("Create").first().click();
> 1650 |             await expect(checkCart.dashboardLoc.buttonByText("Create Another")).toBeVisible({ timeout: 180_000 }); // Create 20 request in once can take longer time
       |                                                                                 ^ Error: Timed out 180000ms waiting for expect(locator).toBeVisible()
  1651 |
  1652 |             //Verify cart have 4 requests left
  1653 |             await checkCart.dashboardLoc.cart.buttonCart.hover({ force: true });
  1654 |             await expect(checkCart.dashboardLoc.cart.requestButtonCart).toBeVisible();
  1655 |             await checkCart.dashboardLoc.cart.requestButtonCart.click();
  1656 |             await expect(checkCart.requestLoc.detail.cartRequest.tdInTable("A Taylor Law Firm").first()).toBeVisible();
  1657 |             await verifyScreenshot('list-request-left-4-requests.png', checkCart.requestLoc.create.overviewCreateFast);
  1658 |         });
  1659 |     });
  1660 |
  1661 |     test("REQ_052 - Resend mail", {
  1662 |         tag: ["@REQ_052", "@request", "@function"]
  1663 |     }, async ({ conf, request }) => {
  1664 |         await test.step("Click resend mail", async () => {
  1665 |             await requestPage.getDetailCase(conf.data.case);
  1666 |             await expect(requestPage.dashboardLoc.buttonByText("Share")).toBeVisible();
  1667 |
  1668 |             await requestPage.dashboardLoc.buttonByText("Share").click();
  1669 |             await expect(requestPage.dashboardLoc.modal.headerModal("Share with others")).toBeVisible();
  1670 |             await expect(requestPage.requestLoc.detail.rowMemberShare(conf.data.member_share)).toBeVisible();
  1671 |
  1672 |             await requestPage.requestLoc.detail.rowMemberShare(conf.data.member_share).hover();
  1673 |             await requestPage.requestLoc.detail.btnResend.first().click();
  1674 |             await expect(requestPage.requestLoc.detail.tagMemberShared(conf.data.member_share)).toBeVisible();
  1675 |
  1676 |             await requestPage.requestLoc.detail.rowMemberShare(conf.data.member_share).hover();
  1677 |             await expect(requestPage.requestLoc.detail.btnResend.first()).not.toBeVisible();
  1678 |         });
  1679 |
  1680 |         await test.step("Verify submit and email received", async () => {
  1681 |             await requestPage.dashboardLoc.buttonByText("Done").first().click();
  1682 |             await expect(requestPage.dashboardLoc.msgSuccess).toBeVisible();
  1683 |             const mail = new Mail(requestPage.page, request);
  1684 |             await mail.open();
  1685 |             await mail.waitForSecond(conf.data.wait_for_email_second);
  1686 |
  1687 |             // Find and verify the share email
  1688 |             await mail.mailLoc.titleMail(`Letter of Protection #${conf.data.case}`).first().click();
  1689 |             const mailFrame = mail.mailLoc.mailFrame;
  1690 |             await mail.waitForSecond(2);
  1691 |
  1692 |             const buttonOpenRequest = mailFrame.locator('//a[contains(text(),"Open")]');
  1693 |             const newTabPage = await requestPage.openLinkAndCompletePasscode(requestPage, request, buttonOpenRequest);
  1694 |             await newTabPage.waitForSecond(3);
  1695 |             expect(newTabPage.page.url()).toContain(`shared/requests/${conf.data.case}`);
  1696 |         });
  1697 |     });
  1698 | });
  1699 |
```