Skip to content

Commit f061aed

Browse files
author
Manuel
committed
test(e2e): Add page model with abstraction for more reuseability in the future #12
1 parent 0ec1375 commit f061aed

4 files changed

Lines changed: 14 additions & 6 deletions

File tree

frontend/cypress/e2e/example.cy.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
import HomePage from '../pages/homePage';
2+
13
describe('example page', () => {
24
beforeEach(() => {
3-
cy.visitDefaultPage();
5+
HomePage.visitDefaultPage();
46
});
57

68
it('should show html', () => {

frontend/cypress/pages/homePage.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { Page } from './page';
2+
3+
class HomePage extends Page {
4+
}
5+
6+
export default new HomePage();

frontend/cypress/pages/page.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export abstract class Page {
2+
visitDefaultPage() {
3+
cy.visit('/');
4+
}
5+
}

frontend/cypress/support/commands.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,3 @@
3636
// }
3737
// }
3838
// }
39-
40-
Cypress.Commands.add('visitDefaultPage', () => {
41-
// Probably add the login in this command as well, see OKR for inspiration
42-
cy.visit('/')
43-
});

0 commit comments

Comments
 (0)