diff --git a/alfa-client/apps/alfa-e2e/src/components/vorgang/vorgang-bescheid-wizard.e2e.component.ts b/alfa-client/apps/alfa-e2e/src/components/vorgang/vorgang-bescheid-wizard.e2e.component.ts index b0312edeb4552a0a5d28367c4ca43c3b902a9e10..5884ec6fe2f829351178b820cfc5a96e8752c343 100644 --- a/alfa-client/apps/alfa-e2e/src/components/vorgang/vorgang-bescheid-wizard.e2e.component.ts +++ b/alfa-client/apps/alfa-e2e/src/components/vorgang/vorgang-bescheid-wizard.e2e.component.ts @@ -50,6 +50,7 @@ export class VorgangBescheidWizardE2EComponent { 'bescheiderstellung-abbrechen-entwurf-speichern'; private readonly uploadBescheidFileButton: string = '-single-file-upload-button'; private readonly uploadAttachmentButton: string = 'Anhang_hochladen-file-upload-button'; + private readonly uploadAutomaticBescheid: string = 'create-bescheid-document-button'; private readonly mailTextArea: string = 'Text-textarea-editor'; private readonly saveBescheid: string = 'save-button'; private readonly sendBescheid: string = 'send-button'; @@ -60,6 +61,8 @@ export class VorgangBescheidWizardE2EComponent { private readonly fileBescheidValid: string = 'Bescheid_validpdf-file-item'; private readonly fileAnhangValid: string = 'Anhang_validpdf-file-item'; + private readonly fileAutomaticBescheid: string = + 'KFAS_LIVE_KI_10_Haltverbot_befristetpdf-file-item'; private readonly bescheidDocument: string = 'bescheid-document'; private readonly attachmentDocument: string = 'bescheid-attachments'; @@ -166,6 +169,10 @@ export class VorgangBescheidWizardE2EComponent { return cy.getTestElement(this.locatorRoot).find(`[data-test-id=${this.fileAnhangValid}]`); } + public getAutomaticBescheidFileInWizard() { + return cy.getTestElement(this.locatorRoot).find(`[data-test-id=${this.fileAutomaticBescheid}]`); + } + public getDeleteButtonOfElement(element: string): Cypress.Chainable<JQuery<HTMLElement>> { return cy.getTestElement(element).find('[title="Anhang löschen"]'); } @@ -198,8 +205,8 @@ export class VorgangBescheidWizardE2EComponent { return cy.get(this.sendenSpinner); } - public getMailTextArea(): Cypress.Chainable<JQuery<HTMLElement>> { - return cy.get(this.mailTextArea); + public getMailText(): Cypress.Chainable<JQuery<HTMLElement>> { + return cy.getTestElement(this.nachrichtText); } public getSaveButton(): Cypress.Chainable<JQuery<HTMLElement>> { @@ -258,6 +265,10 @@ export class VorgangBescheidWizardE2EComponent { this.getRoot().should('not.exist'); } + public getUploadAutomaticBescheidButton() { + return cy.getTestElement(this.uploadAutomaticBescheid); + } + public uploadBescheid(fileName: string): void { uploadFile(this.getUploadBescheidButton(), fileName); } diff --git a/alfa-client/apps/alfa-e2e/src/e2e/main-tests/vorgang-bescheid/vorgang-bescheid-automatisch-erstellen.cy.ts b/alfa-client/apps/alfa-e2e/src/e2e/main-tests/vorgang-bescheid/vorgang-bescheid-automatisch-erstellen.cy.ts new file mode 100644 index 0000000000000000000000000000000000000000..cf0f0f5b587434c26b09330c1eee27bc6d90cd79 --- /dev/null +++ b/alfa-client/apps/alfa-e2e/src/e2e/main-tests/vorgang-bescheid/vorgang-bescheid-automatisch-erstellen.cy.ts @@ -0,0 +1,120 @@ +import { registerLocaleData } from '@angular/common'; +import localeDe from '@angular/common/locales/de'; +import localeDeExtra from '@angular/common/locales/extra/de'; +import { VorgangBescheidWizardE2EComponent } from 'apps/alfa-e2e/src/components/vorgang/vorgang-bescheid-wizard.e2e.component'; +import { VorgangFormularButtonsE2EComponent } from 'apps/alfa-e2e/src/components/vorgang/vorgang-formular-buttons.e2e.components'; +import { VorgangSubnavigationE2EComponent } from 'apps/alfa-e2e/src/components/vorgang/vorgang-subnavigation'; +import { SmockerMocks } from 'apps/alfa-e2e/src/model/smocker'; +import { + EingangE2E, + EingangHeaderE2E, + VorgangE2E, + VorgangStatusE2E, +} from 'apps/alfa-e2e/src/model/vorgang'; +import 'cypress-real-events/support'; +import { VorgangListE2EComponent } from '../../../components/vorgang/vorgang-list.e2e.component'; +import { MainPage, waitForSpinnerToDisappear } from '../../../page-objects/main.po'; +import { VorgangPage } from '../../../page-objects/vorgang.po'; +import { addSmockerMock, dropCollections } from '../../../support/cypress-helper'; +import { exist, haveText, notExist } from '../../../support/cypress.util'; +import { initUsermanagerUsers, loginAsSabine } from '../../../support/user-util'; +import { + buildVorgang, + createVorgang, + initVorgaenge, + objectIds, +} from '../../../support/vorgang-util'; + +registerLocaleData(localeDe, 'de', localeDeExtra); + +describe('Upload automatic Bescheid', () => { + const mainPage: MainPage = new MainPage(); + const vorgangList: VorgangListE2EComponent = mainPage.getVorgangList(); + + const vorgangPage: VorgangPage = new VorgangPage(); + const bescheidWizard: VorgangBescheidWizardE2EComponent = vorgangPage.getBescheidWizard(); + + const formIdP: string = 'KFAS_STAGE_KI_10_Haltverbot_LANDESHACKATHON'; + const formEngineName: string = 'FormSolutions'; + const eingangHeader: EingangHeaderE2E = { ...createVorgang().eingangs[0].header }; + + const eingangP: EingangE2E = { + ...createVorgang().eingangs[0], + header: { ...eingangHeader, formId: formIdP, formEngineName }, + }; + + const bescheidAutomatik: VorgangE2E = { + ...createVorgang(), + status: VorgangStatusE2E.IN_BEARBEITUNG, + name: 'automatischerBescheid', + eingangs: [eingangP], + }; + + const standardVorgang: VorgangE2E = { + ...buildVorgang(objectIds[1], 'Standard Vorgang'), + status: VorgangStatusE2E.IN_BEARBEITUNG, + }; + + const vorgangFormularButtons: VorgangFormularButtonsE2EComponent = + vorgangPage.getFormularButtons(); + + const vorgangSubnavigation: VorgangSubnavigationE2EComponent = vorgangPage.getSubnavigation(); + + before(() => { + initVorgaenge([bescheidAutomatik, standardVorgang]); + initUsermanagerUsers(); + + addSmockerMock(SmockerMocks.SMARTDOCUMENT_MOCK); + + loginAsSabine(); + + waitForSpinnerToDisappear(); + exist(vorgangList.getRoot()); + }); + + after(() => { + dropCollections(); + }); + + describe('Upload automatic Bescheid document', () => { + it('should show automatic Bescheid button', () => { + vorgangList.getListItem(bescheidAutomatik.name).getRoot().click(); + waitForSpinnerToDisappear(); + + vorgangFormularButtons.getBescheidenButton().click(); + bescheidWizard.getWeiterButton().click(); + exist(bescheidWizard.getUploadAutomaticBescheidButton()); + }); + + it('should upload automatic Bescheid file', () => { + waitForSpinnerToDisappear(); + bescheidWizard.getUploadAutomaticBescheidButton().click(); + + exist(bescheidWizard.getBescheidUploadSpinner()); + notExist(bescheidWizard.getBescheidUploadSpinner()); + exist(bescheidWizard.getAutomaticBescheidFileInWizard()); + }); + + it('should show automatic header and text in step 3', () => { + bescheidWizard.getWeiterButton().click(); + waitForSpinnerToDisappear(); + + haveText(bescheidWizard.getMailText(), ''); + }); + }); + + describe('Do not show automatic upload button on other Vorgang', () => { + it('should not show button on Vorgang with different formID', () => { + bescheidWizard.getCloseButton().click(); + bescheidWizard.getCloseVerwerfenButton().click(); + vorgangSubnavigation.getBackButton().click(); + vorgangList.getListItem(standardVorgang.name).getRoot().click(); + waitForSpinnerToDisappear(); + + vorgangFormularButtons.getBescheidenButton().click(); + bescheidWizard.getWeiterButton().click(); + + notExist(bescheidWizard.getUploadAutomaticBescheidButton()); + }); + }); +});