1
- const { defineConfig } = require ( 'cypress' ) ;
2
- const { loadConfig } = require ( '@wordpress/env/lib/config' ) ;
3
- const getCacheDirectory = require ( '@wordpress/env/lib/config/get-cache-directory' ) ;
1
+ const { defineConfig } = require ( 'cypress' ) ;
2
+ const { loadConfig } = require ( '@wordpress/env/lib/config' ) ;
3
+ const getCacheDirectory = require ( '@wordpress/env/lib/config/get-cache-directory' ) ;
4
4
const dotenvPlugin = require ( 'cypress-dotenv' ) ;
5
5
6
- module . exports = defineConfig ( {
6
+ module . exports = defineConfig ( {
7
7
chromeWebSecurity : false ,
8
8
fixturesFolder : 'tests/cypress/fixtures' ,
9
9
screenshotsFolder : 'tests/cypress/screenshots' ,
@@ -13,21 +13,24 @@ module.exports = defineConfig( {
13
13
reporter : 'mochawesome' ,
14
14
reporterOptions : {
15
15
mochaFile : 'mochawesome-[name]' ,
16
- reportDir : __dirname + ' /reports' ,
16
+ reportDir : ` ${ __dirname } /reports` ,
17
17
overwrite : false ,
18
18
html : false ,
19
19
json : true ,
20
20
} ,
21
21
e2e : {
22
- setupNodeEvents ( on , config ) {
22
+ setupNodeEvents ( on , config ) {
23
23
config = dotenvPlugin ( config , { path : '../../.env.test' } ) ; // Load .env variables into Cypress
24
- return setBaseUrl ( on , config ) ;
24
+ return setBaseUrl ( on , config ) ;
25
25
} ,
26
26
specPattern : [
27
- 'tests/cypress/e2e/admin.test.js' ,
27
+ 'tests/cypress/e2e/settings/ admin.test.js' ,
28
28
'tests/cypress/e2e/connect.test.js' ,
29
- 'tests/cypress/e2e/settings.test.js' ,
30
- 'tests/cypress/e2e/mailchimp-block.test.js' ,
29
+ 'tests/cypress/e2e/settings/list.test.js' ,
30
+ 'tests/cypress/e2e/settings/settings.test.js' ,
31
+ 'tests/cypress/e2e/submission/**.test.js' ,
32
+ 'tests/cypress/e2e/validation/**.test.js' ,
33
+ 'tests/cypress/e2e/block.test.js' ,
31
34
'tests/cypress/e2e/logout.test.js' ,
32
35
] ,
33
36
supportFile : 'tests/cypress/support/index.js' ,
@@ -38,23 +41,23 @@ module.exports = defineConfig( {
38
41
runMode : 2 ,
39
42
openMode : 0 ,
40
43
} ,
41
- } ) ;
44
+ } ) ;
42
45
43
46
/**
44
47
* Set WP URL as baseUrl in Cypress config.
45
48
*
46
49
* @param {Function } on function that used to register listeners on various events.
47
- * @param {Object } config Cypress Config object.
48
- * @return { Object } Updated Cypress Config object.
50
+ * @param {object } config Cypress Config object.
51
+ * @returns { object } Updated Cypress Config object.
49
52
*/
50
- const setBaseUrl = async ( on , config ) => {
53
+ const setBaseUrl = async ( on , config ) => {
51
54
const cacheDirectory = await getCacheDirectory ( ) ;
52
- const wpEnvConfig = await loadConfig ( cacheDirectory ) ;
55
+ const wpEnvConfig = await loadConfig ( cacheDirectory ) ;
53
56
54
- if ( wpEnvConfig ) {
57
+ if ( wpEnvConfig ) {
55
58
const port = wpEnvConfig . env . tests . port || null ;
56
59
57
- if ( port ) {
60
+ if ( port ) {
58
61
config . baseUrl = wpEnvConfig . env . tests . config . WP_SITEURL ;
59
62
}
60
63
}
0 commit comments