@@ -28,8 +28,6 @@ module.exports = defineConfig( {
2828 ] ,
2929 e2e : {
3030 setupNodeEvents ( on , config ) {
31- const semver = require ( 'semver' ) ;
32-
3331 // Ensure that the base URL is always properly set.
3432 if ( config . env && config . env . baseUrl ) {
3533 config . baseUrl = config . env . baseUrl ;
@@ -53,13 +51,27 @@ module.exports = defineConfig( {
5351 }
5452 }
5553
56- // Exclude Onboarding and 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)
57- if ( semver . satisfies ( config . env . wpSemverVersion , '<6.5.0' ) || semver . satisfies ( config . env . phpSemverVersion , '<7.4.0' ) ) {
54+ // Tests require Wondor Theme, exclude if not supported due to WP or PHP versions
55+ if ( ! supportsWonderTheme ( config . env ) ) {
56+ config . excludeSpecPattern = config . excludeSpecPattern . concat ( [
57+ 'vendor/newfold-labs/wp-module-onboarding/tests/cypress/integration/**' , // Onboarding requires Wonder Theme
58+ 'vendor/newfold-labs/wp-module-ecommerce/tests/cypress/integration/Home/ecommerce-next-steps.cy.js' , // Requires Onboarding
59+ ] ) ;
60+ }
61+
62+ // Tests requires Woo, so exclude if not supported due to WP or PHP versions
63+ if ( ! supportsWoo ( config . env ) ) {
5864 config . excludeSpecPattern = config . excludeSpecPattern . concat ( [
5965 'vendor/newfold-labs/wp-module-ecommerce/tests/cypress/integration/Site-Capabilities/**' ,
6066 'vendor/newfold-labs/wp-module-ecommerce/tests/cypress/integration/Home/homePageWithWoo.cy.js' ,
61- 'vendor/newfold-labs/wp-module-ecommerce/tests/cypress/integration/Home/ecommerce-next-steps.cy.js' , // Skip this since Onboarding does not support this version
62- '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
67+ 'vendor/newfold-labs/wp-module-coming-soon/tests/cypress/integration/coming-soon-woo.cy.js' ,
68+ ] ) ;
69+ }
70+
71+ // Test requires Jetpack, so exclude if not supported due to WP or PHP versions
72+ if ( ! supportsJetpack ( config . env ) ) {
73+ config . excludeSpecPattern = config . excludeSpecPattern . concat ( [
74+ 'vendor/newfold-labs/wp-module-solutions/tests/cypress/integration/wp-plugins-installation-check.cy.js' ,
6375 ] ) ;
6476 }
6577
@@ -81,3 +93,37 @@ module.exports = defineConfig( {
8193 retries : 1 ,
8294 experimentalMemoryManagement : true ,
8395} ) ;
96+
97+ // Check against plugin support at https://wordpress.org/plugins/woocommerce/
98+ const supportsWoo = ( env ) => {
99+ const semver = require ( 'semver' ) ;
100+ if (
101+ semver . satisfies ( env . wpSemverVersion , '>=6.5.0' ) &&
102+ semver . satisfies ( env . phpSemverVersion , '>=7.4.0' )
103+ ) {
104+ return true ;
105+ }
106+ return false ;
107+ } ;
108+ // Check against plugin support at https://wordpress.org/plugins/jetpack/
109+ const supportsJetpack = ( env ) => {
110+ const semver = require ( 'semver' ) ;
111+ if (
112+ semver . satisfies ( env . wpSemverVersion , '>=6.6.0' ) &&
113+ semver . satisfies ( env . phpSemverVersion , '>=7.2.0' )
114+ ) {
115+ return true ;
116+ }
117+ return false ;
118+ } ;
119+ // Check against theme support at https://github.com/newfold-labs/yith-wonder/blob/master/style.css
120+ const supportsWonderTheme = ( env ) => {
121+ const semver = require ( 'semver' ) ;
122+ if (
123+ semver . satisfies ( env . wpSemverVersion , '>=6.5.0' ) &&
124+ semver . satisfies ( env . phpSemverVersion , '>=7.0.0' )
125+ ) {
126+ return true ;
127+ }
128+ return false ;
129+ } ;
0 commit comments