Skip to content

Commit

Permalink
Merge pull request #413 from newfold-labs/add/tests-for-onboarding
Browse files Browse the repository at this point in the history
Add/tests for onboarding
  • Loading branch information
circlecube authored Feb 2, 2024
2 parents a118880 + 38c8802 commit dd4fcaf
Showing 1 changed file with 51 additions and 21 deletions.
72 changes: 51 additions & 21 deletions cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,26 +25,56 @@ module.exports = defineConfig({
'*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) {
return require('./tests/cypress/plugins/index.js')(on, config)
},
baseUrl: 'http://localhost:8880',
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,
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 onboarding/ecommerce tests for PHP lower than 7.3 (7.1 and 7.2)
if ( semver.satisfies( config.env.phpSemverVersion, '<7.3.0' ) ) {
config.excludeSpecPattern = config.excludeSpecPattern.concat( [
'vendor/newfold-labs/wp-module-onboarding/tests/cypress/integration/3-ecommerce-onboarding-flow/**',
'vendor/newfold-labs/wp-module-onboarding/tests/cypress/integration/2-general-onboarding-flow/top-priority.cy.js',
] );
}

return config;
},
baseUrl: 'http://localhost:8880',
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/', // skipping onboarding tests until they add multi-lingual support or onboarding is activated for all lanugages
'vendor/newfold-labs/wp-module-patterns/tests/cypress/integration/', // skip pattern tests for now
'vendor/newfold-labs/**/tests/cypress/integration/wp-module-support/*.cy.js', // skip any module's wp-module-support files
],
},
retries: 1,
experimentalMemoryManagement: true,
'vendor/newfold-labs/**/tests/cypress/integration/wp-module-support/*.cy.js', // skip any module's wp-module-support files
],
},
retries: 1,
experimentalMemoryManagement: true,
})

0 comments on commit dd4fcaf

Please sign in to comment.