Skip to content

Commit

Permalink
VKT(Frontend) cookie banner cypress test fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jrkkp committed Jan 24, 2024
1 parent 4d67a52 commit 2f33624
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { onPublicEnrollmentPage } from 'tests/cypress/support/page-objects/publicEnrollmentPage';
import { onPublicHomePage } from 'tests/cypress/support/page-objects/publicHomePage';
import { onToast } from 'tests/cypress/support/page-objects/toast';
import { onCookieBanner } from 'tests/cypress/support/page-objects/cookieBanner';

beforeEach(() => {
cy.openPublicEnrollmentPage(2);
Expand All @@ -9,6 +10,8 @@ beforeEach(() => {
describe('Public enrollment', () => {
describe('to exam event with room', () => {
it('reservation should have timer', () => {
onCookieBanner.closeBanner();

onPublicHomePage.expectReservationTimeLeft('30', '00');
cy.tick(3000);
onPublicHomePage.expectReservationTimeLeft('29', '57');
Expand All @@ -17,6 +20,8 @@ describe('Public enrollment', () => {
});

it('reservation should allow renewal', () => {
onCookieBanner.closeBanner();

onPublicHomePage.expectReservationTimeLeft('30', '00');
cy.tick(29 * 60 * 1000);
onPublicHomePage.clickReservationRenewButton();
Expand All @@ -31,6 +36,8 @@ describe('Public enrollment', () => {

it('should be able to fill out enrollment info', () => {
cy.tick(3000);

onCookieBanner.closeBanner();
onPublicEnrollmentPage.expectEnrollmentPersonDetails(
'Sukunimi:TestiläEtunimet:Tessa',
);
Expand Down Expand Up @@ -88,6 +95,7 @@ describe('Public enrollment', () => {

it('should display errors if mandatory info is missing', () => {
cy.tick(3000);
onCookieBanner.closeBanner();
onPublicEnrollmentPage.clickNext();
onPublicEnrollmentPage.expectContactDetailsError(
'email',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class CookieBanner {
closeBanner() {
cy.findByTestId('cookie-banner-accept-button').click();
}
}

export const onCookieBanner = new CookieBanner();

0 comments on commit 2f33624

Please sign in to comment.