testem: with latest chrome, browser is just exiting

not ok 1 Chrome - error
    ---
        message: >
            Error: Browser exited unexpectedly
            Non-zero exit code: null
            Stderr: 
             [0428/112152.254909:ERROR:resource_bundle.cc(767)] Failed to load /Applications/Google Chrome.app/Contents/Versions/58.0.3029.81/Google Chrome Framework.framework/Versions/A/resources.pak
            Some features may not be available.
            
            
        Log: |
            { type: 'error', text: 'Error: Browser exited unexpectedly' }
            { type: 'error', text: 'Non-zero exit code: null' }
            { type: 'error',
              text: '[0428/112152.254909:ERROR:resource_bundle.cc(767)] Failed to load /Applications/Google Chrome.app/Contents/Versions/58.0.3029.81/Google Chrome Framework.framework/Versions/A/resources.pak\nSome features may not be available.\n' }

anyone have any ideas why this happens?

About this issue

  • Original URL
  • State: open
  • Created 7 years ago
  • Comments: 17 (2 by maintainers)

Most upvoted comments

I’m on testem@2.0.0 and I couldn’t get Chrome headless to work locally or on travis until finding @joppa27’s post. Since phantomjs is now unmaintained, it seems like a headless guide that incorporates these flags & packages would be really useful in the README/docs. Do folks agree?

Also crashing with the following output:

DEPRECATION: An addon is trying to access project.nodeModulesPath. This is not a reliable way to discover npm modules. Instead, consider doing: require("resolve").sync(something, { basedir: project.root }). Accessed from:   DependencyVersionChecker.NPMDependencyVersionChecker (/data/app/kochiku-worker/shared/build-partition/sq/invoice-fe/node_modules/ember-try/node_modules/ember-cli-version-checker/src/npm-dependency-version-checker.js:11:32)
Could not start watchman
Visit https://ember-cli.com/user-guide/#watchman for more info.
ember-cli-sentry will not be loaded from bower installation
cleaning up...
Built project successfully. Stored in "/data/app/kochiku-worker/shared/build-partition/sq/invoice-fe/tmp/class-tests_dist-f4XmztuR.tmp".
not ok 1 Chrome - error
    ---
        message: >
            Error: Browser failed to connect within 30s. testem.js not loaded?
            Stderr: 
             [0515/184532.964775:ERROR:gpu_process_transport_factory.cc(1007)] Lost UI shared context.
            
            DevTools listening on ws://127.0.0.1:46394/devtools/browser/f1139e46-5dbf-4b0e-8791-2739c68e27c2
            Fontconfig warning: "/etc/fonts/fonts.conf", line 146: blank doesn't take any effect anymore. please remove it from your fonts.conf
            
            
        Log: |
            { type: 'error',
              text: 'Error: Browser failed to connect within 30s. testem.js not loaded?' }
            { type: 'error',
              text: '[0515/184532.964775:ERROR:gpu_process_transport_factory.cc(1007)] Lost UI shared context.\n\nDevTools listening on ws://127.0.0.1:46394/devtools/browser/f1139e46-5dbf-4b0e-8791-2739c68e27c2\nFontconfig warning: "/etc/fonts/fonts.conf", line 146: blank doesn\'t take any effect anymore. please remove it from your fonts.conf\n' }
    ...

1..1
# tests 1
# pass  0
# skip  0
# fail  1
Testem finished with non-zero exit code. Tests failed.

Using the following flags:

args: [
        "--headless",
        "--disable-gpu",
        "--remote-debugging-port=9222",
        "--remote-debugging-address=0.0.0.0",
        "--no-sandbox",
        "--user-data-dir=/tmp"
      ]

seeing a similar error in travis: https://travis-ci.org/poteto/ember-pipeline/jobs/223030769

Update @jonathanong got past that error in travis!! Pretty much just copied the packages installed in this image: https://github.com/alpeware/chrome-headless-stable/blob/master/Dockerfile#L8

my travis.yml packages now looks like this: https://github.com/joppa27/ember-pipeline/blob/more-params/.travis.yml#L16-L24

 packages:
      - google-chrome-stable
      - libnss3 
      - libnss3-tools 
      - libfontconfig1 
      - wget 
      - ca-certificates 
      - apt-transport-https 
      - inotify-tools

testem.js has these browser_args: https://github.com/joppa27/ember-pipeline/blob/more-params/testem.js

  "browser_args": {
    "Chrome": [
      "--headless",
      "--disable-gpu",
      "--remote-debugging-port=9222",
      "--remote-debugging-address=0.0.0.0",
      "--no-sandbox",
      "--user-data-dir=/tmp"
    ]
}

see the passing run in travis here: https://travis-ci.org/poteto/ember-pipeline/builds/236777062?utm_source=github_status&utm_medium=notification

https://github.com/poteto/ember-pipeline/pull/12

@joppa27 Thanks! I’ve changed my testem.js:

"browser_args": {
    "Chrome": [
      "--headless",
      "--disable-gpu",
      "--remote-debugging-port=9222",
      "--remote-debugging-address=0.0.0.0",
      "--no-sandbox",
      "--user-data-dir=/tmp"
    ]
}

and now it works fine

I’m seeing the same issue when trying to create a screenshot from these instructions https://developers.google.com/web/updates/2017/04/headless-chrome .

$ alias chrome="/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome"
$ chrome --headless --screenshot --window-size=1280,1696 https://www.chromestatus.com/
[0501/145304.402983:ERROR:resource_bundle.cc(767)] Failed to load /Applications/Google Chrome.app/Contents/Versions/58.0.3029.81/Google Chrome Framework.framework/Versions/A/resources.pak
Some features may not be available.
[0501/145304.442912:WARNING:dns_config_service_posix.cc(154)] dns_config has unhandled options!
[1]    56398 segmentation fault  /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --headless

I still see this issue, but removing the --disable-software-rasterizer option from Chrome seems to fix the issue.

I went to about:gpu in Chrome (with direct launch of Chrome.app and with the testem launcher) and compared the results and I see that the one with testem is launched like this:

with --disable-software-rasterizer option in testem config

Command Line	/Applications/Google Chrome.app/Contents/MacOS/Google Chrome --user-data-dir=/var/folders/rx/sck1q_1s6q956kjxpny3jv4r0000gn/T/testem-24785410789419-M28j1i --no-default-browser-check --no-first-run --ignore-certificate-errors --test-type --disable-renderer-backgrounding --disable-background-timer-throttling --flag-switches-begin --flag-switches-end http://localhost:7357/24785410789419/tests/index.html?hidepassed&filter=home%20page

normal Chrome launch from Applications:

Command Line	/Applications/Google Chrome.app/Contents/MacOS/Google Chrome --flag-switches-begin --flag-switches-end

This is kind of confusing because that disable option doesn’t even seem to be passed to Chrome when launching, but maybe this means something more to someone else?

I’m on 76.0.3809.100 on a 13" macbook pro.

--headless is only supported in Chrome 59 and higher on Linux and macOS. Chrome 58 is not supported (although I seem to recall that it works on Linux).

Chrome 59 is currently on the beta channel.