microsoft / playwright

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
https://playwright.dev
Apache License 2.0
64.95k stars 3.53k forks source link

[Question]Can I do an automation test with playwright in github actions? #926

Closed hugetiny closed 4 years ago

hugetiny commented 4 years ago

Can I do an automation test with playwright in github actions?

pavelfeldman commented 4 years ago

We run Playwright tests using GH actions with the following recipes: https://github.com/microsoft/playwright/tree/master/.github/workflows.

Note that we run both headless and headful tests, so we use xvfb, but regular Playwright customers should not need that, everything should just run headlessly.

arjunattam commented 4 years ago

Thanks @hugetiny. I created this example project that shows how to run Playwright scripts on GH Actions: https://github.com/arjun27/playwright-github-actions

FezVrasta commented 4 years ago

Thanks @arjun27 for the repository!

When I try to run my tests I get Running as root without --no-sandbox is not supported, on Firefox I get Failed to launch browser!, ideas?

name: Functional Tests

on: [push]

jobs:
  functional-chromium:
    name: Chromium Functional Tests
    runs-on: ubuntu-latest
    container:
      image: arjun27/playwright-bionic:0.1.0
    steps:
      - run: npm i -g yarn
      - uses: actions/checkout@v2
      - uses: bahmutov/npm-install@v1
      - run: node ./node_modules/playwright/install.js
      - run: yarn test:functional
        env:
          BROWSER: chromium

(this is my code: https://github.com/popperjs/popper-core/pull/990)

arjunattam commented 4 years ago

Thanks @FezVrasta, investigating this issue here: https://github.com/arjun27/playwright-github-actions/issues/1

Curiously, the error message that you are running into (Running as root without --no-sandbox is not supported) is thrown by Chromium - Firefox seems to throw a different string for me (see aforementioned issue). Would be helpful to get a confirmation just in case it's a separate issue.

arjunattam commented 4 years ago

@fezvrasta - Firefox is now working, please use arjun27/playwright-bionic:0.1.1 as the container image. Closing this issue.

FezVrasta commented 4 years ago

With that image I can't npm i -g yarn anymore. :-(

Error: EACCES: permission denied, access '/usr/lib/node_modules'