mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-29 09:07:09 +08:00
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com> Co-authored-by: likhinbopanna <likhin.bopanna@juspay.in>
67 lines
1.9 KiB
JavaScript
67 lines
1.9 KiB
JavaScript
import { defineConfig } from "cypress";
|
|
import mochawesome from "cypress-mochawesome-reporter/plugin.js";
|
|
import fs from "fs";
|
|
|
|
let globalState;
|
|
|
|
// Fetch from environment variable
|
|
const connectorId = process.env.CYPRESS_CONNECTOR || "service";
|
|
const screenshotsFolderName = `screenshots/${connectorId}`;
|
|
const reportName = process.env.REPORT_NAME || `${connectorId}_report`;
|
|
|
|
export default defineConfig({
|
|
e2e: {
|
|
setupNodeEvents(on, config) {
|
|
mochawesome(on);
|
|
|
|
on("task", {
|
|
setGlobalState: (val) => {
|
|
return (globalState = val || {});
|
|
},
|
|
getGlobalState: () => {
|
|
return globalState || {};
|
|
},
|
|
cli_log: (message) => {
|
|
// eslint-disable-next-line no-console
|
|
console.log("Logging console message from task");
|
|
// eslint-disable-next-line no-console
|
|
console.log(message);
|
|
return null;
|
|
},
|
|
});
|
|
on("after:spec", (spec, results) => {
|
|
if (results && 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);
|
|
}
|
|
}
|
|
});
|
|
return config;
|
|
},
|
|
experimentalRunAllSpecs: true,
|
|
|
|
reporter: "cypress-mochawesome-reporter",
|
|
reporterOptions: {
|
|
reportDir: `cypress/reports/${connectorId}`,
|
|
reportFilename: reportName,
|
|
reportPageTitle: `[${connectorId}] Cypress test report`,
|
|
embeddedScreenshots: true,
|
|
overwrite: false,
|
|
inlineAssets: true,
|
|
saveJson: true,
|
|
},
|
|
},
|
|
chromeWebSecurity: false,
|
|
defaultCommandTimeout: 10000,
|
|
pageLoadTimeout: 20000,
|
|
responseTimeout: 30000,
|
|
screenshotsFolder: screenshotsFolderName,
|
|
video: true,
|
|
videoCompression: 32,
|
|
});
|