From 035cbb909b5b39bf735fb215dd6fa79d1342c39b Mon Sep 17 00:00:00 2001 From: Ittay Stern Date: Thu, 26 Dec 2019 09:39:43 +0200 Subject: Use popup-sized viewport on Cypress tests where relevant The smaller viewport let more authentic tests, and a real-life look-and-feel. It is used on: - New Service popup - Audit-info of Instantiation Status - Templates modal Issue-ID: VID-724 Change-Id: I4f9928a3f730085bd66f5920a14b3a44ef5a23ba Signed-off-by: Ittay Stern --- .../steps/genericForm/popupViewport.step.ts | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 vid-webpack-master/cypress/support/steps/genericForm/popupViewport.step.ts (limited to 'vid-webpack-master/cypress/support/steps') diff --git a/vid-webpack-master/cypress/support/steps/genericForm/popupViewport.step.ts b/vid-webpack-master/cypress/support/steps/genericForm/popupViewport.step.ts new file mode 100644 index 000000000..2fbcf406f --- /dev/null +++ b/vid-webpack-master/cypress/support/steps/genericForm/popupViewport.step.ts @@ -0,0 +1,24 @@ +declare namespace Cypress { + interface Chainable { + setViewportToDefault: typeof setViewportToDefault, + setViewportToSmallPopup: typeof setViewportToSmallPopup, + openPopupIframe: typeof openPopupIframe, + } +} + +function setViewportToDefault() { + cy.viewport(Cypress.config('viewportWidth'), Cypress.config('viewportHeight')); +} + +function setViewportToSmallPopup() { + cy.viewport(1103, 691); // the iframe.popup property on common.css +} + +function openPopupIframe(iframeUrl : string): Chainable { + cy.setViewportToSmallPopup(); + return cy.visit(iframeUrl); +} + +Cypress.Commands.add('setViewportToDefault', setViewportToDefault); +Cypress.Commands.add('setViewportToSmallPopup', setViewportToSmallPopup); +Cypress.Commands.add('openPopupIframe', openPopupIframe); -- cgit 1.2.3-korg