Record Cypress test failures in video (#27232)
Signed-off-by: Jon Koops <jonkoops@gmail.com>
This commit is contained in:
parent
de4edc5232
commit
4eb71c4f40
2 changed files with 28 additions and 0 deletions
9
.github/workflows/js-ci.yml
vendored
9
.github/workflows/js-ci.yml
vendored
|
@ -327,6 +327,15 @@ jobs:
|
|||
name: admin-ui-server-log-${{ matrix.container }}-${{ matrix.browser }}
|
||||
path: ~/server.log
|
||||
|
||||
- name: Upload Cypress videos
|
||||
uses: actions/upload-artifact@v3
|
||||
if: github.repository != 'keycloak/keycloak-private'
|
||||
with:
|
||||
name: cypress-videos-${{ matrix.container }}-${{ matrix.browser }}
|
||||
path: js/apps/admin-ui/cypress/videos
|
||||
if-no-files-found: ignore
|
||||
retention-days: 10
|
||||
|
||||
check:
|
||||
name: Status Check - Keycloak JavaScript CI
|
||||
if: always()
|
||||
|
|
|
@ -1,7 +1,11 @@
|
|||
import { defineConfig } from "cypress";
|
||||
import cypressSplit from "cypress-split";
|
||||
import fs from "node:fs";
|
||||
|
||||
const isCI = process.env.CI === "true";
|
||||
|
||||
export default defineConfig({
|
||||
video: isCI,
|
||||
projectId: "j4yhox",
|
||||
chromeWebSecurity: false,
|
||||
viewportWidth: 1360,
|
||||
|
@ -19,7 +23,22 @@ export default defineConfig({
|
|||
slowTestThreshold: 30000,
|
||||
specPattern: "cypress/e2e/**/*.{js,jsx,ts,tsx}",
|
||||
setupNodeEvents(on, config) {
|
||||
on("after:spec", (spec, results) => {
|
||||
if (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);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
cypressSplit(on, config);
|
||||
|
||||
return config;
|
||||
},
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue