Ocelot-Social/cypress/cypress.config.js
mahula dfe9205bf6
refactor(other): cleanup cypress configuration (#8345)
* cypress:remove redundant comment from command config

* cypress: move command and factory imports from global to local

* cypress: linting

* cypress: set support file to false in config
2025-04-08 22:20:41 +02:00

55 lines
1.3 KiB
JavaScript

const dotenv = require('dotenv')
const { defineConfig } = require('cypress');
const browserify = require('@cypress/browserify-preprocessor');
const {
addCucumberPreprocessorPlugin,
} = require('@badeball/cypress-cucumber-preprocessor');
const {
preprendTransformerToOptions,
} = require('@badeball/cypress-cucumber-preprocessor/browserify');
// Test persistent(between commands) store
const testStore = {}
async function setupNodeEvents(on, config) {
await addCucumberPreprocessorPlugin(on, config);
on(
'file:preprocessor',
browserify(preprendTransformerToOptions(config, browserify.defaultOptions)),
);
on('task', {
pushValue({ name, value }) {
testStore[name] = value
return true
},
getValue(name) {
console.log('getValue',name,testStore)
return testStore[name]
},
});
return config;
}
// Import backend .env (smart)?
const { parsed } = dotenv.config({ path: '../backend/.env' })
module.exports = defineConfig({
e2e: {
projectId: 'qa7fe2',
defaultCommandTimeout: 60000,
pageLoadTimeout:180000,
chromeWebSecurity: false,
baseUrl: 'http://localhost:3000',
specPattern: '**/*.feature',
supportFile: false,
retries: 0,
video: false,
viewportHeight: 720,
viewportWidth: 1290,
setupNodeEvents,
},
env: parsed
});