Skip to content

Commit

Permalink
feat(test): create a workflow call for prod and ci
Browse files Browse the repository at this point in the history
  • Loading branch information
bryanlewicki committed Jun 24, 2024
1 parent c9d81b5 commit b7611f0
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 44 deletions.
48 changes: 8 additions & 40 deletions .github/workflows/cypress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,43 +3,11 @@ name: Cypress Tests
on: push

jobs:
cypress-run:
runs-on: ubuntu-22.04
env:
VITE_LOGIN_URL: https://openai.ki.fh-swf.de/api/login
VITE_API_BASE_URL: https://openai.ki.fh-swf.de/api/v1
VITE_USER_URL: https://openai.ki.fh-swf.de/api/user
CYPRESS_USER_NAME: "${{ secrets.CYPRESS_USER_NAME }}"
CYPRESS_USER_PASSWORD: "${{ secrets.CYPRESS_USER_PASSWORD }}"
LANGUAGE: de
container:
image: cypress/browsers:node-20.9.0-chrome-118.0.5993.88-1-ff-118.0.2-edge-118.0.2088.46-1
options: --user 1001
steps:
- name: Checkout
uses: actions/checkout@v4

# Install npm dependencies, cache them correctly
# and run all Cypress tests
- name: Cypress run
uses: cypress-io/github-action@v6
with:
build: npm ci
start: npm start
browser: chrome
spec: cypress/e2e/uiTest.cy.js
record: false

- uses: actions/upload-artifact@v4
# add the line below to store screenshots only on failures
if: failure()
with:
name: cypress-screenshots
path: cypress/screenshots
if-no-files-found: ignore # 'warn' or 'error' are also available, defaults to `warn`
- uses: actions/upload-artifact@v4
if: always()
with:
name: cypress-videos
path: cypress/videos
if-no-files-found: warn # 'warn' or 'error' are also available, defaults to `warn`
cypress-run-ci:
uses: ./.github/workflows/testing_workflow.yml
with:
TESTENV: ci
cypress-run-prod:
uses: ./.github/workflows/testing_workflow.yml
with:
TESTENV: prod
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
name: Cypress Tests Prod
name: Cypress Test Workflow

on: push
on:
workflow_call:
inputs:
TESTENV:
description: 'The test environment'
required: true
type: string

jobs:
cypress-run:
runs-on: ubuntu-22.04
env:
TESTENV: ${{ inputs.TESTENV }}
VITE_LOGIN_URL: https://openai.ki.fh-swf.de/api/login
VITE_API_BASE_URL: https://openai.ki.fh-swf.de/api/v1
VITE_USER_URL: https://openai.ki.fh-swf.de/api/user
CYPRESS_USER_NAME: "${{ secrets.CYPRESS_USER_NAME }}"
CYPRESS_USER_PASSWORD: "${{ secrets.CYPRESS_USER_PASSWORD }}"
LANGUAGE: de
TESTENV: "PROD"

container:
image: cypress/browsers:node-20.9.0-chrome-118.0.5993.88-1-ff-118.0.2-edge-118.0.2088.46-1
options: --user 1001
Expand All @@ -25,6 +32,8 @@ jobs:
- name: Cypress run
uses: cypress-io/github-action@v6
with:
build: npm ci
start: npm start
browser: chrome
spec: cypress/e2e/uiTest.cy.js
record: false
Expand All @@ -41,4 +50,4 @@ jobs:
with:
name: cypress-videos
path: cypress/videos
if-no-files-found: warn # 'warn' or 'error' are also available, defaults to `warn`
if-no-files-found: warn # 'warn' or 'error' are also available, defaults to `warn`

0 comments on commit b7611f0

Please sign in to comment.