bitovi / testee

Automated cross-browser JavaScript testing made easy
https://www.npmjs.com/package/testee
MIT License
119 stars 27 forks source link

testee hangs with chrome on travis #103

Open justinbmeyer opened 7 years ago

justinbmeyer commented 7 years ago

Here's my travis configuration

sudo: false
dist: trusty
language: node_js
node_js: node
addons:
  apt:
    packages:
      - google-chrome-stable
before_script:
  - export DISPLAY=:99.0
  - sh -e /etc/init.d/xvfb start &
- sleep 3

But the build never exits despite saying the single test has passed:

cursor_and_build__22_-_canjs_can-ndjson-stream_-_travis_ci
justinbmeyer commented 7 years ago

Local output:

npm run testee

> can-ndjson-stream@0.0.0 testee /Users/justin/dev/can-ndjson-stream
> DEBUG=testee:* testee test.html --browsers chrome

  testee:main running test for +0ms [ 'test.html' ] [ 'chrome' ] { browsers: 'chrome' }
  testee:main bootstrapping Testee +11ms
  testee:main starting Testee server +1ms { browsers: 'chrome',
  port: 3996,
  root: '/Users/justin/dev/can-ndjson-stream',
  reporter: 'Dot',
  adapter: '/testee/',
  timeout: 120,
  delay: 1000,
  tunnel: { type: 'local', port: 3996 },
  launch: { type: 'local' } }
  testee:server initializing Feathers API +1ms
  testee:hosting intializing static file server +33ms /Users/justin/dev/can-ndjson-stream
  testee:main testee server started and listening +15ms
  testee:main hooking up services to Mocha reporter +0ms
  testee:reporter setting up Mocha command line reporter +0ms
  testee:reporter start +2ms

  testee:main starting up localhost tunnel +0ms { type: 'local', port: 3996 }
  testee:main localhost tunnel started on +0ms http://localhost:3996
  testee:main using browser launcher +1ms local { type: 'local' }
  testee:main browser launcher initialized +1ms
  testee:main setting up test runner +0ms
  testee:main server bootstrapped, running tests. +0ms
  testee:runner running tests for +0ms [ 'test.html' ] [ 'chrome' ]
  testee:runner initializing sequential test runs for browser +1ms chrome
  testee:runner running individual test +2ms http://localhost:3996/test.html?__token=ocoa4i { browser: 'chrome' }
  testee:runner browser instance started +40ms { browser: 'chrome' }
  testee:runner tracking test run +1ms http://localhost:3996/test.html?__token=ocoa4i { browser: 'chrome' }
  testee:html-injector injecting scripts into file +885ms /test.html?__token=ocoa4i
  testee:html-injector injecting scripts into file +342ms /favicon.ico
  testee:reporter starting run +260ms { status: 'running',
  file: 'http://localhost:3996/test.html?__token=ocoa4i',
  id: '25a10a7a1c013f0931c2e553c9612415',
  environment: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36',
  runner: 'QUnit',
  time: 1488057890998 }
  testee:runner checking if browser timeout can be reset +6ms http://localhost:3996/test.html?__token=ocoa4i true
  testee:reporter starting suite +2ms { status: 'running',
  file: 'http://localhost:3996/test.html?__token=ocoa4i',
  title: 'can-ndjson-stream',
  root: true,
  id: '54b200dab4183053ec1ff56d6a74922a',
  parent: '25a10a7a1c013f0931c2e553c9612415' }
  testee:reporter starting suite +2ms { status: 'running',
  file: 'http://localhost:3996/test.html?__token=ocoa4i',
  title: 'can-ndjson-stream',
  parent: '54b200dab4183053ec1ff56d6a74922a',
  id: '7a587c27476530dc375d04bea1b489e3' }
  testee:reporter starting suite +1ms { status: 'running',
  file: 'http://localhost:3996/test.html?__token=ocoa4i',
  title: 'Initialized the plugin',
  parent: '7a587c27476530dc375d04bea1b489e3',
  id: '1c695e725733679069c8680787cc02ea' }
  testee:reporter starting test +2ms { file: 'http://localhost:3996/test.html?__token=ocoa4i',
  id: '294ceea520e66b750eff9589c989ec61',
  title: 'okay',
  parent: '1c695e725733679069c8680787cc02ea' }
  testee:reporter updating test +2ms { file: 'http://localhost:3996/test.html?__token=ocoa4i',
  id: '294ceea520e66b750eff9589c989ec61',
  title: 'okay',
  parent: '1c695e725733679069c8680787cc02ea',
  status: 'passed',
  state: 'passed' }

  ․  testee:reporter updating suite +1ms { status: 'finished',
  file: 'http://localhost:3996/test.html?__token=ocoa4i',
  title: 'Initialized the plugin',
  parent: '7a587c27476530dc375d04bea1b489e3',
  id: '1c695e725733679069c8680787cc02ea' }
  testee:reporter updating suite +2ms { status: 'finished',
  file: 'http://localhost:3996/test.html?__token=ocoa4i',
  title: 'can-ndjson-stream',
  parent: '54b200dab4183053ec1ff56d6a74922a',
  id: '7a587c27476530dc375d04bea1b489e3',
  total: 1,
  failed: 0 }
  testee:reporter updating suite +1ms { status: 'finished',
  file: 'http://localhost:3996/test.html?__token=ocoa4i',
  title: 'can-ndjson-stream',
  root: true,
  id: '54b200dab4183053ec1ff56d6a74922a',
  parent: '25a10a7a1c013f0931c2e553c9612415' }
  testee:reporter updating run +1ms { status: 'finished',
  file: 'http://localhost:3996/test.html?__token=ocoa4i',
  id: '25a10a7a1c013f0931c2e553c9612415',
  environment: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36',
  runner: 'QUnit',
  time: 1488057890998,
  tests: [],
  passed: 1,
  total: 1,
  failed: 0,
  runtime: 6 }
  testee:runner checking if run +0ms http://localhost:3996/test.html?__token=ocoa4i is finished true
  testee:runner stopping browser instance +1ms { browser: 'chrome' }
  testee:main shutting down reporter +335ms
  testee:reporter end +1ms
  testee:reporter reportErrors +1ms 0

  1 passing (2s)

  testee:main closing server +3ms

