Merge pull request #225 from wizelineacademy/cy-tests #168
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: test | |
on: | |
push: | |
branches: | |
- dev | |
pull_request: | |
branches: | |
- dev | |
env: | |
AUTH_SECRET: ${{ secrets.AUTH_SECRET }} | |
POSTGRES_URL: ${{ secrets.POSTGRES_URL }} | |
OPENAI_KEY: ${{ secrets.OPENAI_KEY }} | |
jobs: | |
e2e-test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Git checkout | |
uses: actions/checkout@v4 | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: lts/* | |
- name: Cache Node modules | |
uses: actions/cache@v3 | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: Install Dependencies | |
run: npm ci | |
- name: Start the server | |
run: npm run dev & | |
env: | |
CYPRESS_CACHE_FOLDER: ~/.cache/Cypress | |
- name: Wait for server to be ready | |
run: npx wait-on http://localhost:3000 | |
- name: Run Cypress tests | |
uses: cypress-io/github-action@v6 | |
with: | |
browser: chrome | |
headless: true | |
env: | |
CYPRESS_CACHE_FOLDER: ~/.cache/Cypress | |
unit-test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Git checkout | |
uses: actions/checkout@v4 | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: lts/* | |
- name: Cache Node modules | |
uses: actions/cache@v3 | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: Install Dependencies | |
run: npm ci | |
- name: Run Tests | |
run: npm run test:ci |