# Test info

- Name: Verify feature Search >> REQ_003 - Verify feature Search
- Location: /root/code/portal-automation-test/tests/request/request-003.spec.ts:21:9

# Error details

```
Error: Timed out 10000ms 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 10000ms
  - waiting for locator('//div[@id=\'root\' and @class=\'dashboard-index\']')

    at /root/code/portal-automation-test/tests/request/request-003.spec.ts:15:60
```

# Page snapshot

```yaml
- text: Email Address
- textbox "your@email.com": portal_auto_lawyer@testmail.loprx.com
- text: These credentials do not match our records. Password
- textbox "Your password"
- img
- checkbox "Remember me for 30 days"
- text: Remember me for 30 days
- button:
  - img
- button "Log in"
- paragraph:
  - text: By continuing, you agree to the
  - link "Terms of Use":
    - /url: https://portalassistant.com/terms-of-service/
  - text: ","
  - link "Privacy Policy":
    - /url: https://portalassistant.com/privacy-policy/
  - text: and
  - link "Business Associate Agreement":
    - /url: https://portalassistant.com/baa/
- link "Forgot Password":
  - /url: https://qa.loprx.com/forgot-password
- link "Login with passcode":
  - /url: https://qa.loprx.com/sign-in-with-passcode
```

# Test source

```ts
   1 | import { test, expect } from '../../fixtures';
   2 | import { LoginPage } from '../../pom/login.page';
   3 | import { ReqPage } from '../../pom/request.page';
   4 |
   5 | test.describe('Verify feature Search', () => {
   6 |     let loginPage: LoginPage;
   7 |     let reqPage: ReqPage;
   8 |
   9 |     test.beforeEach(async ({ page, conf }) => {
  10 |         loginPage = new LoginPage(page);
  11 |         reqPage = new ReqPage(page);
  12 |
  13 |         await loginPage.open();
  14 |         await loginPage.login(conf.data.username, conf.data.password);
> 15 |         await expect(loginPage.baseLoc.dashboardContainer).toBeVisible();
     |                                                            ^ Error: Timed out 10000ms waiting for expect(locator).toBeVisible()
  16 |
  17 |         await reqPage.open();
  18 |         await expect(reqPage.reqLoc.pageTitle).toBeVisible();
  19 |     });
  20 |
  21 |     test('REQ_003 - Verify feature Search', {
  22 |         tag: ['@REQ_003', '@request', '@function']
  23 |     }, async ({ conf }) => {
  24 |         for (const [key, value] of Object.entries(conf.data.search_field as Record<string, any>)) {
  25 |             await test.step(`Search with invalid ${key}`, async () => {
  26 |                 await reqPage.search(value.invalid_data);
  27 |                 await expect(reqPage.dashboardLoc.table.noResult).toBeVisible();
  28 |             });
  29 |         }
  30 |
  31 |         for (const [key, value] of Object.entries(conf.data.search_field as Record<string, any>)) {
  32 |             await test.step(`Search with valid ${key}`, async () => {
  33 |                 await reqPage.search(value.valid_data);
  34 |                 if (key === 'doi' || key === 'dob' || key === 'doi_month_day_numeric' || key === 'doi_full_date' ) {
  35 |                     expect(async () => {
  36 |                         const rowCount = await reqPage.getRowCount();
  37 |                         expect(rowCount).toBeGreaterThan(0);
  38 |                         await expect(reqPage.dashboardLoc.table.noResult).not.toBeVisible();
  39 |                     }).toPass();
  40 |                 } else {
  41 |                     await expect(reqPage.dashboardLoc.table.itemInRow(value.valid_data).first()).toBeVisible();
  42 |                 }
  43 |             });
  44 |         }
  45 |     });
  46 | });
  47 |
```