WebdriverIO GitHub Actions YAML Reference Code

I am trying to run WebdriverIO with Github actions. Do you have a reference code for GitHub workflows YAML?

1 Like

Hi Tom,

Yes! Here is a complete YAML config to run WebdriverIO tests with the help of the GitHub Actions:

name: Selenium Tests Workflow

on:
  push:
    branches:
      - main  # Trigger the workflow on pushes to the 'main' branch

jobs:
  selenium_tests:
    name: Selenium Tests Job
    runs-on: ubuntu-latest

env:
  LT_USERNAME: "${{ secrets.LT_USERNAME }}"
  LT_ACCESS_KEY: "${{ secrets.LT_ACCESS_KEY }}"

steps:
  - name: Checkout Repository
    uses: actions/checkout@v2

  - name: Set up Node.js
    uses: actions/setup-node@v2
    with:
      node-version: 16

  - name: Install Dependencies
    run: npm install

  - name: Display Node.js version
    run: node -v

  - name: Install Selenium Webdriver
    run: npm install selenium-webdriver

  - name: Install WebdriverIO
    run: npm install webdriverio

  - name: Run WebdriverIO Tests
    run: npm run single

configured to run on pushes to ‘master’ branch. Set environment variables for lambdaTest credentials, check repository, install node.js and dependencies, and run WebdriverIO test using npm run single. Replace lambdaTest credentials “your_user” and lambdaaccess_key” with your real ones.

You can customize this workflow according to your project needs.

If you have additional questions or need further clarification, feel free to ask!