2022-07-25 09:52:56 +00:00
|
|
|
import { defineConfig } from "cypress";
|
2024-02-20 10:10:54 +00:00
|
|
|
import cypressSplit from "cypress-split";
|
2024-02-27 13:03:34 +00:00
|
|
|
import fs from "node:fs";
|
|
|
|
|
|
|
|
const isCI = process.env.CI === "true";
|
2022-07-25 09:52:56 +00:00
|
|
|
|
|
|
|
export default defineConfig({
|
2024-02-27 13:03:34 +00:00
|
|
|
video: isCI,
|
2022-07-25 09:52:56 +00:00
|
|
|
projectId: "j4yhox",
|
|
|
|
chromeWebSecurity: false,
|
|
|
|
viewportWidth: 1360,
|
|
|
|
viewportHeight: 768,
|
|
|
|
defaultCommandTimeout: 30000,
|
|
|
|
numTestsKeptInMemory: 30,
|
2023-02-10 10:10:35 +00:00
|
|
|
experimentalMemoryManagement: true,
|
2022-08-12 19:55:27 +00:00
|
|
|
|
2022-10-11 08:14:10 +00:00
|
|
|
retries: {
|
|
|
|
runMode: 3,
|
|
|
|
},
|
|
|
|
|
2022-07-25 09:52:56 +00:00
|
|
|
e2e: {
|
|
|
|
baseUrl: "http://localhost:8080",
|
|
|
|
slowTestThreshold: 30000,
|
|
|
|
specPattern: "cypress/e2e/**/*.{js,jsx,ts,tsx}",
|
2024-02-20 10:10:54 +00:00
|
|
|
setupNodeEvents(on, config) {
|
2024-02-27 13:03:34 +00:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2024-02-20 10:10:54 +00:00
|
|
|
cypressSplit(on, config);
|
2024-02-27 13:03:34 +00:00
|
|
|
|
2024-02-20 10:10:54 +00:00
|
|
|
return config;
|
|
|
|
},
|
2022-07-25 09:52:56 +00:00
|
|
|
},
|
|
|
|
});
|