Skip to content

Commit

Permalink
chore: bump Cypress to version 13 (#2935)
Browse files Browse the repository at this point in the history
* chore: bump Cypress to version 13

* chore: yarn deduplicate

* chore: bump node to version 18

* chore: video changes from dhis2/line-listing-app#472

* test: don't expect subtitle to be visible by default

* test: hover over list to prevent it from being stale

* test: refactor data.cy.js to independent test cases
  • Loading branch information
martinkrulltott authored Dec 15, 2023
1 parent 4f3669d commit fb706cf
Show file tree
Hide file tree
Showing 6 changed files with 372 additions and 331 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/dhis2-preview-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 14.x
node-version: 18.x

- uses: c-hive/gha-yarn-cache@v1
- run: yarn install --frozen-lockfile
Expand Down
27 changes: 23 additions & 4 deletions cypress.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const fs = require('fs')
const { chromeAllowXSiteCookies } = require('@dhis2/cypress-plugins')
const { defineConfig } = require('cypress')
const {
Expand All @@ -8,6 +9,28 @@ async function setupNodeEvents(on, config) {
chromeAllowXSiteCookies(on, config)
excludeByVersionTags(on, config)

// Delete videos for passing tests
on('after:spec', (spec, results) => {
try {
if (results && results.video) {
// Do we have failures for any retry attempts?
const failures = results.tests.some((test) =>
test.attempts.some((attempt) => attempt.state === 'failed')
)
if (!failures) {
// delete the video if the spec passed and no tests retried
fs.unlinkSync(results.video)
}
}
} catch (error) {
if (error.code === 'ENOENT') {
console.log('Video already deleted')
} else {
throw error
}
}
})

if (!config.env.dhis2InstanceVersion) {
throw new Error(
'dhis2InstanceVersion is missing. Check the README for more information.'
Expand Down Expand Up @@ -59,10 +82,6 @@ module.exports = defineConfig({
testIsolation: false,
// Record video
video: true,
/* Only compress and upload videos for failures.
* This will save execution time and reduce the risk
* out-of-memory issues on the CI machine */
videoUploadOnPasses: false,
// Enabled to reduce the risk of out-of-memory issues
experimentalMemoryManagement: true,
// Set to a low number to reduce the risk of out-of-memory issues
Expand Down
Loading

0 comments on commit fb706cf

Please sign in to comment.