diff --git a/.gitignore b/.gitignore index 929379fb9a..698d378a27 100644 --- a/.gitignore +++ b/.gitignore @@ -35,3 +35,4 @@ environments.js CLAUDE.md .claude .opencode +cypress.local.js diff --git a/cypress.config.js b/cypress.config.js index f214715a1c..bbdd4d877b 100644 --- a/cypress.config.js +++ b/cypress.config.js @@ -32,6 +32,14 @@ if (activeEnvironment && !environments[activeEnvironment]) { ); } +let cypressLocal = {}; +try { + // eslint-disable-next-line global-require, import/extensions + cypressLocal = require('./cypress.local.js'); +} catch (e) { + // cypress.local.js is gitignored and optional +} + /** * Chains after:spec handlers to ensure both TestRail and flaky marker handlers execute. * Since Cypress's on() overwrites previous handlers (except for 'task'), we need to intercept @@ -186,6 +194,7 @@ module.exports = defineConfig({ // HTTP tasks (axios requests in Node.js context) ...httpTasks, + ...cypressLocal.tasks?.(on, config), }); // keep Cypress running until the ReportPortal reporter is finished. this is a @@ -223,4 +232,5 @@ module.exports = defineConfig({ baseUrl: envOverrides.baseUrl || 'https://folio-etesting-cypress-diku.ci.folio.org', testIsolation: false, }, + ...cypressLocal.cypress, }); diff --git a/cypress/support/e2e.js b/cypress/support/e2e.js index b0e3cb5c54..7f2edaf25c 100644 --- a/cypress/support/e2e.js +++ b/cypress/support/e2e.js @@ -48,3 +48,11 @@ Cypress.on('fail', (err) => { beforeEach(() => { cy.intercept('POST', '/authn/refresh').as('/authn/refresh'); }); + +// cypress.local.js support hooks (gitignored, local-only) +try { + // eslint-disable-next-line global-require, import/extensions + require('../../cypress.local.js').support?.(); +} catch (e) { + // cypress.local.js is optional +}