Skip to content

Commit

Permalink
fixing cypress tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tfhuhtal committed Sep 3, 2024
1 parent 4a5a95d commit 662a9e2
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 62 deletions.
117 changes: 58 additions & 59 deletions .github/workflows/feature_branches.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,72 +5,71 @@ on:
branches-ignore: ['master']

jobs:
#tests:
# strategy:
# fail-fast: false
# matrix:
# spec:
# [
# comparison,
# degreeReform,
# form,
# formNotifications,
# happypath,
# IAMpermissions,
# management,
# misc,
# ospa,
# permissions,
# report,
# sidebar,
# yearselector,
# evaluation,
# metaevaluation,
# homepage,
# ]
# name: Run tests
# runs-on: ubuntu-latest
# steps:
# - name: Checkout
# uses: actions/checkout@v4
# - uses: actions/setup-node@v4
# with:
# node-version: 20
# cache: npm
#
# - name: npm ci
# run: npm ci --no-audit --no-fund
tests:
strategy:
fail-fast: false
matrix:
spec:
[
comparison,
degreeReform,
form,
formNotifications,
happypath,
IAMpermissions,
management,
misc,
ospa,
permissions,
report,
sidebar,
yearselector,
evaluation,
metaevaluation,
homepage,
]
name: Run tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm

- name: npm ci
run: npm ci --no-audit --no-fund

#- name: docker compose up -d
# run: docker compose up -d
- name: docker compose up -d
run: docker compose up -d

#- name: seed db
# run: docker exec lomake_dev bash -c "node index.js seed"
- name: seed db
run: docker exec lomake_dev bash -c "node index.js seed"
- name: Run cypress tests with retry
uses: nick-fields/retry@v3
with:
timeout_minutes: 6
max_attempts: 2
command: ./node_modules/.bin/cypress run --headless --browser chrome --spec "cypress/integration/${{ matrix.spec }}.spec.js"

- uses: actions/upload-artifact@v4
if: failure()
with:
name: Cypress videos
path: /home/runner/work/lomake/lomake/cypress/videos

#- name: Run cypress tests with retry
# uses: nick-fields/retry@v3
# with:
# timeout_minutes: 6
# max_attempts: 2
# command: ./node_modules/.bin/cypress run --headless --browser chrome --spec "cypress/integration/${{ matrix.spec }}.spec.js"
#
#- uses: actions/upload-artifact@v4
# if: failure()
# with:
# name: Cypress videos
# path: /home/runner/work/lomake/lomake/cypress/videos
#
#- uses: actions/upload-artifact@v4
# if: failure()
# with:
# name: Cypress screenshots
# path: /home/runner/work/lomake/lomake/cypress/screenshots
- uses: actions/upload-artifact@v4
if: failure()
with:
name: Cypress screenshots
path: /home/runner/work/lomake/lomake/cypress/screenshots


build:
name: 'Build and publish staging image'
#needs:
# - tests
needs:
- tests
runs-on: ubuntu-latest

steps:
Expand Down
2 changes: 1 addition & 1 deletion client/util/webSocket.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const connect = () => {

return io(window.origin, {
path: `${basePath}socket.io`,
transports: ['websocket', 'polling'],
transports: ['polling'],
extraHeaders: headers,
})
}
Expand Down
4 changes: 2 additions & 2 deletions cypress.config.js → cypress.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ module.exports = defineConfig({
viewportWidth: 1500,
viewportHeight: 1200,
watchForFileChanges: false,
supportFile: 'cypress/support/index',
specPattern: 'cypress/integration/*.spec',
supportFile: 'cypress/support/index.js',
specPattern: 'cypress/integration/*.spec.js',
experimentalRunAllSpecs: true,
},
video: false,
Expand Down

0 comments on commit 662a9e2

Please sign in to comment.