From e2e3b7d4d78fe850505c0427f303ba0a8180a124 Mon Sep 17 00:00:00 2001 From: OZGCloud <ozgcloud@mgm-tp.com> Date: Wed, 13 Nov 2024 12:42:11 +0100 Subject: [PATCH] OZG-7067 updated signature tests --- ...sationseinheiten-signatur.e2e.component.ts | 45 +++++++++++++++++++ .../organisationseinheiten.e2e.component.ts | 35 +-------------- .../postfach/postfach.e2e.component.ts | 1 + .../organisationseinheiten-laden.cy.ts | 2 +- .../organisationseinheiten-signaturen.cy.ts | 40 +++++++++++++++++ ...signatur.cy.ts => postfach-signatur.cy.ts} | 21 +++++---- 6 files changed, 98 insertions(+), 46 deletions(-) create mode 100644 alfa-client/apps/admin-e2e/src/components/organisationseinheiten/organisationseinheiten-signatur.e2e.component.ts create mode 100644 alfa-client/apps/admin-e2e/src/e2e/organisationseinheiten/organisationseinheiten-signaturen.cy.ts rename alfa-client/apps/admin-e2e/src/e2e/postfach/{signatur.cy.ts => postfach-signatur.cy.ts} (69%) diff --git a/alfa-client/apps/admin-e2e/src/components/organisationseinheiten/organisationseinheiten-signatur.e2e.component.ts b/alfa-client/apps/admin-e2e/src/components/organisationseinheiten/organisationseinheiten-signatur.e2e.component.ts new file mode 100644 index 0000000000..5e7bf6e85e --- /dev/null +++ b/alfa-client/apps/admin-e2e/src/components/organisationseinheiten/organisationseinheiten-signatur.e2e.component.ts @@ -0,0 +1,45 @@ +import { haveValue, typeText } from '../../support/cypress.util'; + +export class OrganisationseinheitenSignaturE2EComponent { + private readonly einheitName: string = 'organisations-form-container-headline'; + private readonly signaturText: string = 'signature-textarea'; + private readonly saveSignatureButton: string = 'save-button'; + + public getEinheitName(): Cypress.Chainable<Element> { + return cy.getTestElement(this.einheitName).should('exist'); + } + + public getSignaturText(): any { + return cy.getTestElement(this.signaturText); + } + + public setSignatur(signatur: string): void { + this.clearSignatur(); + typeText(this.getSignaturText(), signatur); + } + + public clearSignatur(): void { + this.getSignaturText().type('{selectAll}{del}'); + } + + public getSaveButton(): Cypress.Chainable<Element> { + return cy.getTestElement(this.saveSignatureButton); + } + + public saveSignatur(): void { + this.getSaveButton().click(); + } + + public signatureIs(compare: string): void { + haveValue(this.getSignaturText(), compare); + } + + public scrollbarIsPresent(): void { + this.getSignaturText().then((textarea) => { + const scrollHeight = textarea[0].scrollHeight; + const clientHeight = textarea[0].clientHeight; + + expect(scrollHeight).to.be.greaterThan(clientHeight); + }); + } +} 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 0d644a2415..05681ad2e4 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,4 +1,4 @@ -import { haveValue, notContainClass, typeText } from '../../support/cypress.util'; +import { notContainClass } from '../../support/cypress.util'; export class OrganisationseinheitenE2EComponent { private readonly einheitenList: string = 'organisations-einheit-list'; @@ -51,37 +51,4 @@ export class OrganisationseinheitenE2EComponent { public elementShowsNoError(einheit: string): void { notContainClass(this.getListItemByName(einheit).closest('ods-list-item'), this.errorColor); } - - public getSignaturText(): any { - return cy.getTestElement(this.signaturText); - } - - public setSignatur(signatur: string): void { - typeText(this.getSignaturText(), signatur); - } - - public clearSignatur(): void { - this.getSignaturText().type('{selectAll}{del}'); - } - - public getSaveButton(): Cypress.Chainable<Element> { - return cy.getTestElement(this.saveSignaturButton); - } - - public saveSignatur(): void { - this.getSaveButton().click(); - } - - public signatureIs(compare: string): void { - haveValue(this.getSignaturText(), compare); - } - - public scrollbarIsPresent(): void { - this.getSignaturText().then((textarea) => { - const scrollHeight = textarea[0].scrollHeight; - const clientHeight = textarea[0].clientHeight; - - expect(scrollHeight).to.be.greaterThan(clientHeight); - }); - } } diff --git a/alfa-client/apps/admin-e2e/src/components/postfach/postfach.e2e.component.ts b/alfa-client/apps/admin-e2e/src/components/postfach/postfach.e2e.component.ts index c0b20783ba..e450fde452 100644 --- a/alfa-client/apps/admin-e2e/src/components/postfach/postfach.e2e.component.ts +++ b/alfa-client/apps/admin-e2e/src/components/postfach/postfach.e2e.component.ts @@ -9,6 +9,7 @@ export class PostfachE2EComponent { } public setSignatur(signatur: string): void { + this.clearSignatur(); typeText(this.getSignaturText(), signatur); } 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 20d0a097f1..f8f5abac66 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 @@ -3,7 +3,7 @@ import { MainPage, waitForSpinnerToDisappear } from '../../page-objects/main.po' import { exist } from '../../support/cypress.util'; import { loginAsAriane } from '../../support/user-util'; -describe('Signatur', () => { +describe('show Organisationsheiten', () => { const mainPage: MainPage = new MainPage(); const organisationseinheitenTab: OrganisationseinheitenE2EComponent = new OrganisationseinheitenE2EComponent(); diff --git a/alfa-client/apps/admin-e2e/src/e2e/organisationseinheiten/organisationseinheiten-signaturen.cy.ts b/alfa-client/apps/admin-e2e/src/e2e/organisationseinheiten/organisationseinheiten-signaturen.cy.ts new file mode 100644 index 0000000000..af7f6e0e48 --- /dev/null +++ b/alfa-client/apps/admin-e2e/src/e2e/organisationseinheiten/organisationseinheiten-signaturen.cy.ts @@ -0,0 +1,40 @@ +import { OrganisationseinheitenSignaturE2EComponent } from '../../components/organisationseinheiten/organisationseinheiten-signatur.e2e.component'; +import { OrganisationseinheitenE2EComponent } from '../../components/organisationseinheiten/organisationseinheiten.e2e.component'; +import { MainPage, waitForSpinnerToDisappear } from '../../page-objects/main.po'; +import { haveText } from '../../support/cypress.util'; +import { loginAsAriane } from '../../support/user-util'; + +describe('Signatur', () => { + const mainPage: MainPage = new MainPage(); + const signaturePage: OrganisationseinheitenSignaturE2EComponent = new OrganisationseinheitenSignaturE2EComponent(); + const organisationseinheitenTab: OrganisationseinheitenE2EComponent = new OrganisationseinheitenE2EComponent(); + + const signaturText: string = 'Signatur\nmit\n\n\n\nZeilenumbruch\n\n'; + + before(() => { + loginAsAriane(); + }); + + it('should open signature page for Bauamt on click', () => { + waitForSpinnerToDisappear(); + mainPage.clickOrganisationseinheitenTab(); + organisationseinheitenTab.clickEinheit('Bauamt'); + + haveText(signaturePage.getEinheitName(), 'Bauamt'); + }); + + it('should show signature input with scrollbar', () => { + signaturePage.setSignatur(signaturText); + signaturePage.saveSignatur(); + + signaturePage.signatureIs(signaturText); + signaturePage.scrollbarIsPresent(); + }); + + it('should enter an save empty signature', () => { + signaturePage.clearSignatur(); + signaturePage.saveSignatur(); + + signaturePage.signatureIs(''); + }); +}); diff --git a/alfa-client/apps/admin-e2e/src/e2e/postfach/signatur.cy.ts b/alfa-client/apps/admin-e2e/src/e2e/postfach/postfach-signatur.cy.ts similarity index 69% rename from alfa-client/apps/admin-e2e/src/e2e/postfach/signatur.cy.ts rename to alfa-client/apps/admin-e2e/src/e2e/postfach/postfach-signatur.cy.ts index c76fd1826c..60bb2c452c 100644 --- a/alfa-client/apps/admin-e2e/src/e2e/postfach/signatur.cy.ts +++ b/alfa-client/apps/admin-e2e/src/e2e/postfach/postfach-signatur.cy.ts @@ -1,12 +1,9 @@ import { PostfachE2EComponent } from '../../components/postfach/postfach.e2e.component'; -import { HeaderE2EComponent } from '../../page-objects/header.po'; -import { MainPage, waitForSpinnerToDisappear } from '../../page-objects/main.po'; +import { waitForSpinnerToDisappear } from '../../page-objects/main.po'; import { exist } from '../../support/cypress.util'; import { loginAsAriane } from '../../support/user-util'; describe('Signatur', () => { - const mainPage: MainPage = new MainPage(); - const header: HeaderE2EComponent = mainPage.getHeader(); const postfachTab: PostfachE2EComponent = new PostfachE2EComponent(); const signaturText: string = 'Signatur\nmit\n\n\n\nZeilenumbruch\n\n'; @@ -15,21 +12,23 @@ describe('Signatur', () => { loginAsAriane(); }); - it('should clear current signature', () => { + it('should show Postfach page', () => { waitForSpinnerToDisappear(); exist(postfachTab.getSignaturText()); - - postfachTab.clearSignatur(); - postfachTab.signatureIs(''); - - postfachTab.saveSignatur(); }); - it('should show Signatur input', () => { + it('should show signature input with scrollbar', () => { postfachTab.setSignatur(signaturText); postfachTab.saveSignatur(); postfachTab.signatureIs(signaturText); postfachTab.scrollbarIsPresent(); }); + + it('should enter an save empty signature', () => { + postfachTab.clearSignatur(); + postfachTab.saveSignatur(); + + postfachTab.signatureIs(''); + }); }); -- GitLab