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 0000000000000000000000000000000000000000..5e7bf6e85e5720b81092d689070b4db49b237e50 --- /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 0d644a241530e6b32d074d07bcdcb1ac38d3a4ef..05681ad2e4dafd2dfd46b996cbc702cc04661486 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 c0b20783ba77f5247d66f50e4c1b21cab2c4271e..e450fde45239755baeda4f07c060d48ce5d845a1 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 20d0a097f1082c9299760d06c5d8753e29a8cec5..f8f5abac667bcb4e8e96d75c9e94e4e7f723b273 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 0000000000000000000000000000000000000000..af7f6e0e48db529c343e0f6ea73b638cba1de9ea --- /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 c76fd1826caa934e995308464b31d9847163d521..60bb2c452c5344113545c600f9c81cf77a5a4348 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(''); + }); });