# Test info

- Name: Feature case for request-listing >> REQ_014 - Verify when create with Fast Submission with multiple request
- Location: /root/code/portal-automation-test/tests/request/function.spec.ts:434:9

# Error details

```
Error: expect(received).toContain(expected) // indexOf

Expected substring: "5718 Westheimer Rd., Ste 1000, Houston, TX 77057"
Received string:    "A Taylor Law Firm
5718 Westheimer Rd., Ste 1000, Houston, Texas 77057"
    at /root/code/portal-automation-test/tests/request/function.spec.ts:461:55
    at /root/code/portal-automation-test/tests/request/function.spec.ts:448: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:
      - button "Shared with me":
        - img
        - text: Shared with me
- banner:
  - button [disabled]:
    - img
  - button:
    - img
  - img
  - text: Tri01 Duc shared details regarding Auto_YXQ Test Letter of Protection. Read it now. 36 minutes ago
  - img
  - text: Son HaiBon Phan assigned a request to you 11 hours ago
  - img
  - text: Son HaiBon Phan assigned a case to you 1 hour 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 "0 Cart":
    - img
    - text: 0 Cart
  - text: Feedback
  - img
  - link "Open user menu":
    - /url: "#"
    - text: Minh
- img
- text: New Request
- button "Switch to Step-by-Step"
- img
- paragraph: "1"
- text: Select an Action
- paragraph: "2"
- text: Identify Patient
- paragraph: "3"
- text: Identify a Business
- paragraph: "4"
- text: Create Message
- paragraph: "5"
- text: Share with Others
- checkbox "Apply all"
- text: Apply all
- checkbox "Apply all"
- text: Apply all
- checkbox "Apply all"
- text: Apply all
- checkbox "Apply all" [disabled]
- text: Apply all
- img
- checkbox "Apply all"
- text: Apply all Letter of Protection Test Request A Taylor Law Firm Templated Message Email
- img
- text: Delete Business
- img
- paragraph: Identify a business to handle this request.
- text: Selection of businesses
- paragraph: Business New84177820
- paragraph: The Vu Law Firm
- paragraph: Consultants
- paragraph: A Taylor Law Firm
- paragraph: AP Law Group
- paragraph: Son35 Pharmacy
- text: Business Name
- textbox "Business Name": A Taylor Law Firm
- button "×"
- text: "Address: 5718 Westheimer Rd., Ste 1000, Houston, TX 77057 Action Patient Business Message Email"
- img
- text: Delete
- button "Add more"
- button "Create"
```

# Test source

