diff --git a/alfa-client/apps/admin-e2e/src/support/commands.ts b/alfa-client/apps/admin-e2e/src/support/commands.ts index 5442317e9972045e9b6be4644c4bbd5621377682..cf4b5dcf983c23a79e107c109a3fbc0f371301a7 100644 --- a/alfa-client/apps/admin-e2e/src/support/commands.ts +++ b/alfa-client/apps/admin-e2e/src/support/commands.ts @@ -74,11 +74,11 @@ Cypress.Commands.add('getTestElementWithOid', (oid, ...args) => { }); Cypress.Commands.add('findTestElementWithClass', { prevSubject: true }, (subject: any, selector) => { - return subject.find(`[${DATA_TEST_CLASS}="${selector}"]`); + return cy.wrap(subject).find(`[${DATA_TEST_CLASS}="${selector}"]`); }); Cypress.Commands.add('findElement', { prevSubject: true }, (subject: any, selector: string) => { - return subject.find(selector); + return cy.wrap(subject).find(selector); }); Cypress.Commands.add('getUserInfo', () => { diff --git a/alfa-client/apps/alfa-e2e/src/components/postfach/postfach-mail-subnavigation.e2e.component.ts b/alfa-client/apps/alfa-e2e/src/components/postfach/postfach-mail-subnavigation.e2e.component.ts index 0e8330dbf59a3eeed60a376d24775e9266711330..45b403cfed6d693dee2c30decd7618c4124aa2de 100644 --- a/alfa-client/apps/alfa-e2e/src/components/postfach/postfach-mail-subnavigation.e2e.component.ts +++ b/alfa-client/apps/alfa-e2e/src/components/postfach/postfach-mail-subnavigation.e2e.component.ts @@ -22,9 +22,14 @@ * unter der Lizenz sind dem Lizenztext zu entnehmen. */ export class PostfachMailSubnavigation { - private readonly locatorBackButton: string = 'back-button'; + private readonly backButton: string = 'back-button'; + private readonly mailUnreadButton: string = 'mail-unread-icon-button-link'; public getBackButton() { - return cy.getTestElement(this.locatorBackButton); + return cy.getTestElement(this.backButton); + } + + public getMailUnreadButton() { + return cy.getTestElement(this.mailUnreadButton); } } diff --git a/alfa-client/apps/alfa-e2e/src/components/postfach/postfach-mail.e2e.component.ts b/alfa-client/apps/alfa-e2e/src/components/postfach/postfach-mail.e2e.component.ts index 30a485fc0e343bb03af71ee4164242865c8dafac..0b068a295bf7ea14ce3ca8a8bc939e7dc3b48a25 100644 --- a/alfa-client/apps/alfa-e2e/src/components/postfach/postfach-mail.e2e.component.ts +++ b/alfa-client/apps/alfa-e2e/src/components/postfach/postfach-mail.e2e.component.ts @@ -34,6 +34,8 @@ export class PostfachMailE2EComponent { private readonly attachments: string = 'postfach-nachricht-attachments-container'; private readonly downloadButtonWithIcon: string = 'postfach-pdf-export-button'; private readonly downloadButtonWithLabel: string = 'postfach-pdf-export-label-button'; + private readonly mailIcon: string = 'postfach-mail-list-mail-icon'; + private readonly mailIconBadge: string = 'mail-icon-badge'; private readonly locatorRoot: string = 'postfach-nachrichten-container-in-vorgang'; @@ -72,8 +74,15 @@ export class PostfachMailE2EComponent { public getDownloadButtonWithLabel(): Cypress.Chainable<JQuery<Element>> { return getTestElement(this.downloadButtonWithLabel); } -} + public getMailIcon() { + return getTestElement(this.mailIcon); + } + + public getMailIconBadge() { + return this.getMailIcon().findTestElementWithClass(this.mailIconBadge); + } +} export class PostfachMailListItemE2EComponent { private readonly createdAt: string = 'mail-created-at'; private readonly subject: string = 'mail-subject'; diff --git a/alfa-client/apps/alfa-e2e/src/e2e/main-tests/postfach-mail/postfach-mail-error.cy.ts b/alfa-client/apps/alfa-e2e/src/e2e/main-tests/postfach-mail/postfach-mail-error.cy.ts index 38cdc69f040a56f482d2f617b18d334b9b28c2f4..7757287c507e52f65933d6510694736938b5070b 100644 --- a/alfa-client/apps/alfa-e2e/src/e2e/main-tests/postfach-mail/postfach-mail-error.cy.ts +++ b/alfa-client/apps/alfa-e2e/src/e2e/main-tests/postfach-mail/postfach-mail-error.cy.ts @@ -43,7 +43,7 @@ import { VorgangAttachedItemE2E, } from '../../../model/vorgang-attached-item'; import { containsSpinner, MainPage, notContainsSpinner, waitForSpinnerToDisappear } from '../../../page-objects/main.po'; -import { PostfachMailPage } from '../../../page-objects/postfach-mail.component.po'; +import { PostfachMailPage } from '../../../page-objects/postfach.po'; import { VorgangPage } from '../../../page-objects/vorgang.po'; import { contains, exist, notExist } from '../../../support/cypress.util'; import { getUserSabineId } from '../../../support/user-util'; diff --git a/alfa-client/apps/alfa-e2e/src/e2e/main-tests/postfach-mail/postfach-mail.cy.ts b/alfa-client/apps/alfa-e2e/src/e2e/main-tests/postfach-mail/postfach-mail.cy.ts index 6a33ba89488ec5a38e389f3e483ffa59f030524d..19d6baacf9dc4e3450c067b5f636156214241943 100644 --- a/alfa-client/apps/alfa-e2e/src/e2e/main-tests/postfach-mail/postfach-mail.cy.ts +++ b/alfa-client/apps/alfa-e2e/src/e2e/main-tests/postfach-mail/postfach-mail.cy.ts @@ -50,7 +50,7 @@ import { VorgangAttachedItemE2E, } from '../../../model/vorgang-attached-item'; import { MainPage, waitForSpinnerToDisappear } from '../../../page-objects/main.po'; -import { PostfachMailPage } from '../../../page-objects/postfach-mail.component.po'; +import { PostfachMailPage } from '../../../page-objects/postfach.po'; import { VorgangPage } from '../../../page-objects/vorgang.po'; import { expectIconWithBadge, expectIconWithoutBadge } from '../../../support/angular.util'; import { readFileFromDownloads } from '../../../support/cypress-helper'; diff --git a/alfa-client/apps/alfa-e2e/src/e2e/main-tests/postfach-mail/postfach-mail.filtered-by-organisationseinheit.cy.ts b/alfa-client/apps/alfa-e2e/src/e2e/main-tests/postfach-mail/postfach-mail.filtered-by-organisationseinheit.cy.ts index 7c15088c5af34553732905a552fde918eaaecda8..93ef336ae450af38d9f3e9a5d702786626001961 100644 --- a/alfa-client/apps/alfa-e2e/src/e2e/main-tests/postfach-mail/postfach-mail.filtered-by-organisationseinheit.cy.ts +++ b/alfa-client/apps/alfa-e2e/src/e2e/main-tests/postfach-mail/postfach-mail.filtered-by-organisationseinheit.cy.ts @@ -26,7 +26,7 @@ import { SnackBarE2EComponent } from '../../../components/ui/snackbar.e2e.compon import { VorgangListE2EComponent } from '../../../components/vorgang/vorgang-list.e2e.component'; import { EingangE2E, VorgangE2E } from '../../../model/vorgang'; import { MainPage, waitForSpinnerToDisappear } from '../../../page-objects/main.po'; -import { PostfachMailPage } from '../../../page-objects/postfach-mail.component.po'; +import { PostfachMailPage } from '../../../page-objects/postfach.po'; import { visitUrl } from '../../../support/cypress-helper'; import { contains, exist, notExist } from '../../../support/cypress.util'; import { ORGANISATIONSEINHEITEN_ID_FOR_ADELHEIT, ORGANISATIONSEINHEITEN_ID_FOR_SABINE } from '../../../support/data.util'; diff --git a/alfa-client/apps/alfa-e2e/src/e2e/main-tests/postfach-mail/postfach-nachricht-authorize-by-role.cy.ts b/alfa-client/apps/alfa-e2e/src/e2e/main-tests/postfach-mail/postfach-nachricht-authorize-by-role.cy.ts index 8fc722691d266e544f795e717ac1065e0082061f..d98003e63d93be5449d9ecdfdc346c17ee553846 100644 --- a/alfa-client/apps/alfa-e2e/src/e2e/main-tests/postfach-mail/postfach-nachricht-authorize-by-role.cy.ts +++ b/alfa-client/apps/alfa-e2e/src/e2e/main-tests/postfach-mail/postfach-nachricht-authorize-by-role.cy.ts @@ -24,7 +24,7 @@ import { SnackBarE2EComponent } from 'apps/alfa-e2e/src/components/ui/snackbar.e2e.component'; import { VorgangE2E, VorgangStatusE2E } from 'apps/alfa-e2e/src/model/vorgang'; import { MainPage, waitForSpinnerToDisappear } from 'apps/alfa-e2e/src/page-objects/main.po'; -import { PostfachMailPage } from 'apps/alfa-e2e/src/page-objects/postfach-mail.component.po'; +import { PostfachMailPage } from 'apps/alfa-e2e/src/page-objects/postfach.po'; import { visitUrl } from 'apps/alfa-e2e/src/support/cypress-helper'; import { contains, exist, notExist } from 'apps/alfa-e2e/src/support/cypress.util'; import { MessagesE2E } from 'apps/alfa-e2e/src/support/messages'; diff --git a/alfa-client/apps/alfa-e2e/src/e2e/main-tests/postfach-mail/postfach-nachricht-mark-unread.cy.ts b/alfa-client/apps/alfa-e2e/src/e2e/main-tests/postfach-mail/postfach-nachricht-mark-unread.cy.ts new file mode 100644 index 0000000000000000000000000000000000000000..5fa3d4ebee019dc3d03dc127285e965b17ec1b99 --- /dev/null +++ b/alfa-client/apps/alfa-e2e/src/e2e/main-tests/postfach-mail/postfach-nachricht-mark-unread.cy.ts @@ -0,0 +1,112 @@ +import { PostfachMailPage } from 'apps/alfa-e2e/src/page-objects/postfach.po'; +import { + createPostfachNachrichtAttachedItem, + createPostfachNachrichtReplyItem, +} from 'apps/alfa-e2e/src/support/postfach-nachricht.util'; +import { initVorgangAttachedItem } from 'apps/alfa-e2e/src/support/vorgang-attached-item-util'; +import { VorgangListE2EComponent } from '../../../components/vorgang/vorgang-list.e2e.component'; +import { E2EPostfachHelper } from '../../../helper/postfach/postfach.helper'; +import { E2EPostfachVerifier } from '../../../helper/postfach/postfach.verifier'; +import { E2EVorgangNavigator } from '../../../helper/vorgang/vorgang.navigator'; +import { ClientAttributeNameE2E, VorgangE2E } from '../../../model/vorgang'; +import { PostfachMailItemE2E, VorgangAttachedItemClientE2E, VorgangAttachedItemE2E } from '../../../model/vorgang-attached-item'; +import { MainPage, waitForSpinnerToDisappear } from '../../../page-objects/main.po'; +import { dropCollections } from '../../../support/cypress-helper'; +import { exist } from '../../../support/cypress.util'; +import { initUsermanagerUsers, loginAsSabine } from '../../../support/user-util'; +import { + buildVorgang, + createHasNewPostfachNachrichtClientAttribute, + createHasPostfachNachrichtClientAttribute, + createVorgang, + initVorgaenge, + objectIds, +} from '../../../support/vorgang-util'; + +describe('Postfach Nachrichten mark unread', () => { + const vorgangList: VorgangListE2EComponent = new MainPage().getVorgangList(); + const vorgangNavigator: E2EVorgangNavigator = new E2EVorgangNavigator(); + + const postfachMailPage: PostfachMailPage = new PostfachMailPage(); + const postfachVerifier: E2EPostfachVerifier = new E2EPostfachVerifier(); + const postfachHelper: E2EPostfachHelper = new E2EPostfachHelper(); + + const vorgang: VorgangE2E = createVorgang(); + const vorgangWithReply: VorgangE2E = { + ...buildVorgang(objectIds[0], 'VorgangWithReply'), + clientAttributes: { + [VorgangAttachedItemClientE2E.OZGCLOUD_NACHRICHTEN_MANAGER]: { + [ClientAttributeNameE2E.HAS_NEW_POSTFACH_NACHRICHT]: createHasNewPostfachNachrichtClientAttribute(true), + [ClientAttributeNameE2E.HAS_POSTFACH_NACHRICHT]: createHasPostfachNachrichtClientAttribute(true), + }, + }, + }; + + const postfachMailReply: PostfachMailItemE2E = createPostfachNachrichtReplyItem(); + const postfachNachrichtAttachedItem: VorgangAttachedItemE2E = { + ...createPostfachNachrichtAttachedItem(objectIds[1], objectIds[0]), + item: postfachMailReply, + }; + + before(() => { + initVorgaenge([vorgang, vorgangWithReply]); + initVorgangAttachedItem([postfachNachrichtAttachedItem]); + initUsermanagerUsers(); + + loginAsSabine(); + + waitForSpinnerToDisappear(); + exist(vorgangList.getRoot()); + }); + + after(() => { + dropCollections(); + }); + + describe('mail icon', () => { + it('should not have unread badge', () => { + vorgangNavigator.openVorgang(vorgang.name); + + postfachVerifier.verifyMailIconWithoutBadgeExists(); + }); + + it('should have unread badge', () => { + vorgangNavigator.openVorgang(vorgangWithReply.name); + + postfachVerifier.verifyMailIconWithBadgeExists(); + }); + + it('should not have unread badge after messages were read', () => { + postfachHelper.navigateToPostfach(); + postfachMailPage.getSubnavigation().getBackButton().click(); + + postfachVerifier.verifyMailIconWithoutBadgeExists(); + }); + }); + + describe('mark as unread button', () => { + it('should be displayed as action button', () => { + postfachHelper.navigateToPostfach(); + + exist(postfachMailPage.getSubnavigation().getMailUnreadButton()); + }); + + it('should navigate back and mark messages as unread', () => { + postfachMailPage.getSubnavigation().getMailUnreadButton().click(); + + postfachVerifier.verifyMailIconWithBadgeExists(); + }); + + it('should be displayed as button', () => { + postfachHelper.navigateToPostfach(); + + exist(postfachMailPage.getMailUnreadButton()); + }); + + it('should navigate back and mark messages as unread', () => { + postfachMailPage.getMailUnreadButton().click(); + + postfachVerifier.verifyMailIconWithBadgeExists(); + }); + }); +}); diff --git a/alfa-client/apps/alfa-e2e/src/e2e/main-tests/postfach-mail/postfach-nachrichten.cy.ts b/alfa-client/apps/alfa-e2e/src/e2e/main-tests/postfach-mail/postfach-nachrichten.cy.ts index fa8a20f7a68e1e6c147c2f3c46ad9fd66e04e041..27d04e6196a2e9172d42db0e720d9896272ba8a0 100644 --- a/alfa-client/apps/alfa-e2e/src/e2e/main-tests/postfach-mail/postfach-nachrichten.cy.ts +++ b/alfa-client/apps/alfa-e2e/src/e2e/main-tests/postfach-mail/postfach-nachrichten.cy.ts @@ -22,7 +22,7 @@ * unter der Lizenz sind dem Lizenztext zu entnehmen. */ import { PostfachMailE2EComponent } from 'apps/alfa-e2e/src/components/postfach/postfach-mail.e2e.component'; -import { PostfachMailPage } from 'apps/alfa-e2e/src/page-objects/postfach-mail.component.po'; +import { PostfachMailPage } from 'apps/alfa-e2e/src/page-objects/postfach.po'; import { createPostfachNachrichtAttachedItem, createPostfachNachrichtReplyItem, @@ -114,7 +114,7 @@ describe('Postfach Nachrichten', () => { describe('by download button on nachrichten details page', () => { it('should show an overview of all nachrichten after clicking on nachricht', () => { - postfachMailContainer.getList().click(); + postfachMailContainer.getListItem(postfachMailReply.subject).getRoot().click(); waitForSpinnerToDisappear(); exist(postfachMailPage.getRoot()); diff --git a/alfa-client/apps/alfa-e2e/src/e2e/main-tests/vorgang-bescheid/vorgang-bescheid-dokumente-hochladen.cy.ts b/alfa-client/apps/alfa-e2e/src/e2e/main-tests/vorgang-bescheid/vorgang-bescheid-dokumente-hochladen.cy.ts index 71531d122d7f3fdc14570feb7d498dd7f449b467..745950f0b64a4b73ea09d1df2fe11c7c46ba1a3b 100644 --- a/alfa-client/apps/alfa-e2e/src/e2e/main-tests/vorgang-bescheid/vorgang-bescheid-dokumente-hochladen.cy.ts +++ b/alfa-client/apps/alfa-e2e/src/e2e/main-tests/vorgang-bescheid/vorgang-bescheid-dokumente-hochladen.cy.ts @@ -127,6 +127,8 @@ describe('Bescheid Dokumente hochladen', () => { waitForSpinnerToDisappear(); vorgangFormularButtons.getBescheidenButton().click(); + waitForSpinnerToDisappear(); + exist(bescheidWizard.getWeiterButton()); bescheidWizard.getWeiterButton().click(); exist(bescheidWizard.getFileBescheidValidInWizard()); exist(bescheidWizard.getFileAnhangValidInWizard()); diff --git a/alfa-client/apps/alfa-e2e/src/e2e/main-tests/vorgang-bescheid/vorgang-bescheid-senden.cy.ts b/alfa-client/apps/alfa-e2e/src/e2e/main-tests/vorgang-bescheid/vorgang-bescheid-senden.cy.ts index 43e23febb7f15a82dd1431890c52590438388cfd..0b89bde0a5f58f854855f9ab4574cc0f29dca7d7 100644 --- a/alfa-client/apps/alfa-e2e/src/e2e/main-tests/vorgang-bescheid/vorgang-bescheid-senden.cy.ts +++ b/alfa-client/apps/alfa-e2e/src/e2e/main-tests/vorgang-bescheid/vorgang-bescheid-senden.cy.ts @@ -26,12 +26,12 @@ import localeDe from '@angular/common/locales/de'; import localeDeExtra from '@angular/common/locales/extra/de'; import { PostfachMailE2EComponent, - PostfachMailListItem, + PostfachMailListItemE2EComponent, } from 'apps/alfa-e2e/src/components/postfach/postfach-mail.e2e.component'; 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 } from 'apps/alfa-e2e/src/model/vorgang'; -import { PostfachMailPage } from 'apps/alfa-e2e/src/page-objects/postfach-mail.component.po'; +import { PostfachMailPage } from 'apps/alfa-e2e/src/page-objects/postfach.po'; import { TEST_FILE_BESCHEID_ANHANG_VALID, TEST_FILE_BESCHEID_VALID } from 'apps/alfa-e2e/src/support/data.util'; import { uploadFile } from 'apps/alfa-e2e/src/support/file-upload'; import { getAdjustedDateGerman } from 'apps/alfa-e2e/src/support/tech.util'; @@ -97,17 +97,17 @@ describe('Bescheid senden', () => { bescheidWizard.getSendButton().click(); waitForSpinnerToDisappear(); - const postfachMailItem: PostfachMailListItem = postfachMailContainer.getListItem(mailText); + const postfachMailItem: PostfachMailListItemE2EComponent = postfachMailContainer.getListItem(mailText); exist(postfachMailItem.getRoot()); }); it('should contain correct text and both attachments', () => { - const postfachMailItem: PostfachMailListItem = postfachMailContainer.getListItem(mailText); + const postfachMailItem: PostfachMailListItemE2EComponent = postfachMailContainer.getListItem(mailText); postfachMailItem.getRoot().click(); waitForSpinnerToDisappear(); - const postfachListItem: PostfachMailListItem = postfachMailPage.getListItem(mailText); + const postfachListItem: PostfachMailListItemE2EComponent = postfachMailPage.getListItem(mailText); contains(postfachMailPage.getMailText(), anredeText); exist(postfachListItem.getAttachmentContainer().getList().getItem(TEST_FILE_BESCHEID_VALID).getRoot()); diff --git a/alfa-client/apps/alfa-e2e/src/e2e/main-tests/vorgang-list/vorgang-list-ungelesen.cy.ts b/alfa-client/apps/alfa-e2e/src/e2e/main-tests/vorgang-list/vorgang-list-ungelesen.cy.ts index 55378be9b89267e067ca4a9a8269c21e9fbb5fc6..f6a46976701b8800ccfcb7b2cf9629ab37ff63cb 100644 --- a/alfa-client/apps/alfa-e2e/src/e2e/main-tests/vorgang-list/vorgang-list-ungelesen.cy.ts +++ b/alfa-client/apps/alfa-e2e/src/e2e/main-tests/vorgang-list/vorgang-list-ungelesen.cy.ts @@ -23,7 +23,7 @@ */ import { PostfachMailE2EComponent, - PostfachMailListItem, + PostfachMailListItemE2EComponent, } from 'apps/alfa-e2e/src/components/postfach/postfach-mail.e2e.component'; import { VorgangSubnavigationE2EComponent } from 'apps/alfa-e2e/src/components/vorgang/vorgang-subnavigation'; import { @@ -121,7 +121,7 @@ describe('VorgangList Ungelesene Nachrichten', () => { vorgangList.getListItem(vorgangWithReply1.name).getRoot().click(); waitForSpinnerToDisappear(); - const postfachMailItem: PostfachMailListItem = postfachMailContainer.getListItem('Subject'); + const postfachMailItem: PostfachMailListItemE2EComponent = postfachMailContainer.getListItem('Subject'); postfachMailItem.getRoot().click(); waitForSpinnerToDisappear(); @@ -135,7 +135,7 @@ describe('VorgangList Ungelesene Nachrichten', () => { vorgangList.getListItem(vorgangWithReply2.name).getRoot().click(); waitForSpinnerToDisappear(); - const postfachMailItem: PostfachMailListItem = postfachMailContainer.getListItem('Subject'); + const postfachMailItem: PostfachMailListItemE2EComponent = postfachMailContainer.getListItem('Subject'); postfachMailItem.getRoot().click(); waitForSpinnerToDisappear(); diff --git a/alfa-client/apps/alfa-e2e/src/e2e/main-tests/vorgang-list/vorgang-list.search.cy.ts b/alfa-client/apps/alfa-e2e/src/e2e/main-tests/vorgang-list/vorgang-list.search.cy.ts index 62f8b2d334931f7c3886c41d3aa9afedf310b0bc..434809c2d84768844c80712abd817c247f33bb8c 100644 --- a/alfa-client/apps/alfa-e2e/src/e2e/main-tests/vorgang-list/vorgang-list.search.cy.ts +++ b/alfa-client/apps/alfa-e2e/src/e2e/main-tests/vorgang-list/vorgang-list.search.cy.ts @@ -23,7 +23,7 @@ */ import { faker } from '@faker-js/faker'; import { KommentarInVorgangE2EComponent } from 'apps/alfa-e2e/src/components/kommentar/kommentar-list.e2e.component'; -import { PostfachMailListItem } from 'apps/alfa-e2e/src/components/postfach/postfach-mail.e2e.component'; +import { PostfachMailListItemE2EComponent } from 'apps/alfa-e2e/src/components/postfach/postfach-mail.e2e.component'; import { VorgangDetailHeaderE2EComponent } from 'apps/alfa-e2e/src/components/vorgang/vorgang-detail-header.e2e.component'; import { VorgangListItemE2EComponent } from 'apps/alfa-e2e/src/components/vorgang/vorgang-item.e2e.component'; import { VorgangListE2EComponent } from 'apps/alfa-e2e/src/components/vorgang/vorgang-list.e2e.component'; @@ -437,7 +437,7 @@ describe('VorgangList Suche', () => { }); it('should have postfachNachricht', () => { - const postfachNachricht: PostfachMailListItem = vorgangPage + const postfachNachricht: PostfachMailListItemE2EComponent = vorgangPage .getPostfachMailcontainer() .getListItem('PostfachNachrichtOther'); diff --git a/alfa-client/apps/alfa-e2e/src/helper/app.helper.ts b/alfa-client/apps/alfa-e2e/src/helper/app.helper.ts index a517ed1e108ee3e5da3de0897b6efea428cce45f..ba5c324caeefddbf48a3efb7fb3cd5d6b7bbaaf2 100644 --- a/alfa-client/apps/alfa-e2e/src/helper/app.helper.ts +++ b/alfa-client/apps/alfa-e2e/src/helper/app.helper.ts @@ -28,6 +28,10 @@ export class E2EAppHelper { this.mainPage.getHeader().getLogo().click(); } + public navigateRelative(url: string): void { + cy.location('pathname').then((currentPath: string) => cy.visit(`${currentPath}/${url}`)); + } + public saveAndCloseSnackbar(message: string): void { this.verifier.verifySnackbar(message); this.closeSnackbar(); diff --git a/alfa-client/apps/alfa-e2e/src/helper/postfach-nachricht/postfach-nachricht.verifier.ts b/alfa-client/apps/alfa-e2e/src/helper/postfach-nachricht/postfach-nachricht.verifier.ts index d6f9c0cebf1d90fa9c434c594c83bf8fa2ce3c00..05254f563d2e2b8ba6c15cd271105ea293a83937 100644 --- a/alfa-client/apps/alfa-e2e/src/helper/postfach-nachricht/postfach-nachricht.verifier.ts +++ b/alfa-client/apps/alfa-e2e/src/helper/postfach-nachricht/postfach-nachricht.verifier.ts @@ -1,6 +1,6 @@ import { PostfachMailListItemE2EComponent } from '../../components/postfach/postfach-mail.e2e.component'; import { PostfachNachrichtMessageCodeMessagesE2E } from '../../model/vorgang-attached-item'; -import { PostfachMailPage } from '../../page-objects/postfach-mail.component.po'; +import { PostfachMailPage } from '../../page-objects/postfach.po'; import { contains, exist } from '../../support/cypress.util'; export class E2EPostfachNachrichtVerifier { diff --git a/alfa-client/apps/alfa-e2e/src/helper/postfach/postfach.helper.ts b/alfa-client/apps/alfa-e2e/src/helper/postfach/postfach.helper.ts new file mode 100644 index 0000000000000000000000000000000000000000..29040f66391ad02a33ca4158196d1b7bcd906f2f --- /dev/null +++ b/alfa-client/apps/alfa-e2e/src/helper/postfach/postfach.helper.ts @@ -0,0 +1,15 @@ +import { waitForSpinnerToDisappear } from '../../page-objects/main.po'; +import { PostfachMailPage } from '../../page-objects/postfach.po'; +import { exist } from '../../support/cypress.util'; +import { E2EAppHelper } from '../app.helper'; + +export class E2EPostfachHelper { + private readonly appHelper: E2EAppHelper = new E2EAppHelper(); + private readonly postfachMailPage: PostfachMailPage = new PostfachMailPage(); + + public navigateToPostfach(): void { + this.appHelper.navigateRelative('postfach'); + waitForSpinnerToDisappear(); + exist(this.postfachMailPage.getRoot()); + } +} diff --git a/alfa-client/apps/alfa-e2e/src/helper/postfach/postfach.verifier.ts b/alfa-client/apps/alfa-e2e/src/helper/postfach/postfach.verifier.ts new file mode 100644 index 0000000000000000000000000000000000000000..d20b3070f6f015fb328b8144739a146f21edb0b8 --- /dev/null +++ b/alfa-client/apps/alfa-e2e/src/helper/postfach/postfach.verifier.ts @@ -0,0 +1,16 @@ +import { VorgangPage } from '../../page-objects/vorgang.po'; +import { exist, notExist } from '../../support/cypress.util'; + +export class E2EPostfachVerifier { + private readonly vorgangPage: VorgangPage = new VorgangPage(); + + verifyMailIconWithoutBadgeExists(): void { + exist(this.vorgangPage.getPostfachMailcontainer().getMailIcon()); + notExist(this.vorgangPage.getPostfachMailcontainer().getMailIconBadge()); + } + + verifyMailIconWithBadgeExists(): void { + exist(this.vorgangPage.getPostfachMailcontainer().getMailIcon()); + exist(this.vorgangPage.getPostfachMailcontainer().getMailIconBadge()); + } +} diff --git a/alfa-client/apps/alfa-e2e/src/page-objects/postfach-mail.component.po.ts b/alfa-client/apps/alfa-e2e/src/page-objects/postfach.po.ts similarity index 90% rename from alfa-client/apps/alfa-e2e/src/page-objects/postfach-mail.component.po.ts rename to alfa-client/apps/alfa-e2e/src/page-objects/postfach.po.ts index 50d8ffd1fbcfcbcfa098a986b7c7ece618087205..e594682abe4a8f259f11f1cb395b982f40754137 100644 --- a/alfa-client/apps/alfa-e2e/src/page-objects/postfach-mail.component.po.ts +++ b/alfa-client/apps/alfa-e2e/src/page-objects/postfach.po.ts @@ -21,13 +21,13 @@ * Die sprachspezifischen Genehmigungen und Beschränkungen * unter der Lizenz sind dem Lizenztext zu entnehmen. */ -//TODO Datei umbenennen in postfach.po.ts import { PostfachMailSubnavigation } from '../components/postfach/postfach-mail-subnavigation.e2e.component'; import { PostfachMailListItemE2EComponent } from '../components/postfach/postfach-mail.e2e.component'; export class PostfachMailPage { - private readonly root: string = 'postfach-mail-list'; + private readonly root: string = 'postfach-page-mail-list'; private readonly downloadButton: string = 'postfach-pdf-export-button'; + private readonly mailUnreadButton: string = 'mail-unread-button-link'; private readonly mailText: string = 'postfach-outgoing-nachricht'; private readonly heading: string = 'postfach-mail-heading'; private readonly headingText: string = 'Nachrichten zum Vorgang'; @@ -58,6 +58,10 @@ export class PostfachMailPage { return cy.getTestElement(this.downloadButton); } + getMailUnreadButton() { + return cy.getTestElement(this.mailUnreadButton); + } + getMailText() { return cy.getTestElement(this.mailText); } diff --git a/alfa-client/apps/alfa-e2e/src/support/commands.ts b/alfa-client/apps/alfa-e2e/src/support/commands.ts index 30e88fd0f58f79fb5d3db717bb46a835fc2b5b54..79b18c3d143739d601e0a3aaa4b67f8c416fffa2 100644 --- a/alfa-client/apps/alfa-e2e/src/support/commands.ts +++ b/alfa-client/apps/alfa-e2e/src/support/commands.ts @@ -107,11 +107,11 @@ Cypress.Commands.add('getTestElementWithOid', (oid, ...args) => { }); Cypress.Commands.add('findTestElementWithClass', { prevSubject: true }, (subject: any, selector) => { - return subject.find(`[${DATA_TEST_CLASS}="${selector}"]`); + return cy.wrap(subject).find(`[${DATA_TEST_CLASS}="${selector}"]`); }); Cypress.Commands.add('findElement', { prevSubject: true }, (subject: any, selector: string) => { - return subject.find(selector); + return cy.wrap(subject).find(selector); }); Cypress.Commands.add('login', (user: string, password: string) => {