From 04f9add4fb89a2ffbf811dfedccdb70024a577cd Mon Sep 17 00:00:00 2001 From: sangeetha-nayak Date: Fri, 10 May 2024 10:06:41 +0530 Subject: [PATCH 01/17] Tests to verify migrate screen and redirection url --- tests/cypress/fixtures/migrate-connect.json | 8 ++++ .../5-AI-SiteGen-onboarding-flow/1-fork.cy.js | 40 +++++++++++++++++++ .../wp-module-support/MockApi.cy.js | 12 ++++++ 3 files changed, 60 insertions(+) create mode 100644 tests/cypress/fixtures/migrate-connect.json diff --git a/tests/cypress/fixtures/migrate-connect.json b/tests/cypress/fixtures/migrate-connect.json new file mode 100644 index 000000000..ef9a805cb --- /dev/null +++ b/tests/cypress/fixtures/migrate-connect.json @@ -0,0 +1,8 @@ +{ + "success": true, + "data": { + "message": "Connect plugin is installed and ready to start the migration.", + "response": true, + "redirect_url": "https:\/\/app.instawp.io\/migrate\/bluehost?d_id=1bb9623e-5208-40f7-9383-cd91df2fe58c" + } +} \ No newline at end of file diff --git a/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/1-fork.cy.js b/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/1-fork.cy.js index e8216c2a0..d41186010 100644 --- a/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/1-fork.cy.js +++ b/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/1-fork.cy.js @@ -5,6 +5,7 @@ import { DarkBGCheck, LightBGCheck, } from '../wp-module-support/siteGen.cy'; +import { apiList, migrationConnection } from '../wp-module-support/MockApi.cy'; describe( 'SiteGen Fork Step', function () { before( () => { @@ -75,3 +76,42 @@ describe( 'SiteGen Fork Step', function () { .should( 'contain', 'Already have a WordPress site' ); } ); } ); + +describe( 'SiteGen Fork Step- Migration Screen', function () { + before( () => { + cy.exec( + `npx wp-env run cli wp option set _transient_nfd_site_capabilities '{"hasAISiteGen": true, "canAccessAI": true, "canMigrateSite": true}' --format=json` + ); + cy.visit( 'wp-admin/?page=nfd-onboarding#/wp-setup/step/fork' ); + cy.wait( 5000 ); + } ); + + it( 'Verify Import site leads to migration process initiation screen', () => { + cy.intercept( apiList.migrateConnect, ( req ) => { + migrationConnection( req ); + } ).as( 'migrateCall' ); + + cy.get( '.nfd-onboarding-step--site-gen__fork__importsite', { + timeout: 20000, + } ) + .scrollIntoView() + .should( 'exist' ) + .click(); + cy.get( '.nfd-onboarding-step__heading__title' ).should( 'exist' ); + cy.get( + '.nfd-onboarding-step--site-gen__migration--container__loader' + ).should( 'exist' ); + cy.get( + '.nfd-onboarding-step--site-gen__migration--container__importtext' + ).should( 'exist' ); + + AdminBarCheck(); + DarkBGCheck(); + LightBGCheck(); + cy.wait( '@migrateCall' ); + } ); + + it( 'Verify migrate connection is successful and redirection happened', () => { + cy.url().should( 'contain', 'app.instawp.io/migrate' ); + } ); +} ); diff --git a/tests/cypress/integration/wp-module-support/MockApi.cy.js b/tests/cypress/integration/wp-module-support/MockApi.cy.js index e7c96ba90..b73d085b1 100644 --- a/tests/cypress/integration/wp-module-support/MockApi.cy.js +++ b/tests/cypress/integration/wp-module-support/MockApi.cy.js @@ -11,6 +11,7 @@ const homepages_mock = require( '../../fixtures/homepages.json' ); const theme_style_mock = require( '../../fixtures/theme-style.json' ); const customize_data_mock = require( '../../fixtures/customize-data.json' ); const homepage_regenerate_mock = require( '../../fixtures/homepage-regenerate.json' ); +const migate_connect_mock = require( '../../fixtures/migrate-connect.json' ); export const apiList = { sitegen: @@ -23,6 +24,8 @@ export const apiList = { '/index.php?rest_route=%2Fnewfold-onboarding%2Fv1%2Fthemes%2Fvariations&variations=false&flow=sitegen&_locale=user', customizedata: '/index.php?rest_route=%2Fnewfold-onboarding%2Fv1%2Fsitegen%2Fcustomize-data&flow=sitegen&_locale=user', + migrateConnect: + '/index.php?rest_route=%2Fnewfold-migration%2Fv1%2Fmigrate%2Fconnect&_locale=user', }; export const siteGenMockAll = ( req ) => { @@ -91,3 +94,12 @@ export const homePagesRegenerate = ( req ) => { }, } ); }; + +export const migrationConnection = ( req ) => { + req.reply( { + method: 'GET', + statusCode: 200, + body: migate_connect_mock, + delay: 5000, + } ); +}; From 0af9bbea91296a21b950253ebbc790cb4e042861 Mon Sep 17 00:00:00 2001 From: sangeetha-nayak Date: Fri, 10 May 2024 12:00:32 +0530 Subject: [PATCH 02/17] Edit description --- .../integration/5-AI-SiteGen-onboarding-flow/1-fork.cy.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/1-fork.cy.js b/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/1-fork.cy.js index d41186010..93a2473ab 100644 --- a/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/1-fork.cy.js +++ b/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/1-fork.cy.js @@ -111,7 +111,7 @@ describe( 'SiteGen Fork Step- Migration Screen', function () { cy.wait( '@migrateCall' ); } ); - it( 'Verify migrate connection is successful and redirection happened', () => { + it( 'Verify migration connection request is successful and redirection happens', () => { cy.url().should( 'contain', 'app.instawp.io/migrate' ); } ); } ); From 275c5da5fc0950dc8500a898c08c8b8d1412d727 Mon Sep 17 00:00:00 2001 From: sangeetha-nayak Date: Fri, 10 May 2024 13:17:48 +0530 Subject: [PATCH 03/17] set 20 sec timeout --- .../integration/5-AI-SiteGen-onboarding-flow/1-fork.cy.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/1-fork.cy.js b/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/1-fork.cy.js index 93a2473ab..593749964 100644 --- a/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/1-fork.cy.js +++ b/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/1-fork.cy.js @@ -87,12 +87,12 @@ describe( 'SiteGen Fork Step- Migration Screen', function () { } ); it( 'Verify Import site leads to migration process initiation screen', () => { + cy.timeout( 20000 ) cy.intercept( apiList.migrateConnect, ( req ) => { migrationConnection( req ); } ).as( 'migrateCall' ); cy.get( '.nfd-onboarding-step--site-gen__fork__importsite', { - timeout: 20000, } ) .scrollIntoView() .should( 'exist' ) From 70ba76faa5cf736943a6208ecea441ab7a8438f5 Mon Sep 17 00:00:00 2001 From: sangeetha-nayak Date: Fri, 10 May 2024 14:31:52 +0530 Subject: [PATCH 04/17] update site-capability --- .../integration/5-AI-SiteGen-onboarding-flow/1-fork.cy.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/1-fork.cy.js b/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/1-fork.cy.js index 593749964..5523bc406 100644 --- a/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/1-fork.cy.js +++ b/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/1-fork.cy.js @@ -80,7 +80,10 @@ describe( 'SiteGen Fork Step', function () { describe( 'SiteGen Fork Step- Migration Screen', function () { before( () => { cy.exec( - `npx wp-env run cli wp option set _transient_nfd_site_capabilities '{"hasAISiteGen": true, "canAccessAI": true, "canMigrateSite": true}' --format=json` + 'npx wp-env run cli wp option delete nfd_module_onboarding_flow' + ); + cy.exec( + `npx wp-env run cli wp option update _transient_nfd_site_capabilities '{"hasAISiteGen": true, "canAccessAI": true, "canMigrateSite": true}' --format=json` ); cy.visit( 'wp-admin/?page=nfd-onboarding#/wp-setup/step/fork' ); cy.wait( 5000 ); @@ -95,7 +98,7 @@ describe( 'SiteGen Fork Step- Migration Screen', function () { cy.get( '.nfd-onboarding-step--site-gen__fork__importsite', { } ) .scrollIntoView() - .should( 'exist' ) + .should('exist') .click(); cy.get( '.nfd-onboarding-step__heading__title' ).should( 'exist' ); cy.get( From d6a14e46881403e1bb492bd5888d2f6e297df913 Mon Sep 17 00:00:00 2001 From: sangeetha-nayak Date: Fri, 10 May 2024 15:18:54 +0530 Subject: [PATCH 05/17] testing --- .../integration/5-AI-SiteGen-onboarding-flow/1-fork.cy.js | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/1-fork.cy.js b/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/1-fork.cy.js index 5523bc406..fec3c8033 100644 --- a/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/1-fork.cy.js +++ b/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/1-fork.cy.js @@ -100,6 +100,7 @@ describe( 'SiteGen Fork Step- Migration Screen', function () { .scrollIntoView() .should('exist') .click(); + cy.wait(10000) cy.get( '.nfd-onboarding-step__heading__title' ).should( 'exist' ); cy.get( '.nfd-onboarding-step--site-gen__migration--container__loader' From bd63b8817b6bb85476a4bfea16eb73054b84858c Mon Sep 17 00:00:00 2001 From: sangeetha-nayak Date: Fri, 10 May 2024 16:33:32 +0530 Subject: [PATCH 06/17] club tests --- .../5-AI-SiteGen-onboarding-flow/1-fork.cy.js | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/1-fork.cy.js b/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/1-fork.cy.js index fec3c8033..6184c0a8c 100644 --- a/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/1-fork.cy.js +++ b/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/1-fork.cy.js @@ -13,7 +13,7 @@ describe( 'SiteGen Fork Step', function () { 'npx wp-env run cli wp option delete nfd_module_onboarding_flow' ); cy.exec( - `npx wp-env run cli wp option set _transient_nfd_site_capabilities '{"hasAISiteGen": true, "canAccessAI": true}' --format=json` + `npx wp-env run cli wp option set _transient_nfd_site_capabilities '{"hasAISiteGen": true, "canAccessAI": true, "canMigrateSite": true}' --format=json` ); cy.exec( `npx wp-env run cli wp option set _transient_timeout_nfd_site_capabilities 4102444800` @@ -75,19 +75,6 @@ describe( 'SiteGen Fork Step', function () { .should( 'exist' ) .should( 'contain', 'Already have a WordPress site' ); } ); -} ); - -describe( 'SiteGen Fork Step- Migration Screen', function () { - before( () => { - cy.exec( - 'npx wp-env run cli wp option delete nfd_module_onboarding_flow' - ); - cy.exec( - `npx wp-env run cli wp option update _transient_nfd_site_capabilities '{"hasAISiteGen": true, "canAccessAI": true, "canMigrateSite": true}' --format=json` - ); - cy.visit( 'wp-admin/?page=nfd-onboarding#/wp-setup/step/fork' ); - cy.wait( 5000 ); - } ); it( 'Verify Import site leads to migration process initiation screen', () => { cy.timeout( 20000 ) @@ -99,8 +86,7 @@ describe( 'SiteGen Fork Step- Migration Screen', function () { } ) .scrollIntoView() .should('exist') - .click(); - cy.wait(10000) + .click( { force: true} ); cy.get( '.nfd-onboarding-step__heading__title' ).should( 'exist' ); cy.get( '.nfd-onboarding-step--site-gen__migration--container__loader' From 9ac54ec7ca013a7ff4bec6540c04b7765b9e8ef3 Mon Sep 17 00:00:00 2001 From: sangeetha-nayak Date: Fri, 10 May 2024 17:07:15 +0530 Subject: [PATCH 07/17] remove timeout --- .../integration/5-AI-SiteGen-onboarding-flow/1-fork.cy.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/1-fork.cy.js b/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/1-fork.cy.js index 6184c0a8c..24a51d6d5 100644 --- a/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/1-fork.cy.js +++ b/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/1-fork.cy.js @@ -77,7 +77,6 @@ describe( 'SiteGen Fork Step', function () { } ); it( 'Verify Import site leads to migration process initiation screen', () => { - cy.timeout( 20000 ) cy.intercept( apiList.migrateConnect, ( req ) => { migrationConnection( req ); } ).as( 'migrateCall' ); @@ -87,7 +86,7 @@ describe( 'SiteGen Fork Step', function () { .scrollIntoView() .should('exist') .click( { force: true} ); - cy.get( '.nfd-onboarding-step__heading__title' ).should( 'exist' ); + cy.get( '.nfd-onboarding-step__heading__title' , { timeout: 10000 }).should( 'exist' ); cy.get( '.nfd-onboarding-step--site-gen__migration--container__loader' ).should( 'exist' ); From 1024a82831026f24d38bd7c8409e1d13dd6cba18 Mon Sep 17 00:00:00 2001 From: sangeetha-nayak Date: Fri, 10 May 2024 18:19:50 +0530 Subject: [PATCH 08/17] check if migrate call is gone or not --- .../integration/5-AI-SiteGen-onboarding-flow/1-fork.cy.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/1-fork.cy.js b/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/1-fork.cy.js index 24a51d6d5..f0a8e7eae 100644 --- a/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/1-fork.cy.js +++ b/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/1-fork.cy.js @@ -81,11 +81,14 @@ describe( 'SiteGen Fork Step', function () { migrationConnection( req ); } ).as( 'migrateCall' ); + cy.get( '.nfd-onboarding-step--site-gen__fork__importsite', { } ) .scrollIntoView() .should('exist') - .click( { force: true} ); + .click(); + cy.wait( '@migrateCall' , {timeout: 20000}); + cy.get( '.nfd-onboarding-step__heading__title' , { timeout: 10000 }).should( 'exist' ); cy.get( '.nfd-onboarding-step--site-gen__migration--container__loader' @@ -97,7 +100,7 @@ describe( 'SiteGen Fork Step', function () { AdminBarCheck(); DarkBGCheck(); LightBGCheck(); - cy.wait( '@migrateCall' ); + // cy.wait( '@migrateCall' , {timeout: 10000}); } ); it( 'Verify migration connection request is successful and redirection happens', () => { From 1bd003ce362f9dd3d303cfea5268a2537c19f841 Mon Sep 17 00:00:00 2001 From: sangeetha-nayak Date: Mon, 13 May 2024 09:47:50 +0530 Subject: [PATCH 09/17] Increase delay in interception --- .../integration/5-AI-SiteGen-onboarding-flow/1-fork.cy.js | 6 ++---- tests/cypress/integration/wp-module-support/MockApi.cy.js | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/1-fork.cy.js b/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/1-fork.cy.js index f0a8e7eae..157033b62 100644 --- a/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/1-fork.cy.js +++ b/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/1-fork.cy.js @@ -60,7 +60,7 @@ describe( 'SiteGen Fork Step', function () { arr.each( ( $element ) => { const dataSlugText = $element.attr( 'data-flow' ); if ( dataSlugText == 'sitegen' ) { - $element.click(); + $element.trigger('click'); cy.url().should( 'include', 'sitegen/step/welcome', { timeout: 10000, } ); @@ -87,8 +87,6 @@ describe( 'SiteGen Fork Step', function () { .scrollIntoView() .should('exist') .click(); - cy.wait( '@migrateCall' , {timeout: 20000}); - cy.get( '.nfd-onboarding-step__heading__title' , { timeout: 10000 }).should( 'exist' ); cy.get( '.nfd-onboarding-step--site-gen__migration--container__loader' @@ -100,7 +98,7 @@ describe( 'SiteGen Fork Step', function () { AdminBarCheck(); DarkBGCheck(); LightBGCheck(); - // cy.wait( '@migrateCall' , {timeout: 10000}); + cy.wait( '@migrateCall' , {timeout: 10000}); } ); it( 'Verify migration connection request is successful and redirection happens', () => { diff --git a/tests/cypress/integration/wp-module-support/MockApi.cy.js b/tests/cypress/integration/wp-module-support/MockApi.cy.js index b73d085b1..092643f4c 100644 --- a/tests/cypress/integration/wp-module-support/MockApi.cy.js +++ b/tests/cypress/integration/wp-module-support/MockApi.cy.js @@ -100,6 +100,6 @@ export const migrationConnection = ( req ) => { method: 'GET', statusCode: 200, body: migate_connect_mock, - delay: 5000, + delay: 8000, } ); }; From 17fb383ea1c107e925ad7ecf9fb0bcd822bd1b61 Mon Sep 17 00:00:00 2001 From: sangeetha-nayak Date: Mon, 13 May 2024 10:58:32 +0530 Subject: [PATCH 10/17] validate with and without can migrate flag --- .../5-AI-SiteGen-onboarding-flow/1-fork.cy.js | 49 +++++++++++++++---- 1 file changed, 40 insertions(+), 9 deletions(-) diff --git a/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/1-fork.cy.js b/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/1-fork.cy.js index 157033b62..0daa4603a 100644 --- a/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/1-fork.cy.js +++ b/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/1-fork.cy.js @@ -13,7 +13,7 @@ describe( 'SiteGen Fork Step', function () { 'npx wp-env run cli wp option delete nfd_module_onboarding_flow' ); cy.exec( - `npx wp-env run cli wp option set _transient_nfd_site_capabilities '{"hasAISiteGen": true, "canAccessAI": true, "canMigrateSite": true}' --format=json` + `npx wp-env run cli wp option set _transient_nfd_site_capabilities '{"hasAISiteGen": true, "canAccessAI": true}' --format=json` ); cy.exec( `npx wp-env run cli wp option set _transient_timeout_nfd_site_capabilities 4102444800` @@ -60,7 +60,7 @@ describe( 'SiteGen Fork Step', function () { arr.each( ( $element ) => { const dataSlugText = $element.attr( 'data-flow' ); if ( dataSlugText == 'sitegen' ) { - $element.trigger('click'); + $element.trigger( 'click' ); cy.url().should( 'include', 'sitegen/step/welcome', { timeout: 10000, } ); @@ -76,18 +76,49 @@ describe( 'SiteGen Fork Step', function () { .should( 'contain', 'Already have a WordPress site' ); } ); + it( ' Verify by default import your WP account leads to transfer site link ', () => { + cy.window().then( ( win ) => { + cy.spy( win, 'open', ( url ) => { + win.location.href = + 'https://bluehost.com/my-account/hosting/details/sites/add/transfer'; + } ).as( 'windowOpen' ); + } ); + + cy.get( '.nfd-onboarding-step--site-gen__fork__importsite' ) + .scrollIntoView() + .click(); + + cy.get( '@windowOpen' ).should( 'be.called' ); + } ); +} ); + +describe( 'Verify Import WP when can migrate capability is set', function () { + before( () => { + cy.exec( + 'npx wp-env run cli wp option delete _transient_nfd_site_capabilities' + ); + cy.exec( + `npx wp-env run cli wp option set _transient_nfd_site_capabilities '{"hasAISiteGen": true, "canAccessAI": true, "canMigrateSite": true}' --format=json` + ); + cy.exec( + `npx wp-env run cli wp option set _transient_timeout_nfd_site_capabilities 4102444800` + ); + cy.wait( 10000 ); + cy.visit( 'wp-admin/?page=nfd-onboarding#/wp-setup/step/fork' ); + cy.timeout( 60000 ); + } ); + it( 'Verify Import site leads to migration process initiation screen', () => { cy.intercept( apiList.migrateConnect, ( req ) => { migrationConnection( req ); } ).as( 'migrateCall' ); - - - cy.get( '.nfd-onboarding-step--site-gen__fork__importsite', { - } ) + cy.get( '.nfd-onboarding-step--site-gen__fork__importsite' ) .scrollIntoView() - .should('exist') + .should( 'exist' ) .click(); - cy.get( '.nfd-onboarding-step__heading__title' , { timeout: 10000 }).should( 'exist' ); + cy.get( '.nfd-onboarding-step__heading__title', { + timeout: 10000, + } ).should( 'exist' ); cy.get( '.nfd-onboarding-step--site-gen__migration--container__loader' ).should( 'exist' ); @@ -98,7 +129,7 @@ describe( 'SiteGen Fork Step', function () { AdminBarCheck(); DarkBGCheck(); LightBGCheck(); - cy.wait( '@migrateCall' , {timeout: 10000}); + cy.wait( '@migrateCall' , { timeout: 10000 } ); } ); it( 'Verify migration connection request is successful and redirection happens', () => { From 22f2c5bd140c6aeb9e8e4df25da194bc9f80ca08 Mon Sep 17 00:00:00 2001 From: sangeetha-nayak Date: Mon, 13 May 2024 11:57:22 +0530 Subject: [PATCH 11/17] set the capabilities right --- .../5-AI-SiteGen-onboarding-flow/1-fork.cy.js | 19 ++++++++++--------- .../2-welcome.cy.js | 2 +- .../3-site-details.cy.js | 2 +- .../4-site-logo.cy.js | 2 +- .../5-experience.cy.js | 2 +- .../6-preview.cy.js | 2 +- 6 files changed, 15 insertions(+), 14 deletions(-) diff --git a/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/1-fork.cy.js b/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/1-fork.cy.js index 0daa4603a..ca68e53f9 100644 --- a/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/1-fork.cy.js +++ b/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/1-fork.cy.js @@ -15,9 +15,6 @@ describe( 'SiteGen Fork Step', function () { cy.exec( `npx wp-env run cli wp option set _transient_nfd_site_capabilities '{"hasAISiteGen": true, "canAccessAI": true}' --format=json` ); - cy.exec( - `npx wp-env run cli wp option set _transient_timeout_nfd_site_capabilities 4102444800` - ); cy.wait( 10000 ); cy.visit( 'wp-admin/?page=nfd-onboarding#/wp-setup/step/fork' ); cy.timeout( 60000 ); @@ -95,24 +92,28 @@ describe( 'SiteGen Fork Step', function () { describe( 'Verify Import WP when can migrate capability is set', function () { before( () => { cy.exec( - 'npx wp-env run cli wp option delete _transient_nfd_site_capabilities' + 'npx wp-env run cli wp option delete _transient_nfd_site_capabilities', + { timeout: 20000 } ); cy.exec( - `npx wp-env run cli wp option set _transient_nfd_site_capabilities '{"hasAISiteGen": true, "canAccessAI": true, "canMigrateSite": true}' --format=json` + `npx wp-env run cli wp option set _transient_nfd_site_capabilities '{"hasAISiteGen": true, "canAccessAI": true, "canMigrateSite": true}' --format=json`, + { timeout: 20000 } ); cy.exec( - `npx wp-env run cli wp option set _transient_timeout_nfd_site_capabilities 4102444800` + `npx wp-env run cli wp option set _transient_timeout_nfd_site_capabilities 4102444800`, + { timeout: 20000 } ); cy.wait( 10000 ); cy.visit( 'wp-admin/?page=nfd-onboarding#/wp-setup/step/fork' ); - cy.timeout( 60000 ); } ); it( 'Verify Import site leads to migration process initiation screen', () => { cy.intercept( apiList.migrateConnect, ( req ) => { migrationConnection( req ); } ).as( 'migrateCall' ); - cy.get( '.nfd-onboarding-step--site-gen__fork__importsite' ) + cy.get( '.nfd-onboarding-step--site-gen__fork__importsite' , { + timeout: 10000, + } ) .scrollIntoView() .should( 'exist' ) .click(); @@ -129,7 +130,7 @@ describe( 'Verify Import WP when can migrate capability is set', function () { AdminBarCheck(); DarkBGCheck(); LightBGCheck(); - cy.wait( '@migrateCall' , { timeout: 10000 } ); + cy.wait( '@migrateCall', { timeout: 10000 } ); } ); it( 'Verify migration connection request is successful and redirection happens', () => { diff --git a/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/2-welcome.cy.js b/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/2-welcome.cy.js index 28fc5bafe..f965e81ba 100644 --- a/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/2-welcome.cy.js +++ b/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/2-welcome.cy.js @@ -8,7 +8,7 @@ import { ProgressBarCheck, } from '../wp-module-support/siteGen.cy'; -describe( 'SiteGen Welcome Step', function () { +describe.skip( 'SiteGen Welcome Step', function () { before( () => { cy.visit( 'wp-admin/?page=nfd-onboarding#/sitegen/step/welcome' ); } ); diff --git a/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/3-site-details.cy.js b/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/3-site-details.cy.js index 140674952..188d55e46 100644 --- a/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/3-site-details.cy.js +++ b/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/3-site-details.cy.js @@ -8,7 +8,7 @@ import { ProgressBarCheck, } from '../wp-module-support/siteGen.cy'; -describe( 'SiteGen Site Details Step', function () { +describe.skip( 'SiteGen Site Details Step', function () { before( () => { cy.visit( 'wp-admin/index.php?page=nfd-onboarding#/sitegen/step/site-details' diff --git a/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/4-site-logo.cy.js b/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/4-site-logo.cy.js index bd758a4b7..3d73a98c6 100644 --- a/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/4-site-logo.cy.js +++ b/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/4-site-logo.cy.js @@ -15,7 +15,7 @@ import { homePagesMock, } from '../wp-module-support/MockApi.cy'; -describe( 'SiteGen Site Logo Step', function () { +describe.skip( 'SiteGen Site Logo Step', function () { before( () => { cy.intercept( apiList.sitegen, ( req ) => { siteGenMockAll( req ); diff --git a/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/5-experience.cy.js b/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/5-experience.cy.js index 1828ac94f..8cb085d17 100644 --- a/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/5-experience.cy.js +++ b/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/5-experience.cy.js @@ -13,7 +13,7 @@ import { homePagesMock, } from '../wp-module-support/MockApi.cy'; -describe( 'SiteGen Experience & Site Building Step', function () { +describe.skip( 'SiteGen Experience & Site Building Step', function () { before( () => { cy.visit( 'wp-admin/index.php?page=nfd-onboarding#/sitegen/step/experience' diff --git a/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/6-preview.cy.js b/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/6-preview.cy.js index ab8dcacdb..9579029a0 100644 --- a/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/6-preview.cy.js +++ b/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/6-preview.cy.js @@ -13,7 +13,7 @@ import { homePagesRegenerate, } from '../wp-module-support/MockApi.cy'; -describe( 'SiteGen Site Preview Step', function () { +describe.skip( 'SiteGen Site Preview Step', function () { before( () => { cy.visit( 'wp-admin/index.php?page=nfd-onboarding#/sitegen/step/preview' From 19f0e44d4c2adebef4017732d6a10d42b04b6b74 Mon Sep 17 00:00:00 2001 From: sangeetha-nayak Date: Mon, 13 May 2024 12:20:19 +0530 Subject: [PATCH 12/17] just increase timeout --- .../integration/5-AI-SiteGen-onboarding-flow/1-fork.cy.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/1-fork.cy.js b/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/1-fork.cy.js index ca68e53f9..1cea26231 100644 --- a/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/1-fork.cy.js +++ b/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/1-fork.cy.js @@ -121,7 +121,7 @@ describe( 'Verify Import WP when can migrate capability is set', function () { timeout: 10000, } ).should( 'exist' ); cy.get( - '.nfd-onboarding-step--site-gen__migration--container__loader' + '.nfd-onboarding-step--site-gen__migration--container__loader', { timeout : 10000 } ).should( 'exist' ); cy.get( '.nfd-onboarding-step--site-gen__migration--container__importtext' From 974a291f52041cf0b6caef061d0f241eda0266be Mon Sep 17 00:00:00 2001 From: sangeetha-nayak Date: Mon, 13 May 2024 13:01:35 +0530 Subject: [PATCH 13/17] update capability --- .../5-AI-SiteGen-onboarding-flow/1-fork.cy.js | 20 +++---------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/1-fork.cy.js b/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/1-fork.cy.js index 1cea26231..1d4a3cf21 100644 --- a/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/1-fork.cy.js +++ b/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/1-fork.cy.js @@ -87,27 +87,13 @@ describe( 'SiteGen Fork Step', function () { cy.get( '@windowOpen' ).should( 'be.called' ); } ); -} ); -describe( 'Verify Import WP when can migrate capability is set', function () { - before( () => { - cy.exec( - 'npx wp-env run cli wp option delete _transient_nfd_site_capabilities', - { timeout: 20000 } - ); - cy.exec( - `npx wp-env run cli wp option set _transient_nfd_site_capabilities '{"hasAISiteGen": true, "canAccessAI": true, "canMigrateSite": true}' --format=json`, - { timeout: 20000 } - ); + it(' Verify Import site leads to migration process initiation screen when can migrate capability is set ', () => { cy.exec( - `npx wp-env run cli wp option set _transient_timeout_nfd_site_capabilities 4102444800`, + `npx wp-env run cli wp option update _transient_nfd_site_capabilities '{"hasAISiteGen": true, "canAccessAI": true, "canMigrateSite": true}' --format=json`, { timeout: 20000 } ); - cy.wait( 10000 ); - cy.visit( 'wp-admin/?page=nfd-onboarding#/wp-setup/step/fork' ); - } ); - - it( 'Verify Import site leads to migration process initiation screen', () => { + cy.reload() cy.intercept( apiList.migrateConnect, ( req ) => { migrationConnection( req ); } ).as( 'migrateCall' ); From ca2e3918e8227099618ee17362a9e812f3b10eaf Mon Sep 17 00:00:00 2001 From: sangeetha-nayak Date: Mon, 13 May 2024 13:25:14 +0530 Subject: [PATCH 14/17] final test --- .../integration/5-AI-SiteGen-onboarding-flow/1-fork.cy.js | 6 +++--- .../5-AI-SiteGen-onboarding-flow/2-welcome.cy.js | 2 +- .../5-AI-SiteGen-onboarding-flow/3-site-details.cy.js | 2 +- .../5-AI-SiteGen-onboarding-flow/4-site-logo.cy.js | 2 +- .../5-AI-SiteGen-onboarding-flow/5-experience.cy.js | 2 +- .../5-AI-SiteGen-onboarding-flow/6-preview.cy.js | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/1-fork.cy.js b/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/1-fork.cy.js index 1d4a3cf21..77d979750 100644 --- a/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/1-fork.cy.js +++ b/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/1-fork.cy.js @@ -73,7 +73,7 @@ describe( 'SiteGen Fork Step', function () { .should( 'contain', 'Already have a WordPress site' ); } ); - it( ' Verify by default import your WP account leads to transfer site link ', () => { + it( 'Verify by default import your WP account leads to transfer site link' , () => { cy.window().then( ( win ) => { cy.spy( win, 'open', ( url ) => { win.location.href = @@ -88,7 +88,7 @@ describe( 'SiteGen Fork Step', function () { cy.get( '@windowOpen' ).should( 'be.called' ); } ); - it(' Verify Import site leads to migration process initiation screen when can migrate capability is set ', () => { + it( 'Verify Import site leads to migration process initiation screen when can migrate capability is set' , () => { cy.exec( `npx wp-env run cli wp option update _transient_nfd_site_capabilities '{"hasAISiteGen": true, "canAccessAI": true, "canMigrateSite": true}' --format=json`, { timeout: 20000 } @@ -119,7 +119,7 @@ describe( 'SiteGen Fork Step', function () { cy.wait( '@migrateCall', { timeout: 10000 } ); } ); - it( 'Verify migration connection request is successful and redirection happens', () => { + it( 'Verify migration connection request is successful and redirection happens' , () => { cy.url().should( 'contain', 'app.instawp.io/migrate' ); } ); } ); diff --git a/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/2-welcome.cy.js b/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/2-welcome.cy.js index f965e81ba..28fc5bafe 100644 --- a/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/2-welcome.cy.js +++ b/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/2-welcome.cy.js @@ -8,7 +8,7 @@ import { ProgressBarCheck, } from '../wp-module-support/siteGen.cy'; -describe.skip( 'SiteGen Welcome Step', function () { +describe( 'SiteGen Welcome Step', function () { before( () => { cy.visit( 'wp-admin/?page=nfd-onboarding#/sitegen/step/welcome' ); } ); diff --git a/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/3-site-details.cy.js b/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/3-site-details.cy.js index 188d55e46..140674952 100644 --- a/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/3-site-details.cy.js +++ b/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/3-site-details.cy.js @@ -8,7 +8,7 @@ import { ProgressBarCheck, } from '../wp-module-support/siteGen.cy'; -describe.skip( 'SiteGen Site Details Step', function () { +describe( 'SiteGen Site Details Step', function () { before( () => { cy.visit( 'wp-admin/index.php?page=nfd-onboarding#/sitegen/step/site-details' diff --git a/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/4-site-logo.cy.js b/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/4-site-logo.cy.js index 3d73a98c6..bd758a4b7 100644 --- a/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/4-site-logo.cy.js +++ b/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/4-site-logo.cy.js @@ -15,7 +15,7 @@ import { homePagesMock, } from '../wp-module-support/MockApi.cy'; -describe.skip( 'SiteGen Site Logo Step', function () { +describe( 'SiteGen Site Logo Step', function () { before( () => { cy.intercept( apiList.sitegen, ( req ) => { siteGenMockAll( req ); diff --git a/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/5-experience.cy.js b/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/5-experience.cy.js index 8cb085d17..1828ac94f 100644 --- a/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/5-experience.cy.js +++ b/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/5-experience.cy.js @@ -13,7 +13,7 @@ import { homePagesMock, } from '../wp-module-support/MockApi.cy'; -describe.skip( 'SiteGen Experience & Site Building Step', function () { +describe( 'SiteGen Experience & Site Building Step', function () { before( () => { cy.visit( 'wp-admin/index.php?page=nfd-onboarding#/sitegen/step/experience' diff --git a/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/6-preview.cy.js b/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/6-preview.cy.js index 9579029a0..ab8dcacdb 100644 --- a/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/6-preview.cy.js +++ b/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/6-preview.cy.js @@ -13,7 +13,7 @@ import { homePagesRegenerate, } from '../wp-module-support/MockApi.cy'; -describe.skip( 'SiteGen Site Preview Step', function () { +describe( 'SiteGen Site Preview Step', function () { before( () => { cy.visit( 'wp-admin/index.php?page=nfd-onboarding#/sitegen/step/preview' From 9fbda2d1dc6d5b5bfebbe40fcb4ac628953b54da Mon Sep 17 00:00:00 2001 From: sangeetha-nayak Date: Mon, 13 May 2024 14:41:28 +0530 Subject: [PATCH 15/17] add back deleted line --- .../integration/5-AI-SiteGen-onboarding-flow/1-fork.cy.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/1-fork.cy.js b/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/1-fork.cy.js index 77d979750..e1ca3335d 100644 --- a/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/1-fork.cy.js +++ b/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/1-fork.cy.js @@ -15,6 +15,9 @@ describe( 'SiteGen Fork Step', function () { cy.exec( `npx wp-env run cli wp option set _transient_nfd_site_capabilities '{"hasAISiteGen": true, "canAccessAI": true}' --format=json` ); + cy.exec( + `npx wp-env run cli wp option set _transient_timeout_nfd_site_capabilities 4102444800` + ); cy.wait( 10000 ); cy.visit( 'wp-admin/?page=nfd-onboarding#/wp-setup/step/fork' ); cy.timeout( 60000 ); From 07390b75d25ad3d788df8a07dd8d6d5c75a66b46 Mon Sep 17 00:00:00 2001 From: sangeetha-nayak Date: Mon, 13 May 2024 14:42:33 +0530 Subject: [PATCH 16/17] end of file --- tests/cypress/fixtures/migrate-connect.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/cypress/fixtures/migrate-connect.json b/tests/cypress/fixtures/migrate-connect.json index ef9a805cb..920af5173 100644 --- a/tests/cypress/fixtures/migrate-connect.json +++ b/tests/cypress/fixtures/migrate-connect.json @@ -5,4 +5,4 @@ "response": true, "redirect_url": "https:\/\/app.instawp.io\/migrate\/bluehost?d_id=1bb9623e-5208-40f7-9383-cd91df2fe58c" } -} \ No newline at end of file +} From 6182823cbef8c35e4f5c5b576c38015fdb0ac461 Mon Sep 17 00:00:00 2001 From: sangeetha-nayak Date: Tue, 14 May 2024 10:58:03 +0530 Subject: [PATCH 17/17] corrected typo --- tests/cypress/integration/wp-module-support/MockApi.cy.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/cypress/integration/wp-module-support/MockApi.cy.js b/tests/cypress/integration/wp-module-support/MockApi.cy.js index 092643f4c..39e908ce2 100644 --- a/tests/cypress/integration/wp-module-support/MockApi.cy.js +++ b/tests/cypress/integration/wp-module-support/MockApi.cy.js @@ -11,7 +11,7 @@ const homepages_mock = require( '../../fixtures/homepages.json' ); const theme_style_mock = require( '../../fixtures/theme-style.json' ); const customize_data_mock = require( '../../fixtures/customize-data.json' ); const homepage_regenerate_mock = require( '../../fixtures/homepage-regenerate.json' ); -const migate_connect_mock = require( '../../fixtures/migrate-connect.json' ); +const migrate_connect_mock = require( '../../fixtures/migrate-connect.json' ); export const apiList = { sitegen: @@ -99,7 +99,7 @@ export const migrationConnection = ( req ) => { req.reply( { method: 'GET', statusCode: 200, - body: migate_connect_mock, + body: migrate_connect_mock, delay: 8000, } ); };