1

I am running UI tests using NightwatchJS v 1.1.11 and Selenoid

selenoid is hosted on a t2.micro EC2 instance(evaluation phase hence using t2.micro).

Tests randomly fail in the middle of tests for 2 main reasons:

1) socket hang up exceptions

13:10:05 tests/readOnlyProduction/palette.js POST http://xx.xx.xx.xx:4444 /wd/hub/session/87f6eb1b0b3369ba93bb9ce8c548fa89/element/0.46204216593315195-1/click - ECONNRESET

13:10:05 tests/readOnlyProduction/palette.js Error: socket hang up

13:10:05 tests/readOnlyProduction/palette.js at createHangUpError (_http_client.js:342:15)

13:10:05 tests/readOnlyProduction/palette.js at Socket.socketCloseListener (_http_client.js:377:23)

13:10:05 tests/readOnlyProduction/palette.js Error while running .clickElement() protocol action: An unknown error has occurred.

2) session timed out or not found

13:11:06 tests/readOnlyProduction/palette.js Error while running .locateMultipleElements() protocol action: Session timed out or not found

Tests are being triggered from Jenkins running against selenoid in EC2 but similar exceptions are observed when selenoid is hosted in local and tests are triggered in local.

Most importantly, this happens when tests are run in parallel while same tests works fine when run one at a time.

So far tried following, but no luck so far.

1) Adding this in nightwatch.json

"request_timeout_options": { "timeout": 100000, "retry_attempts": 3 }

2) I had lots of test cases inside single test suite, so broke into smaller tests.

srinathbharadwaj
  • 125
  • 2
  • 13

1 Answers1

0

Several things to check:

1) Check that your VM has sufficient computing resources (CPU, memory, disk). This can be usually verified using AWS CloudWatch (more on this). Our recommendation is to start with ~1.5-2 browsers per CPU core and 1 Gb RAM for every browser running in parallel.

2) Try to increase Selenoid session timeout (default is 1 minute). This could be e.g. easily done with capability:

sessionTimeout: "2m"

3) Check that you don't have any network connectivity issues, e.g. static page resources like JS and CSS blocked by firewall rules.

vania-pooh
  • 2,933
  • 4
  • 24
  • 42
  • Thank you. It worked for me with this settings. "-retry-count 3 -session-attempt-timeout 2m". **Exact command I used :** ./selenoid -conf /home/ec2-user/browsers.json -limit 10 -retry-count 3 -session-attempt-timeout 2m -log-output-dir /home/ec2-user/selenoid-logs -timeout 2m -video-recorder-image "selenoid/video-recorder:latest-release" – srinathbharadwaj Aug 02 '19 at 22:26
  • Just an additional note. It did not work for me when I ran selenoid in docker with session time out option. I was able to spin up the container but for some reason, the session time out was not considered and tests were still failing for same reason. Later, I started selenoid binary with session options and so far, it is looking good. – srinathbharadwaj Aug 02 '19 at 22:40
  • Unfortunately, I still see socket hang up exceptions and they are more in occurrence when tests are run via Jenkins. I am running out of ideas to proceed.
    Say, there is a network issue, then where would those be logged? I do not have any information yet to confidently say, there is network issue.
    – srinathbharadwaj Aug 05 '19 at 16:56