```ts
  361 |         })
  362 |
  363 |         await test.step("Choose action type and verify next step", async () => {
  364 |             await requestPage.requestLoc.actionLetterOfProtection.click();
  365 |             await requestPage.requestLoc.btnNextStep.click();
  366 |             await expect(requestPage.requestLoc.create.headerInCreateStep("Patient")).toBeVisible();
  367 |         })
  368 |
  369 |         await test.step("Choose client and verify next step", async () => {
  370 |             const dataOfOptions = await requestPage.fillDataCreateRequest("Type or select a name", "Name", conf.data.patient);
  371 |             expect(dataOfOptions.infoPatient).toContain(dataOfOptions.address);
  372 |
  373 |             await requestPage.requestLoc.btnNextStep.click();
  374 |             await expect(requestPage.requestLoc.create.headerInCreateStep("Business")).toBeVisible();
  375 |         })
  376 |
  377 |         await test.step("Choose business and verify next step", async () => {
  378 |             uniqueBusiness = conf.data.business + randomString(8);
  379 |             await requestPage.requestLoc.create.inputByPlaceholder("Type or select a business").first().type(uniqueBusiness, { delay: 100 });
  380 |             await expect(requestPage.requestLoc.create.btnAddNewOption(uniqueBusiness)).toBeVisible();
  381 |             await requestPage.requestLoc.create.btnAddNewOption(uniqueBusiness).click();
  382 |
  383 |             await expect(requestPage.dashboardLoc.modal.headerModal("New Business")).toBeVisible();
  384 |             await expect(requestPage.dashboardLoc.modal.inputByID("autocomplete_name")).toHaveValue(uniqueBusiness);
  385 |
  386 |             await requestPage.dashboardLoc.buttonByText("Create").nth(1).click();
  387 |             await expect(requestPage.dashboardLoc.msgCreateSuccess).toBeVisible();
  388 |             await expect(requestPage.dashboardLoc.modal.inputByID("autocomplete_business_provider_id")).toHaveValue(uniqueBusiness);
  389 |             await requestPage.requestLoc.btnNextStep.click();
  390 |             await expect(requestPage.requestLoc.create.headerInCreateStep("Message")).toBeVisible();
  391 |         })
  392 |
  393 |         await test.step("Verify add message, share request", async () => {
  394 |             await requestPage.requestLoc.btnNextStep.click();
  395 |             await expect(requestPage.requestLoc.create.headerInCreateStep("Share")).toBeVisible();
  396 |             await requestPage.requestLoc.create.inputByPlaceholder("Type or select an email address").type(conf.data.user_recive, { delay: 100 });
  397 |             await expect(requestPage.requestLoc.create.inputByPlaceholder("Type or select an email address")).toHaveValue(conf.data.user_recive);
  398 |             await expect(requestPage.requestLoc.create.dropdownMemberShare(conf.data.user_recive)).toBeVisible();
  399 |             await requestPage.requestLoc.create.dropdownMemberShare(conf.data.user_recive).click({ force: true });
  400 |
  401 |             await requestPage.requestLoc.create.headerInCreateStep("Share").click();
  402 |             await requestPage.requestLoc.create.btnCreateAndShare.click();
  403 |             await expect(requestPage.requestLoc.create.caseIDRequest).toBeVisible();
  404 |             url = requestPage.page.url();
  405 |         });
  406 |
  407 |         await test.step("Verify business had suggest in the firsts list", async () => {
  408 |             //Verify showing in case detail
  409 |             const casePage = new CasePage(requestPage.page);
  410 |             await casePage.open();
  411 |             await casePage.getDetailCase("495528");
  412 |             await casePage.dashboardLoc.listBusinesses.last().click();
  413 |             await expect(casePage.dashboardLoc.modal.headerModal("Business")).toBeVisible();
  414 |             const businessFirstRecommend = await casePage.caseLoc.detail.firstSuggestBusiness.innerText();
  415 |             expect(businessFirstRecommend).toBe(uniqueBusiness);
  416 |
  417 |             // Verify showing when create request
  418 |             await requestPage.gotoCreateRequest("multi");
  419 |             await requestPage.requestLoc.create.itemStep(3).first().click();
  420 |             await expect(requestPage.requestLoc.detail.businessFirstRecommend).toHaveText(uniqueBusiness);
  421 |         })
  422 |
  423 |         await test.step("Verify user had recive request", async () => {
  424 |             await requestPage.changeUser(conf.data.username_recive, conf.data.password_recive, requestPage.page);
  425 |
  426 |             await expect(loginPage.baseLoc.dashboardContainer).toBeVisible({ timeout: 15_000 });
  427 |             await requestPage.checkNotification("New Request", true);
  428 |             await expect(requestPage.requestLoc.create.caseIDRequest).toBeVisible();
  429 |             const urlRecive = requestPage.page.url();
  430 |             expect(urlRecive.replace('/shared', '')).toBe(url);
  431 |         })
  432 |     })
  433 |
  434 |     test("REQ_014 - Verify when create with Fast Submission with multiple request", {
  435 |         tag: ['@REQ_014', '@request', '@function']
  436 |     }, async ({ conf }) => {
  437 |         await test.step("Goto create new with Fast Submission", async () => {
  438 |             await requestPage.gotoCreateRequest("multi");
  439 |             await expect(requestPage.dashboardLoc.buttonByText("Switch to Step-by-Step")).toBeVisible();
  440 |         })
  441 |
  442 |         await test.step("Verify when click add more request", async () => {
  443 |             await requestPage.dashboardLoc.buttonByText("Add more").click();
  444 |             const listOfCreationRequests = (await requestPage.requestLoc.create.boxCreateMultiRequests.all()).length;
  445 |             expect(listOfCreationRequests).toBe(2);
  446 |         })
  447 |
  448 |         await test.step("Fill data to request", async () => {
  449 |             //Choose Action type
  450 |             await requestPage.requestLoc.create.itemStep(1).first().click();
  451 |             await requestPage.requestLoc.actionLetterOfProtection.first().click();
  452 |
  453 |             //Choose Client
  454 |             await requestPage.requestLoc.create.itemStep(2).first().click();
  455 |             const dataOfOptionsClient = await requestPage.fillDataCreateRequest("Type or select a name", "Name", conf.data.patient);
  456 |             expect(dataOfOptionsClient.infoPatient).toContain(dataOfOptionsClient.address);
  457 |
  458 |             //Choose Business
  459 |             await requestPage.requestLoc.create.itemStep(3).first().click();
  460 |             const dataOfOptionsBusiness = await requestPage.fillDataCreateRequest("Type or select a business", "Business Name", conf.data.business);
> 461 |             expect(dataOfOptionsBusiness.infoPatient).toContain(dataOfOptionsBusiness.address);
      |                                                       ^ Error: expect(received).toContain(expected) // indexOf
  462 |
  463 |             //Fill email member to share
  464 |             await requestPage.requestLoc.create.itemStep(5).first().click();
  465 |             await requestPage.requestLoc.create.inputByPlaceholder("Type or select an email address").first().fill(conf.data.user_recive);
  466 |             await expect(requestPage.requestLoc.create.inputByPlaceholder("Type or select an email address").first()).toHaveValue(conf.data.user_recive);
  467 |             await requestPage.requestLoc.create.dropdownMemberShare(conf.data.user_recive).click();
  468 |
  469 |             // Aplly for all requests
  470 |             const applyAllFields = ["action", "patient", "business", "message", "share"];
  471 |             for (let i = 0; i < applyAllFields.length; i++) {
  472 |                 await requestPage.waitForSecond(1);
  473 |                 await requestPage.requestLoc.create.inputCheckAll(applyAllFields[i]).click();
  474 |             }
  475 |         })
  476 |
  477 |         await test.step("Verify create multi request", async () => {
  478 |             await requestPage.dashboardLoc.buttonByText("Create").first().click();
  479 |             await expect(requestPage.dashboardLoc.modal.headerModal("Missing Information")).toBeVisible();
  480 |             await requestPage.dashboardLoc.buttonByText("Continue").click();
  481 |             await expect(requestPage.requestLoc.create.viewRequest.first()).toBeVisible({ timeout: 35_000 });
  482 |             const requestsCreated = await requestPage.requestLoc.create.viewRequest.all();
  483 |             expect(requestsCreated.length).toBe(2);
  484 |             const listRequest: string[] = [];
  485 |             for (let i = 0; i < requestsCreated.length; i++) {
  486 |                 listRequest.push(await requestsCreated[i].innerText());
  487 |             }
  488 |             listRequest.reverse();
  489 |
  490 |             //Verify receive notification from shared user
  491 |             await requestPage.changeUser(conf.data.username_recive, conf.data.password_recive, requestPage.page);
  492 |             await expect(requestPage.dashboardLoc.notification.signalNoti).toBeVisible();
  493 |             await requestPage.checkNotification("New Request");
  494 |             await expect(requestPage.dashboardLoc.notification.requestID(listRequest[0])).toBeVisible();
  495 |             await requestPage.waitForSecond(3);
  496 |
  497 |             const listDesNotifications = await requestPage.dashboardLoc.notification.desNotifications.all();
  498 |             for (let i = 0; i < requestsCreated.length; i++) {
  499 |                 const descriptin = await listDesNotifications[i].textContent();
  500 |                 expect(descriptin).toContain(listRequest[i]);
  501 |                 expect(descriptin).toContain(conf.data.patient);
  502 |                 expect(descriptin).toContain(conf.data.action_type);
  503 |             }
  504 |
  505 |             //Verify in data exist in share with me
  506 |             let sharedRequestPage = new SharedRequestPage(requestPage.page);
  507 |             await sharedRequestPage.open()
  508 |             for (let i = 0; i < requestsCreated.length; i++) {
  509 |                 await sharedRequestPage.search(listRequest[i].replace("#", ""))
  510 |                 await expect(sharedRequestPage.dashboardLoc.table.itemInRow(listRequest[i].replace("#", ""))).toBeVisible();
  511 |             }
  512 |         })
  513 |     })
  514 |
  515 |     test("REQ_017 - Verify business sharing edits in case the business has not accepted the request", {
  516 |         tag: ['@REQ_017', '@request', '@function']
  517 |     }, async ({ conf, browser }) => {
  518 |         test.setTimeout(200_000);
  519 |
  520 |         await test.step("Get detail request", async () => {
  521 |             await requestPage.getDetailCase(conf.data.case);
  522 |         })
  523 |
  524 |         await test.step("Edit change share to another business", async () => {
  525 |             await requestPage.editBusinessAndShare(conf.data.business_change_to, conf.data.user.member_new, conf.data.member_change_to);
  526 |         })
  527 |
  528 |         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 () => {
  529 |             await requestPage.verifyShareRequest(browser, conf, 'member_old', true);
  530 |             await requestPage.verifyShareRequest(browser, conf, 'member_new', false);
  531 |         })
  532 |
  533 |         await test.step("Edit change share to old business", async () => {
  534 |             await requestPage.editBusinessAndShare(conf.data.business_chane, conf.data.user.member_old, conf.data.member_change);
  535 |         })
  536 |
  537 |         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 () => {
  538 |             await requestPage.verifyShareRequest(browser, conf, 'member_new', true);
  539 |             await requestPage.verifyShareRequest(browser, conf, 'member_old', false);
  540 |         })
  541 |     })
  542 |
  543 |     test("REQ_018 - Verify business sharing edits in case the business has accepted the request", {
  544 |         tag: ['@REQ_018', '@request', '@function']
  545 |     }, async ({ conf }) => {
  546 |         await requestPage.getDetailCase(conf.data.case);
  547 |         await requestPage.requestLoc.detail.btnDropdownEditBusiness.click();
  548 |         await requestPage.requestLoc.detail.btnEdit.click();
  549 |         await expect(requestPage.dashboardLoc.modal.headerModal("Designated Business Cannot Be Modified")).toBeVisible();
  550 |     });
  551 |
  552 |     test("REQ_019 - Verify add tag in request", {
  553 |         tag: ['@REQ_019', '@request', '@function']
  554 |     }, async ({ conf }) => {
  555 |         await test.step("Navigate to request detail", async () => {
  556 |             await requestPage.getDetailCase(conf.data.case);
  557 |         });
  558 |
  559 |         await test.step("Verify add tags with tag count greater than 9 (invalid)", async () => {
  560 |             await requestPage.addMultipleTags(10);
  561 |             await requestPage.saveTags();
```