Skip to content

Commit

Permalink
Development: Fix sorry cypress for cypress version 13 (#7191)
Browse files Browse the repository at this point in the history
  • Loading branch information
TheZoker authored Sep 13, 2023
1 parent 4321727 commit 4332d9e
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 29 deletions.
10 changes: 9 additions & 1 deletion src/test/cypress/cypress.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { defineConfig } from 'cypress';
import { cloudPlugin } from 'cypress-cloud/plugin';
import fs from 'fs';

export default defineConfig({
clientCertificates: [
Expand Down Expand Up @@ -38,7 +39,6 @@ export default defineConfig({
screenshotsFolder: 'screenshots',
videosFolder: 'videos',
video: true,
videoUploadOnPasses: false,
screenshotOnRunFailure: true,
viewportWidth: 1920,
viewportHeight: 1080,
Expand All @@ -65,6 +65,14 @@ export default defineConfig({
return null;
},
});
on('after:spec', (spec: Cypress.Spec, results: CypressCommandLine.RunResult) => {
if (results && results.video) {
const failures = results.tests.some((test) => test.attempts.some((attempt) => attempt.state === 'failed'));
if (!failures) {
fs.unlinkSync(results.video);
}
}
});
on('before:browser:launch', (browser, launchOptions) => {
launchOptions.args.push('--lang=en');
return launchOptions;
Expand Down
71 changes: 48 additions & 23 deletions src/test/cypress/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions src/test/cypress/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
],
"devDependencies": {
"@4tw/cypress-drag-drop": "2.2.4",
"@types/node": "20.5.9",
"cypress": "13.1.0",
"cypress-cloud": "1.9.4",
"@types/node": "20.6.0",
"cypress": "13.2.0",
"cypress-cloud": "1.10.0-beta.4",
"cypress-file-upload": "5.0.8",
"cypress-wait-until": "2.0.1",
"typescript": "5.2.2",
"uuid": "9.0.0",
"uuid": "9.0.1",
"wait-on": "7.0.1"
},
"overrides": {
Expand All @@ -30,7 +30,7 @@
"cypress:open": "cypress open",
"cypress:run": "cypress run --browser=chrome",
"cypress:setup": "cypress install && cypress run --quiet --spec init/ImportUsers.cy.ts",
"cypress:record:mysql": "npx cypress-cloud run --parallel --record --ci-build-id \"${SORRY_CYPRESS_BRANCH_NAME} #${SORRY_CYPRESS_BUILD_ID} ${SORRY_CYPRESS_RERUN_COUNT} (MySQL)\"",
"cypress:record:mysql": "npx cypress-cloud run --cloud-debug --parallel --record --ci-build-id \"${SORRY_CYPRESS_BRANCH_NAME} #${SORRY_CYPRESS_BUILD_ID} ${SORRY_CYPRESS_RERUN_COUNT} (MySQL)\"",
"cypress:record:postgres": "npx cypress-cloud run --parallel --record --ci-build-id \"${SORRY_CYPRESS_BRANCH_NAME} #${SORRY_CYPRESS_BUILD_ID} ${SORRY_CYPRESS_RERUN_COUNT} (Postgres)\"",
"update": "npm-upgrade"
}
Expand Down

0 comments on commit 4332d9e

Please sign in to comment.