Skip to content
Snippets Groups Projects
Commit 56439e79 authored by OZGCloud's avatar OZGCloud
Browse files

Merge pull request 'add test for Bescheid nur speichern' (#592) from...

Merge pull request 'add test for Bescheid nur speichern' (#592) from OZG-5243-Bescheid-Wizard-E2E into master

Reviewed-on: https://git.ozg-sh.de/ozgcloud-app/alfa/pulls/592


Reviewed-by: default avatarOZGCloud <ozgcloud@mgm-tp.com>
parents fc39bbc9 efacc1d4
No related branches found
No related tags found
No related merge requests found
......@@ -39,12 +39,15 @@ export class VorgangBescheidWizardE2EComponent {
private readonly stepButton3: string = 'step-3-button';
private readonly closeButton: string = 'close-bescheid';
private readonly closeDialog: string = 'bescheid-close-dialog';
private readonly bescheidResultBox: string = 'bescheiden-result';
private readonly bescheidVerwerfenButton: string =
'bescheiderstellung-abbrechen-entwurf-verwerfen';
private readonly bescheidSpeichernButton: string =
'bescheiderstellung-abbrechen-entwurf-speichern';
private readonly uploadBescheidFile: string = '-single-file-upload-button';
private readonly uploadAttachment: string = 'Attachment_hochladen-file-upload-button';
private readonly saveBescheid: string = 'save-button';
private readonly confirmAndSaveButton: string = 'confirm-and-save-button';
private readonly fileBescheidValid: string = 'Bescheid_validpdf-file-item';
private readonly fileAnhangValid: string = 'Anhang_validpdf-file-item';
......@@ -171,4 +174,16 @@ export class VorgangBescheidWizardE2EComponent {
public getAttachmentUploadSpinner() {
return cy.get(this.attachmentUploadSpinner);
}
public getSaveButton() {
return cy.getTestElement(this.saveBescheid);
}
public getResultBox() {
return cy.getTestElement(this.bescheidResultBox);
}
public getConfirmAndSaveButton() {
return cy.getTestElement(this.confirmAndSaveButton);
}
}
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 {
VorgangE2E,
VorgangStatusE2E,
vorgangStatusLabelE2E,
} from 'apps/alfa-e2e/src/model/vorgang';
import { uploadFile } from 'apps/alfa-e2e/src/support/file-upload';
import { getAdjustedDateGerman } from 'apps/alfa-e2e/src/support/tech.util';
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 { dropCollections } from '../../../support/cypress-helper';
import { contains, enterWith, exist, haveText, notExist } from '../../../support/cypress.util';
import {
TEST_FILE_BESCHEID_ANHANG_VALID,
TEST_FILE_BESCHEID_VALID,
} from '../../../support/data.util';
import { initUsermanagerUsers, loginAsSabine } from '../../../support/user-util';
import { buildVorgang, initVorgaenge, objectIds } from '../../../support/vorgang-util';
registerLocaleData(localeDe, 'de', localeDeExtra);
describe('Bescheid Wizard', () => {
const mainPage: MainPage = new MainPage();
const vorgangList: VorgangListE2EComponent = mainPage.getVorgangList();
const abgelehntText: string = 'Abgelehnt am';
const manuellText: string = 'Bescheid muss manuell';
const vorgangPage: VorgangPage = new VorgangPage();
const bescheidWizard: VorgangBescheidWizardE2EComponent = vorgangPage.getBescheidWizard();
const bescheidVorgang: VorgangE2E = {
...buildVorgang(objectIds[0], 'Wizard Vorgang'),
status: VorgangStatusE2E.IN_BEARBEITUNG,
};
const vorgangFormularButtons: VorgangFormularButtonsE2EComponent =
vorgangPage.getFormularButtons();
before(() => {
initVorgaenge([bescheidVorgang]);
initUsermanagerUsers();
loginAsSabine();
waitForSpinnerToDisappear();
exist(vorgangList.getRoot());
});
after(() => {
dropCollections();
});
describe('Only save Bescheid', () => {
it('should update Bescheid info after click on Nur Speichern', () => {
vorgangList.getListItem(bescheidVorgang.name).getRoot().click();
waitForSpinnerToDisappear();
vorgangFormularButtons.getBescheidenButton().click();
bescheidWizard.getAbgelehntButton().click();
enterWith(bescheidWizard.getDateInput(), getAdjustedDateGerman(-1));
bescheidWizard.getWeiterButton().click();
uploadFile(bescheidWizard.getUploadBescheidButton(), TEST_FILE_BESCHEID_VALID);
notExist(bescheidWizard.getBescheidUploadSpinner());
uploadFile(bescheidWizard.getUploadAttachmentButton(), TEST_FILE_BESCHEID_ANHANG_VALID);
notExist(bescheidWizard.getAttachmentUploadSpinner());
bescheidWizard.getWeiterButton().click();
bescheidWizard.getSaveButton().click();
contains(bescheidWizard.getStatusText(), abgelehntText + ' ' + getAdjustedDateGerman(-1));
exist(bescheidWizard.getFileAnhangValid());
exist(bescheidWizard.getFileBescheidValid());
contains(bescheidWizard.getResultBox(), manuellText);
exist(bescheidWizard.getConfirmAndSaveButton());
});
it('should update Vorgang status after saving', () => {
bescheidWizard.getConfirmAndSaveButton().click();
notExist(bescheidWizard.getRoot());
waitForSpinnerToDisappear();
haveText(
vorgangPage.getVorgangDetailHeader().getStatus(),
vorgangStatusLabelE2E[VorgangStatusE2E.BESCHIEDEN],
);
});
});
});
......@@ -81,7 +81,7 @@
<ods-button-with-spinner
class="self-end"
*ngIf="canSave$ | async"
data-test-id="save-and-send-button"
data-test-id="confirm-and-save-button"
[stateResource]="saveAndSendInProgress$ | async"
text="Antrag bescheiden und speichern"
(clickEmitter)="saveAndSendManually(bescheidDraftStateResource.resource)"
......
......@@ -21,7 +21,7 @@
[name]="formServiceClass.FIELD_SEND_BY"
variant="bescheid_save"
[fullWidthText]="true"
data-test-id="save-and-send-button"
data-test-id="save-button"
><ods-save-icon></ods-save-icon
></ods-radio-button-card>
</ng-container>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment