Skip to content

Commit

Permalink
VKT(Frontend): PublicHomePage Cypress tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pkoivisto committed Jan 3, 2025
1 parent 6004b68 commit af02950
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { AppRoutes } from 'enums/app';
import { onPublicHomePage } from 'tests/cypress/support/page-objects/publicHomePage';

describe('PublicHomePage', () => {
beforeEach(() => {
cy.openPublicHomePage();
});

it('should link to excellent level exams', () => {
onPublicHomePage.continueToExcellentLevelExams();
cy.url().should('include', AppRoutes.PublicExcellentLevelLanding);
});

it('should link to good and satisfactory level exams', () => {
onPublicHomePage.continueToGoodAndSatisfactoryLevelExams();
cy.url().should('include', AppRoutes.PublicGoodAndSatisfactoryLevelLanding);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { RouteUtils } from 'utils/routes';
Cypress.Commands.add('openPublicHomePage', () => {
cy.window().then((win) => {
win.sessionStorage.setItem('persist:root', '{}');
cy.setCookie('cookie-consent-vkt', 'true');
});
cy.visit(AppRoutes.PublicHomePage);
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
class PublicHomePage {
elements = {
toExcellentLevelExams: () =>
cy.findByRole('button', {
name: 'Ilmoittaudu erinomaisen taidon tutkintoon',
}),
toGoodAndSatisfactoryLevelExam: () =>
cy.findByRole('button', {
name: 'Ota yhteyttä tutkinnon vastaanottajiin',
}),
};

continueToExcellentLevelExams() {
this.elements.toExcellentLevelExams().scrollIntoView();
this.elements.toExcellentLevelExams().click();
}

continueToGoodAndSatisfactoryLevelExams() {
this.elements.toGoodAndSatisfactoryLevelExam().scrollIntoView();
this.elements.toGoodAndSatisfactoryLevelExam().click();
}
}

export const onPublicHomePage = new PublicHomePage();
export const onPublicHomePage = new PublicHomePage();

0 comments on commit af02950

Please sign in to comment.