Skip to content
Snippets Groups Projects
Commit 3f4121af authored by Martin's avatar Martin
Browse files

OZG-7590 adjust e2e tests

parent a14f3f23
Branches
Tags
1 merge request!59OZG-7590-Administration-neue-Rolle
Showing
with 98 additions and 130 deletions
......@@ -21,19 +21,24 @@
* Die sprachspezifischen Genehmigungen und Beschränkungen
* unter der Lizenz sind dem Lizenztext zu entnehmen.
*/
import { haveValue, typeText } from '../../support/cypress.util';
import { haveValue } from '../../support/cypress.util';
export class PostfachE2EComponent {
private readonly headline: string = 'headline';
private readonly signaturText: string = 'signature-textarea';
private readonly saveSignaturButton: string = 'save-button';
public getHeadline(): any {
return cy.getTestElement(this.headline);
}
public getSignaturText(): any {
return cy.getTestElement(this.signaturText);
}
public setSignatur(signatur: string): void {
this.clearSignatur();
typeText(this.getSignaturText(), signatur);
this.getSignaturText().type(signatur);
}
public clearSignatur(): void {
......
import { typeText } from '../../support/cypress.util';
export class ZustaendigeStelleDialogE2EComponent {
private readonly locatorZustaendigeStelleForm: string = 'search-organisations-einheit';
private readonly locatorSearchInput: string = 'instant_search-text-input';
......@@ -15,7 +13,7 @@ export class ZustaendigeStelleDialogE2EComponent {
}
public enterSearchTerm(searchTerm: string): void {
typeText(this.getSearchInput(), searchTerm);
this.getSearchInput().type(searchTerm);
}
public countSearchEntries(): Cypress.Chainable<number> {
......
......@@ -47,7 +47,7 @@ describe('Benutzer und Rollen', () => {
it('should show users and attributes in list', () => {
helper.openBenutzerListPage();
const ariane: BenutzerListItemE2EComponent = benutzerListPage.getItem(AlfaUsers.ARAINE);
const ariane: BenutzerListItemE2EComponent = benutzerListPage.getItem(AlfaUsers.ARIANE);
exist(ariane.getRoot());
contains(ariane.getRoles(), AlfaRollen.USER);
......@@ -76,14 +76,9 @@ describe('Benutzer und Rollen', () => {
exist(richard.getNoOrganisationsEinheitText());
});
it('should show single user screen on click', () => {
it('should show checkbox for each role', () => {
helper.openNewBenutzerPage();
exist(benutzerPage.getVornameInput());
exist(benutzerPage.getNachnameInput());
exist(benutzerPage.getBenutzernameInput());
exist(benutzerPage.getMailInput());
notBeChecked(benutzerPage.getAdminCheckbox());
notBeChecked(benutzerPage.getDatenbeauftragungCheckbox());
notBeChecked(benutzerPage.getLoeschenCheckbox());
......@@ -91,7 +86,7 @@ describe('Benutzer und Rollen', () => {
notBeChecked(benutzerPage.getPostCheckbox());
});
it('should activate loeschen checkbox and deactivate the other two checkboxes', () => {
it('should deactivate other alfa roles if "loeschen" role is selected', () => {
benutzerPage.getLoeschenCheckbox().click();
beChecked(benutzerPage.getLoeschenCheckbox());
notBeEnabled(benutzerPage.getUserCheckbox());
......@@ -103,22 +98,7 @@ describe('Benutzer und Rollen', () => {
beEnabled(benutzerPage.getPostCheckbox());
});
it('should additionally activate and deactivate admin checkbox', () => {
benutzerPage.getLoeschenCheckbox().click();
benutzerPage.getAdminCheckbox().click();
benutzerPage.getDatenbeauftragungCheckbox().click();
beChecked(benutzerPage.getLoeschenCheckbox());
beChecked(benutzerPage.getAdminCheckbox());
beChecked(benutzerPage.getDatenbeauftragungCheckbox());
benutzerPage.getAdminCheckbox().click();
notBeChecked(benutzerPage.getLoeschenCheckbox());
notBeChecked(benutzerPage.getAdminCheckbox());
notBeChecked(benutzerPage.getDatenbeauftragungCheckbox());
});
it('should activate user checkbox and deactivate the other two checkboxes', () => {
benutzerPage.getLoeschenCheckbox().click();
it('should deactivate other alfa roles if "user" role is selected', () => {
benutzerPage.getUserCheckbox().click();
beChecked(benutzerPage.getUserCheckbox());
notBeEnabled(benutzerPage.getLoeschenCheckbox());
......@@ -130,7 +110,7 @@ describe('Benutzer und Rollen', () => {
beEnabled(benutzerPage.getPostCheckbox());
});
it('should activate post checkbox and deactivate the other two checkboxes', () => {
it('should deactivate other alfa roles if "poststelle" role is selected', () => {
benutzerPage.getPostCheckbox().click();
beChecked(benutzerPage.getPostCheckbox());
notBeEnabled(benutzerPage.getLoeschenCheckbox());
......@@ -141,4 +121,16 @@ describe('Benutzer und Rollen', () => {
beEnabled(benutzerPage.getLoeschenCheckbox());
beEnabled(benutzerPage.getUserCheckbox());
});
it('should activate and deactivate admin roles', () => {
benutzerPage.getAdminCheckbox().click();
benutzerPage.getDatenbeauftragungCheckbox().click();
beChecked(benutzerPage.getAdminCheckbox());
beChecked(benutzerPage.getDatenbeauftragungCheckbox());
benutzerPage.getAdminCheckbox().click();
benutzerPage.getDatenbeauftragungCheckbox().click();
notBeChecked(benutzerPage.getAdminCheckbox());
notBeChecked(benutzerPage.getDatenbeauftragungCheckbox());
});
});
import { MainPage, waitForSpinnerToDisappear } from 'apps/admin-e2e/src/page-objects/main.po';
import { visitUrl } from 'apps/admin-e2e/src/support/cypress-helper';
import { exist, notExist } from 'apps/admin-e2e/src/support/cypress.util';
import { MainPage } from 'apps/admin-e2e/src/page-objects/main.po';
import { containClass, exist, notExist } from 'apps/admin-e2e/src/support/cypress.util';
import { loginAsAriane } from 'apps/admin-e2e/src/support/user-util';
describe('Navigation', () => {
describe('Ariane Navigation', () => {
const mainPage: MainPage = new MainPage();
describe('with user ariane', () => {
before(() => {
loginAsAriane();
waitForSpinnerToDisappear();
});
it('should show benutzer navigation item', () => {
exist(mainPage.getBenutzerNavigationItem());
});
it('should show postfach navigation item', () => {
it('should show organisationseinheiten navigation item', () => {
exist(mainPage.getOrganisationEinheitNavigationItem());
});
describe('postfach navigation item', () => {
it('should be visible', () => {
exist(mainPage.getPostfachNavigationItem());
});
it('should show organisationseinheiten navigation item', () => {
exist(mainPage.getOrganisationEinheitNavigationItem());
it('should be selected initial', () => {
containClass(mainPage.getPostfachNavigationItem(), 'border-selected');
});
});
it('should hide statistik navigation item', () => {
visitUrl('/statistik');
notExist(mainPage.getStatistikNavigationItem());
});
});
......
import { MainPage, waitForSpinnerToDisappear } from 'apps/admin-e2e/src/page-objects/main.po';
import { exist, notExist, visible } from 'apps/admin-e2e/src/support/cypress.util';
import { MainPage } from 'apps/admin-e2e/src/page-objects/main.po';
import { containClass, exist, notExist } from 'apps/admin-e2e/src/support/cypress.util';
import { loginAsDaria } from 'apps/admin-e2e/src/support/user-util';
import { StatistikE2EComponent } from '../../../components/statistik/statistik.e2e.component';
describe('Navigation', () => {
describe('Daria Navigation', () => {
const mainPage: MainPage = new MainPage();
const statistikPage: StatistikE2EComponent = new StatistikE2EComponent();
describe('with user daria', () => {
before(() => {
loginAsDaria();
waitForSpinnerToDisappear();
});
it('should hide other navigation item', () => {
it('should hide benutzer navigation item', () => {
notExist(mainPage.getBenutzerNavigationItem());
});
it('should hide postfach navigation item', () => {
notExist(mainPage.getPostfachNavigationItem());
});
it('should hide organisationseinheiten navigation item', () => {
notExist(mainPage.getOrganisationEinheitNavigationItem());
});
describe('statistik', () => {
it('should hide postfach navigation item', () => {
notExist(mainPage.getPostfachNavigationItem());
});
describe('statistik navigation item', () => {
it('should be visible', () => {
exist(mainPage.getStatistikNavigationItem());
});
it('should be initial selected', () => {
mainPage.isStatistikNavigationItemSelected();
});
it('should show header text', () => {
visible(statistikPage.getHeaderText());
containClass(mainPage.getStatistikNavigationItem(), 'border-selected');
});
});
});
......
import { MainPage, waitForSpinnerToDisappear } from 'apps/admin-e2e/src/page-objects/main.po';
import { exist, visible } from 'apps/admin-e2e/src/support/cypress.util';
import { MainPage } from 'apps/admin-e2e/src/page-objects/main.po';
import { containClass, exist } from 'apps/admin-e2e/src/support/cypress.util';
import { loginAsSafira } from 'apps/admin-e2e/src/support/user-util';
import { StatistikE2EComponent } from '../../../components/statistik/statistik.e2e.component';
describe('Navigation', () => {
describe('Safira Navigation', () => {
const mainPage: MainPage = new MainPage();
const statistikPage: StatistikE2EComponent = new StatistikE2EComponent();
describe('with user safira', () => {
before(() => {
loginAsSafira();
waitForSpinnerToDisappear();
});
it('should show benutzer navigation item', () => {
exist(mainPage.getBenutzerNavigationItem());
});
it('should show postfach navigation item', () => {
exist(mainPage.getPostfachNavigationItem());
});
it('should show organisationseinheiten navigation item', () => {
exist(mainPage.getOrganisationEinheitNavigationItem());
});
describe('statistik', () => {
describe('postfach navigation item', () => {
it('should be visible', () => {
exist(mainPage.getStatistikNavigationItem());
exist(mainPage.getPostfachNavigationItem());
});
describe('on selection', () => {
before(() => {
mainPage.clickStatistikNavigationItem();
it('should be selected initial', () => {
containClass(mainPage.getPostfachNavigationItem(), 'border-selected');
});
it('should show page on selection', () => {
visible(statistikPage.getHeaderText());
});
it('should mark navigation item as selected', () => {
mainPage.isStatistikNavigationItemSelected();
});
});
it('should show statistik navigation item', () => {
exist(mainPage.getStatistikNavigationItem());
});
});
});
......@@ -18,7 +18,7 @@ describe('Organisationseinheiten', () => {
it('should show table with Organisationseinheiten', () => {
waitForSpinnerToDisappear();
mainPage.clickOrganisationsEinheitenNavigationItem();
mainPage.getOrganisationEinheitNavigationItem().click();
exist(organisationsEinheitenComponent.getOrganisationsEinheitHinzufuegenButton());
});
......
......@@ -36,7 +36,7 @@ describe('Organisationsheiten list', () => {
it('should show Organisationseinheiten list', () => {
waitForSpinnerToDisappear();
mainPage.clickOrganisationsEinheitenNavigationItem();
mainPage.getOrganisationEinheitNavigationItem().click();
waitForSpinnerToDisappear();
exist(organisationsEinheitenTab.getOrganisationsEinheitList());
......
......@@ -21,12 +21,12 @@
* Die sprachspezifischen Genehmigungen und Beschränkungen
* unter der Lizenz sind dem Lizenztext zu entnehmen.
*/
import { E2EPostfachHelper } from 'apps/admin-e2e/src/helper/postfach/postfach.helper';
import { PostfachE2EComponent } from '../../../components/postfach/postfach.e2e.component';
import { waitForSpinnerToDisappear } from '../../../page-objects/main.po';
import { exist } from '../../../support/cypress.util';
import { loginAsAriane } from '../../../support/user-util';
describe('Signatur', () => {
describe('(TODO: Ist noch wackelig in Bezug auf die Eingabe in das Feld) Postfach Signatur', () => {
const postfachHelper: E2EPostfachHelper = new E2EPostfachHelper();
const postfach: PostfachE2EComponent = new PostfachE2EComponent();
const signaturText: string = 'Signatur\nmit\n\n\n\nZeilenumbruch\n\n';
......@@ -35,12 +35,9 @@ describe('Signatur', () => {
loginAsAriane();
});
it('should show Postfach page', () => {
waitForSpinnerToDisappear();
exist(postfach.getSignaturText());
});
it('should show signature input with scrollbar', () => {
postfachHelper.openPostfachPage();
postfach.setSignatur(signaturText);
postfach.saveSignatur();
......
import { E2EPostfachNavigator } from './postfach.navigator';
export class E2EPostfachHelper {
private readonly navigator: E2EPostfachNavigator = new E2EPostfachNavigator();
public openPostfachPage(): void {
this.navigator.openPostfachPage();
}
}
import { PostfachE2EComponent } from '../../components/postfach/postfach.e2e.component';
import { MainPage } from '../../page-objects/main.po';
import { exist } from '../../support/cypress.util';
export class E2EPostfachNavigator {
private mainPage: MainPage = new MainPage();
private postfach: PostfachE2EComponent = new PostfachE2EComponent();
public openPostfachPage(): void {
this.navigateToDomain();
this.mainPage.getPostfachNavigationItem().click();
exist(this.postfach.getHeadline());
}
private navigateToDomain(): void {
this.mainPage.getHeader().getLogo().click();
}
}
......@@ -22,17 +22,16 @@
* unter der Lizenz sind dem Lizenztext zu entnehmen.
*/
import { BuildInfoE2EComponent } from '../components/buildinfo/buildinfo.e2e.component';
import { containClass, exist } from '../support/cypress.util';
import { HeaderE2EComponent } from './header.po';
export class MainPage {
private readonly buildInfo: BuildInfoE2EComponent = new BuildInfoE2EComponent();
private readonly header: HeaderE2EComponent = new HeaderE2EComponent();
private readonly benutzerNavigationItem: string = 'caption-Benutzer__Rollen';
private readonly postfachNavigationItem: string = 'postfach-navigation';
private readonly organisationEinheitNavigationItem: string = 'organisations-einheiten-navigation';
private readonly statistikNavigationItem: string = 'statistik-navigation';
private readonly benutzerNavigationItem: string = 'link-path-benutzer';
private readonly organisationEinheitNavigationItem: string = 'link-path-organisationseinheiten';
private readonly postfachNavigationItem: string = 'link-path-postfach';
private readonly statistikNavigationItem: string = 'link-path-statistik';
public getBuildInfo(): BuildInfoE2EComponent {
return this.buildInfo;
......@@ -46,41 +45,17 @@ export class MainPage {
return cy.getTestElement(this.benutzerNavigationItem);
}
public clickBenutzerNavigationItem(): void {
this.getBenutzerNavigationItem().click();
}
public benutzerNavigationItemIsVisible(): void {
exist(this.getBenutzerNavigationItem());
}
public getPostfachNavigationItem(): Cypress.Chainable<Element> {
return cy.getTestElement(this.postfachNavigationItem);
}
public clickPostfachNavigationItem(): void {
this.getPostfachNavigationItem().click();
}
public getOrganisationEinheitNavigationItem(): Cypress.Chainable<Element> {
return cy.getTestElement(this.organisationEinheitNavigationItem);
}
public clickOrganisationsEinheitenNavigationItem(): void {
this.getOrganisationEinheitNavigationItem().click();
}
public getStatistikNavigationItem(): Cypress.Chainable<Element> {
return cy.getTestElement(this.statistikNavigationItem);
}
public clickStatistikNavigationItem(): void {
this.getStatistikNavigationItem().click();
}
public isStatistikNavigationItemSelected(): void {
containClass(this.getStatistikNavigationItem().get('a'), 'border-selected');
}
}
export function waitForSpinnerToDisappear(): boolean {
......
......@@ -128,10 +128,6 @@ export function enterWith(element: Cypress.Chainable<Element>, value: string, de
element.type(CypressKeyboardActions.ENTER);
}
export function typeText(element: Cypress.Chainable<Element>, value: string): void {
element.type(value);
}
export function backspaceOn(element: Cypress.Chainable<Element>): void {
element.type(CypressKeyboardActions.BACKSPACE);
}
......
<h1 class="heading-1">Postfach</h1>
<h1 class="heading-1" data-test-id="headline">Postfach</h1>
<admin-postfach-form [postfachStateResource]="postfachStateResource$ | async" />
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment