Github actions make it easy to automate, customize, and execute your software development workflows such as build and tests directly from your repository.


  • Working project to test that has been pushed to Github
  • Tests run properly in your local system

Setup Guide

In this example we will be learning how to run Nightwatch tests using Github actions using the nightwatch-examples Github repo

Step 1: Install NodeJS plugin

First go to Github Actions sections of your repository and then setup NodeJS plugin by clicking on New workflow and type node in Search Workflow input box and then click on configure of Node.js plugin

NodeJS Plugin Setup

Step 2 : Configure .yml file

Now you have to write the steps inside the node.js.yml file to run your tests.

# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: Nightwatch Tests

    branches: [ "main" ]
    branches: [ "main" ]


    runs-on: ubuntu-latest

        node-version: [12.x, 14.x, 16.x]
        # See supported Node.js release schedule at https://nodejs.org/en/about/releases/

    - uses: actions/checkout@v3
    - name: Use Node.js ${{ matrix.node-version }}
      uses: actions/setup-node@v3
        node-version: ${{ matrix.node-version }}
        cache: 'npm'

    - name: npm-install
      run: npm ci
    - run: sudo apt-get install xvfb

    - name: Run Nightwatch tests
      run: xvfb-run --auto-servernum npm test -- --env chrome

Please follow the guide for the more detailed version of the .yml file.

Step 3: Push .yml file to github

Now click the commit new file button after filling out the Commit new file form accordingly.

NodeJS Plugin Setup

You can either skip the above steps and can also directly push your .yml from local. But make sure the file path should always be .github/workflow/file_name.yml.

Step 4: How to run the tests?

Once you push your changes to Github and will raise a Pull Request the pipeline will start and your tests will run automatically.

Improve this article