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

OZG-3575 OZG-3708 Add E2E test for tabbing

parent aa1cab66
Branches
Tags
No related merge requests found
Showing
with 617 additions and 10422 deletions
......@@ -43,7 +43,7 @@ export class CurrentUserProfileE2EComponent {
this.getLogoutButton().click();
}
private getUserIconButton() {
public getUserIconButton() {
return cy.getTestElement(this.locatorUserIconButton);
}
......
......@@ -28,6 +28,7 @@ export class UserSettingsE2EComponent {
private readonly rootLocator: string = 'user-settings';
private readonly emailBenachrichtigungLocator: string = 'email-benachrichtigung';
private readonly darkModeLocator: string = 'dark-mode';
private readonly buttonLocator: string = 'icon-button';
public getRoot() {
return cy.getTestElementWithOid(this.rootLocator);
......@@ -40,6 +41,10 @@ export class UserSettingsE2EComponent {
public getDarkMode(): ToggleE2EComponent {
return new ToggleE2EComponent(this.darkModeLocator);
}
public getButton() {
return this.getRoot().findTestElementWithClass(this.buttonLocator);
}
}
export class ToggleE2EComponent {
......
......@@ -60,6 +60,10 @@ export class VorgangSearchE2EComponent {
public getClearButton() {
return cy.getTestElement(this.locatorClearButton);
}
public getMatFormField() {
return this.getForm().find('mat-form-field');
}
}
export class VorgangSearchPreviewListItemE2EComponent {
......
import { NavigationE2EComponent } from 'apps/goofy-e2e/src/components/navigation/navigation.e2e.component';
import { VorgangListE2EComponent } from 'apps/goofy-e2e/src/components/vorgang/vorgang-list.e2e.component';
import { VorgangViewsE2EComponent } from 'apps/goofy-e2e/src/components/vorgang/vorgang-views.e2e.component';
import { HeaderE2EComponent } from 'apps/goofy-e2e/src/page-objects/header.po';
import { MainPage, waitForSpinnerToDisappear } from 'apps/goofy-e2e/src/page-objects/main.po';
import { dropCollections } from 'apps/goofy-e2e/src/support/cypress-helper';
import { containClass } from 'apps/goofy-e2e/src/support/cypress.util';
import { getUserManagerUserSabine, initUsermanagerUsers, loginAsSabine } from 'apps/goofy-e2e/src/support/user-util';
describe('Vorgang views and filter', () => {
const mainPage: MainPage = new MainPage();
const header: HeaderE2EComponent = mainPage.getHeader();
const vorgangList: VorgangListE2EComponent = mainPage.getVorgangList();
const views: VorgangViewsE2EComponent = mainPage.getViews();
const navigation: NavigationE2EComponent = mainPage.getNavigation();
before(() => {
initUsermanagerUsers([getUserManagerUserSabine()]);
loginAsSabine();
waitForSpinnerToDisappear();
})
after(() => {
dropCollections();
})
describe('Tab through page', () => {
it('should select start element', () => {
header.getLogo().click();
})
it('should focus search field', () => {
cy.realPress('Tab');
cy.realPress('Tab');
isMatFocused(header.getSearch().getMatFormField());
})
it('should focus settings icon', () => {
cy.realPress('Tab');
cy.realPress('Tab');
isKeyboardFocused(header.getUserSettings().getButton());
})
it('should focus user icon', () => {
cy.realPress('Tab');
isKeyboardFocused(header.getCurrentUserProfile().getUserIconButton());
})
it('should focus Meine filter', () => {
cy.realPress('Tab');
isKeyboardFocused(navigation.getMeineVorgaengeFilter());
})
it('should focus Alle filter', () => {
cy.realPress('Tab');
isKeyboardFocused(navigation.getAlleFilter());
})
it('should focus Neu view', () => {
cy.realPress('Tab');
isKeyboardFocused(views.getNeu());
})
it('should focus Angenommen view', () => {
cy.realPress('Tab');
isKeyboardFocused(views.getAngenommen());
})
it('should focus InBearbeitung view', () => {
cy.realPress('Tab');
isKeyboardFocused(views.getInBearbeitung());
})
it('should focus Beschieden view', () => {
cy.realPress('Tab');
isKeyboardFocused(views.getBeschieden());
})
it('should focus Abgeschlossen view', () => {
cy.realPress('Tab');
isKeyboardFocused(views.getAbgeschlossen());
})
it('should focus Verworfen view', () => {
cy.realPress('Tab');
isKeyboardFocused(views.getVerworfen());
})
it('should focus VorgangList view', () => {
cy.realPress('Tab');
isKeyboardFocused(views.getVorgangList());
})
it('should focus Suche view', () => {
cy.realPress('Tab');
isKeyboardFocused(views.getSuche());
})
})
function isKeyboardFocused(element) {
containClass(element, 'cdk-keyboard-focused');
}
function isMatFocused(element) {
containClass(element, 'mat-focused');
}
})
\ No newline at end of file
......@@ -29,10 +29,10 @@ import { EingangE2E, VorgangE2E, VorgangStatusE2E } from 'apps/goofy-e2e/src/mod
import { VorgangPage } from 'apps/goofy-e2e/src/page-objects/vorgang.po';
import { dropCollections, reload } from 'apps/goofy-e2e/src/support/cypress-helper';
import { generate12ByteId } from 'apps/goofy-e2e/src/support/tech.util';
import { AntragstellerE2ETestData, buildVorgang, createVorgang, EingangE2ETestData, EingangHeaderE2ETestData, initSearchIndex, initVorgaenge, objectIds } from 'apps/goofy-e2e/src/support/vorgang-util';
import { AntragstellerE2ETestData, EingangE2ETestData, EingangHeaderE2ETestData, buildVorgang, createVorgang, initSearchIndex, initVorgaenge, objectIds } from 'apps/goofy-e2e/src/support/vorgang-util';
import { MainPage, waitForSpinnerToDisappear } from '../../../page-objects/main.po';
import { CypressKeyboardActions, exist, haveText, haveValue, notExist } from '../../../support/cypress.util';
import { loginAsSabine, UserRoleE2E } from '../../../support/user-util';
import { UserRoleE2E, loginAsSabine } from '../../../support/user-util';
describe('VorgangList Suche', () => {
const mainPage: MainPage = new MainPage();
......
......@@ -6,7 +6,7 @@ import { VorgangE2E, VorgangStatusE2E } from 'apps/goofy-e2e/src/model/vorgang';
import { MainPage, waitForSpinnerToDisappear } from 'apps/goofy-e2e/src/page-objects/main.po';
import { isButtonToggleChecked, isButtonToggleNotChecked } from 'apps/goofy-e2e/src/support/angular.util';
import { dropCollections } from 'apps/goofy-e2e/src/support/cypress-helper';
import { containClass, CypressKeyboardActions, exist, haveLength, haveText, notContainClass } from 'apps/goofy-e2e/src/support/cypress.util';
import { CypressKeyboardActions, containClass, exist, haveLength, haveText, notContainClass } from 'apps/goofy-e2e/src/support/cypress.util';
import { getUserManagerUserSabine, getUserSabineInternalId, initUsermanagerUsers, loginAsSabine } from 'apps/goofy-e2e/src/support/user-util';
import { buildVorgang, createVorgang, initSearchIndex, initVorgaenge, objectIds } from 'apps/goofy-e2e/src/support/vorgang-util';
......@@ -154,7 +154,7 @@ describe('Vorgang views and filter', () => {
describe('Angenommen', () => {
it('should set selected after click', () => {
it('should set selected after tab + enter', () => {
views.getAngenommen().click();
waitForSpinnerToDisappear();
......
......@@ -23,6 +23,7 @@
*/
import { CurrentUserProfileE2EComponent } from "../components/user-profile/current-user-profile.component.e2e";
import { UserSettingsE2EComponent } from "../components/user-settings/user-settings.component.e2e";
import { VorgangSearchE2EComponent } from "../components/vorgang/vorgang-search.e2e.component";
export class HeaderE2EComponent {
......@@ -31,6 +32,7 @@ export class HeaderE2EComponent {
private readonly userSettings: UserSettingsE2EComponent = new UserSettingsE2EComponent();
private readonly currentUserProfile: CurrentUserProfileE2EComponent = new CurrentUserProfileE2EComponent();
private readonly search: VorgangSearchE2EComponent = new VorgangSearchE2EComponent();
public getRoot() {
return cy.getTestElement(this.locatorRoot);
......@@ -40,6 +42,10 @@ export class HeaderE2EComponent {
return cy.getTestElement(this.locatorLogo);
}
public getSearch(): VorgangSearchE2EComponent {
return this.search;
}
public getUserSettings(): UserSettingsE2EComponent {
return this.userSettings;
}
......
......@@ -6,7 +6,7 @@
"sourceMap": false,
"target": "es2020",
"lib": ["es2018", "dom"],
"types": ["cypress"]
"types": ["cypress", "cypress-real-events"]
},
"references": [
{
......
This diff is collapsed.
......@@ -111,6 +111,7 @@
"cypress": "^9.7.0",
"cypress-file-upload": "5.0.8",
"cypress-mochawesome-reporter": "3.3.0",
"cypress-real-events": "^1.7.6",
"cypress-timestamps": "^1.2.3",
"eslint": "8.15.0",
"eslint-config-prettier": "8.3.0",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment