xUrko
xUrko

Reputation: 335

Running Nightwatch.js tests via Jenkins - Windows size issue

If I run a test manually via CMD, the window size is set as defined in the test (e.g. .resizeWindow(1680,1050)). window size via CMD

If execute the same test on the workstation via Jenkins, the window size is smaller than defined in the test (e.g. 1034x663) what causes test failures in some situations. window size via Jenkins

What could be the reason for such behaviour?

Upvotes: 0

Views: 804

Answers (3)

LasaleFamine
LasaleFamine

Reputation: 633

If you are using xvfb as virtual monitor you can try with this and expand the virtual window:

xvfb-run --server-args="-screen 0, 1900x1200x16" npm run your_nightwatch_tests

Upvotes: 0

user7813528
user7813528

Reputation:

try changing the browser to phantomJS

Upvotes: 1

ghusse
ghusse

Reputation: 3210

If an element is not visible on screen, nightwatch does not manage to click on it.

In your failing tests, you need to replace calls to

browser.click(hiddenElementSelector);

By

// Will scroll to the element
browser.moveToElement(hiddenElementSelector);
// Then nightwatch will successfully click on it
browser.click(hiddenElementSelector);

Upvotes: 0

Related Questions