# Test info

- Name: Feature case for request-listing >> REQ_020 - Verify assigne request
- Location: /root/code/portal-automation-test/tests/request/function.spec.ts:591:9

# Error details

```
Error: expect(received).toBe(expected) // Object.is equality

Expected: 1
Received: 11
    at /root/code/portal-automation-test/tests/request/function.spec.ts:605:36
    at /root/code/portal-automation-test/tests/request/function.spec.ts:599: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 some information about New Case 123 Letter of Protection. Find out what it says. 4 days ago
  - img
  - text: What did Tri01 Duc say? Their response to John Doe Letter of Protection is waiting. 5 hours ago
  - img
  - text: Son HaiBon Phan assigned a request to you 5 hours ago
  - img
  - text: Son HaiBon Phan assigned a case to you 8 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: Tri01 Duc response to Test Request Letter of Protection is in! See the information now. 4 hours ago
  - img
  - text: Son HaiBon Phan assigned a request to you 5 hours ago
  - img
  - text: Son HaiBon Phan assigned a case to you 8 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: "#449539 Letter of Protection"
- img
- img
- img
- link "Test Request":
  - /url: /clients/801a8b15-a5c5-4282-aacd-6a9b2e6ae3b3
- text: "-"
- 'link "DOB: 03/01/1999"':
  - /url: /clients/801a8b15-a5c5-4282-aacd-6a9b2e6ae3b3
- 'link "Case: #538240"':
  - /url: /cases/538240
- text: "-"
- 'link "DOI: 01/05/2026"':
  - /url: /cases/538240
- 'link "Category: Unspecified Accident"':
  - /url: /cases/538240
- text: Tag
- img
- 'button "Status: Open"'
- button "Status Details:":
  - text: "Status Details:"
  - listbox:
    - listitem:
      - text: Awaiting
      - img
  - img
- 'button "Assignee: Minh Phong"':
  - text: "Assignee: Minh Phong"
  - img
- button:
  - img
- button:
  - img
- button "Activity":
  - img
  - text: Activity
- button "Share":
  - img
  - text: Share
- paragraph: Minh Phong
- text: Posted
- paragraph: 07/04/2025
- img
- list:
  - listitem
- textbox "Message"
- button [disabled]:
  - img
- heading "Snapshot" [level=2]
- list:
  - listitem: Minh Phong 07/04/2025 Submitted a request Respond
- heading "Discussion" [level=2]
- text: Start a discussion
- img
- heading "Minh Phong (You)" [level=4]
- img
- heading "Team Discussion" [level=4]
- img
- heading "Discussion" [level=2]
- text: Start a discussion
- img
- heading "Minh Phong (You)" [level=4]
- img
- heading "Team Discussion" [level=4]
- img
- img "image-share-this-request"
- paragraph: Share this request using the Share button.
- text: Share
- heading "Assignee" [level=3]
- button "Close"
- heading "Please select a member to assign this request to." [level=4]:
  - text: Please select a member to assign this request to.
  - img
- text: Recommended members to choose from
- paragraph: Minh Phong
- paragraph: Mariam Hanah
- paragraph: Duc04 Tri
- paragraph: Son HaiBon Phan
- paragraph: Khanh.Son04 Phan
- paragraph: Duc05 Tri
- text: Search member
- textbox "Search...": triducgog0301+1@gmail.com
- button "×"
- text: Unassigned
- button "Close"
- button "Submit"
```

# Test source

