Closed GrayedFox closed 7 years ago
I'm afraid I'm going to go ahead and close this. Sorry for the inconvenience, but I don't think I can help you with it. What you are describing is a very complicated scenario and one that is extremely hard to reproduce. I think it's up to you to continue debugging this and if there's a more concrete issue which needs fixing in Nightwatch, please open a new ticket and reference this one.
You might also get more help by posting on the Mailing List.
The solution we went with was containerisation. Honestly, I understand why you would close this - this thing was a nightmare of a bug which comes from having local and remote machines differing in various ways which are unseemly and difficult to spot.
Go Docker.
I believe I have the same issue - I'm using workers on a docker container and running my tests on CircleCI.
OK. 112 total assertions passed. (2m 22s)
Exited with code 1
Nightwatch exits for some weird reasons without running all of the assertions (I have no failing assertions)
Any solutions? :cry:
After much debugging and combing through massive amounts of selenium server output and node debugging (of http with NODE_DEBUG=http flag set), I think I've narrowed down this problem to being one with Nightwatch.
Unfortunately, running tests on our CI server via Jenkins has proved that using
test_workers
is inherently unstable. The output is unfortunately not helpful, as the behaviour is that a test will begin and then finish without running any assertions (and without any other output from that test) which will result in the build failing. All the extra output from verbose logging andNODE_DEBUG
being set also just pollutes the log, without any persistent errors appearing.The most annoying part is that this error never manifests locally - on my Mac, my colleague's Linux (Ubuntu LTS) machine, or any of our other team members (6 people with different workstations) ever experience this issue. It's just when trying to get NW to run inside our CI process with Jenkins.
nightwatch.json:
The (not very useful and long) output:
Notice how the
homePagePartnerLogos
test finishes a long time after it was started (at the top of the log) without any other output? This is the essential problem. A random (sometimes several) tests will fail in this same way - they will start, other tests will run and pass in between, and then the tests started before will finish without any output. Nothing in any of the extra debug info indicates anything out of the ordinary - (no errors, no warnings - just INFO level logs).Extra Info During our debugging I found some other annoying bugs which I will link here in case it helps others:
be careful when archiving artifacts with Jenkins, it can silently fail your build: https://issues.jenkins-ci.org/browse/JENKINS-38005
if starting your selenium server manually (and not using the built in nightwatch way) you may run into this bug: https://github.com/seleniumhq/selenium-google-code-issue-archive/issues/2492. I tried using
pkill java
as a workaround but this only sometimes worked - luckily - Nightwatch seems to handle the cleanup of selenium properly and I do not experience this bug if allowing Nightwatch to manage selenium.Still having (maybe 2 from 5 builds) failures due to this: https://github.com/nightwatchjs/nightwatch/issues/1083. Not sure what to do here, except wait for a fix - would really appreciate feedback for a workaround - will ask our infrastructure guys if we can reinstall java on the Jenkin's machines, based on comments on that thread. Now trying this workaround: http://stackoverflow.com/questions/41487659/nightwatch-selenium-socket-hang-up