UNPKG

nightwatch

Version:

Easy to use Node.js based end-to-end testing solution for web applications using the W3C WebDriver API.

38 lines (37 loc) 1.08 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const ClientCommand = require('./_base-command.js'); /** * Resizes the current window. * * @example * this.demoTest = function (browser) { * browser.resizeWindow(1000, 800); * }; * * * @method resizeWindow * @param {number} width The new window width. * @param {number} height The new window height. * @param {function} [callback] Optional callback function to be called when the command finishes. * @see windowSize * @api protocol.contexts * @deprecated In favour of `.window.resize()`. */ class ResizeWindow extends ClientCommand { static get isTraceable() { return true; } performAction(callback) { const { width, height } = this; this.transportActions.setWindowSize(width, height).catch(err => { return err; }).then(result => callback(result)); } command(width, height, callback) { this.width = width; this.height = height; return super.command(callback); } } module.exports = ResizeWindow;