Skip to content

Commit

Permalink
Fixed failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
penny-lischer committed Sep 7, 2024
1 parent 1682da1 commit f8e04fe
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 73 deletions.
43 changes: 43 additions & 0 deletions frontend-react/e2e/pages/authenticated/admin/receiver-status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});


Expand Down

0 comments on commit f8e04fe

Please sign in to comment.