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

OZG-6967 update test and component

parent 0094b7bf
No related branches found
No related tags found
No related merge requests found
import { haveValue, typeText } from '../../support/cypress.util';
import { haveValue, notContainClass, typeText } from '../../support/cypress.util';
export class OrganisationseinheitenE2EComponent {
private readonly einheitenList: string = 'organisations-einheit-list';
private readonly einheitenItem: string = 'organisations-einheit-list-item';
private readonly einheitenName: string = 'organisations-einheit-name';
private readonly einheitenID: string = 'organisations-einheit-id';
private readonly errorColor: string = 'text-red-500';
private readonly errorIcon: string = 'organisations-einheit-sync-error';
private readonly errorText: string = 'Organisationseinheit wurde nicht in den PVOG-Daten gefunden.';
public getOETable(): Cypress.Chainable<Element> {
return cy.getTestElement(this.einheitenList);
return cy.getTestElement(this.einheitenList).should('exist');
}
public getOEItemsList(): Cypress.Chainable<JQuery<HTMLElement>> {
return cy.getTestElement(this.einheitenItem);
public getListItemByName(einheit: string): Cypress.Chainable<JQuery<HTMLElement>> {
return cy.getTestElement(this.einheitenName).contains(einheit).should('exist');
}
public getOEItem(value: number): Cypress.Chainable<JQuery<HTMLElement>> {
return this.getOEItemsList().get(value);
public organisationseinheitContainsID(einheit: string, einheitID: string): void {
this.getListItemByName(einheit)
.parents('a')
.within(() => {
cy.getTestElement(this.einheitenID).should('have.text', einheitID);
});
}
public stringExistsInOEEntryNumber(phrase: string, user: string): void {
this.getUserEntry(user).within(() => {
exist(cy.contains(phrase));
public elementIsShownAsError(einheit: string): void {
this.getListItemByName(einheit).closest('ods-list-item').should('have.class', this.errorColor);
}
public getErrorIconInElement(einheit: string): Cypress.Chainable<JQuery<HTMLAnchorElement>> {
return this.getListItemByName(einheit)
.parents('a')
.within(() => {
cy.getTestElement(this.errorIcon).should('exist');
});
}
public getErrorTooltip(einheit: string): Cypress.Chainable<JQuery<HTMLElement>> {
return this.getErrorIconInElement(einheit)
.find('ods-exclamation-icon[mattooltip]')
.should('have.attr', 'mattooltip')
.and('include', this.errorText);
}
public elementShowsNoError(einheit: string): void {
notContainClass(this.getListItemByName(einheit).closest('ods-list-item'), this.errorColor);
}
public getEinheitenEntry(einheit: string): Cypress.Chainable<Element> {
return cy.getTestElement(this.einheitenName);
}
public getSignaturText(): any {
return cy.getTestElement(this.signaturText);
}
......
......@@ -18,7 +18,23 @@ describe('Signatur', () => {
exist(organisationseinheitenTab.getOETable());
});
it('should show defined data ', () => {
organisationseinheitenTab.stringExistsInOEEntryNumber();
it('should show identical data in Keycloak and PVOG without error', () => {
organisationseinheitenTab.getListItemByName('Bauamt');
organisationseinheitenTab.organisationseinheitContainsID('Bauamt', '248240886');
organisationseinheitenTab.elementShowsNoError('Bauamt');
});
it('should show data not found in PVOG in red color and with error icon and tooltip message', () => {
const einheit: string = 'Fundstelle';
organisationseinheitenTab.organisationseinheitContainsID(einheit, '10363455');
organisationseinheitenTab.elementIsShownAsError(einheit);
organisationseinheitenTab.getErrorIconInElement(einheit);
organisationseinheitenTab.getErrorTooltip(einheit);
});
it('should get name for OE from PVOG, if mismatch with Keycloak, but without error', () => {
organisationseinheitenTab.organisationseinheitContainsID('Landesamt für Denkmalpflege', '9093371');
organisationseinheitenTab.elementShowsNoError('Landesamt für Denkmalpflege');
});
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment