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' ) ;
44const dotenvPlugin = require ( 'cypress-dotenv' ) ;
55
6- module . exports = defineConfig ( {
6+ module . exports = defineConfig ( {
77 chromeWebSecurity : false ,
88 fixturesFolder : 'tests/cypress/fixtures' ,
99 screenshotsFolder : 'tests/cypress/screenshots' ,
@@ -13,21 +13,24 @@ module.exports = defineConfig( {
1313 reporter : 'mochawesome' ,
1414 reporterOptions : {
1515 mochaFile : 'mochawesome-[name]' ,
16- reportDir : __dirname + ' /reports' ,
16+ reportDir : ` ${ __dirname } /reports` ,
1717 overwrite : false ,
1818 html : false ,
1919 json : true ,
2020 } ,
2121 e2e : {
22- setupNodeEvents ( on , config ) {
22+ setupNodeEvents ( on , config ) {
2323 config = dotenvPlugin ( config , { path : '../../.env.test' } ) ; // Load .env variables into Cypress
24- return setBaseUrl ( on , config ) ;
24+ return setBaseUrl ( on , config ) ;
2525 } ,
2626 specPattern : [
27- 'tests/cypress/e2e/admin.test.js' ,
27+ 'tests/cypress/e2e/settings/ admin.test.js' ,
2828 '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' ,
3134 'tests/cypress/e2e/logout.test.js' ,
3235 ] ,
3336 supportFile : 'tests/cypress/support/index.js' ,
@@ -38,23 +41,23 @@ module.exports = defineConfig( {
3841 runMode : 2 ,
3942 openMode : 0 ,
4043 } ,
41- } ) ;
44+ } ) ;
4245
4346/**
4447 * Set WP URL as baseUrl in Cypress config.
4548 *
4649 * @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.
4952 */
50- const setBaseUrl = async ( on , config ) => {
53+ const setBaseUrl = async ( on , config ) => {
5154 const cacheDirectory = await getCacheDirectory ( ) ;
52- const wpEnvConfig = await loadConfig ( cacheDirectory ) ;
55+ const wpEnvConfig = await loadConfig ( cacheDirectory ) ;
5356
54- if ( wpEnvConfig ) {
57+ if ( wpEnvConfig ) {
5558 const port = wpEnvConfig . env . tests . port || null ;
5659
57- if ( port ) {
60+ if ( port ) {
5861 config . baseUrl = wpEnvConfig . env . tests . config . WP_SITEURL ;
5962 }
6063 }
0 commit comments