-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #68 from newfold-labs/Mig-PRESS0-2083
PRESS0-2083: Cypress Tests for emulating AM flow
- Loading branch information
Showing
3 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
tests/cypress/integration/Migration/landIntoMigrationFromAM.cy.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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=' ); | ||
} ); | ||
} ); | ||
} | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' ) ); | ||
}; |