DEV Community

rahulbhave
rahulbhave

Posted on • Updated on

Selenium Tests using GitHub action

My Workflow

This flow is created, to setup github action for running selenium Tests using headless chrome browser.

GitHub action steps:

I. Install dependencies-

name: Run Python Test
on:
  push:
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Install Python 3
        uses: actions/setup-python@v1
        with:
          python-version: 3.8
      - name: Install dependencies
        run: |
          set -ex
          wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
          sudo apt install ./google-chrome-stable_current_amd64.deb
          python -m pip install --upgrade pip
          pip install -r requirements.txt
          pip install msedge-selenium-tools
Enter fullscreen mode Exit fullscreen mode

II. Run Tests

# Execute Test
      - name: Run test 
        run: python -m pytest tests/test_form.py 
Enter fullscreen mode Exit fullscreen mode

Submission Category:

DIY Deployments

Yaml File:

name: Run Python Test
on:
  push:
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Install Python 3
        uses: actions/setup-python@v1
        with:
          python-version: 3.8
      - name: Install dependencies
        run: |
          set -ex
          wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
          sudo apt install ./google-chrome-stable_current_amd64.deb
          python -m pip install --upgrade pip
          pip install -r requirements.txt
          pip install msedge-selenium-tools
      # Execute Test
      - name: Run test
        run: python -m pytest tests/test_form.py

Enter fullscreen mode Exit fullscreen mode

Discussion (0)