Travis Run

build

> DEBUG=testee:* testee test.html --browsers chrome

  testee:main running test for +0ms [ 'test.html' ] [ 'chrome' ] { browsers: 'chrome' }

  testee:main bootstrapping Testee +6ms

  testee:main starting Testee server +2ms { browsers: 'chrome',

  port: 3996,

  root: '/home/travis/build/canjs/can-ndjson-stream',

  reporter: 'Dot',

  adapter: '/testee/',

  timeout: 120,

  delay: 1000,

  tunnel: { type: 'local', port: 3996 },

  launch: { type: 'local' } }

  testee:server initializing Feathers API +1ms

  testee:hosting intializing static file server +41ms /home/travis/build/canjs/can-ndjson-stream

  testee:main testee server started and listening +17ms

  testee:main hooking up services to Mocha reporter +1ms

  testee:reporter setting up Mocha command line reporter +0ms

  testee:reporter start +0ms

  testee:main starting up localhost tunnel +1ms { type: 'local', port: 3996 }

  testee:main localhost tunnel started on +1ms http://localhost:3996

  testee:main using browser launcher +0ms local { type: 'local' }

  testee:main browser launcher initialized +2ms

  testee:main setting up test runner +0ms

  testee:main server bootstrapped, running tests. +0ms

  testee:runner running tests for +1ms [ 'test.html' ] [ 'chrome' ]

  testee:runner initializing sequential test runs for browser +1ms chrome

  testee:runner running individual test +4ms http://localhost:3996/test.html?__token=b1ej11 { browser: 'chrome' }

  testee:runner browser instance started +105ms { browser: 'chrome' }

  testee:runner tracking test run +1ms http://localhost:3996/test.html?__token=b1ej11 { browser: 'chrome' }

  testee:runner Xlib:  extension "RANDR" missing on display ":99.0".

 +184ms http://localhost:3996/test.html?__token=b1ej11 { browser: 'chrome' }

  testee:runner [2542:2564:0225/212648.828985:ERROR:bus.cc(427)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/system_bus_socket: Connection refused

 +47ms http://localhost:3996/test.html?__token=b1ej11 { browser: 'chrome' }

  testee:runner Xlib:  extension "RANDR" missing on display ":99.0".

 +2ms http://localhost:3996/test.html?__token=b1ej11 { browser: 'chrome' }

  testee:runner [2597:2597:0225/212649.134262:ERROR:sandbox_linux.cc(343)] InitializeSandbox() called with multiple threads in process gpu-process. 

 +303ms http://localhost:3996/test.html?__token=b1ej11 { browser: 'chrome' }

  testee:runner [2542:2576:0225/212649.195057:ERROR:browser_gpu_channel_host_factory.cc(125)] Failed to create channel.

 +62ms http://localhost:3996/test.html?__token=b1ej11 { browser: 'chrome' }

  testee:runner [2542:2576:0225/212649.208182:ERROR:browser_gpu_channel_host_factory.cc(125)] Failed to create channel.

 +12ms http://localhost:3996/test.html?__token=b1ej11 { browser: 'chrome' }

  testee:runner [2542:2576:0225/212649.269317:ERROR:browser_gpu_channel_host_factory.cc(125)] Failed to create channel.
 +65ms http://localhost:3996/test.html?__token=b1ej11 { browser: 'chrome' }
  testee:html-injector injecting scripts into file +17ms /test.html?__token=b1ej11
  testee:runner [2542:2576:0225/212649.293973:ERROR:browser_gpu_channel_host_factory.cc(125)] Failed to create channel.
 +21ms http://localhost:3996/test.html?__token=b1ej11 { browser: 'chrome' }
  testee:runner [2542:2576:0225/212649.316563:ERROR:browser_gpu_channel_host_factory.cc(125)] Failed to create channel.
 +12ms http://localhost:3996/test.html?__token=b1ej11 { browser: 'chrome' }
  testee:html-injector injecting scripts into file +552ms /favicon.ico
  testee:reporter starting run +745ms { status: 'running',
  file: 'http://localhost:3996/test.html?__token=b1ej11',
  id: '76c25cab4e0019ea1639cab75ddb85cf',
  environment: 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36',
  runner: 'QUnit',
  time: 1488058010602 }
  testee:runner checking if browser timeout can be reset +12ms http://localhost:3996/test.html?__token=b1ej11 true
  testee:reporter starting suite +50ms { status: 'running',
  file: 'http://localhost:3996/test.html?__token=b1ej11',
  title: 'can-ndjson-stream',
  root: true,
  id: '9d403457d721750bf0bd6ecd10a8b3f0',
  parent: '76c25cab4e0019ea1639cab75ddb85cf' }
  testee:reporter starting suite +12ms { status: 'running',
  file: 'http://localhost:3996/test.html?__token=b1ej11',
  title: 'can-ndjson-stream',
  parent: '9d403457d721750bf0bd6ecd10a8b3f0',
  id: 'd483d3d67d4b2937588c8723bd16cc79' }
  testee:reporter starting suite +10ms { status: 'running',
  file: 'http://localhost:3996/test.html?__token=b1ej11',
  title: 'Initialized the plugin',
  parent: 'd483d3d67d4b2937588c8723bd16cc79',
  id: '23a293ca53a5c94195d1ce0ff1250c64' }
  testee:reporter starting test +6ms { file: 'http://localhost:3996/test.html?__token=b1ej11',
  id: 'dad8cb6290f9dc2ad7ce156e616b6bc6',
  title: 'okay',
  parent: '23a293ca53a5c94195d1ce0ff1250c64' }
  testee:reporter updating test +10ms { file: 'http://localhost:3996/test.html?__token=b1ej11',
  id: 'dad8cb6290f9dc2ad7ce156e616b6bc6',
  title: 'okay',
  parent: '23a293ca53a5c94195d1ce0ff1250c64',
  status: 'passed',
  state: 'passed' }

․  testee:reporter updating suite +17ms { status: 'finished',
  file: 'http://localhost:3996/test.html?__token=b1ej11',
  title: 'Initialized the plugin',
  parent: 'd483d3d67d4b2937588c8723bd16cc79',
  id: '23a293ca53a5c94195d1ce0ff1250c64' }
  testee:reporter updating suite +3ms { status: 'finished',
  file: 'http://localhost:3996/test.html?__token=b1ej11',
  title: 'can-ndjson-stream',
  parent: '9d403457d721750bf0bd6ecd10a8b3f0',
  id: 'd483d3d67d4b2937588c8723bd16cc79',
  failed: 0,
  total: 1 }
  testee:reporter updating suite +2ms { status: 'finished',
  file: 'http://localhost:3996/test.html?__token=b1ej11',
  title: 'can-ndjson-stream',
  root: true,
  id: '9d403457d721750bf0bd6ecd10a8b3f0',
  parent: '76c25cab4e0019ea1639cab75ddb85cf' }
  testee:reporter updating run +20ms { status: 'finished',
  file: 'http://localhost:3996/test.html?__token=b1ej11',
  id: '76c25cab4e0019ea1639cab75ddb85cf',
  environment: 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36',
  runner: 'QUnit',
  time: 1488058010602,
  failed: 0,
  passed: 1,
  total: 1,
  runtime: 16,
  tests: [] }
  testee:runner checking if run +1ms http://localhost:3996/test.html?__token=b1ej11 is finished true
  testee:runner stopping browser instance +0ms { browser: 'chrome' }
  testee:main shutting down reporter +2ms

  testee:reporter end +0ms
  testee:reporter reportErrors +1ms 0

  1 passing (2s)

  testee:main closing server +2ms
andrejewski commented 7 years ago

I experience a similar thing on Firefox (v52.0.2), the tests complete but the browser does not close and the process hangs indefinitely.

OS: macOS 10.11.6

m-a-n-i-s-h commented 5 years ago

Has anyone actually solved the issue? I am running the predefined code used by testee-npm. I have testee.json and running it using DEBUG=testee:* testee test.html --config=test.json But I want to exit after the browser is shutdown .i.e. testee:runner stopping browser instance { browser: 'chromium',args: [ '--headless', '--disable-gpu', '--remote-debugging-port=9222' ] } +1ms

testee:runner tracking test run http://localhost:3621/test.html?__token=cnpg77 { browser: 'chromium', args: [ '--headless', '--disable-gpu', '--remote-debugging-port=9222' ] } +1ms testee:runner [0617/112021.260975:ERROR:zygote_host_impl_linux.cc(89)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180. testee:runner http://localhost:3621/test.html?__token=cnpg77 { browser: 'chromium', args: [ '--headless', '--disable-gpu', '--remote-debugging-port=9222' ] } +46ms testee:runner test http://localhost:3621/test.html?__token=cnpg77 timed out +8s testee:runner stopping browser instance { browser: 'chromium', args: [ '--headless', '--disable-gpu', '--remote-debugging-port=9222' ] } +1ms

chasenlehara commented 5 years ago

@m-a-n-i-s-h That error looks like you need to add the --no-sandbox flag to args. See this bit in the readme for an example: https://github.com/bitovi/testee#browsers

m-a-n-i-s-h commented 5 years ago

@chasenlehara Thank you. It helped.