Lambdatest + Github Actions + Playwright possible?

Hello I have been using Lambdatest for about a month and loving it!

I have been able to integrate Lambdatest with Playwright in Typescript and runs no problem from my command line from my Ubuntu machine but I don’t seem to be able to run the same set of tests and lambdatest setup to run from Github Actions manually.

Has anybody here able to setup Github Actions workflow yaml file working with Playwright?

Once setup I can run Github Action workflow either manually or periodically and test results are stored in Lambdatest for better reference.

I’m not quite there yet but wondering anybody here got it working…

1 Like

Hello @amano ! Thanks for your kind feedback. Yes, we can setup Github Actions workflow for running Playwright tests on LambdaTest.

Please follow the steps given:

  1. Add the user and access key to your repository secrets. Go to https://github.com/<Github Repo>/settings/secrets/actions. Add the following secrets:
    1. LT_USERNAME: Your LambdaTest username.
    2. LT_ACCESS_KEY: Your LambdaTest access key. You can get it from https://automation.lambdatest.com.
  2. Add a script in your package.json file to run the Playwright tests. e.g.
.
.
 "scripts": {
    "test": "npx playwright test --config=./playwright.config.js"
  }
  1. Add the following workflow file in your repository at .github/workflows/tests
name: Tests

on:
  # Add the triggers as required
  push:
    branches:
      - '**'

  pull_request:
    branches:
      - '**'
  schedule:
    # * is a special character in YAML so you have to quote this string
    # This example triggers the workflow every day at 6:00 and 18:00 UTC:
    - cron:  '0 6,18 * * *'

jobs:
  tests:
    runs-on: ubuntu-latest
    env:
      LT_USERNAME: ${{ secrets.LT_USERNAME }}
      LT_ACCESS_KEY: ${{ secrets.LT_ACCESS_KEY }}

    strategy:
      matrix:
        # Specify as per the service requirements
        node-version: [14.x]

    steps:
      - uses: actions/checkout@v2
      - name: Use Node.js ${{ matrix.node-version }}
        uses: actions/setup-node@v1
        with:
          node-version: ${{ matrix.node-version }}
      - run: npm install
      - run: npm run build --if-present
      - run: npm run test

Your tests will run as per the triggers defined and the test results can be viewed on the LambdaTest dashboard. Let us know if you face any issues in the integration.

2 Likes