2022-07-25 09:52:56 +00:00
|
|
|
import webpackPreprocessor from "@cypress/webpack-batteries-included-preprocessor";
|
|
|
|
import { defineConfig } from "cypress";
|
|
|
|
import { deleteAsync } from "del";
|
|
|
|
import { createRequire } from "node:module";
|
|
|
|
|
|
|
|
const require = createRequire(import.meta.url);
|
|
|
|
|
|
|
|
export default defineConfig({
|
|
|
|
projectId: "j4yhox",
|
|
|
|
screenshotsFolder: "assets/screenshots",
|
|
|
|
videosFolder: "assets/videos",
|
|
|
|
chromeWebSecurity: false,
|
|
|
|
viewportWidth: 1360,
|
|
|
|
viewportHeight: 768,
|
|
|
|
defaultCommandTimeout: 30000,
|
|
|
|
videoCompression: false,
|
|
|
|
numTestsKeptInMemory: 30,
|
|
|
|
videoUploadOnPasses: false,
|
2022-08-12 19:55:27 +00:00
|
|
|
|
2022-07-25 09:52:56 +00:00
|
|
|
e2e: {
|
|
|
|
setupNodeEvents(on) {
|
|
|
|
on(
|
|
|
|
"file:preprocessor",
|
|
|
|
webpackPreprocessor({
|
|
|
|
typescript: require.resolve("typescript"),
|
|
|
|
})
|
|
|
|
);
|
|
|
|
|
|
|
|
on("after:spec", async (spec, results) => {
|
|
|
|
if (!results.video) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Do we have failures for any retry attempts?
|
|
|
|
const failures = results.tests.some(({ attempts }) =>
|
|
|
|
attempts.some(({ state }) => state === "failed")
|
|
|
|
);
|
|
|
|
|
|
|
|
// Delete the video if the spec passed and no tests were retried.
|
|
|
|
if (!failures) {
|
|
|
|
await deleteAsync(results.video);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
baseUrl: "http://localhost:8080",
|
|
|
|
slowTestThreshold: 30000,
|
|
|
|
specPattern: "cypress/e2e/**/*.{js,jsx,ts,tsx}",
|
|
|
|
},
|
2022-08-12 19:55:27 +00:00
|
|
|
|
|
|
|
component: {
|
|
|
|
devServer: {
|
|
|
|
framework: "react",
|
|
|
|
bundler: "vite",
|
|
|
|
},
|
|
|
|
},
|
2022-07-25 09:52:56 +00:00
|
|
|
});
|