cypress-cucumber-steps
Version:
Cypress Cucumber step definitions
99 lines • 2.81 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.When_I_set_viewport = When_I_set_viewport;
exports.When_I_set_viewport_width_height = When_I_set_viewport_width_height;
var cypress_cucumber_preprocessor_1 = require("@badeball/cypress-cucumber-preprocessor");
/**
* When I set viewport to [preset](https://docs.cypress.io/api/commands/viewport#Arguments):
*
* ```gherkin
* When I set viewport to {string}
* ```
*
* When I set viewport to preset and orientation:
*
* ```gherkin
* When I set viewport to {string} and {string}
* ```
*
* Preset supports the following options:
*
* | Preset | width | height |
* | --- | --- | --- |
* | `ipad-2` | 768 | 1024 |
* | `ipad-mini` | 768 | 1024 |
* | `iphone-3` | 320 | 480 |
* | `iphone-4` | 320 | 480 |
* | `iphone-5` | 320 | 568 |
* | `iphone-6` | 375 | 667 |
* | `iphone-6+` | 414 | 736 |
* | `iphone-7` | 375 | 667 |
* | `iphone-8` | 375 | 667 |
* | `iphone-x` | 375 | 812 |
* | `iphone-xr` | 414 | 896 |
* | `iphone-se2` | 375 | 667 |
* | `macbook-11` | 1366 | 768 |
* | `macbook-13` | 1280 | 800 |
* | `macbook-15` | 1440 | 900 |
* | `macbook-16` | 1536 | 960 |
* | `samsung-note9` | 414 | 846 |
* | `samsung-s10` | 360 | 760 |
*
* The _default orientation_ is `portrait`.
*
* @example
*
* Resize viewport to iPhone 6 width and height (375px x 667px):
*
* ```gherkin
* When I set viewport to "iphone-6"
* ```
*
* Resize viewport to iPhone 6 width and height and change orientation to landscape:
*
* ```gherkin
* When I set viewport to "iphone-6" and "landscape"
* ```
*
* @remarks
*
* Controls the size and orientation of the screen for your application.
*
* @see
*
* - {@link When_I_set_viewport_width_height | When I set viewport width height}
*/
function When_I_set_viewport(preset, orientation) {
if (orientation === void 0) { orientation = 'portrait'; }
cy.viewport(preset, orientation);
}
(0, cypress_cucumber_preprocessor_1.When)('I set viewport to {string}', When_I_set_viewport);
(0, cypress_cucumber_preprocessor_1.When)('I set viewport to {string} and {string}', When_I_set_viewport);
/**
* When I set viewport to width and height:
*
* ```gherkin
* When I set viewport to {int}px by {int}px
* ```
*
* @example
*
* Resize viewport to 375px width by 667px height:
*
* ```gherkin
* When I set viewport to 375px by 667px
* ```
*
* @remarks
*
* Controls the size and orientation of the screen for your application.
*
* @see
*
* - {@link When_I_set_viewport | When I set viewport}
*/
function When_I_set_viewport_width_height(width, height) {
cy.viewport(width, height);
}
(0, cypress_cucumber_preprocessor_1.When)('I set viewport to {int}px by {int}px', When_I_set_viewport_width_height);
//# sourceMappingURL=viewport.js.map