# Test info

- Name: Feature case for request-listing >> REQ_045 - Share request: Sharing multiple requests with a single user
- Location: /root/code/portal-automation-test/tests/request/function.spec.ts:1514:9

# Error details

```
Error: locator.check: Test timeout of 200000ms exceeded.
Call log:
  - waiting for locator('//input[contains(@id,\'checkbox-undefined-undefined\')]').first()

    at RequestPage.bulkShareFirstNRequests (/root/code/portal-automation-test/pom/request/request.page.ts:542:72)
    at /root/code/portal-automation-test/tests/request/function.spec.ts:1520:13
    at /root/code/portal-automation-test/tests/request/function.spec.ts:1518: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. 2 days ago
  - img
  - text: "Get the details: Lawyer Phan's response to the Letter of Protection Test Request is now available. 2 days ago"
  - img
  - text: Son HaiBon Phan assigned a request to you 25 minutes ago
  - img
  - text: Son HaiBon Phan assigned a case to you 2 hours ago
  - img
  - text: Minh Phong shared some information about New Case 123 Letter of Protection. Find out what it says. 2 days ago
  - img
  - text: "Get the details: Lawyer Phan's response to the Letter of Protection Test Request is now available. 2 days ago"
  - img
  - text: Son HaiBon Phan assigned a request to you 25 minutes 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: Bulk Edit
- button "Back"
- paragraph: "0"
- paragraph: Bulk Edit
- paragraph: "0"
- paragraph: Reduction
- text: "1 of 4 steps Step 1: Choose Requests Step 2: Apply Bulk Action Step 3: Action Detail Step 4: Confirmation"
- img
- paragraph:
  - text: "Step 1: Choose Requests"
  - img
- paragraph: Showing 0 requests from Page 1.
- table:
  - rowgroup:
    - 'row "Request # Request Patient Name From Directed To Status Status Details"':
      - cell:
        - img
      - 'cell "Request #"'
      - cell "Request"
      - cell "Patient Name"
      - cell "From"
      - cell "Directed To"
      - cell "Status"
      - cell "Status Details"
      - cell
  - rowgroup:
    - row "No records found":
      - cell "No records found"
- button "Back"
- text: You have selected 0 request
- button "Next" [disabled]
```

# Test source

