-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcypress.config.ts
55 lines (47 loc) · 1.7 KB
/
cypress.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import { defineConfig } from 'cypress';
import createBundler from '@bahmutov/cypress-esbuild-preprocessor';
import { addCucumberPreprocessorPlugin } from '@badeball/cypress-cucumber-preprocessor';
import { createEsbuildPlugin } from '@badeball/cypress-cucumber-preprocessor/esbuild';
import pluginConfig from './cypress/plugins/index';
const loadBddConfig = async (on: Cypress.PluginEvents, config: Cypress.PluginConfigOptions) => {
// reference https://github.com/badeball/cypress-cucumber-preprocessor/blob/master/docs/step-definitions.md
await addCucumberPreprocessorPlugin(on, config);
const bundler = createBundler({
plugins: [createEsbuildPlugin(config)],
});
on('file:preprocessor', bundler);
};
const loadCustomPlugins = (on: Cypress.PluginEvents, config: Cypress.PluginConfigOptions) => {
pluginConfig(on, config);
};
const showCypressLogOnHeadlessMode = (on) => {
on('task', {
log(...message) {
console.log(...message);
return null;
},
});
};
async function setupNodeEvents(on: Cypress.PluginEvents, config: Cypress.PluginConfigOptions): Promise<Cypress.PluginConfigOptions> {
loadCustomPlugins(on, config);
showCypressLogOnHeadlessMode(on);
await loadBddConfig(on, config);
return config;
}
export default defineConfig({
chromeWebSecurity: false,
viewportWidth: 1366,
viewportHeight: 768,
defaultCommandTimeout: 5000,
pageLoadTimeout: 5000,
requestTimeout: 5000,
responseTimeout: 5000,
screenshotOnRunFailure: true,
video: false,
retries: 1,
e2e: {
setupNodeEvents,
specPattern: ['cypress/e2e/bdd/*.feature', 'cypress/e2e/accessibility/*.{js,ts}', 'cypress/e2e/tests/*.{js,ts}'],
baseUrl: 'http://127.0.0.1:5556/youtube-reload',
},
});