Skip to content

Commit

Permalink
Merge pull request #68 from newfold-labs/Mig-PRESS0-2083
Browse files Browse the repository at this point in the history
PRESS0-2083: Cypress Tests for emulating AM flow
  • Loading branch information
ramyakrishnai authored Sep 25, 2024
2 parents d84570b + fe9811e commit 233207a
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 0 deletions.
41 changes: 41 additions & 0 deletions tests/cypress/integration/Migration/landIntoMigrationFromAM.cy.js
Original file line number Diff line number Diff line change
@@ -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=' );
} );
} );
}
);
}
8 changes: 8 additions & 0 deletions tests/cypress/integration/wp-module-support/pluginID.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// <reference types="Cypress" />
export const GetPluginId = () => {
return Cypress.env('pluginId');
}

export const getAppId = () => {
return Cypress.env('appId');
}
3 changes: 3 additions & 0 deletions tests/cypress/integration/wp-module-support/utils.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const wpLogin = () => {
cy.login( Cypress.env( 'wpUsername' ), Cypress.env( 'wpPassword' ) );
};

0 comments on commit 233207a

Please sign in to comment.