```ts
  505 |                 expect(descriptin).toContain(conf.data.patient);
  506 |                 expect(descriptin).toContain(conf.data.action_type);
  507 |             }
  508 |
  509 |             //Verify in data exist in share with me
  510 |             let sharedRequestPage = new SharedRequestPage(requestPage.page);
  511 |             await sharedRequestPage.open()
  512 |             for (let i = 0; i < requestsCreated.length; i++) {
  513 |                 await sharedRequestPage.search(listRequest[i].replace("#", ""))
  514 |                 await expect(sharedRequestPage.dashboardLoc.table.itemInRow(listRequest[i].replace("#", ""))).toBeVisible();
  515 |             }
  516 |         })
  517 |     })
  518 |
  519 |     // Tạm thời vì sẽ đang có automation link r
  520 |     // test("REQ_017 - Verify business sharing edits in case the business has not accepted the request", {
  521 |     //     tag: ['@REQ_017', '@request', '@function']
  522 |     // }, async ({ conf, browser }) => {
  523 |     //     test.setTimeout(200_000);
  524 |
  525 |     //     await test.step("Get detail request", async () => {
  526 |     //         await requestPage.getDetailCase(conf.data.case);
  527 |     //     })
  528 |
  529 |     //     await test.step("Edit change share to another business", async () => {
  530 |     //         await requestPage.editBusinessAndShare(conf.data.business_change_to, conf.data.user.member_new, conf.data.member_change_to);
  531 |     //     })
  532 |
  533 |     //     await test.step("Check that the record no longer exists in the 'Shared with me' list of the deleted user, and that the record exists for the newly shared user", async () => {
  534 |     //         await requestPage.verifyShareRequest(browser, conf, 'member_old', true);
  535 |     //         await requestPage.verifyShareRequest(browser, conf, 'member_new', false);
  536 |     //     })
  537 |
  538 |     //     await test.step("Edit change share to old business", async () => {
  539 |     //         await requestPage.editBusinessAndShare(conf.data.business_chane, conf.data.user.member_old, conf.data.member_change);
  540 |     //     })
  541 |
  542 |     //     await test.step("Check that the record no longer exists in the 'Shared with me' list of the deleted user, and that the record exists for the newly shared user", async () => {
  543 |     //         await requestPage.verifyShareRequest(browser, conf, 'member_new', true);
  544 |     //         await requestPage.verifyShareRequest(browser, conf, 'member_old', false);
  545 |     //     })
  546 |     // })
  547 |
  548 |     test("REQ_018 - Verify business sharing edits in case the business has accepted the request", {
  549 |         tag: ['@REQ_018', '@request', '@function']
  550 |     }, async ({ conf }) => {
  551 |         await requestPage.getDetailCase(conf.data.case);
  552 |         await requestPage.requestLoc.detail.btnDropdownEditBusiness.click();
  553 |         await requestPage.requestLoc.detail.btnEdit.click();
  554 |         await expect(requestPage.dashboardLoc.modal.headerModal("Designated Business Cannot Be Modified")).toBeVisible();
  555 |     });
  556 |
  557 |     test("REQ_019 - Verify add tag in request", {
  558 |         tag: ['@REQ_019', '@request', '@function']
  559 |     }, async ({ conf }) => {
  560 |         await test.step("Navigate to request detail", async () => {
  561 |             await requestPage.getDetailCase(conf.data.case);
  562 |         });
  563 |
  564 |         await test.step("Verify add tags with tag count greater than 9 (invalid)", async () => {
  565 |             await requestPage.addMultipleTags(10);
  566 |             await requestPage.saveTags();
  567 |             await expect(requestPage.dashboardLoc.tag.errorMaxTag).toBeVisible();
  568 |         });
  569 |
  570 |         await test.step("Verify when add < 9 tag (valid)", async () => {
  571 |             await requestPage.removeOneTag();
  572 |             await requestPage.saveTags();
  573 |             await expect(requestPage.dashboardLoc.msgSuccess).toBeVisible();
  574 |             await requestPage.waitForSecond(1);
  575 |             await requestPage.dashboardLoc.btnClosePopupNotification.click();
  576 |             await expect(requestPage.dashboardLoc.tag.btnSaveTag).not.toBeVisible();
  577 |
  578 |             const tagCount = await requestPage.getTagCount();
  579 |             expect(tagCount).toBe(9);
  580 |         });
  581 |
  582 |         await test.step("Clear all tag", async () => {
  583 |             await requestPage.clearAllTags();
  584 |             await expect(requestPage.dashboardLoc.tag.btnSaveTag).not.toBeVisible();
  585 |
  586 |             const tagCount = await requestPage.getTagCount();
  587 |             expect(tagCount).toBe(0);
  588 |         });
  589 |     });
  590 |
  591 |     test("REQ_020 - Verify assigne request", {
  592 |         tag: ['@REQ_020', '@request', '@function']
  593 |     }, async ({ conf }) => {
  594 |         let url: string = "";
  595 |         await test.step("Get detail request", async () => {
  596 |             await requestPage.getDetailCase(conf.data.case);
  597 |         });
  598 |
  599 |         await test.step("Assignee to member not exist in business", async () => {
  600 |             await requestPage.requestLoc.detail.btnAssignee.click();
  601 |             await expect(requestPage.dashboardLoc.modal.headerModal("Assignee")).toBeVisible();
  602 |             await requestPage.requestLoc.detail.inputSearchAssignee.fill(conf.data.user_not_in_business);
  603 |             await requestPage.waitForSecond(2);
  604 |             const options = await requestPage.requestLoc.detail.optionsMember.all();
> 605 |             expect(options.length).toBe(1);
      |                                    ^ Error: expect(received).toBe(expected) // Object.is equality
  606 |         });
  607 |
  608 |         await test.step("Assignee to member in business", async () => {
  609 |             await requestPage.requestLoc.detail.inputSearchAssignee.clear();
  610 |             const currentUser = await requestPage.requestLoc.detail.fullnameAssignee.innerText();
  611 |             await requestPage.assignToUser(conf.data.user_recive);
  612 |             await requestPage.waitForSecond(2);
  613 |
  614 |             // Verify activity
  615 |             const textActivity = await requestPage.getNewestRequestHistory();
  616 |             url = requestPage.page.url();
  617 |             expect(textActivity).toContain(`changed the Assignee ${currentUser} ${conf.data.user_recive} ${await getTodayInTimeZone()}`);
  618 |         });
  619 |
  620 |         await test.step("Verify the assigned member receives a notification", async () => {
  621 |             await requestPage.changeUser(conf.data.username_recive, conf.data.password, requestPage.page);
  622 |             await requestPage.checkNotification("Assignee", true);
  623 |             await expect(requestPage.requestLoc.create.caseIDRequest).toBeVisible();
  624 |             const urlRecive = requestPage.page.url();
  625 |             expect(urlRecive).toBe(url);
  626 |         });
  627 |
  628 |         await test.step("Teardown: Assign back to the previous member", async () => {
  629 |             await requestPage.requestLoc.detail.btnAssignee.click();
  630 |             await requestPage.assignToUser(conf.data.user_send);
  631 |             await expect(requestPage.dashboardLoc.notificationUpdateSuccess).toBeVisible();
  632 |         });
  633 |     });
  634 |
  635 |
  636 |     test("REQ_021 - Verify Snapshot in request had action type Letter of Protection", {
  637 |         tag: ["@REQ_021", "@request", "@function"]
  638 |     }, async ({ conf, browser }) => {
  639 |         test.setTimeout(200_000);
  640 |         const popupNewPost = requestPage.dashboardLoc.modal.headerModal("New Post: Minimize Previous Post?");
  641 |         await requestPage.page.addLocatorHandler(popupNewPost, async () => {
  642 |             await requestPage.dashboardLoc.buttonByText("Leave it").click();
  643 |         })
  644 |
  645 |         await test.step("User A post a new respond", async () => {
  646 |             await requestPage.getDetailCase(conf.data.case);
  647 |             await requestPage.respondToRequest(conf.data.message);
  648 |             await requestPage.waitForSecond(2) //Wait for activity update
  649 |
  650 |             const textActivity = await requestPage.getNewestRequestHistory();
  651 |             expect(textActivity).toContain(`responded to the request ${await getTodayInTimeZone()}`);
  652 |             await requestPage.verifyPostSnapshot();
  653 |             await requestPage.waitForSecond(5);
  654 |             await verifyScreenshot("post-details-snapshot.png", requestPage.requestLoc.detailPostedAttachment, [], 0.02);
  655 |             await requestPage.page.close();
  656 |         });
  657 |
  658 |         await test.step("User B get noti and send back respond", async () => {
  659 |             const { context: contextB, requestPage: requestPageB } = await requestPage.loginInAnotherBrowser(browser, conf.data.username_recive, conf.data.password);
  660 |             await requestPageB.checkNotification("New Response", true);
  661 |             await requestPageB.verifyPostSnapshot();
  662 |             await verifyScreenshot("post-details-snapshot.png", requestPageB.requestLoc.detailPostedAttachment, [], 0.02);
  663 |             await requestPageB.backToRequestList();
  664 |             await requestPageB.respondToRequest(conf.data.message);
  665 |             await requestPageB.waitForSecond(2) //Wait for activity update
  666 |
  667 |             const textActivityB = await requestPageB.getNewestRequestHistory();
  668 |             expect(textActivityB).toContain(`responded to the request ${await getTodayInTimeZone()}`);
  669 |             await requestPageB.verifyPostSnapshot();
  670 |             await verifyScreenshot("post-details-snapshot.png", requestPageB.requestLoc.detailPostedAttachment, [], 0.02);
  671 |             await contextB.close();
  672 |         });
  673 |
  674 |         await test.step("User A check new noti and repond from user B", async () => {
  675 |             const { context: contextA, requestPage: requestPageA } = await requestPage.loginInAnotherBrowser(browser, conf.data.username, conf.data.password);
  676 |             await requestPageA.checkNotification("New Response", true);
  677 |             await requestPageA.verifyPostSnapshot();
  678 |             await verifyScreenshot("post-details-snapshot.png", requestPageA.requestLoc.detailPostedAttachment, [], 0.02);
  679 |             await contextA.close();
  680 |         });
  681 |     });
  682 |
  683 |     test("REQ_023 - Verify comment in Post and Edit comment", {
  684 |         tag: ["@REQ_023", "@request", "@function"]
  685 |     }, async ({ conf, browser }) => {
  686 |         test.setTimeout(180_000)
  687 |         const commentUnique = `${conf.data.comment}, ${randomString(10)}`;
  688 |         const commentReplyUnique = `${conf.data.comment_reply}, ${randomString(10)}`;
  689 |
  690 |         await test.step("User A comment in newest post", async () => {
  691 |             await requestPage.getDetailCase(conf.data.case);
  692 |             await requestPage.addCommentToNewestPost(commentUnique);
  693 |             await expect(requestPage.dashboardLoc.comment.cmtInPost.last()).toContainText(commentUnique);
  694 |             await requestPage.page.close();
  695 |         });
  696 |
  697 |         await test.step("User B get noti, verify comment, and comment back", async () => {
  698 |             const { context: contextB, requestPage: requestPageB } = await requestPage.loginInAnotherBrowser(browser, conf.data.username_recive, conf.data.password);
  699 |             await requestPageB.checkNotification("New Comment", true);
  700 |             await expect(requestPageB.dashboardLoc.comment.cmtInPost.last()).toContainText(commentUnique, { timeout: 30_000 });
  701 |
  702 |             // User B comments back
  703 |             await requestPageB.addCommentToNewestPost(commentReplyUnique);
  704 |             await expect(requestPageB.dashboardLoc.comment.cmtInPost.last()).toContainText(commentReplyUnique);
  705 |             await contextB.close();
```