Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

378-cypress-in-ci #379

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion .github/workflows/build-test-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,33 @@ jobs:
webTarget: web
cypress:
runs-on: ubuntu-22.04
# Runs tests in parallel with matrix strategy https://docs.cypress.io/guides/guides/parallelization
strategy:
fail-fast: false # https://github.com/cypress-io/github-action/issues/48
matrix:
containers: [1, 2] # Uses 2 parallel instances
environment:
name: Production
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Cypress e2e
uses: cypress-io/github-action@v6
with:
start: yarn start
wait-on: 'http://localhost:3000'
command: yarn cypress:headless:e2e
record: false
parallel: true
env:
# For recording and parallelization to work you must set your CYPRESS_RECORD_KEY
# in GitHub repo → Settings → Secrets → Actions
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
# Creating a token https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NEXTAUTH_SECRET: ${{ secrets.NEXTAUTH_SECRET }}
NEXTAUTH_URL: ${{ secrets.NEXTAUTH_URL }}
NEXT_PUBLIC_TOKEN: ${{ secrets.NEXT_PUBLIC_TOKEN }}
TEST_SESSION_COOKIE: ${{ secrets.TEST_SESSION_COOKIE }}
eslint:
needs: build
uses: scientist-softserv/actions/.github/workflows/[email protected]
Expand Down
1 change: 1 addition & 0 deletions cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ module.exports = defineConfig({
TEST_SCIENTIST_USER: '[email protected]',
TEST_SESSION_COOKIE: process.env.TEST_SESSION_COOKIE,
},
projectId: '6wuou2',
reporter: 'junit',
reporterOptions: {
mochaFile: 'cypress/results/results-[hash].xml',
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"scripts": {
"build": "next build",
"cypress:e2e": "start-server-and-test dev http://localhost:3000 \"cypress open --e2e --browser electron\"",
"cypress:e2e:ci": "next build && start-server-and-test dev http://localhost:3000 \"cypress run --record --e2e --browser electron --key 9f881837-3cd6-48bb-b8dd-a3c085e2ce6c\"",
"cypress:headless:e2e": "start-server-and-test dev http://localhost:3000 \"cypress run --e2e --browser electron\"",
"dev": "next dev",
"lint": "next lint --dir pages --dir utils --dir cypress/e2e",
Expand Down
Loading