diff --git a/alfa-client/apps/admin-e2e/src/components/organisationseinheiten/organisationseinheiten.e2e.component.ts b/alfa-client/apps/admin-e2e/src/components/organisationseinheiten/organisationseinheiten.e2e.component.ts index d91e4ba2a9f45642888d4851d1ddbc6e30479084..617b8085a5eac0f65cf20d3c3a336150eaf8c4bd 100644 --- a/alfa-client/apps/admin-e2e/src/components/organisationseinheiten/organisationseinheiten.e2e.component.ts +++ b/alfa-client/apps/admin-e2e/src/components/organisationseinheiten/organisationseinheiten.e2e.component.ts @@ -1,25 +1,55 @@ -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 { diff --git a/alfa-client/apps/admin-e2e/src/e2e/organisationseinheiten/organisationseinheiten-laden.cy.ts b/alfa-client/apps/admin-e2e/src/e2e/organisationseinheiten/organisationseinheiten-laden.cy.ts index 4e2bf657a6fdda59d4c014cef3830d43148e4890..20d0a097f1082c9299760d06c5d8753e29a8cec5 100644 --- a/alfa-client/apps/admin-e2e/src/e2e/organisationseinheiten/organisationseinheiten-laden.cy.ts +++ b/alfa-client/apps/admin-e2e/src/e2e/organisationseinheiten/organisationseinheiten-laden.cy.ts @@ -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'); }); });