Ocelot-Social/cypress/cypress.config.js
dependabot[bot] fa71b0e189
build(deps-dev): bump the cypress group across 1 directory with 3 updates (#9058)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-01-18 12:29:03 +01:00

88 lines
2.1 KiB
JavaScript

const dotenv = require('dotenv')
const { defineConfig } = require('cypress');
const webpackPreprocessor = require('@cypress/webpack-preprocessor');
const {
addCucumberPreprocessorPlugin,
} = require('@badeball/cypress-cucumber-preprocessor');
const NodePolyfillPlugin = require('node-polyfill-webpack-plugin');
const webpack = require('webpack');
// Test persistent(between commands) store
const testStore = {}
async function setupNodeEvents(on, config) {
// This is required for the preprocessor to be able to generate JSON reports after each run, and more
await addCucumberPreprocessorPlugin(on, config);
on(
'file:preprocessor',
webpackPreprocessor({
webpackOptions: {
mode: 'development',
devtool: 'source-map',
resolve: {
extensions: ['.js', '.json'],
fallback: {
fs: false,
net: false,
tls: false,
},
},
module: {
rules: [
{
test: /\.feature$/,
use: [
{
loader: '@badeball/cypress-cucumber-preprocessor/webpack',
options: config,
},
],
},
],
},
plugins: [
new NodePolyfillPlugin(),
new webpack.ProvidePlugin({
process: 'process/browser',
Buffer: ['buffer', 'Buffer'],
}),
],
},
}),
);
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
});