diff --git a/tests/cypress/integration/Migration/landIntoMigrationFromAM.cy.js b/tests/cypress/integration/Migration/landIntoMigrationFromAM.cy.js new file mode 100644 index 0000000..fc1c3d8 --- /dev/null +++ b/tests/cypress/integration/Migration/landIntoMigrationFromAM.cy.js @@ -0,0 +1,41 @@ +import { GetPluginId } from '../wp-module-support/pluginID.cy'; +import { wpLogin } from '../wp-module-support/utils.cy'; +const customCommandTimeout = 120000; +const pluginId = GetPluginId(); + +if ( pluginId == 'bluehost' ) { + describe( + 'Verify Migration- emulating AM flow', + { testIsolation: true }, + () => { + before( () => { + wpLogin(); + + cy.exec( + `npx wp-env run cli wp option set nfd_migrate_site "true"` + ); + + cy.reload(); + } ) + + it( 'Verify Migration page is loaded', () => { + cy.intercept( + 'GET', + 'https://migrate.bluehost.com/api/v2/initial-data' + ).as( 'Migration-initialise' ); + cy.visit( + '/wp-admin/?page=nfd-onboarding#/sitegen/step/migration' + ); + cy.wait( '@Migration-initialise', { + timeout: customCommandTimeout, + } ) + .then( ( interception ) => { + expect( interception.response.statusCode ).to.eq( 200 ); + } ) + .then( () => { + cy.url().should( 'contain', 'migrate/bluehost?d_id=' ); + } ); + } ); + } + ); +} \ No newline at end of file diff --git a/tests/cypress/integration/wp-module-support/pluginID.cy.js b/tests/cypress/integration/wp-module-support/pluginID.cy.js new file mode 100644 index 0000000..04dceca --- /dev/null +++ b/tests/cypress/integration/wp-module-support/pluginID.cy.js @@ -0,0 +1,8 @@ +// +export const GetPluginId = () => { + return Cypress.env('pluginId'); +} + +export const getAppId = () => { + return Cypress.env('appId'); +} \ No newline at end of file diff --git a/tests/cypress/integration/wp-module-support/utils.cy.js b/tests/cypress/integration/wp-module-support/utils.cy.js new file mode 100644 index 0000000..07f26bd --- /dev/null +++ b/tests/cypress/integration/wp-module-support/utils.cy.js @@ -0,0 +1,3 @@ +export const wpLogin = () => { + cy.login( Cypress.env( 'wpUsername' ), Cypress.env( 'wpPassword' ) ); +}; \ No newline at end of file