mujo-code / puppeteer-headful

Github Action for puppeteer that is headful.
MIT License
100 stars 43 forks source link

Job fails with `Cannot open display` #7

Closed stefanbuck closed 5 years ago

stefanbuck commented 5 years ago

Hi,

I want to use this GitHub action to test a chrome extension. I set headless to false according to the docs as well as the env var PUPPETEER_EXEC_PATH. However, the job is failing with the following error message.

(chrome:6378): Gtk-WARNING **: 18:44:16.028: cannot open display: 
Error: Failed to launch chrome!

It seems like PUPPETEER_EXEC_PATH is not defined. Any idea what is missing? I tried to find other repositories which are using this action, but nothing showed up in the GitHub search. I also set PUPPETEER_EXEC_PATH to google-chrome-stable, but it keeps failing

This is how my workflow file looks like

name: Node CI
on: [push, pull_request]
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v1
    - uses: actions/setup-node@v1
      with:
        node-version: '10.x'
    - run: npm ci
    - run: npm run build
    - name: Run E2E
      uses: mujo-code/puppeteer-headful@master
      env:
        CI: true
        PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true
    - run: npm run e2e

This is the related PR https://github.com/OctoLinker/OctoLinker/pull/662/

jcblw commented 5 years ago

Hey there, @stefanbuck

This is the place I am using this action https://github.com/mujo-code/source/blob/master/.github/workflows/push.yml#L32

and here is the configuration of puppeteer https://github.com/mujo-code/source/blob/master/packages/extension/src/e2e.test.js#L19

The only thing that jumps out to me is the different passing of args. I pass it in a with block. Let me know if that working and I can update the documentation around this.

stefanbuck commented 5 years ago

Right after opening this issue I spotted this as well. Thanks for confirming this and I'll let you know if this works.

stefanbuck commented 5 years ago

This works, but only if I use test to issue a npm test command. In my case I want to use npm run e2e so set args to run e2e. This seems to be cut off on the whitespace.

jcblw commented 5 years ago

yup! left a comment over on the other repo.

https://github.com/OctoLinker/OctoLinker/pull/662#pullrequestreview-295908805

I think your use case is more common so I am open to changing the way the command is executed.

stefanbuck commented 5 years ago

I just pushed a commit with args: '"run e2e"' which should work, but it looks super weird 😆

stefanbuck commented 5 years ago

What about decoupling this from npm so you can pass every command like npm test, npm run whatever or even run.sh?

jcblw commented 5 years ago

Seems like that run failed. I am also up for that. I am not sure who all is using it. I know if we switch to just a running a sh script that will bust any existing. that being said I do thing that is probably the right direction.

stefanbuck commented 5 years ago

Here we go https://github.com/mujo-code/puppeteer-headful/pull/9

jcblw commented 5 years ago

@stefanbuck I merged it thanks again, I think you can run it off master. Let me know if you need a release setup to try.