-
Notifications
You must be signed in to change notification settings - Fork 4
/
cypress.config.js
86 lines (79 loc) · 3.16 KB
/
cypress.config.js
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
const {defineConfig} = require('cypress')
const {phpVersion, core} = require('./.wp-env.json')
const wpVersion = /[^/]*$/.exec(core)[0]
module.exports = defineConfig({
projectId: 'kuks2q',
env: {
wpUsername: 'admin',
wpPassword: 'password',
wpVersion,
phpVersion,
pluginId: 'hostgator',
appId: 'hgwp',
pluginSlug: 'wp-plugin-hostgator',
},
downloadsFolder: 'tests/cypress/downloads',
fixturesFolder: 'tests/cypress/fixtures',
screenshotsFolder: 'tests/cypress/screenshots',
video: true,
videosFolder: 'tests/cypress/videos',
chromeWebSecurity: false,
viewportWidth: 1024,
viewportHeight: 768,
blockHosts: [
'*doubleclick.net',
'*jnn-pa.googleapis.com',
'*youtube.com',
],
e2e: {
// We've imported your old cypress plugins here.
// You may want to clean this up later by importing these.
setupNodeEvents(on, config) {
const semver = require('semver');
// Ensure that the base URL is always properly set.
if (config.env && config.env.baseUrl) {
config.baseUrl = config.env.baseUrl;
}
// Ensure that we have a semantically correct WordPress version number for comparisons.
if (config.env.wpVersion) {
if (config.env.wpVersion.split('.').length !== 3) {
config.env.wpSemverVersion = `${config.env.wpVersion}.0`;
} else {
config.env.wpSemverVersion = config.env.wpVersion;
}
}
// Ensure that we have a semantically correct PHP version number for comparisons.
if (config.env.phpVersion) {
if (config.env.phpVersion.split('.').length !== 3) {
config.env.phpSemverVersion = `${config.env.phpVersion}.0`;
} else {
config.env.phpSemverVersion = config.env.phpVersion;
}
}
// Exclude ecommerce tests for WordPress lower than 6.5 (6.4 or 6.3) or PHP lower than 7.4 (7.1, 7.2 and 7.3)
if ( semver.satisfies( config.env.wpSemverVersion, '<6.5.0' ) || semver.satisfies( config.env.phpSemverVersion, '<7.4.0' )) {
config.excludeSpecPattern = config.excludeSpecPattern.concat( [
'vendor/newfold-labs/wp-module-ecommerce/tests/cypress/integration/Site-Capabilities/**',
'vendor/newfold-labs/wp-module-ecommerce/tests/cypress/integration/Home/homePageWithWoo.cy.js',
'vendor/newfold-labs/wp-module-ecommerce/tests/cypress/integration/Home/ecommerce-next-steps.cy.js', // Skip this since Onboarding does not support this version
'vendor/newfold-labs/wp-module-onboarding/tests/cypress/integration/**' // Onboarding requires WP 6.5 or greater, as it uses the Wonder Theme which has the same requirement
] );
}
return config;
},
baseUrl: 'http://localhost:8884',
specPattern: [
'tests/cypress/integration/**/*.cy.{js,jsx,ts,tsx}',
'vendor/newfold-labs/**/tests/cypress/integration/**/*.cy.{js,jsx,ts,tsx}',
],
supportFile: 'tests/cypress/support/index.js',
testIsolation: false,
excludeSpecPattern: [
'vendor/newfold-labs/**/tests/cypress/integration/wp-module-support/*.cy.js', // skip any module's wp-module-support files
'vendor/newfold-labs/wp-module-onboarding/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/*.cy.js', // skip onboarding sitegen tests for now
],
experimentalRunAllSpecs: true,
},
retries: 1,
experimentalMemoryManagement: true,
})