aboutsummaryrefslogtreecommitdiffstats
path: root/vid-webpack-master/cypress/support/steps/genericForm/popupViewport.step.ts
blob: 2fbcf406fc38a7e8b0f594f7efabd24f6d193aa1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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<Window> {
  cy.setViewportToSmallPopup();
  return cy.visit(iframeUrl);
}

Cypress.Commands.add('setViewportToDefault', setViewportToDefault);
Cypress.Commands.add('setViewportToSmallPopup', setViewportToSmallPopup);
Cypress.Commands.add('openPopupIframe', openPopupIframe);