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

OZG-7507 create delete organisationsEinheit E2E Test; adjust test component structure

parent 2977c4fe
No related branches found
No related tags found
1 merge request!82OZG-7507 use new open dialog button
Showing
with 265 additions and 60 deletions
...@@ -21,21 +21,52 @@ ...@@ -21,21 +21,52 @@
* Die sprachspezifischen Genehmigungen und Beschränkungen * Die sprachspezifischen Genehmigungen und Beschränkungen
* unter der Lizenz sind dem Lizenztext zu entnehmen. * unter der Lizenz sind dem Lizenztext zu entnehmen.
*/ */
export class OrganisationsEinheitListE2EComponent {
private readonly root: string = 'organisations-einheit-list';
public getRoot(): Cypress.Chainable<Element> {
return cy.getTestElement(this.root);
}
public getListItem(name: string): OrganisationsEinheitListItemE2EComponent {
return new OrganisationsEinheitListItemE2EComponent(name);
}
}
export class OrganisationsEinheitListItemE2EComponent {
private root: string;
export class OrganisationsEinheitenE2EComponent {
private readonly organisationsEinheitenList: string = 'organisations-einheit-list';
private readonly organisationsEinheitHinzufuegen: string = 'add-organisationseinheit-button';
private readonly organisationsEinheitItemSuffix: string = '-organisation-item'; private readonly organisationsEinheitItemSuffix: string = '-organisation-item';
private readonly deleteButton: string = 'delete-button';
constructor(name: string) {
this.root = name;
}
public getRoot(): Cypress.Chainable<Element> {
return cy.getTestElement(this.root + this.organisationsEinheitItemSuffix);
}
public getDeleteButton(): Cypress.Chainable<Element> {
return this.getRoot().findTestElementWithClass(this.deleteButton);
}
}
export class OrganisationsEinheitDeleteDialogE2EComponent {
private readonly root: string = 'organisations-einheit-delete-dialog';
private readonly deleteButton: string = 'dialog-delete-button';
private readonly cancelButton: string = 'dialog-cancel-button';
public getOrganisationsEinheitList(): Cypress.Chainable<Element> { public getRoot(): Cypress.Chainable<Element> {
return cy.getTestElement(this.organisationsEinheitenList); return cy.getTestElement(this.root);
} }
public getOrganisationsEinheitHinzufuegenButton(): Cypress.Chainable<Element> { public getDeleteButton(): Cypress.Chainable<Element> {
return cy.getTestElement(this.organisationsEinheitHinzufuegen); return cy.getTestElement(this.deleteButton);
} }
public getListItem(name: string) { public getCancelButton(): Cypress.Chainable<Element> {
return cy.getTestElement(name + this.organisationsEinheitItemSuffix); return cy.getTestElement(this.cancelButton);
} }
} }
import { E2EOrganisationsEinheitHelper } from 'apps/admin-e2e/src/helper/organisations-einheit/organisations-einheit.helper';
import { E2EOrganisationsEinheitVerifier } from 'apps/admin-e2e/src/helper/organisations-einheit/organisations-einheit.verifier';
import { OrganisationsEinheitPage } from 'apps/admin-e2e/src/page-objects/organisations-einheit.po';
import { ZustaendigeStelleDialogE2EComponent } from '../../../components/zustaendige-stelle/zustaendige-stelle-dialog.e2e.component';
import { exist } from '../../../support/cypress.util';
import { loginAsAriane } from '../../../support/user-util';
describe('Organisationseinheit', () => {
const organisationsEinheitPage: OrganisationsEinheitPage = new OrganisationsEinheitPage();
const organisationsEinheitHelper: E2EOrganisationsEinheitHelper = new E2EOrganisationsEinheitHelper();
const organisationsEinheitVerifier: E2EOrganisationsEinheitVerifier = new E2EOrganisationsEinheitVerifier();
const zustaendigeStelleSearchComponent: ZustaendigeStelleDialogE2EComponent = new ZustaendigeStelleDialogE2EComponent();
const organisationsEinheit: string = 'Wasserwerk - Hamburg Wasser - Hamburger Stadtentwässerung';
before(() => {
loginAsAriane();
});
describe('hinzufügen', () => {
it('should show search dialog on add button click', () => {
organisationsEinheitHelper.openOrganisationsEinheitPage();
organisationsEinheitPage.getAddButton().click();
exist(zustaendigeStelleSearchComponent.getZustaendigeStelleForm());
});
it('should find at least one organisationseinheit on search', () => {
zustaendigeStelleSearchComponent.enterSearchTerm(organisationsEinheit);
zustaendigeStelleSearchComponent.expectNumberOfEntriesToBeGreaterThan(1);
});
it('should show organisationseinheit in list', () => {
organisationsEinheitHelper.addOrganisationsEinheit(organisationsEinheit);
organisationsEinheitVerifier.verifyOrganisationsEinheitInList(organisationsEinheit);
});
});
describe('löschen', () => {
it('should not show entry in list', () => {
organisationsEinheitHelper.openOrganisationsEinheitPage();
organisationsEinheitHelper.deleteOrganisationsEinheit(organisationsEinheit);
organisationsEinheitVerifier.verifyOrganisationsEinheitNotInList(organisationsEinheit);
});
});
});
...@@ -21,36 +21,41 @@ ...@@ -21,36 +21,41 @@
* Die sprachspezifischen Genehmigungen und Beschränkungen * Die sprachspezifischen Genehmigungen und Beschränkungen
* unter der Lizenz sind dem Lizenztext zu entnehmen. * unter der Lizenz sind dem Lizenztext zu entnehmen.
*/ */
import { OrganisationsEinheitenE2EComponent } from '../../../components/organisationseinheiten/organisationseinheiten.e2e.component'; import { OrganisationsEinheitListE2EComponent } from 'apps/admin-e2e/src/components/organisationseinheiten/organisationseinheiten.e2e.component';
import { MainPage, waitForSpinnerToDisappear } from '../../../page-objects/main.po'; import { E2EOrganisationsEinheitHelper } from 'apps/admin-e2e/src/helper/organisations-einheit/organisations-einheit.helper';
import { OrganisationsEinheitE2E } from 'apps/admin-e2e/src/model/organisations-einheit';
import { OrganisationsEinheitPage } from 'apps/admin-e2e/src/page-objects/organisations-einheit.po';
import { exist } from '../../../support/cypress.util'; import { exist } from '../../../support/cypress.util';
import { loginAsAriane } from '../../../support/user-util'; import { loginAsAriane } from '../../../support/user-util';
describe('Organisationsheiten list', () => { describe('Organisationsheiten page', () => {
const mainPage: MainPage = new MainPage(); const organisationsEinheitPage: OrganisationsEinheitPage = new OrganisationsEinheitPage();
const organisationsEinheitenTab: OrganisationsEinheitenE2EComponent = new OrganisationsEinheitenE2EComponent();
const organisationsEinheitHelper: E2EOrganisationsEinheitHelper = new E2EOrganisationsEinheitHelper();
const organisationsEinheitList: OrganisationsEinheitListE2EComponent = new OrganisationsEinheitListE2EComponent();
before(() => { before(() => {
loginAsAriane(); loginAsAriane();
}); });
it('should show Organisationseinheiten list', () => { it('should show list', () => {
waitForSpinnerToDisappear(); organisationsEinheitHelper.openOrganisationsEinheitPage();
mainPage.clickOrganisationsEinheitenNavigationItem();
waitForSpinnerToDisappear();
exist(organisationsEinheitenTab.getOrganisationsEinheitList()); exist(organisationsEinheitPage.getList().getRoot());
}); });
it('should show entry for Bauamt', () => { it('should show add button', () => {
exist(organisationsEinheitenTab.getListItem('Bauamt')); organisationsEinheitHelper.openOrganisationsEinheitPage();
});
it('should show entry for Fundstelle', () => { exist(organisationsEinheitPage.getAddButton());
exist(organisationsEinheitenTab.getListItem('Fundstelle'));
}); });
it('should show entry for Denkmalpflege', () => { it('should show default (Bauamt, Fundstelle, Denkmalpflege) entries', () => {
exist(organisationsEinheitenTab.getListItem('Denkmalpflege')); organisationsEinheitHelper.openOrganisationsEinheitPage();
exist(organisationsEinheitList.getListItem(OrganisationsEinheitE2E.BAUAMT).getRoot());
exist(organisationsEinheitList.getListItem(OrganisationsEinheitE2E.FUNDSTELLE).getRoot());
exist(organisationsEinheitList.getListItem(OrganisationsEinheitE2E.DENKMALPFLEGE).getRoot());
}); });
}); });
import { convertToDataTestId } from 'apps/admin-e2e/src/support/tech-util';
import { OrganisationsEinheitenE2EComponent } from '../../../components/organisationseinheiten/organisationseinheiten.e2e.component';
import { ZustaendigeStelleDialogE2EComponent } from '../../../components/zustaendige-stelle/zustaendige-stelle-dialog.e2e.component';
import { MainPage, waitForSpinnerToDisappear } from '../../../page-objects/main.po';
import { exist } from '../../../support/cypress.util';
import { loginAsAriane } from '../../../support/user-util';
describe('Organisationseinheiten', () => {
const mainPage: MainPage = new MainPage();
const organisationsEinheitenComponent: OrganisationsEinheitenE2EComponent = new OrganisationsEinheitenE2EComponent();
const zustaendigeStelleSearchComponent: ZustaendigeStelleDialogE2EComponent = new ZustaendigeStelleDialogE2EComponent();
const searchTerm: string = 'Hamburg';
before(() => {
loginAsAriane();
});
it('should show table with Organisationseinheiten', () => {
waitForSpinnerToDisappear();
mainPage.clickOrganisationsEinheitenNavigationItem();
exist(organisationsEinheitenComponent.getOrganisationsEinheitHinzufuegenButton());
});
it('should show button to add Organisationseinheit', () => {
exist(organisationsEinheitenComponent.getOrganisationsEinheitHinzufuegenButton());
});
it('should show search Organisationseinheit dialog', () => {
organisationsEinheitenComponent.getOrganisationsEinheitHinzufuegenButton().click();
exist(zustaendigeStelleSearchComponent.getZustaendigeStelleForm());
});
it('should find at least one Organisationseinheit', () => {
zustaendigeStelleSearchComponent.enterSearchTerm(searchTerm);
zustaendigeStelleSearchComponent.expectNumberOfEntriesToBeGreaterThan(1);
});
it('should add first Organisationseinheit', () => {
zustaendigeStelleSearchComponent.getZustaendigeStelleTitle(0).then((name: string) => {
zustaendigeStelleSearchComponent.clickFoundItem(0);
exist(organisationsEinheitenComponent.getListItem(convertToDataTestId(name)));
});
});
});
import {
OrganisationsEinheitDeleteDialogE2EComponent,
OrganisationsEinheitListE2EComponent,
} from '../../components/organisationseinheiten/organisationseinheiten.e2e.component';
import { ZustaendigeStelleDialogE2EComponent } from '../../components/zustaendige-stelle/zustaendige-stelle-dialog.e2e.component';
import { OrganisationsEinheitPage } from '../../page-objects/organisations-einheit.po';
import { exist } from '../../support/cypress.util';
import { convertToDataTestId } from '../../support/tech-util';
export class E2EOrganisationsEinheitExecutor {
private readonly organisationsEinheitPage: OrganisationsEinheitPage = new OrganisationsEinheitPage();
private readonly organisationsEinheitList: OrganisationsEinheitListE2EComponent = this.organisationsEinheitPage.getList();
private readonly deleteDialog: OrganisationsEinheitDeleteDialogE2EComponent =
new OrganisationsEinheitDeleteDialogE2EComponent();
private readonly zustaendigeStelleSearchComponent: ZustaendigeStelleDialogE2EComponent =
new ZustaendigeStelleDialogE2EComponent();
public addOrganisationsEinheit(name: string): void {
//TODO von index auf Name umstellen
this.zustaendigeStelleSearchComponent
.getZustaendigeStelleTitle(0)
.then((name: string) => this.zustaendigeStelleSearchComponent.clickFoundItem(0));
exist(this.organisationsEinheitList.getRoot());
}
public deleteOrganisationsEinheit(name: string): void {
this.organisationsEinheitList.getListItem(convertToDataTestId(name)).getDeleteButton().click();
exist(this.deleteDialog.getRoot());
this.deleteDialog.getDeleteButton().click();
exist(this.organisationsEinheitList.getRoot());
}
}
import { E2EOrganisationsEinheitExecutor } from './organisations-einheit.executor';
import { E2EOrganisationsEinheitNavigator } from './organisations-einheit.navigator';
export class E2EOrganisationsEinheitHelper {
private readonly navigator: E2EOrganisationsEinheitNavigator = new E2EOrganisationsEinheitNavigator();
private readonly executor: E2EOrganisationsEinheitExecutor = new E2EOrganisationsEinheitExecutor();
public openOrganisationsEinheitPage(): void {
this.navigator.openOrganisationsEinheitListPage();
}
public addOrganisationsEinheit(name: string): void {
this.executor.addOrganisationsEinheit(name);
}
public deleteOrganisationsEinheit(name: string): void {
this.executor.deleteOrganisationsEinheit(name);
}
}
import { OrganisationsEinheitListE2EComponent } from '../../components/organisationseinheiten/organisationseinheiten.e2e.component';
import { MainPage } from '../../page-objects/main.po';
import { OrganisationsEinheitPage } from '../../page-objects/organisations-einheit.po';
import { exist } from '../../support/cypress.util';
export class E2EOrganisationsEinheitNavigator {
private readonly mainPage: MainPage = new MainPage();
private readonly organisationsEinheitPage: OrganisationsEinheitPage = new OrganisationsEinheitPage();
private readonly organisationsEinheitList: OrganisationsEinheitListE2EComponent = this.organisationsEinheitPage.getList();
public openOrganisationsEinheitListPage(): void {
this.navigateToDomain();
this.mainPage.getOrganisationEinheitNavigationItem().click();
exist(this.organisationsEinheitList.getRoot());
}
private navigateToDomain(): void {
this.mainPage.getHeader().getLogo().click();
}
}
import { OrganisationsEinheitListE2EComponent } from '../../components/organisationseinheiten/organisationseinheiten.e2e.component';
import { OrganisationsEinheitPage } from '../../page-objects/organisations-einheit.po';
import { exist, notExist } from '../../support/cypress.util';
import { convertToDataTestId } from '../../support/tech-util';
export class E2EOrganisationsEinheitVerifier {
private readonly organisationsEinheitPage: OrganisationsEinheitPage = new OrganisationsEinheitPage();
private readonly organisationsEinheitList: OrganisationsEinheitListE2EComponent = this.organisationsEinheitPage.getList();
public verifyOrganisationsEinheitInList(name: string): void {
exist(this.organisationsEinheitList.getListItem(convertToDataTestId(name)).getRoot());
}
public verifyOrganisationsEinheitNotInList(name: string): void {
notExist(this.organisationsEinheitList.getListItem(convertToDataTestId(name)).getRoot());
}
}
export enum OrganisationsEinheitE2E { export enum OrganisationsEinheitE2E {
ORDNUNGSAMT = 'Ordnungsamt', BAUAMT = 'Bauamt',
DENKMALPFLEGE = 'Denkmalpflege', DENKMALPFLEGE = 'Denkmalpflege',
FUNDSTELLE = 'Fundstelle',
ORDNUNGSAMT = 'Ordnungsamt',
WIRTSCHAFTSFOERDERUNG = 'Wirtschaftsförderung', WIRTSCHAFTSFOERDERUNG = 'Wirtschaftsförderung',
} }
...@@ -24,13 +24,13 @@ ...@@ -24,13 +24,13 @@
import { CurrentUserProfileE2EComponent } from '../components/user-profile/current-user-profile.component.e2e'; import { CurrentUserProfileE2EComponent } from '../components/user-profile/current-user-profile.component.e2e';
import { UserSettingsE2EComponent } from '../components/user-settings/user-settings.component.e2e'; import { UserSettingsE2EComponent } from '../components/user-settings/user-settings.component.e2e';
//TODO Zu den Componenten packen, nicht zu den page-objects
export class HeaderE2EComponent { export class HeaderE2EComponent {
private readonly locatorLogo: string = 'logo-link'; private readonly locatorLogo: string = 'logo-link';
private readonly locatorRoot: string = 'header'; private readonly locatorRoot: string = 'header';
private readonly userSettings: UserSettingsE2EComponent = new UserSettingsE2EComponent(); private readonly userSettings: UserSettingsE2EComponent = new UserSettingsE2EComponent();
private readonly currentUserProfile: CurrentUserProfileE2EComponent = private readonly currentUserProfile: CurrentUserProfileE2EComponent = new CurrentUserProfileE2EComponent();
new CurrentUserProfileE2EComponent();
public getRoot() { public getRoot() {
return cy.getTestElement(this.locatorRoot); return cy.getTestElement(this.locatorRoot);
......
//TODO Das sollte eher eine Component als eine Page sein
export class LoginPage { export class LoginPage {
private readonly locatorLogin: string = '#kc-login'; private readonly locatorLogin: string = '#kc-login';
private readonly locatorBarrierefreiheitLink: string = '#kc-barrierefreiheit'; private readonly locatorBarrierefreiheitLink: string = '#kc-barrierefreiheit';
......
import { OrganisationsEinheitListE2EComponent } from '../components/organisationseinheiten/organisationseinheiten.e2e.component';
export class OrganisationsEinheitPage {
private readonly addButton: string = 'add-organisationseinheit-button';
private readonly list: OrganisationsEinheitListE2EComponent = new OrganisationsEinheitListE2EComponent();
public getAddButton(): Cypress.Chainable<Element> {
return cy.getTestElement(this.addButton);
}
public getList(): OrganisationsEinheitListE2EComponent {
return this.list;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment