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 @@