# Test info

- Name: UI case for client tests >> SWR_010 - Verify create new discussion
- Location: /root/code/portal-automation-test/tests/share-with-me-request/function.spec.ts:278:7

# Error details

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

Locator: locator('//div[@id=\'root\' and @class=\'dashboard-index\']')
Expected: visible
Received: <element(s) not found>
Call log:
  - expect.toBeVisible with timeout 15000ms
  - waiting for locator('//div[@id=\'root\' and @class=\'dashboard-index\']')

    at SharedRequestPage.loginInAnotherBrowser (/root/code/portal-automation-test/pom/share-request.page.ts:166:60)
    at /root/code/portal-automation-test/tests/share-with-me-request/function.spec.ts:292:76
    at /root/code/portal-automation-test/tests/share-with-me-request/function.spec.ts:291:5
```

# Page snapshot

```yaml
- heading "Two-factor authentication" [level=2]
- paragraph: Enter the 6 digits from your authenticator app and press confirm.
- textbox
- textbox
- textbox
- text: "-"
- textbox
- textbox
- textbox
- link "Cancel":
  - /url: https://qa.loprx.com/logout
- button "Confirm":
  - img
  - text: Confirm
```

# Test source

```ts
   66 |         }
   67 |     }
   68 |
   69 |     get shareRequestSnapshot() {
   70 |         return {
   71 |             turnOffAllNotificationInApp: turnOffAllNotificationInApp,
   72 |             turnOffAllNotificationEmail: turnOffAllNotificationEmail,
   73 |             turnOnAllNotificationInApp: turnOnAllNotificationInApp,
   74 |             turnOnAllNotificationEmail: turnOnAllNotificationEmail,
   75 |             dialogCompareRequest: modalCompareRequest,
   76 |             modalManuallyLinkCase: modalManuallyLinkCase
   77 |         }
   78 |     }
   79 |
   80 |     get shareRequestProps() {
   81 |         return {
   82 |             filterProperties: [
   83 |                 {
   84 |                     name: 'patient',
   85 |                     type: 'input'
   86 |                 },
   87 |                 {
   88 |                     name: 'from_business_name',
   89 |                     type: 'select'
   90 |                 },
   91 |                 {
   92 |                     name: 'to_business_name',
   93 |                     type: 'select'
   94 |                 }
   95 |             ],
   96 |             threeDotDropdownMenus: {
   97 |                 customizedColumn: 'Customized Columns',
   98 |             },
   99 |             customizedColumns: [
  100 |                 {
  101 |                     name: 'Pin',
  102 |                     default: true,
  103 |                     tableDisplayName: 'Pin'
  104 |                 },
  105 |                 {
  106 |                     name: 'Request #',
  107 |                     default: true,
  108 |                     tableDisplayName: 'Request #'
  109 |                 },
  110 |                 {
  111 |                     name: 'Request Type',
  112 |                     default: true,
  113 |                     tableDisplayName: 'Request Type'
  114 |                 },
  115 |                 {
  116 |                     name: 'Client Name',
  117 |                     default: true,
  118 |                     tableDisplayName: 'Client Name'
  119 |                 },
  120 |                 {
  121 |                     name: 'Creator',
  122 |                     default: true,
  123 |                     tableDisplayName: 'Creator'
  124 |                 },
  125 |                 {
  126 |                     name: 'Directed To',
  127 |                     default: true,
  128 |                     tableDisplayName: 'Directed To'
  129 |                 },
  130 |                 {
  131 |                     name: 'Status',
  132 |                     default: true,
  133 |                     tableDisplayName: 'Status'
  134 |                 },
  135 |                 {
  136 |                     name: 'Status Details',
  137 |                     default: true,
  138 |                     tableDisplayName: 'Status Details'
  139 |                 },
  140 |                 {
  141 |                     name: 'Submitted User',
  142 |                     default: false,
  143 |                     tableDisplayName: 'Submitted User'
  144 |                 },
  145 |                 {
  146 |                     name: 'Received',
  147 |                     default: false,
  148 |                     tableDisplayName: 'Received'
  149 |                 },
  150 |                 {
  151 |                     name: 'Updated',
  152 |                     default: false,
  153 |                     tableDisplayName: 'Updated'
  154 |                 }
  155 |             ]
  156 |         }
  157 |     }
  158 |
  159 |     // Login as another user in a new browser context and return the new RequestPage
  160 |     async loginInAnotherBrowser(browser: Browser, username: string, password: string): Promise<{ context: BrowserContext; page: Page; sharedRequestPage: SharedRequestPage }> {
  161 |         const context = await browser.newContext();
  162 |         const page = await context.newPage();
  163 |         const loginPage = new LoginPage(page);
  164 |         await loginPage.open();
  165 |         await loginPage.login(username, password);
> 166 |         await expect(loginPage.baseLoc.dashboardContainer).toBeVisible({ timeout: 15_000 });
      |                                                            ^ Error: Timed out 15000ms waiting for expect(locator).toBeVisible()
  167 |         return { context, page, sharedRequestPage: new SharedRequestPage(page) };
  168 |     }
  169 |
  170 |     async respondToRequest(message: string): Promise<void> {
  171 |         const textEditorBody = this.shareRequestLoc.textEditorCreateCaseArea;
  172 |         await this.shareRequestLoc.buttonRepond.waitFor({ state: 'visible' });
  173 |         await this.shareRequestLoc.buttonRepond.click({ force: true });
  174 |         await textEditorBody.waitFor({ state: 'visible' });
  175 |         await textEditorBody.type(message, { delay: 20 });
  176 |         await this.shareRequestLoc.btnSubmitMessage.click();
  177 |         await this.dashboardLoc.msgCreateSuccess.waitFor({ state: 'visible' });
  178 |         await textEditorBody.waitFor({ state: 'hidden' });
  179 |     }
  180 |
  181 |     async verifyPostSnapshot(): Promise<void> {
  182 |         await this.shareRequestLoc.thumbImagePosted.first().waitFor({ state: 'visible' });
  183 |         await this.shareRequestLoc.thumbImagePosted.first().click();
  184 |         await this.waitForSecond(2);
  185 |     }
  186 |
  187 |     async backToRequestList(): Promise<void> {
  188 |         if (await this.shareRequestLoc.btnBackToReq.isVisible()) {
  189 |             await this.shareRequestLoc.btnBackToReq.click();
  190 |         }
  191 |     }
  192 |
  193 |     async openLinkAndCompletePasscode(sharedRequestPage: SharedRequestPage, requestCtx: any, buttonLocator: Locator): Promise<SharedRequestPage> {
  194 |         const buttonPage = await buttonLocator.elementHandle().then(el => el?.ownerFrame()).then(frame => frame?.page()) || buttonLocator.page();
  195 |         const [newPage] = await Promise.all([
  196 |             buttonPage.context().waitForEvent('page'),
  197 |             buttonLocator.click()
  198 |         ]);
  199 |
  200 |         const newTabPage = new SharedRequestPage(newPage);
  201 |         await newTabPage.dashboardLoc.buttonByText("Next").click();
  202 |         await newTabPage.waitForSecond(3);
  203 |
  204 |         const foundMail = await newTabPage.findMail(requestCtx);
  205 |         expect(foundMail).toBeTruthy();
  206 |
  207 |         const verificationCode = extractVerificationCode(foundMail.Subject) || '';
  208 |         await newTabPage.dashboardLoc.inputCode.fill(verificationCode);
  209 |         await newTabPage.dashboardLoc.buttonByText("Next").click();
  210 |
  211 |         return newTabPage;
  212 |     }
  213 |
  214 |     async findMail(request: { get: (arg0: string) => any; }): Promise<any> {
  215 |         let mailUrl = process.env.MAIL_SERVER || 'http://69.28.90.112:8025/'
  216 |         // Call API to get mails
  217 |         const rawResponse = await request.get(`${mailUrl}/api/v1/messages`);
  218 |         expect(rawResponse.status()).toEqual(200);
  219 |         const response = await rawResponse.json();
  220 |         const messages = await response.messages;
  221 |         return messages[0];
  222 |     }
  223 | }
  224 |
```