From 32b578022ee15cb20219ff2715b7792df1081991 Mon Sep 17 00:00:00 2001 From: Penelope Lischer Date: Sat, 21 Sep 2024 21:22:22 -0700 Subject: [PATCH] 15908 - Implement user flow for e2e smoke test for Org Settings Edit Page --- ...ation-settings-edit-page-user-flow.spec.ts | 86 +++++++++++++++++++ ...ganization-settings-page-user-flow.spec.ts | 16 ++-- 2 files changed, 94 insertions(+), 8 deletions(-) create mode 100644 frontend-react/e2e/spec/chromium-only/authenticated/organization-settings-edit-page-user-flow.spec.ts diff --git a/frontend-react/e2e/spec/chromium-only/authenticated/organization-settings-edit-page-user-flow.spec.ts b/frontend-react/e2e/spec/chromium-only/authenticated/organization-settings-edit-page-user-flow.spec.ts new file mode 100644 index 00000000000..a96aefcb628 --- /dev/null +++ b/frontend-react/e2e/spec/chromium-only/authenticated/organization-settings-edit-page-user-flow.spec.ts @@ -0,0 +1,86 @@ +import { expect } from "@playwright/test"; +import { OrganizationEditPage } from "../../../pages/authenticated/admin/organization-edit"; +import { test as baseTest } from "../../../test"; + +export interface OrganizationEditPageFixtures { + organizationEditPage: OrganizationEditPage; +} + +const test = baseTest.extend({ + organizationEditPage: async ( + { + page: _page, + isMockDisabled, + adminLogin, + senderLogin, + receiverLogin, + storageState, + frontendWarningsLogPath, + isFrontendWarningsLog, + }, + use, + ) => { + const page = new OrganizationEditPage({ + page: _page, + isMockDisabled, + adminLogin, + senderLogin, + receiverLogin, + storageState, + frontendWarningsLogPath, + isFrontendWarningsLog, + }); + await page.goto(); + await use(page); + }, +}); + +test.describe("Organization Edit Page", { + tag: "@smoke", +}, () => { + test.describe("admin user", () => { + test.use({storageState: "e2e/.auth/admin.json"}); + + test("has correct title", async ({organizationEditPage}) => { + await organizationEditPage.testHeader(false); + await expect(organizationEditPage.page.getByText(/Org name: ignore/)).toBeVisible(); + }); + + test.describe("edit section", () => { + test("has expected 'Meta'", async ({organizationEditPage}) => { + const meta = organizationEditPage.page.getByTestId("gridContainer").getByTestId("grid").nth(2); + await expect(meta).not.toBeEmpty(); + }); + + test("has expected 'Description'", async ({organizationEditPage}) => { + await expect(organizationEditPage.page.getByTestId("description")).not.toBeEmpty(); + }); + + test("has expected 'Jurisdiction'", async ({organizationEditPage}) => { + await expect(organizationEditPage.page.getByTestId("jurisdiction")).not.toBeEmpty(); + }); + }); + + test.describe("'Organization Sender Settings' section", () => { + test.beforeEach(async ({ organizationEditPage }) => { + await organizationEditPage.page.locator("#orgsendersettings .usa-table tbody").waitFor({ state: "visible" }); + }); + + test("has at least one sender listed in the table", async ({organizationEditPage}) => { + const rowCount = await organizationEditPage.page.locator("#orgsendersettings .usa-table tbody tr").count(); + expect(rowCount).toBeGreaterThanOrEqual(1); + }); + }); + + test.describe("'Organization Receiver Settings' section", () => { + test.beforeEach(async ({ organizationEditPage }) => { + await organizationEditPage.page.locator("#orgreceiversettings .usa-table tbody").waitFor({ state: "visible" }); + }); + + test("has at least one sender listed in the table", async ({organizationEditPage}) => { + const rowCount = await organizationEditPage.page.locator("#orgreceiversettings .usa-table tbody tr").count(); + expect(rowCount).toBeGreaterThanOrEqual(1); + }); + }); + }); +}); diff --git a/frontend-react/e2e/spec/chromium-only/authenticated/organization-settings-page-user-flow.spec.ts b/frontend-react/e2e/spec/chromium-only/authenticated/organization-settings-page-user-flow.spec.ts index 0cd6327d074..c1decd33a17 100644 --- a/frontend-react/e2e/spec/chromium-only/authenticated/organization-settings-page-user-flow.spec.ts +++ b/frontend-react/e2e/spec/chromium-only/authenticated/organization-settings-page-user-flow.spec.ts @@ -1,6 +1,5 @@ import { expect } from "@playwright/test"; import { tableRows } from "../../../helpers/utils"; -import { MOCK_GET_ORGANIZATION_SETTINGS_LIST } from "../../../mocks/organizations"; import { OrganizationPage } from "../../../pages/authenticated/admin/organization"; import { test as baseTest } from "../../../test"; @@ -72,23 +71,24 @@ test.describe("Admin Organization Settings Page - user flow smoke tests", { test("filtering works as expected", async ({organizationPage}) => { const table = organizationPage.page.getByRole("table"); - const {description, name, jurisdiction, stateCode} = MOCK_GET_ORGANIZATION_SETTINGS_LIST[2]; + const firstDataRow = organizationPage.page.getByRole("table").getByRole("row").nth(1); + const firstDataRowName = (await firstDataRow.getByRole("cell").nth(0).textContent()) ?? "INVALID"; const filterBox = organizationPage.page.getByRole("textbox", { name: "Filter:", }); await expect(filterBox).toBeVisible(); - await filterBox.fill(name); + await filterBox.fill(firstDataRowName); const rows = await table.getByRole("row").all(); expect(rows).toHaveLength(2); const cols = rows[1].getByRole("cell").allTextContents(); const expectedColContents = [ - name, - description ?? "", - jurisdiction ?? "", - stateCode ?? "", - "", + await firstDataRow.getByRole("cell").nth(0).textContent(), + await firstDataRow.getByRole("cell").nth(1).textContent() ?? "", + await firstDataRow.getByRole("cell").nth(2).textContent() ?? "", + await firstDataRow.getByRole("cell").nth(3).textContent() ?? "", + await firstDataRow.getByRole("cell").nth(4).textContent() ?? "", "SetEdit", ];