diff --git a/test/e2e-test-application/cypress/e2e/tests/1-angular/luigi-client-link-manager-features-3.cy.js b/test/e2e-test-application/cypress/e2e/tests/1-angular/luigi-client-link-manager-features-3.cy.js index 406948da49..25fbf68fd4 100644 --- a/test/e2e-test-application/cypress/e2e/tests/1-angular/luigi-client-link-manager-features-3.cy.js +++ b/test/e2e-test-application/cypress/e2e/tests/1-angular/luigi-client-link-manager-features-3.cy.js @@ -152,6 +152,76 @@ describe('Luigi client linkManager', () => { }); }); + describe('linkManager OpenAsModal() promise functionality', () => { + let $iframeBody; + beforeEach(() => { + // "clear" variables to make sure they are not reused and throw error in case something goes wrong + $iframeBody = undefined; + cy.visitLoggedIn('/projects/pr2'); + cy.getIframeBody().then(result => { + $iframeBody = result; + }); + }); + it('Open and Close Modal with Close Button', () => { + cy.wrap($iframeBody) + .find('[data-testid=open-modal-on-close-promise]') + .click() + .then(() => { + cy.get('[data-testid=lui-modal-index-0]') // X-button + .click() + }) + cy.wrap($iframeBody).should('contain', 'promise resolved!'); + }); + it('Open and Close Modal With Esc Key', () => { + cy.wrap($iframeBody) + .find('[data-testid=open-modal-on-close-promise]') + .click(); + cy.get('body').trigger('keydown', { keyCode: 27}); // Esc + cy.wrap($iframeBody).should('contain', 'promise resolved!'); + }); + it('Open and Close Modal With linkManager.goBack()', () => { + cy.wrap($iframeBody) + .find('[data-testid=open-modal-on-close-promise]') + .click(); + cy.get('[data-testid=modal-mf] iframe') + .iframe() + .then($modal => { + cy.wrap($modal) + .contains('Click here') // linkManager().goBack() + .click(); + }); + cy.wrap($iframeBody).should('contain', 'promise resolved!'); + }); + it('Open and Close Modal With linkManager().navigate()', () => { + cy.wrap($iframeBody) + .find('[data-testid=open-modal-on-close-promise]') + .click(); + cy.get('[data-testid=modal-mf] iframe') + .eq(0) + .iframe() + .then($modal => { + cy.wrap($modal) + .contains('absolute: to /projects/pr2') // linkManager().navigate('/projects/pr2') + .click(); + }); + cy.wrap($iframeBody).should('contain', 'promise resolved!'); + }); + it('Open and Close Modal With uxManager().closeCurrentModal()', () => { + cy.wrap($iframeBody) + .find('[data-testid=open-modal-on-close-promise]') + .click(); + cy.get('[data-testid=modal-mf] iframe') + .eq(0) + .iframe() + .then($modal => { + cy.wrap($modal) + .contains('Close modal') // uxManager().closeCurrentModal() + .click(); + }); + cy.wrap($iframeBody).should('contain', 'promise resolved!'); + }); + }); + describe('linkManager wrong paths navigation', () => { let $iframeBody; beforeEach(() => { diff --git a/test/e2e-test-application/src/app/project/project.component.html b/test/e2e-test-application/src/app/project/project.component.html index 4da4fad84c..c5a90aa1e3 100644 --- a/test/e2e-test-application/src/app/project/project.component.html +++ b/test/e2e-test-application/src/app/project/project.component.html @@ -585,6 +585,29 @@

Navigate

> +
  • + Open A modal with On Close Promise + + +
  • +
  • Demo time *ngIf="projectId === 'pr1'" [modalActive]="modalActive" (modalClosed)="toggleModal()" -> +> \ No newline at end of file diff --git a/test/e2e-test-application/src/app/project/project.component.ts b/test/e2e-test-application/src/app/project/project.component.ts index cd375eb9d1..aa075ee437 100644 --- a/test/e2e-test-application/src/app/project/project.component.ts +++ b/test/e2e-test-application/src/app/project/project.component.ts @@ -128,6 +128,15 @@ export class ProjectComponent implements OnInit, OnDestroy { } } + openAsModal() { + linkManager().openAsModal('/projects/pr2/settings', { + title: 'microfrontend in a modal', + size: 'm', + }).then(() => { + document.getElementById('promiseTest').innerHTML='promise resolved!' + }) + } + showConfirmationModal() { this.confirmationModalResult = ''; const settings = { diff --git a/test/e2e-test-application/src/app/project/settings/settings.component.html b/test/e2e-test-application/src/app/project/settings/settings.component.html index 8eab8e453c..e0fd542855 100644 --- a/test/e2e-test-application/src/app/project/settings/settings.component.html +++ b/test/e2e-test-application/src/app/project/settings/settings.component.html @@ -223,6 +223,15 @@

    Navigate

    >
  • +
  • + absolute: to /projects/pr2 + +