testcafe icon indicating copy to clipboard operation
testcafe copied to clipboard

Failed to find a DNS-record when monitor is turned off / sleeping

Open KingM1 opened this issue 8 years ago • 1 comments

What is your Test Scenario?

Running tests on a computer where the monitor is turned off / asleep

What is the Current behavior?

The test throws the following error:

Failed to find a DNS-record for the resource at {url} (./node_modules/testcafe/src/api/wrap-test-function.js:18:28) at (./node_modules/testcafe/src/api/wrap-test-function.js:8:5) at fn (./node_modules/testcafe/src/test-run/index.js:238:19) at TestRun._executeTestFn (./node_modules/testcafe/src/test-run/index.js:234:38) at _executeTestFn (./node_modules/testcafe/src/test-run/index.js:258:31) at TestRun._runBeforeHook (./node_modules/testcafe/src/test-run/index.js:253:29) at _runBeforeHook (./node_modules/testcafe/src/test-run/index.js:278:24)

When I run the suite of tests with the monitor on, the tests pass and fail as expected. When I run the suite of tests with the monitor off or in sleep mode, most of the tests fail with the above error. I have tested on my Mac through command line, and through jenkins build. I have also tried headless mode, but got the same results (works monitor on, fails monitor off).

We run our tests through a jenkins build on mac minis, which don't always have a monitor plugged in.

What is the Expected behavior?

Tests should be able to run properly when screen goes idle / monitor is off

Steps to Reproduce:

  1. Run a test
  2. Set computer to sleep mode
  3. Wait a few minutes, then wake the computer up
  4. Tests time out with the error described above (takes about 10 minutes to time out with the error, but if you wake it up beforehand, you can still see the browser not loading the url)

Your Environment details:

  • testcafe version: 0.21.1
  • node.js version: 8.11.1
  • browser name and version:
    ** Chrome 69.0.3497 ** HeadlessChrome 69.0.3497
  • platform and version: Mac OS X 10.12.6

KingM1 avatar Oct 19 '18 19:10 KingM1

When your Mac enters sleep mode, it disconnects all network interfaces, so TestCafe gets disconnected from the browser and throws this error. You should configure your Mac so that it will not enter the sleep mode while tests are running.

In addition, check that your Mac doesn't enter the sleep mode automatically when screen turns off in the Energy Saver settings.

To enable headless testing on a Mac server, you need to turn on automatic login and configure Apple Remote Desktop.

AndreyBelym avatar Oct 24 '18 11:10 AndreyBelym