Skip to content
Snippets Groups Projects
Commit 45924c77 authored by OZGCloud's avatar OZGCloud
Browse files

OZG-7021 improve tests

parent bf28a120
No related branches found
No related tags found
No related merge requests found
...@@ -22,18 +22,20 @@ ...@@ -22,18 +22,20 @@
* unter der Lizenz sind dem Lizenztext zu entnehmen. * unter der Lizenz sind dem Lizenztext zu entnehmen.
*/ */
import { HeaderE2EComponent } from '../../../page-objects/header.po'; import { HeaderE2EComponent } from '../../../page-objects/header.po';
import { LoginPage } from '../../../page-objects/login.po';
import { MainPage } from '../../../page-objects/main.po'; import { MainPage } from '../../../page-objects/main.po';
import { reload } from '../../../support/cypress-helper'; import { reload } from '../../../support/cypress-helper';
import { exist } from '../../../support/cypress.util'; import { exist } from '../../../support/cypress.util';
import { loginByUi } from '../../../support/user-util'; import { loginByUi } from '../../../support/user-util';
describe('Login and Logout', () => { describe('Login and Logout', () => {
const loginPage: LoginPage = new LoginPage();
const mainPage: MainPage = new MainPage(); const mainPage: MainPage = new MainPage();
const header: HeaderE2EComponent = mainPage.getHeader(); const header: HeaderE2EComponent = mainPage.getHeader();
it('should display accessibility link', () => { it('should display accessibility link', () => {
cy.visit(''); cy.visit('');
exist(cy.get('#kc-barrierefreiheit')); exist(loginPage.getBarrierefreiheitLink());
}); });
it('login as Ariane', () => { it('login as Ariane', () => {
...@@ -56,7 +58,7 @@ describe('Login and Logout', () => { ...@@ -56,7 +58,7 @@ describe('Login and Logout', () => {
it('should logout', () => { it('should logout', () => {
header.getCurrentUserProfile().logout(); header.getCurrentUserProfile().logout();
exist(cy.get('#kc-login')); exist(loginPage.getLogin());
Cypress.session.clearAllSavedSessions(); Cypress.session.clearAllSavedSessions();
}); });
......
export class LoginPage {
private readonly locatorLogin: string = '#kc-login';
private readonly locatorBarrierefreiheitLink: string = '#kc-barrierefreiheit';
public getLogin() {
return cy.get(this.locatorLogin);
}
public getBarrierefreiheitLink() {
return cy.get(this.locatorBarrierefreiheitLink);
}
}
...@@ -26,6 +26,7 @@ import { getApp } from 'apps/alfa-e2e/src/support/app-util'; ...@@ -26,6 +26,7 @@ import { getApp } from 'apps/alfa-e2e/src/support/app-util';
import { reload } from 'apps/alfa-e2e/src/support/cypress-helper'; import { reload } from 'apps/alfa-e2e/src/support/cypress-helper';
import { UserE2E } from '../../../model/user'; import { UserE2E } from '../../../model/user';
import { HeaderE2EComponent } from '../../../page-objects/header.po'; import { HeaderE2EComponent } from '../../../page-objects/header.po';
import { LoginPage } from '../../../page-objects/login.po';
import { MainPage, waitForSpinnerToDisappear } from '../../../page-objects/main.po'; import { MainPage, waitForSpinnerToDisappear } from '../../../page-objects/main.po';
import { exist } from '../../../support/cypress.util'; import { exist } from '../../../support/cypress.util';
import { getUserSabine } from '../../../support/user-util'; import { getUserSabine } from '../../../support/user-util';
...@@ -34,6 +35,7 @@ describe('Login and Logout', () => { ...@@ -34,6 +35,7 @@ describe('Login and Logout', () => {
const app: App = getApp(); const app: App = getApp();
const user: UserE2E = getUserSabine(); const user: UserE2E = getUserSabine();
const loginPage: LoginPage = new LoginPage();
const mainPage: MainPage = new MainPage(); const mainPage: MainPage = new MainPage();
const header: HeaderE2EComponent = mainPage.getHeader(); const header: HeaderE2EComponent = mainPage.getHeader();
...@@ -42,7 +44,7 @@ describe('Login and Logout', () => { ...@@ -42,7 +44,7 @@ describe('Login and Logout', () => {
}); });
it('should display accessibility link', () => { it('should display accessibility link', () => {
exist(cy.get('#kc-barrierefreiheit')); exist(loginPage.getBarrierefreiheitLink());
}); });
it('login as test user', () => { it('login as test user', () => {
...@@ -73,6 +75,6 @@ describe('Login and Logout', () => { ...@@ -73,6 +75,6 @@ describe('Login and Logout', () => {
it('should logout', () => { it('should logout', () => {
header.getCurrentUserProfile().logout(); header.getCurrentUserProfile().logout();
exist(cy.get('#kc-login')); exist(loginPage.getLogin());
}); });
}); });
export class LoginPage {
private readonly locatorLogin: string = '#kc-login';
private readonly locatorBarrierefreiheitLink: string = '#kc-barrierefreiheit';
public getLogin() {
return cy.get(this.locatorLogin);
}
public getBarrierefreiheitLink() {
return cy.get(this.locatorBarrierefreiheitLink);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment