'Nightwatch testing: Set browser to fixed size

Is there any way to ensure that the browser does not change from the initial window size. There are several things that are clicked during testing that are causing the window to maximize but i would like it to stay the same size throughout.



Solution 1:[1]

You can fix the screen size before each test like that :

module.exports = {
  tags: ['myTest'],
  before : function (browser) {
    browser.resizeWindow(800, 600);
  },
  'Test #1' : function (browser) {
    return browser
      .url('http://localhost/test1')
      .waitForElementVisible('body', 2000); 
  },
  'Test #2' : function (browser) {
    return browser
      .url('http://localhost/test2')
      .waitForElementVisible('body', 2000); 
  },
  after : function (browser) {
    browser.end();
  }
}

Solution 2:[2]

here is the firefox fix they should approve the pr, and it will work, https://github.com/nightwatchjs/nightwatch/pull/2169

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 Ilan