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 }}
|
name: admin-ui-server-log-${{ matrix.container }}-${{ matrix.browser }}
|
||||||
path: ~/server.log
|
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:
|
check:
|
||||||
name: Status Check - Keycloak JavaScript CI
|
name: Status Check - Keycloak JavaScript CI
|
||||||
if: always()
|
if: always()
|
||||||
|
|
|
@ -1,7 +1,11 @@
|
||||||
import { defineConfig } from "cypress";
|
import { defineConfig } from "cypress";
|
||||||
import cypressSplit from "cypress-split";
|
import cypressSplit from "cypress-split";
|
||||||
|
import fs from "node:fs";
|
||||||
|
|
||||||
|
const isCI = process.env.CI === "true";
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
|
video: isCI,
|
||||||
projectId: "j4yhox",
|
projectId: "j4yhox",
|
||||||
chromeWebSecurity: false,
|
chromeWebSecurity: false,
|
||||||
viewportWidth: 1360,
|
viewportWidth: 1360,
|
||||||
|
@ -19,7 +23,22 @@ export default defineConfig({
|
||||||
slowTestThreshold: 30000,
|
slowTestThreshold: 30000,
|
||||||
specPattern: "cypress/e2e/**/*.{js,jsx,ts,tsx}",
|
specPattern: "cypress/e2e/**/*.{js,jsx,ts,tsx}",
|
||||||
setupNodeEvents(on, config) {
|
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);
|
cypressSplit(on, config);
|
||||||
|
|
||||||
return config;
|
return config;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue