From 4f7bf577a5410423799c5c6006a44134b8ff1456 Mon Sep 17 00:00:00 2001 From: Pyry Koivisto Date: Fri, 3 Jan 2025 12:54:16 +0200 Subject: [PATCH] VKT(Frontend): Rename publicHomePage -> publicExcellentLevelPage in Cypress tests --- .../mobile_public_home_page.spec.ts | 30 +++++++++---------- .../integration/public_enrollment.spec.ts | 22 +++++++------- .../integration/public_home_page.spec.ts | 30 +++++++++---------- .../vkt/src/tests/cypress/support/commands.ts | 2 +- ...omePage.ts => publicExcellentLevelPage.ts} | 4 +-- .../publicGoodAndSatisfactoryLevelPage.ts | 0 .../tests/cypress/support/types/index.d.ts | 2 +- 7 files changed, 45 insertions(+), 45 deletions(-) rename frontend/packages/vkt/src/tests/cypress/support/page-objects/{publicHomePage.ts => publicExcellentLevelPage.ts} (96%) create mode 100644 frontend/packages/vkt/src/tests/cypress/support/page-objects/publicGoodAndSatisfactoryLevelPage.ts diff --git a/frontend/packages/vkt/src/tests/cypress/integration/mobile_public_home_page.spec.ts b/frontend/packages/vkt/src/tests/cypress/integration/mobile_public_home_page.spec.ts index a915238dc..864a6a6db 100644 --- a/frontend/packages/vkt/src/tests/cypress/integration/mobile_public_home_page.spec.ts +++ b/frontend/packages/vkt/src/tests/cypress/integration/mobile_public_home_page.spec.ts @@ -1,32 +1,32 @@ import { ExamLanguage } from 'enums/app'; -import { onPublicHomePage } from 'tests/cypress/support/page-objects/publicHomePage'; +import { onPublicExcellentLevelPage } from 'tests/cypress/support/page-objects/publicExcellentLevelPage'; import { publicExamEvents11 } from 'tests/msw/fixtures/publicExamEvents11'; describe('PublicHomePage (mobile)', () => { beforeEach(() => { cy.viewport('iphone-x'); - cy.openPublicHomePage(); + cy.openPublicExcellentLevelPage(); }); it('should allow filtering exam events based on exam language', () => { - onPublicHomePage.expectFilteredExamEventsCount(publicExamEvents11.length); + onPublicExcellentLevelPage.expectFilteredExamEventsCount(publicExamEvents11.length); - onPublicHomePage.filterByLanguage(ExamLanguage.FI); - onPublicHomePage.expectFilteredExamEventsCount(6); + onPublicExcellentLevelPage.filterByLanguage(ExamLanguage.FI); + onPublicExcellentLevelPage.expectFilteredExamEventsCount(6); - onPublicHomePage.filterByLanguage(ExamLanguage.SV); - onPublicHomePage.expectFilteredExamEventsCount(5); + onPublicExcellentLevelPage.filterByLanguage(ExamLanguage.SV); + onPublicExcellentLevelPage.expectFilteredExamEventsCount(5); - onPublicHomePage.filterByLanguage(ExamLanguage.ALL); - onPublicHomePage.expectFilteredExamEventsCount(publicExamEvents11.length); + onPublicExcellentLevelPage.filterByLanguage(ExamLanguage.ALL); + onPublicExcellentLevelPage.expectFilteredExamEventsCount(publicExamEvents11.length); }); it('should display enroll button correctly based on enrollment status', () => { - onPublicHomePage.expectEnrollButtonDisabled(1); - onPublicHomePage.expectEnrollButtonText(1, 'Ilmoittaudu myöhemmin'); - onPublicHomePage.expectEnrollButtonEnabled(2); - onPublicHomePage.expectEnrollButtonText(2, 'Ilmoittaudu'); - onPublicHomePage.expectEnrollButtonEnabled(5); - onPublicHomePage.expectEnrollButtonText(5, 'Ilmoittaudu jonoon'); + onPublicExcellentLevelPage.expectEnrollButtonDisabled(1); + onPublicExcellentLevelPage.expectEnrollButtonText(1, 'Ilmoittaudu myöhemmin'); + onPublicExcellentLevelPage.expectEnrollButtonEnabled(2); + onPublicExcellentLevelPage.expectEnrollButtonText(2, 'Ilmoittaudu'); + onPublicExcellentLevelPage.expectEnrollButtonEnabled(5); + onPublicExcellentLevelPage.expectEnrollButtonText(5, 'Ilmoittaudu jonoon'); }); }); diff --git a/frontend/packages/vkt/src/tests/cypress/integration/public_enrollment.spec.ts b/frontend/packages/vkt/src/tests/cypress/integration/public_enrollment.spec.ts index 086f80253..821c0ec71 100644 --- a/frontend/packages/vkt/src/tests/cypress/integration/public_enrollment.spec.ts +++ b/frontend/packages/vkt/src/tests/cypress/integration/public_enrollment.spec.ts @@ -3,7 +3,7 @@ import { HTTPStatusCode } from 'shared/enums'; import { APIEndpoints } from 'enums/api'; import { PublicReservationResponse } from 'interfaces/publicEnrollment'; import { onPublicEnrollmentPage } from 'tests/cypress/support/page-objects/publicEnrollmentPage'; -import { onPublicHomePage } from 'tests/cypress/support/page-objects/publicHomePage'; +import { onPublicExcellentLevelPage } from 'tests/cypress/support/page-objects/publicExcellentLevelPage'; import { onToast } from 'tests/cypress/support/page-objects/toast'; import { fixedDateForTests } from 'tests/cypress/support/utils/date'; @@ -14,11 +14,11 @@ beforeEach(() => { describe('Public enrollment', () => { describe('to exam event with room', () => { it('reservation should have timer', () => { - onPublicHomePage.expectReservationTimeLeft('30', '00'); + onPublicExcellentLevelPage.expectReservationTimeLeft('30', '00'); cy.tick(3000); - onPublicHomePage.expectReservationTimeLeft('29', '57'); + onPublicExcellentLevelPage.expectReservationTimeLeft('29', '57'); cy.tick(30 * 60 * 1000); - onPublicHomePage.expectReservationTimeLeft('00', '00'); + onPublicExcellentLevelPage.expectReservationTimeLeft('00', '00'); }); it('reservation should allow renewal', () => { @@ -35,17 +35,17 @@ describe('Public enrollment', () => { body: response, }).as('renewReservation'); - onPublicHomePage.expectReservationTimeLeft('30', '00'); + onPublicExcellentLevelPage.expectReservationTimeLeft('30', '00'); cy.tick(29 * 60 * 1000); - onPublicHomePage.clickReservationRenewButton(); + onPublicExcellentLevelPage.clickReservationRenewButton(); cy.wait('@renewReservation'); cy.tick(30 * 1000); - onPublicHomePage.expectReservationTimeLeft('29', '30'); + onPublicExcellentLevelPage.expectReservationTimeLeft('29', '30'); }); it('reservation expired should display info modal', () => { cy.tick(31 * 60 * 1000); - onPublicHomePage.expectReservationExpiredOkButtonEnabled(); + onPublicExcellentLevelPage.expectReservationExpiredOkButtonEnabled(); }); it('should show session expired modal', () => { @@ -54,7 +54,7 @@ describe('Public enrollment', () => { cy.setCookie('noAuth', 'true'); cy.wait(10); cy.tick(6 * 1000); - onPublicHomePage.expectSessionExpiredModal(); + onPublicExcellentLevelPage.expectSessionExpiredModal(); }); it('should be able to fill out enrollment info', () => { @@ -233,13 +233,13 @@ describe('Public enrollment', () => { // TODO: Enable again once auth flow is complete. describe('errors when enroll button is clicked on the home page', () => { it.skip('exam event received congestion after the home page was opened', () => { - onPublicHomePage.clickEnrollButton(10); + onPublicExcellentLevelPage.clickEnrollButton(10); onToast.expectText('Tutkintotilaisuus on ruuhkautunut'); }); it.skip('registration to exam event closed after the home page was opened', () => { - onPublicHomePage.clickEnrollButton(11); + onPublicExcellentLevelPage.clickEnrollButton(11); onToast.expectText( 'Tutkintotilaisuuteen ilmoittautuminen on sulkeutunut', diff --git a/frontend/packages/vkt/src/tests/cypress/integration/public_home_page.spec.ts b/frontend/packages/vkt/src/tests/cypress/integration/public_home_page.spec.ts index fbc3046f8..373162c6c 100644 --- a/frontend/packages/vkt/src/tests/cypress/integration/public_home_page.spec.ts +++ b/frontend/packages/vkt/src/tests/cypress/integration/public_home_page.spec.ts @@ -1,11 +1,11 @@ import { ExamLanguage } from 'enums/app'; import { onCookieBanner } from 'tests/cypress/support/page-objects/cookieBanner'; -import { onPublicHomePage } from 'tests/cypress/support/page-objects/publicHomePage'; +import { onPublicExcellentLevelPage } from 'tests/cypress/support/page-objects/publicExcellentLevelPage'; import { publicExamEvents11 } from 'tests/msw/fixtures/publicExamEvents11'; describe('PublicHomePage', () => { beforeEach(() => { - cy.openPublicHomePage(); + cy.openPublicExcellentLevelPage(); }); it('should close cookie banner', () => { @@ -15,24 +15,24 @@ describe('PublicHomePage', () => { }); it('should allow filtering exam events based on exam language', () => { - onPublicHomePage.expectFilteredExamEventsCount(publicExamEvents11.length); + onPublicExcellentLevelPage.expectFilteredExamEventsCount(publicExamEvents11.length); - onPublicHomePage.filterByLanguage(ExamLanguage.FI); - onPublicHomePage.expectFilteredExamEventsCount(6); + onPublicExcellentLevelPage.filterByLanguage(ExamLanguage.FI); + onPublicExcellentLevelPage.expectFilteredExamEventsCount(6); - onPublicHomePage.filterByLanguage(ExamLanguage.SV); - onPublicHomePage.expectFilteredExamEventsCount(5); + onPublicExcellentLevelPage.filterByLanguage(ExamLanguage.SV); + onPublicExcellentLevelPage.expectFilteredExamEventsCount(5); - onPublicHomePage.filterByLanguage(ExamLanguage.ALL); - onPublicHomePage.expectFilteredExamEventsCount(publicExamEvents11.length); + onPublicExcellentLevelPage.filterByLanguage(ExamLanguage.ALL); + onPublicExcellentLevelPage.expectFilteredExamEventsCount(publicExamEvents11.length); }); it('should display enroll button correctly based on enrollment status', () => { - onPublicHomePage.expectEnrollButtonDisabled(1); - onPublicHomePage.expectEnrollButtonText(1, 'Ilmoittaudu myöhemmin'); - onPublicHomePage.expectEnrollButtonEnabled(2); - onPublicHomePage.expectEnrollButtonText(2, 'Ilmoittaudu'); - onPublicHomePage.expectEnrollButtonEnabled(5); - onPublicHomePage.expectEnrollButtonText(5, 'Ilmoittaudu jonoon'); + onPublicExcellentLevelPage.expectEnrollButtonDisabled(1); + onPublicExcellentLevelPage.expectEnrollButtonText(1, 'Ilmoittaudu myöhemmin'); + onPublicExcellentLevelPage.expectEnrollButtonEnabled(2); + onPublicExcellentLevelPage.expectEnrollButtonText(2, 'Ilmoittaudu'); + onPublicExcellentLevelPage.expectEnrollButtonEnabled(5); + onPublicExcellentLevelPage.expectEnrollButtonText(5, 'Ilmoittaudu jonoon'); }); }); diff --git a/frontend/packages/vkt/src/tests/cypress/support/commands.ts b/frontend/packages/vkt/src/tests/cypress/support/commands.ts index 711084f6a..5b506473e 100644 --- a/frontend/packages/vkt/src/tests/cypress/support/commands.ts +++ b/frontend/packages/vkt/src/tests/cypress/support/commands.ts @@ -1,7 +1,7 @@ import { AppRoutes } from 'enums/app'; import { RouteUtils } from 'utils/routes'; -Cypress.Commands.add('openPublicHomePage', () => { +Cypress.Commands.add('openPublicExcellentLevelPage', () => { cy.window().then((win) => { win.sessionStorage.setItem('persist:root', '{}'); }); diff --git a/frontend/packages/vkt/src/tests/cypress/support/page-objects/publicHomePage.ts b/frontend/packages/vkt/src/tests/cypress/support/page-objects/publicExcellentLevelPage.ts similarity index 96% rename from frontend/packages/vkt/src/tests/cypress/support/page-objects/publicHomePage.ts rename to frontend/packages/vkt/src/tests/cypress/support/page-objects/publicExcellentLevelPage.ts index e07461954..16d328839 100644 --- a/frontend/packages/vkt/src/tests/cypress/support/page-objects/publicHomePage.ts +++ b/frontend/packages/vkt/src/tests/cypress/support/page-objects/publicExcellentLevelPage.ts @@ -2,7 +2,7 @@ import { ExamLanguage } from 'enums/app'; const row = (id: number) => `public-exam-events__id-${id}-row`; -class PublicHomePage { +class PublicExcellentLevelPage { elements = { enrollButton: (examEventId: number) => cy.findByTestId(`public-exam-events-${examEventId}__enroll-btn`), @@ -89,4 +89,4 @@ class PublicHomePage { } } -export const onPublicHomePage = new PublicHomePage(); +export const onPublicExcellentLevelPage = new PublicExcellentLevelPage(); diff --git a/frontend/packages/vkt/src/tests/cypress/support/page-objects/publicGoodAndSatisfactoryLevelPage.ts b/frontend/packages/vkt/src/tests/cypress/support/page-objects/publicGoodAndSatisfactoryLevelPage.ts new file mode 100644 index 000000000..e69de29bb diff --git a/frontend/packages/vkt/src/tests/cypress/support/types/index.d.ts b/frontend/packages/vkt/src/tests/cypress/support/types/index.d.ts index e4776e3d2..65ad50c7a 100644 --- a/frontend/packages/vkt/src/tests/cypress/support/types/index.d.ts +++ b/frontend/packages/vkt/src/tests/cypress/support/types/index.d.ts @@ -5,7 +5,7 @@ export {}; declare global { namespace Cypress { interface Chainable { - openPublicHomePage(): void; + openPublicExcellentLevelPage(): void; openPublicEnrollmentPage( examEventId: number, persistedState?: string,