diff --git a/frontend-react/e2e/pages/authenticated/admin/receiver-status.ts b/frontend-react/e2e/pages/authenticated/admin/receiver-status.ts index a65ed16ce84..297a9cf9d66 100644 --- a/frontend-react/e2e/pages/authenticated/admin/receiver-status.ts +++ b/frontend-react/e2e/pages/authenticated/admin/receiver-status.ts @@ -487,6 +487,49 @@ export class AdminReceiverStatusPage extends BasePage { return true; } + async testReceiverMessage() { + // get first entry's result from all-fail receiver's first day -> third time period + const receiverI = 0; + const dayI = 0; + const timePeriodI = 2; + const entryI = 0; + const {days} = this.timePeriodData[receiverI]; + const {connectionCheckResult} = days[dayI].timePeriods[timePeriodI].entries[entryI]; + + const receiversStatusRows = this.receiverStatusRowsLocator; + + await this.updateFilters({ + resultMessage: connectionCheckResult, + }); + + for (const [i, {days}] of this.timePeriodData.entries()) { + const isRowExpected = i === receiverI; + const row = receiversStatusRows.nthCustom(i); + + for (const [i, {timePeriods}] of days.entries()) { + const isDayExpected = isRowExpected && i === dayI; + const rowDay = row.days.nthCustom(i); + + for (const [i] of timePeriods.entries()) { + const isTimePeriodExpected = isDayExpected && i === timePeriodI; + const expectedClass = !isTimePeriodExpected + ? /success-result-hidden/ + : /^((?!success-result-hidden).)*$/; + const rowDayTimePeriod = rowDay.timePeriods.nth(i); + + await expect(rowDayTimePeriod).toBeVisible(); + await expect(rowDayTimePeriod).toHaveClass(expectedClass); + } + } + } + + await this.resetFilters(); + + await this.testReceiverStatusDisplay(); + + return true; + } + async testReceiverOrgLinks(isSmoke = false) { const rows = this.receiverStatusRowsLocator; diff --git a/frontend-react/e2e/spec/all/authenticated/admin/receiver-status-page.spec.ts b/frontend-react/e2e/spec/all/authenticated/admin/receiver-status-page.spec.ts index e647a00534b..edba29a56c0 100644 --- a/frontend-react/e2e/spec/all/authenticated/admin/receiver-status-page.spec.ts +++ b/frontend-react/e2e/spec/all/authenticated/admin/receiver-status-page.spec.ts @@ -201,50 +201,37 @@ test.describe("Admin Receiver Status Page", () => { }, ); - test("receiver name", async ({adminReceiverStatusPage}) => { - const result = await adminReceiverStatusPage.testReceiverName(); - expect(result).toBe(true); - }); - - test("result message", async ({adminReceiverStatusPage}) => { - // get first entry's result from all-fail receiver's first day -> third time period - const receiverI = 0; - const dayI = 0; - const timePeriodI = 2; - const entryI = 0; - const {days} = adminReceiverStatusPage.timePeriodData[receiverI]; - const {connectionCheckResult} = days[dayI].timePeriods[timePeriodI].entries[entryI]; + test("receiver name", async ({ adminReceiverStatusPage }) => { + const { organizationName, receiverName, successRate } = + adminReceiverStatusPage.timePeriodData[1]; const receiversStatusRows = adminReceiverStatusPage.receiverStatusRowsLocator; + const expectedReceiverStatusRow = receiversStatusRows.nthCustom(0); + const expectedReceiverStatusRowTitle = + adminReceiverStatusPage.getExpectedReceiverStatusRowTitle( + organizationName, + receiverName, + successRate, + ); + + await expect(receiversStatusRows).toHaveCount(adminReceiverStatusPage.timePeriodData.length); await adminReceiverStatusPage.updateFilters({ - resultMessage: connectionCheckResult, + receiverName, }); - for (const [i, {days}] of adminReceiverStatusPage.timePeriodData.entries()) { - const isRowExpected = i === receiverI; - const row = receiversStatusRows.nthCustom(i); - - for (const [i, {timePeriods}] of days.entries()) { - const isDayExpected = isRowExpected && i === dayI; - const rowDay = row.days.nthCustom(i); - - for (const [i] of timePeriods.entries()) { - const isTimePeriodExpected = isDayExpected && i === timePeriodI; - const expectedClass = !isTimePeriodExpected - ? /success-result-hidden/ - : /^((?!success-result-hidden).)*$/; - const rowDayTimePeriod = rowDay.timePeriods.nth(i); - - await expect(rowDayTimePeriod).toBeVisible(); - await expect(rowDayTimePeriod).toHaveClass(expectedClass); - } - } - } + await expect(receiversStatusRows).toHaveCount(1); + await expect(expectedReceiverStatusRow).toBeVisible(); + await expect(expectedReceiverStatusRow.title).toHaveText(expectedReceiverStatusRowTitle); await adminReceiverStatusPage.resetFilters(); - await adminReceiverStatusPage.testReceiverStatusDisplay(); + await expect(receiversStatusRows).toHaveCount(adminReceiverStatusPage.timePeriodData.length); + }); + + test("result message", async ({adminReceiverStatusPage}) => { + const result = await adminReceiverStatusPage.testReceiverMessage(); + expect(result).toBe(true); }); test("success type", async ({adminReceiverStatusPage}) => { diff --git a/frontend-react/e2e/spec/chromium-only/authenticated/receiver-status-page-user-flow.spec.ts b/frontend-react/e2e/spec/chromium-only/authenticated/receiver-status-page-user-flow.spec.ts index 80241109259..456a0f18318 100644 --- a/frontend-react/e2e/spec/chromium-only/authenticated/receiver-status-page-user-flow.spec.ts +++ b/frontend-react/e2e/spec/chromium-only/authenticated/receiver-status-page-user-flow.spec.ts @@ -181,44 +181,8 @@ test.describe("Admin Receiver Status Page", }); test("result message", async ({adminReceiverStatusPage}) => { - // get first entry's result from all-fail receiver's first day -> third time period - const receiverI = 0; - const dayI = 0; - const timePeriodI = 2; - const entryI = 0; - const {days} = adminReceiverStatusPage.timePeriodData[receiverI]; - const {connectionCheckResult} = days[dayI].timePeriods[timePeriodI].entries[entryI]; - - const receiversStatusRows = adminReceiverStatusPage.receiverStatusRowsLocator; - - await adminReceiverStatusPage.updateFilters({ - resultMessage: connectionCheckResult, - }); - - for (const [i, {days}] of adminReceiverStatusPage.timePeriodData.entries()) { - const isRowExpected = i === receiverI; - const row = receiversStatusRows.nthCustom(i); - - for (const [i, {timePeriods}] of days.entries()) { - const isDayExpected = isRowExpected && i === dayI; - const rowDay = row.days.nthCustom(i); - - for (const [i] of timePeriods.entries()) { - const isTimePeriodExpected = isDayExpected && i === timePeriodI; - const expectedClass = !isTimePeriodExpected - ? /success-result-hidden/ - : /^((?!success-result-hidden).)*$/; - const rowDayTimePeriod = rowDay.timePeriods.nth(i); - - await expect(rowDayTimePeriod).toBeVisible(); - await expect(rowDayTimePeriod).toHaveClass(expectedClass); - } - } - } - - await adminReceiverStatusPage.resetFilters(); - - await adminReceiverStatusPage.testReceiverStatusDisplay(); + const result = await adminReceiverStatusPage.testReceiverMessage(); + expect(result).toBe(true); });