Skip to content

Commit

Permalink
Added check if using mock
Browse files Browse the repository at this point in the history
  • Loading branch information
penny-lischer committed Sep 9, 2024
1 parent f8e04fe commit 5b29b41
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,6 @@ export class AdminReceiverStatusPage extends BasePage {
this.timePeriodData[1];

const receiversStatusRows = this.receiverStatusRowsLocator;
const defaultReceiversStatusRowsCount = await receiversStatusRows.count();
const expectedReceiverStatusRow = receiversStatusRows.nthCustom(0);
const expectedReceiverStatusRowTitle =
this.getExpectedReceiverStatusRowTitle(
Expand All @@ -469,20 +468,19 @@ export class AdminReceiverStatusPage extends BasePage {
successRate,
);

expect(defaultReceiversStatusRowsCount).toBe(this.timePeriodData.length);
await expect(receiversStatusRows).toHaveCount(this.timePeriodData.length);

await this.updateFilters({
receiverName,
});

const receiversStatusRowsCount = await receiversStatusRows.count();
expect(receiversStatusRowsCount).toBeGreaterThanOrEqual(1);
await expect(receiversStatusRows).toHaveCount(1);
await expect(expectedReceiverStatusRow).toBeVisible();
await expect(expectedReceiverStatusRow.title).toHaveText(expectedReceiverStatusRowTitle);

await this.resetFilters();

expect(defaultReceiversStatusRowsCount).toBe(this.timePeriodData.length);
await expect(receiversStatusRows).toHaveCount(this.timePeriodData.length);

return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,16 +175,72 @@ test.describe("Admin Receiver Status Page",
},
);

test("receiver name", async ({ adminReceiverStatusPage }) => {
const result = await adminReceiverStatusPage.testReceiverName();
expect(result).toBe(true);
});
test("receiver name", async ({adminReceiverStatusPage, isMockDisabled}) => {
test.skip(!isMockDisabled, "Mocks are ENABLED, skipping 'receiver name' test");

Check warning on line 179 in frontend-react/e2e/spec/chromium-only/authenticated/receiver-status-page-user-flow.spec.ts

View workflow job for this annotation

GitHub Actions / Lint

Unexpected use of the `.skip()` annotation
const {organizationName, receiverName, successRate} =
adminReceiverStatusPage.timePeriodData[1];

test("result message", async ({adminReceiverStatusPage}) => {
const result = await adminReceiverStatusPage.testReceiverMessage();
expect(result).toBe(true);
const receiversStatusRows = adminReceiverStatusPage.receiverStatusRowsLocator;
const defaultReceiversStatusRowsCount = await receiversStatusRows.count();
const expectedReceiverStatusRow = receiversStatusRows.nthCustom(0);
const expectedReceiverStatusRowTitle =
adminReceiverStatusPage.getExpectedReceiverStatusRowTitle(
organizationName,
receiverName,
successRate,
);

expect(defaultReceiversStatusRowsCount).toBe(adminReceiverStatusPage.timePeriodData.length);

await adminReceiverStatusPage.updateFilters({
receiverName,
});

const receiversStatusRowsCount = await receiversStatusRows.count();
expect(receiversStatusRowsCount).toBeGreaterThanOrEqual(1);
await expect(expectedReceiverStatusRow).toBeVisible();
await expect(expectedReceiverStatusRow.title).toHaveText(expectedReceiverStatusRowTitle);

await adminReceiverStatusPage.resetFilters();

expect(defaultReceiversStatusRowsCount).toBe(adminReceiverStatusPage.timePeriodData.length);
});

test("result message", async ({adminReceiverStatusPage, isMockDisabled}) => {
test.skip(!isMockDisabled, "Mocks are ENABLED, skipping 'result message' test");
// 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 row = receiversStatusRows.nthCustom(i);

for (const [i, {timePeriods}] of days.entries()) {
const rowDay = row.days.nthCustom(i);

for (const [i] of timePeriods.entries()) {
const rowDayTimePeriod = rowDay.timePeriods.nth(i);

await expect(rowDayTimePeriod).toHaveClass(/success-result-hidden/);
}
}
}

await adminReceiverStatusPage.resetFilters();

// TODO: revisit after filters have been fixed per ticket #15737
// await adminReceiverStatusPage.testReceiverStatusDisplay();
});

test("success type", async ({ adminReceiverStatusPage }) => {
const [failRow, ,] = adminReceiverStatusPage.timePeriodData;
Expand Down

0 comments on commit 5b29b41

Please sign in to comment.