Skip to content

Commit

Permalink
Merge pull request #15 from pepfar-datim/cypress-ci-testing
Browse files Browse the repository at this point in the history
test: add cypress tests to CI
  • Loading branch information
plinnegan authored Sep 20, 2024
2 parents ff1e0fb + e1deb16 commit 5f371fb
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 1 deletion.
48 changes: 48 additions & 0 deletions .github/workflows/cypress-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Run Cypress tests on pull requests to main

on:
pull_request:
branches:
- main

jobs:
cypress-tests:
runs-on: ubuntu-latest
env:
DEV_AUTH: ${{ secrets.DEV_AUTH }}
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Setup node.js
uses: actions/setup-node@v3
with:
node-version: '20'

- name: Cache Node.js modules
uses: actions/cache@v3
with:
path: ~/.npm # The directory to cache (this is for npm; use "node_modules" if you're not using a global cache)
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} # Cache key based on OS and lock file
restore-keys: |
${{ runner.os }}-node- # Fallback if an exact match is not found
- name: Install dependencies
run: npm install

- name: Setup temp build
run: make

- name: Start dev server
run: npm start &

- name: Run Cypress tests
run: npx cypress run

- name: Upload Cypress artifacts
if: failure()
uses: actions/upload-artifact@v3
with:
name: cypress-artifacts
path: cypress/screenshots/cypress/videos

2 changes: 1 addition & 1 deletion cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const { defineConfig } = require("cypress");
module.exports = defineConfig({
video: true,
e2e: {
baseUrl: 'http://127.0.0.1:8081',
baseUrl: 'http://127.0.0.1:8080',
viewportWidth: 1400,
viewportHeight: 900,
setupNodeEvents(on, config) {
Expand Down

0 comments on commit 5f371fb

Please sign in to comment.