```ts
  442 |     await this.dashboardLoc.btnClosePopupNotification.click();
  443 |   }
  444 |
  445 |   async assignToUser(username: string): Promise<void> {
  446 |     await this.requestLoc.detail.inputSearchAssignee.fill(username);
  447 |     await this.requestLoc.create.boxTextBusiness(username).click();
  448 |     await this.requestLoc.detail.btnSubmitAssignee.click();
  449 |   }
  450 |
  451 |   async openCloneRequestModal(): Promise<void> {
  452 |     await this.dashboardLoc.buttonByText("Activity").click();
  453 |     await this.dashboardLoc.buttonByText("Clone Request").first().click();
  454 |   }
  455 |
  456 |   async fillCloneRequestForm(business: string, member: string, archiveOption?: string): Promise<void> {
  457 |     await this.requestLoc.detail.cloneRequest.inputBusiness.first().fill(business);
  458 |     await this.requestLoc.create.boxTextBusiness(business).click();
  459 |     await this.requestLoc.detail.cloneRequest.inputMember.fill(member);
  460 |     await this.requestLoc.create.dropdownMemberShare(member).click();
  461 |     await this.dashboardLoc.modal.headerModal("Clone Request").click();
  462 |     // await this.requestLoc.detail.cloneRequest.inputMember.fill(member);
  463 |     if (archiveOption) {
  464 |       await this.requestLoc.detail.cloneRequest.inputArchive.click();
  465 |       await this.requestLoc.detail.cloneRequest.inputArchive.type(archiveOption, { delay: 100 });
  466 |       await this.requestLoc.detail.cloneRequest.optionArchive(archiveOption).click();
  467 |     }
  468 |   }
  469 |
  470 |   async submitCloneRequest(): Promise<void> {
  471 |     await this.requestLoc.detail.btnSubmitCloneRequest.click();
  472 |   }
  473 |
  474 |   async toggleNotification(notiType: any): Promise<void> {
  475 |     await this.requestLoc.detail.notification.btnOpenModalNoti.nth(1).click();
  476 |     await this.requestLoc.detail.notification.btnToggleSettingNoti.first().click();
  477 |     await this.waitForSecond(2);
  478 |     await this.requestLoc.detail.notification.inputNotiByName(notiType.name).click({ force: true });
  479 |     await this.waitForSecond(2);
  480 |     await this.dashboardLoc.buttonByText("Close").nth(2).click();
  481 |     await this.open();
  482 |   }
  483 |
  484 |   async triggerNotificationFromAnotherUser(browser: Browser, username: string, password: string, caseID: string, notiType: any, uniqueMsg: string): Promise<void> {
  485 |     const { context, requestPage: requestPageB } = await this.loginInAnotherBrowser(browser, username, password);
  486 |     await requestPageB.open();
  487 |     await requestPageB.getDetailCase(caseID);
  488 |     await requestPageB.notiApp[notiType.index].addNoti(uniqueMsg);
  489 |     await requestPageB.waitForSecond(1);
  490 |     await context.close();
  491 |   }
  492 |
  493 |   async findMail(request: { get: (arg0: string) => any; }): Promise<any> {
  494 |     let mailUrl = process.env.MAIL_SERVER || 'http://69.28.90.112:8025/'
  495 |     // Call API to get mails
  496 |     const rawResponse = await request.get(`${mailUrl}/api/v1/messages`);
  497 |     expect(rawResponse.status()).toEqual(200);
  498 |     const response = await rawResponse.json();
  499 |     const messages = await response.messages;
  500 |     return messages[0];
  501 |   }
  502 |
  503 |   async shareRequestToEmail(requestPage: RequestPage, email: string, message?: string) {
  504 |     await expect(requestPage.dashboardLoc.buttonByText("Share")).toBeVisible();
  505 |     await requestPage.waitForSecond(1);
  506 |     await requestPage.dashboardLoc.buttonByText("Share").click();
  507 |     await requestPage.requestLoc.detail.share.inputEmail.first().fill(email);
  508 |     await expect(requestPage.requestLoc.create.dropdownMemberShare(email)).toBeVisible();
  509 |     await requestPage.requestLoc.create.dropdownMemberShare(email).click();
  510 |     if (message) {
  511 |       await requestPage.requestLoc.detail.share.inputMessage.fill(message);
  512 |     }
  513 |     await requestPage.dashboardLoc.buttonByText("Done").first().click();
  514 |   }
  515 |
  516 |   async openLinkAndCompletePasscode(requestPage: RequestPage, requestCtx: any, buttonLocator: Locator): Promise<RequestPage> {
  517 |     const buttonPage = await buttonLocator.elementHandle().then(el => el?.ownerFrame()).then(frame => frame?.page()) || buttonLocator.page();
  518 |     const [newPage] = await Promise.all([
  519 |       buttonPage.context().waitForEvent('page'),
  520 |       buttonLocator.click()
  521 |     ]);
  522 |
  523 |     const newTabPage = new RequestPage(newPage);
  524 |     await newTabPage.dashboardLoc.buttonByText("Next").click();
  525 |     await newTabPage.waitForSecond(3);
  526 |
  527 |     const foundMail = await newTabPage.findMail(requestCtx);
  528 |     expect(foundMail).toBeTruthy();
  529 |
  530 |     const verificationCode = extractVerificationCode(foundMail.Subject) || '';
  531 |     await newTabPage.dashboardLoc.inputCode.fill(verificationCode);
  532 |     await newTabPage.dashboardLoc.buttonByText("Next").click();
  533 |
  534 |     return newTabPage;
  535 |   }
  536 |
  537 |   async bulkShareFirstNRequests(requestPage: RequestPage, n: number, email: string): Promise<void> {
  538 |     await requestPage.dashboardLoc.buttonByText("Bulk Edit").click();
  539 |     await requestPage.waitForSecond(3);
  540 |
  541 |     for (let i = 0; i < n; i++) {
> 542 |       await requestPage.requestLoc.detail.bulkEdit.listCheckbox.nth(i).check();
      |                                                                        ^ Error: locator.check: Test timeout of 200000ms exceeded.
  543 |       await requestPage.requestLoc.detail.bulkEdit.listCheckbox.nth(i).isChecked();
  544 |     }
  545 |     await requestPage.waitForSecond(1);
  546 |     await requestPage.dashboardLoc.buttonByText("Next").click();
  547 |     await requestPage.requestLoc.detail.bulkEdit.bulkAction("Share/Remove Shared").check();
  548 |     await requestPage.dashboardLoc.buttonByText("Next").click();
  549 |     await requestPage.requestLoc.detail.bulkEdit.bulkAction("Share").check();
  550 |
  551 |     for (let i = 0; i < n; i++) {
  552 |       await requestPage.requestLoc.detail.bulkEdit.listMailShare.first().click();
  553 |       await expect(requestPage.dashboardLoc.modal.headerModal("Share")).toBeVisible();
  554 |       await requestPage.requestLoc.detail.share.inputEmail.first().fill(email);
  555 |       await expect(requestPage.requestLoc.create.dropdownMemberShare(email)).toBeVisible();
  556 |       await requestPage.requestLoc.create.dropdownMemberShare(email).click();
  557 |       await requestPage.dashboardLoc.modal.headerModal("Share").click();;
  558 |       await requestPage.requestLoc.detail.btnSubmitShare.click();
  559 |       await expect(requestPage.dashboardLoc.modal.headerModal("Share")).not.toBeVisible();
  560 |     }
  561 |
  562 |     await requestPage.dashboardLoc.buttonByText("Next").click();
  563 |     await requestPage.dashboardLoc.buttonByText("Confirmation").click();
  564 |   }
  565 |
  566 |   async shareToMultipleEmails(requestPage: RequestPage, emails: string[]): Promise<void> {
  567 |     await requestPage.dashboardLoc.buttonByText("Share").click({ force: true });
  568 |     await requestPage.dashboardLoc.modal.headerModal("Share with others").waitFor({ state: 'visible' });
  569 |
  570 |     for (const email of emails) {
  571 |       await requestPage.requestLoc.detail.share.inputEmail.first().type(email, { delay: 150 });
  572 |       await expect(requestPage.requestLoc.create.dropdownMemberShare(email)).toBeVisible();
  573 |       await requestPage.requestLoc.create.dropdownMemberShare(email).click();
  574 |     }
  575 |     await requestPage.dashboardLoc.buttonByText("Done").first().click();
  576 |   }
  577 |
  578 |   async handleMissingInfoPopup(): Promise<void> {
  579 |     const popupMissingInfo = this.dashboardLoc.modal.headerModal("Missing Information");
  580 |     await this.page.addLocatorHandler(popupMissingInfo, async () => {
  581 |       await this.waitForSecond(1);
  582 |       await this.dashboardLoc.buttonByText("Continue").click();
  583 |     });
  584 |   };
  585 |
  586 |   async initiateRequestCreation(patientName: string): Promise<void> {
  587 |     await this.gotoCreateRequest("multi");
  588 |     await expect(this.dashboardLoc.buttonByText("Switch to Step-by-Step")).toBeVisible();
  589 |
  590 |     await this.requestLoc.create.itemStep(1).first().click();
  591 |     await this.dashboardLoc.common.pText("Prescription").first().click();
  592 |
  593 |     await this.requestLoc.create.itemStep(2).first().click();
  594 |     await this.fillDataCreateRequest("Type or select a name", "Name", patientName);
  595 |
  596 |     await this.requestLoc.create.itemStep(4).first().click();
  597 |   };
  598 |
  599 |   async submitAndVerifyRequest(screenshotName: string): Promise<void> {
  600 |     await this.dashboardLoc.buttonByText("Create").first().click();
  601 |     await expect(this.requestLoc.thumbImagePosted).toBeVisible({ timeout: 50_000 });
  602 |     await this.requestLoc.thumbImagePosted.first().click();
  603 |     await this.waitForSecond(8);
  604 |     await verifyScreenshot(screenshotName, this.requestLoc.detailPostedAttachment, [], 0.02);
  605 |   };
  606 |
  607 |   async handlePopupMinimize(): Promise<void> {
  608 |     const popupNewPost = this.dashboardLoc.modal.headerModal("New Post: Minimize Previous Post?");
  609 |     await this.page.addLocatorHandler(popupNewPost, async () => {
  610 |       await this.dashboardLoc.buttonByText("Leave it").click();
  611 |     })
  612 |   };
  613 |
  614 |   async getDetailRequest(caseID: string): Promise<void> {
  615 |     await this.dashboardLoc.search.inputSearch.fill(caseID);
  616 |     await this.waitForSecond(2);
  617 |     await this.requestLoc.itemInRowRequest(caseID).waitFor({ state: 'visible' });
  618 |     await this.requestLoc.itemInRowRequest(caseID).click({ force: true });
  619 |   };
  620 |
  621 |   async createSimpleAndShareRequest(emailRecive: string, businessName: string, clientName: string): Promise<void> {
  622 |     await this.requestLoc.create.itemStep(1).first().click();
  623 |     await this.dashboardLoc.common.pText("Medical Bill").first().click();
  624 |
  625 |     //Choose Patient
  626 |     await this.requestLoc.create.itemStep(2).first().click();
  627 |     await this.requestLoc.create.inputByPlaceholder("Type or select a name").first().fill(clientName);
  628 |     await this.waitForSecond(2);
  629 |     await this.requestLoc.create.boxTextBusiness(clientName).click({ force: true });
  630 |
  631 |     //Choose Business
  632 |     await this.requestLoc.create.itemStep(3).first().click();
  633 |     await this.requestLoc.create.inputByPlaceholder("Type or select a business").first().fill(businessName);
  634 |     await this.waitForSecond(2);
  635 |     await this.requestLoc.create.boxTextBusiness(businessName).click({ force: true });
  636 |
  637 |     await this.requestLoc.create.itemStep(5).first().click();
  638 |     await this.requestLoc.create.inputByPlaceholder("Type or select an email address").first().type(emailRecive, { delay: 200 });
  639 |     await this.requestLoc.create.optionMember(emailRecive).click();
  640 |
  641 |     await this.requestLoc.create.btnCloseAction.last().click();
  642 |     await this.dashboardLoc.buttonByText("Create").first().click();
```