generated from CDCgov/template
-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* #15217 - Implement smoke test user flow for Last Mile Failures * Fixed linting issues * Fixed linting issues
- Loading branch information
1 parent
8b42d9c
commit e864acf
Showing
2 changed files
with
157 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
98 changes: 98 additions & 0 deletions
98
...tend-react/e2e/spec/chromium-only/authenticated/last-mile-failures-page-user-flow.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
import { tableRows } from "../../../helpers/utils"; | ||
import { LastMileFailuresPage } from "../../../pages/authenticated/last-mile-failures"; | ||
import { test as baseTest, expect } from "../../../test"; | ||
|
||
export interface LastMileFailuresPageFixtures { | ||
lastMileFailuresPage: LastMileFailuresPage; | ||
} | ||
|
||
const test = baseTest.extend<LastMileFailuresPageFixtures>({ | ||
lastMileFailuresPage: async ( | ||
{ | ||
page: _page, | ||
isMockDisabled, | ||
adminLogin, | ||
senderLogin, | ||
receiverLogin, | ||
storageState, | ||
frontendWarningsLogPath, | ||
isFrontendWarningsLog, | ||
}, | ||
use, | ||
) => { | ||
const page = new LastMileFailuresPage({ | ||
page: _page, | ||
isMockDisabled, | ||
adminLogin, | ||
senderLogin, | ||
receiverLogin, | ||
storageState, | ||
frontendWarningsLogPath, | ||
isFrontendWarningsLog, | ||
}); | ||
await page.goto(); | ||
await use(page); | ||
}, | ||
}); | ||
|
||
test.describe("Last Mile Failure page", | ||
{ | ||
tag: "@smoke", | ||
}, () => { | ||
test.describe("admin user", () => { | ||
test.use({ storageState: "e2e/.auth/admin.json" }); | ||
|
||
test.describe("'Filter'", () => { | ||
test("table has expected data when filtering by 'ReportId'", async ({ lastMileFailuresPage }) => { | ||
const reportId = await tableRows(lastMileFailuresPage.page).nth(0).locator("td").nth(1).innerText(); | ||
await lastMileFailuresPage.filterFormInputs.filter.input.fill(reportId); | ||
const isReportIdReturned = await lastMileFailuresPage.testReportId( | ||
reportId, | ||
); | ||
expect(isReportIdReturned).toBe(true); | ||
}); | ||
}); | ||
|
||
test.describe("'Days to show' filter", () => { | ||
test.beforeEach(async ({ lastMileFailuresPage }) => { | ||
await lastMileFailuresPage.filterFormInputs.daysToShow.input.fill("200"); | ||
await lastMileFailuresPage.page.locator(".usa-table tbody").waitFor({ state: "visible" }); | ||
}); | ||
|
||
test("table has correct headers", async ({ lastMileFailuresPage }) => { | ||
await expect(lastMileFailuresPage.page.locator(".column-header-text").nth(0)).toHaveText(/Failed At/); | ||
await expect(lastMileFailuresPage.page.locator(".column-header-text").nth(1)).toHaveText(/ReportId/); | ||
await expect(lastMileFailuresPage.page.locator(".column-header-text").nth(2)).toHaveText(/Receiver/); | ||
}); | ||
|
||
test("table column 'Failed At' has expected data", async ({ lastMileFailuresPage, isMockDisabled }) => { | ||
test.skip(!isMockDisabled, "Mocks are ENABLED, test"); | ||
const areDatesInRange = await lastMileFailuresPage.tableColumnDateTimeInRange( | ||
200, | ||
); | ||
expect(areDatesInRange).toBe(true); | ||
}); | ||
}); | ||
|
||
test("table column 'ReportId' will open a modal with report details", async ({ lastMileFailuresPage }) => { | ||
const reportId = tableRows(lastMileFailuresPage.page).nth(0).locator("td").nth(1); | ||
const reportIdCell = await reportId.innerText(); | ||
await reportId.click(); | ||
|
||
const modal = lastMileFailuresPage.page.getByTestId("modalWindow").nth(0); | ||
await expect(modal).toContainText(`Report ID:${reportIdCell}`); | ||
}); | ||
|
||
test("table column 'Receiver' will open receiver edit page", async ({ lastMileFailuresPage, isMockDisabled }) => { | ||
test.skip(!isMockDisabled, "Mocks are ENABLED, skipping test"); | ||
const receiver = tableRows(lastMileFailuresPage.page).nth(0).locator("td").nth(2); | ||
const receiverCell = await receiver.getByRole("link").innerText(); | ||
await receiver.click(); | ||
|
||
await expect(lastMileFailuresPage.page).toHaveURL( | ||
`/admin/orgreceiversettings/org/${receiverCell}/receiver//action/edit`, | ||
); | ||
}); | ||
}); | ||
}, | ||
); |