From 2ed7ecf9ea0011b16a6473b52b8f3d279796b41a Mon Sep 17 00:00:00 2001 From: sangeetha-nayak Date: Thu, 25 Apr 2024 17:48:40 +0530 Subject: [PATCH 1/4] Replace text identifiers with id --- build/index.asset.php | 2 +- .../integration/Home/commerceHomePage.cy.js | 85 ++++++++++++------- .../integration/Home/homePageWithWoo.cy.js | 18 ++-- 3 files changed, 61 insertions(+), 44 deletions(-) diff --git a/build/index.asset.php b/build/index.asset.php index a87d81f3..9fcad2ac 100644 --- a/build/index.asset.php +++ b/build/index.asset.php @@ -1 +1 @@ - array('lodash', 'moment', 'react', 'wp-api-fetch', 'wp-data', 'wp-date', 'wp-dom-ready', 'wp-element', 'wp-i18n', 'wp-url'), 'version' => '75ee6dfacce73eb32cea'); + array('lodash', 'moment', 'react', 'wp-api-fetch', 'wp-data', 'wp-date', 'wp-dom-ready', 'wp-element', 'wp-i18n', 'wp-url'), 'version' => 'cc8b2cb93b30057db3f5'); diff --git a/tests/cypress/integration/Home/commerceHomePage.cy.js b/tests/cypress/integration/Home/commerceHomePage.cy.js index 8a4c46bb..0ab655bf 100644 --- a/tests/cypress/integration/Home/commerceHomePage.cy.js +++ b/tests/cypress/integration/Home/commerceHomePage.cy.js @@ -157,11 +157,17 @@ describe( 'Commerce Home Page- Next Steps', () => { } ); it( 'Verify Next steps for your site when woocommerce is not active', () => { - const steps = [ - 'Add a new page to your site', - 'Upload media to your site', - 'Enable Jetpack to connect to your social media accounts', + // const steps = [ + // 'Upload media to your site', + // 'Add a new page to your site', + // 'Enable Jetpack to connect to your social media accounts', + // ]; + const step_id = [ + 'add-a-new-page-to-your-site', + 'upload-media-to-your-site', + 'enable-jetpack-to-connect-to-your-social-media-accounts', ]; + cy.get( '.nfd-grid.nfd-gap-4', { timeout: customCommandTimeout } ) .as( 'nextSteps' ) .should( 'exist' ); @@ -169,25 +175,40 @@ describe( 'Commerce Home Page- Next Steps', () => { cy.get( '@nextSteps' ).find( 'p' ).should( 'exist' ); cy.get( '@nextSteps' ) .find( 'ul li' ) - .each( ( item, index, list ) => { - expect( list ).to.have.length( 3 ); + .each( ( ele, index, list ) => { + expect(list).to.have.length(3); + cy.get(ele).invoke('attr', 'id').then((domId) => { + expect(domId).to.eq(step_id[ index ]) + }) - expect( Cypress.$( item ).text() ).to.eq( steps[ index ] ); + // expect( Cypress.$( item ).id() ).to.eq( steps[ index ] ); } ); } ); it( 'Verify Next steps when experience level is novice', () => { - const other_steps = [ - 'Sign up for Yoast SEO Academy', - 'Add a new page to your site', - 'Upload media to your site', - 'Enable Jetpack to connect to your social media accounts', - ]; + // const other_steps = [ + // 'Sign up for Yoast SEO Academy', + // 'Add a new page to your site', + // 'Upload media to your site', + // 'Enable Jetpack to connect to your social media accounts', + // ]; - const steps = [ - 'Sign up for Bluehost WordPress Academy', - ...other_steps, - ]; + const other_step_id = [ + 'sign-up-for-yoast-seo-academy', + 'add-a-new-page-to-your-site', + 'upload-media-to-your-site', + 'enable-jetpack-to-connect-to-your-social-media-accounts', + ] + + // const steps = [ + // 'Sign up for Bluehost WordPress Academy', + // ...other_steps, + // ]; + + const step_id = [ + 'sign-up-for-bluehost-wordpress-academy', + ...other_step_id, + ] cy.visit( '/wp-admin/index.php?page=nfd-onboarding#/wp-setup/step/get-started/experience' @@ -208,15 +229,17 @@ describe( 'Commerce Home Page- Next Steps', () => { cy.get( '@nextSteps' ) .find( 'ul li' ) - .each( ( item, index, list ) => { + .each( ( ele, index, list ) => { if ( pluginId == 'bluehost' ) { expect( list ).to.have.length( 5 ); - expect( Cypress.$( item ).text() ).to.eq( steps[ index ] ); - } else { + cy.get(ele).invoke('attr', 'id').then((domId) => { + expect(domId).to.eq(other_step_id[index]) + } + )} else { expect( list ).to.have.length( 4 ); - expect( Cypress.$( item ).text() ).to.eq( - other_steps[ index ] - ); + cy.get(ele).invoke('attr', 'id').then((domId) => { + expect(domId).to.eq(step_id[index]) + }) } } ); } ); @@ -224,9 +247,7 @@ describe( 'Commerce Home Page- Next Steps', () => { it( 'Verify Signup for Bluehost WordPress Academy step', () => { if ( pluginId == 'bluehost' ) { cy.intercept( APIList.bh_academy ).as( 'events' ); - cy.contains( - '.nfd-grid.nfd-gap-4 ul li a', - 'Sign up for Bluehost WordPress Academy', + cy.get('#sign-up-for-bluehost-wordpress-academy a', { timeout: customCommandTimeout } ) .as( 'nextSteps' ) @@ -250,9 +271,8 @@ describe( 'Commerce Home Page- Next Steps', () => { it( 'Verify Signup for Wordpress SEO Academy step', () => { cy.intercept( APIList.yoast_seo_academy ).as( 'events' ); - cy.contains( - '.nfd-grid.nfd-gap-4 ul li a', - 'Sign up for Yoast SEO Academy', + cy.get( + '#sign-up-for-yoast-seo-academy a', { timeout: customCommandTimeout } ) .as( 'nextSteps' ) @@ -284,9 +304,8 @@ describe( 'Commerce Home Page- Next Steps', () => { cy.get( '.nfd-grid.nfd-gap-4 ul li', { timeout: customCommandTimeout, } ); - cy.contains( - '.nfd-grid.nfd-gap-4 ul li a', - 'Add a new page to your site', + cy.get( + '#add-a-new-page-to-your-site a', { timeout: customCommandTimeout, } @@ -308,7 +327,7 @@ describe( 'Commerce Home Page- Next Steps', () => { } ); it( 'Verify Option Upload Media to your site', () => { - cy.contains( 'Upload media to your site', { + cy.get( '#upload-media-to-your-site a', { timeout: customCommandTimeout, } ) .as( 'uploadMedia' ) diff --git a/tests/cypress/integration/Home/homePageWithWoo.cy.js b/tests/cypress/integration/Home/homePageWithWoo.cy.js index 29d4a6f2..85c65454 100644 --- a/tests/cypress/integration/Home/homePageWithWoo.cy.js +++ b/tests/cypress/integration/Home/homePageWithWoo.cy.js @@ -24,7 +24,7 @@ describe( 'Commerce Home Page- When WooCommerce is installed', () => { it( 'Verify next steps "Add your store info"', () => { waitForNextSteps() - cy.contains( '.nfd-grid.nfd-gap-4 ul li a', 'Add your store info', { + cy.get( '#add-your-store-info a', { timeout: customCommandTimeout, } ) .as( 'storeInfoStep' ) @@ -77,9 +77,8 @@ describe( 'Commerce Home Page- When WooCommerce is installed', () => { it( 'Verify next step "Connect a payment processor"', () => { cy.reload(); waitForNextSteps(); - cy.contains( - '.nfd-grid.nfd-gap-4 ul li a', - 'Connect a payment processor', + cy.get( + '#connect-a-payment-processor a', { timeout: customCommandTimeout, } @@ -128,9 +127,8 @@ describe( 'Commerce Home Page- When WooCommerce is installed', () => { it( ' Verify next step "Set up Shipping options" ', () => { if ( pluginId == 'bluehost' ) { waitForNextSteps(); - cy.contains( - '.nfd-grid.nfd-gap-4 ul li a', - 'Setup shipping options', + cy.get( + '#setup-shipping-options a', { timeout: customCommandTimeout, } @@ -167,9 +165,9 @@ describe( 'Commerce Home Page- When WooCommerce is installed', () => { } } ); - it.skip( 'Verify next step "Configure tax settings"', () => { + it( 'Verify next step "Configure tax settings"', () => { waitForNextSteps(); - cy.contains( '.nfd-grid.nfd-gap-4 ul li a', 'Configure tax settings', { + cy.get( '#configure-tax-settings a', { timeout: customCommandTimeout, } ) .as( 'taxStep' ) @@ -197,7 +195,7 @@ describe( 'Commerce Home Page- When WooCommerce is installed', () => { it( 'Verify next step "Add a Product"', () => { waitForNextSteps(); - cy.contains( '.nfd-grid.nfd-gap-4 ul li a', 'Add a product', { + cy.get( '#add-a-product a', { timeout: customCommandTimeout, }) .as( 'addProduct' ) From a5ff999dab9875522bb8191f8078ff1f4b33f456 Mon Sep 17 00:00:00 2001 From: sangeetha-nayak Date: Thu, 25 Apr 2024 18:15:29 +0530 Subject: [PATCH 2/4] corrected reversed steps --- tests/cypress/integration/Home/commerceHomePage.cy.js | 4 ++-- tests/cypress/integration/Home/homePageWithWoo.cy.js | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/cypress/integration/Home/commerceHomePage.cy.js b/tests/cypress/integration/Home/commerceHomePage.cy.js index 0ab655bf..f0354dd2 100644 --- a/tests/cypress/integration/Home/commerceHomePage.cy.js +++ b/tests/cypress/integration/Home/commerceHomePage.cy.js @@ -233,12 +233,12 @@ describe( 'Commerce Home Page- Next Steps', () => { if ( pluginId == 'bluehost' ) { expect( list ).to.have.length( 5 ); cy.get(ele).invoke('attr', 'id').then((domId) => { - expect(domId).to.eq(other_step_id[index]) + expect(domId).to.eq(step_id[index]) } )} else { expect( list ).to.have.length( 4 ); cy.get(ele).invoke('attr', 'id').then((domId) => { - expect(domId).to.eq(step_id[index]) + expect(domId).to.eq(other_step_id[index]) }) } } ); diff --git a/tests/cypress/integration/Home/homePageWithWoo.cy.js b/tests/cypress/integration/Home/homePageWithWoo.cy.js index 85c65454..2061609e 100644 --- a/tests/cypress/integration/Home/homePageWithWoo.cy.js +++ b/tests/cypress/integration/Home/homePageWithWoo.cy.js @@ -183,7 +183,8 @@ describe( 'Commerce Home Page- When WooCommerce is installed', () => { } ).should( 'exist' ); cy.get( '.nfd-w-0 p' ).should( 'exist' ); - cy.get( `.${ appId }-app-navitem-Home` ).click(); + cy.get(`.${appId}-app-navitem-Home`).click(); + cy.reload() waitForNextSteps() cy.get( '@taxStep', { timeout: 30000 } ).should( 'not.exist' From f91927c59d5407f7d8b7597a01394b328c149ffb Mon Sep 17 00:00:00 2001 From: sangeetha-nayak Date: Thu, 25 Apr 2024 19:35:35 +0530 Subject: [PATCH 3/4] removed more text identifiers, fixed linting --- .../integration/Home/commerceHomePage.cy.js | 128 ++++++++---------- .../integration/Home/homePageWithWoo.cy.js | 70 ++++------ .../Site-Capabilities/siteCapabilities.cy.js | 43 +++--- .../integration/wp-module-support/utils.cy.js | 8 +- 4 files changed, 110 insertions(+), 139 deletions(-) diff --git a/tests/cypress/integration/Home/commerceHomePage.cy.js b/tests/cypress/integration/Home/commerceHomePage.cy.js index f0354dd2..f98eb9bf 100644 --- a/tests/cypress/integration/Home/commerceHomePage.cy.js +++ b/tests/cypress/integration/Home/commerceHomePage.cy.js @@ -2,7 +2,7 @@ import { GetPluginId } from '../wp-module-support/pluginID.cy'; import { comingSoon, viewCompletedTasks, - viewRemainingTasks, + viewRemainingTasks } from '../wp-module-support/utils.cy'; import { EventsAPI, APIList } from '../wp-module-support/eventsAPIs.cy'; @@ -116,9 +116,10 @@ describe( 'Commerce Home Page- Live Mode', () => { } ); it( 'Verify by default View Site option should be displayed', () => { - cy.contains( '.nfd-button--primary', 'View Site', { + cy.get( '.nfd-button--primary', { timeout: customCommandTimeout, } ) + .eq( 1 ) .should( 'exist' ) .invoke( 'removeAttr', 'target' ) .click(); @@ -127,15 +128,35 @@ describe( 'Commerce Home Page- Live Mode', () => { } ); describe( 'Commerce Home Page- Next Steps', () => { + const step_id = [ + 'add-a-new-page-to-your-site', + 'upload-media-to-your-site', + 'enable-jetpack-to-connect-to-your-social-media-accounts', + ]; + + const novice_step_id = [ + 'sign-up-for-yoast-seo-academy', + 'add-a-new-page-to-your-site', + 'upload-media-to-your-site', + 'enable-jetpack-to-connect-to-your-social-media-accounts', + ]; + + const novice_step_id_bh = [ + 'sign-up-for-bluehost-wordpress-academy', + ...other_step_id, + ]; + before( () => { cy.exec( `npx wp-env run cli wp plugin deactivate woocommerce`, { failOnNonZeroExit: false, } ); - cy.exec(`npx wp-env run cli wp option set mm_brand ${ pluginId }`); + cy.exec( `npx wp-env run cli wp option set mm_brand ${ pluginId }` ); if ( pluginId == 'hostgator' ) { - cy.exec(`npx wp-env run cli wp option set hg_region ${ hg_region }`); + cy.exec( + `npx wp-env run cli wp option set hg_region ${ hg_region }` + ); } } ); @@ -157,18 +178,7 @@ describe( 'Commerce Home Page- Next Steps', () => { } ); it( 'Verify Next steps for your site when woocommerce is not active', () => { - // const steps = [ - // 'Upload media to your site', - // 'Add a new page to your site', - // 'Enable Jetpack to connect to your social media accounts', - // ]; - const step_id = [ - 'add-a-new-page-to-your-site', - 'upload-media-to-your-site', - 'enable-jetpack-to-connect-to-your-social-media-accounts', - ]; - - cy.get( '.nfd-grid.nfd-gap-4', { timeout: customCommandTimeout } ) + cy.get( '#next-steps-section', { timeout: customCommandTimeout } ) .as( 'nextSteps' ) .should( 'exist' ); cy.get( '@nextSteps' ).find( 'h1' ).should( 'exist' ); @@ -176,40 +186,16 @@ describe( 'Commerce Home Page- Next Steps', () => { cy.get( '@nextSteps' ) .find( 'ul li' ) .each( ( ele, index, list ) => { - expect(list).to.have.length(3); - cy.get(ele).invoke('attr', 'id').then((domId) => { - expect(domId).to.eq(step_id[ index ]) - }) - - // expect( Cypress.$( item ).id() ).to.eq( steps[ index ] ); + expect( list ).to.have.length( 3 ); + cy.get( ele ) + .invoke( 'attr', 'id' ) + .then( ( domId ) => { + expect( domId ).to.eq( step_id[ index ] ); + } ); } ); } ); it( 'Verify Next steps when experience level is novice', () => { - // const other_steps = [ - // 'Sign up for Yoast SEO Academy', - // 'Add a new page to your site', - // 'Upload media to your site', - // 'Enable Jetpack to connect to your social media accounts', - // ]; - - const other_step_id = [ - 'sign-up-for-yoast-seo-academy', - 'add-a-new-page-to-your-site', - 'upload-media-to-your-site', - 'enable-jetpack-to-connect-to-your-social-media-accounts', - ] - - // const steps = [ - // 'Sign up for Bluehost WordPress Academy', - // ...other_steps, - // ]; - - const step_id = [ - 'sign-up-for-bluehost-wordpress-academy', - ...other_step_id, - ] - cy.visit( '/wp-admin/index.php?page=nfd-onboarding#/wp-setup/step/get-started/experience' ); @@ -222,7 +208,7 @@ describe( 'Commerce Home Page- Next Steps', () => { failOnNonZeroExit: false, } ); cy.wait( 2000 ); - cy.get( '.nfd-grid.nfd-gap-4', { timeout: customCommandTimeout } ) + cy.get( '#next-steps-section', { timeout: customCommandTimeout } ) .as( 'nextSteps' ) .should( 'exist' ) .scrollIntoView(); @@ -232,14 +218,18 @@ describe( 'Commerce Home Page- Next Steps', () => { .each( ( ele, index, list ) => { if ( pluginId == 'bluehost' ) { expect( list ).to.have.length( 5 ); - cy.get(ele).invoke('attr', 'id').then((domId) => { - expect(domId).to.eq(step_id[index]) - } - )} else { + cy.get( ele ) + .invoke( 'attr', 'id' ) + .then( ( domId ) => { + expect( domId ).to.eq( novice_step_id_bh[ index ] ); + } ); + } else { expect( list ).to.have.length( 4 ); - cy.get(ele).invoke('attr', 'id').then((domId) => { - expect(domId).to.eq(other_step_id[index]) - }) + cy.get( ele ) + .invoke( 'attr', 'id' ) + .then( ( domId ) => { + expect( domId ).to.eq( novice_step_id[ index ] ); + } ); } } ); } ); @@ -247,9 +237,9 @@ describe( 'Commerce Home Page- Next Steps', () => { it( 'Verify Signup for Bluehost WordPress Academy step', () => { if ( pluginId == 'bluehost' ) { cy.intercept( APIList.bh_academy ).as( 'events' ); - cy.get('#sign-up-for-bluehost-wordpress-academy a', - { timeout: customCommandTimeout } - ) + cy.get( `#${ novice_step_id_bh[ 0 ] } a`, { + timeout: customCommandTimeout, + } ) .as( 'nextSteps' ) .should( 'exist' ) .scrollIntoView() @@ -271,10 +261,9 @@ describe( 'Commerce Home Page- Next Steps', () => { it( 'Verify Signup for Wordpress SEO Academy step', () => { cy.intercept( APIList.yoast_seo_academy ).as( 'events' ); - cy.get( - '#sign-up-for-yoast-seo-academy a', - { timeout: customCommandTimeout } - ) + cy.get( `#${ novice_step_id_bh[ 1 ] } a`, { + timeout: customCommandTimeout, + } ) .as( 'nextSteps' ) .should( 'exist' ) .scrollIntoView() @@ -296,7 +285,7 @@ describe( 'Commerce Home Page- Next Steps', () => { cy.get( '@nextSteps' ).should( 'not.exist' ); viewCompletedTasks(); - cy.get('@nextSteps').should('exist'); + cy.get( '@nextSteps' ).should( 'exist' ); viewRemainingTasks(); } ); @@ -304,12 +293,9 @@ describe( 'Commerce Home Page- Next Steps', () => { cy.get( '.nfd-grid.nfd-gap-4 ul li', { timeout: customCommandTimeout, } ); - cy.get( - '#add-a-new-page-to-your-site a', - { - timeout: customCommandTimeout, - } - ) + cy.get( `#${ novice_step_id_bh[ 2 ] } a`, { + timeout: customCommandTimeout, + } ) .as( 'addPage' ) .scrollIntoView() .click(); @@ -322,12 +308,12 @@ describe( 'Commerce Home Page- Next Steps', () => { cy.wait( 2000 ); cy.get( '@addPage' ).should( 'not.exist' ); viewCompletedTasks(); - cy.get( '@addPage' ).should( 'exist' ); - viewRemainingTasks(); + cy.get( '@addPage' ).should( 'exist' ); + viewRemainingTasks(); } ); it( 'Verify Option Upload Media to your site', () => { - cy.get( '#upload-media-to-your-site a', { + cy.get( `#${ novice_step_id_bh[ 3 ] } a`, { timeout: customCommandTimeout, } ) .as( 'uploadMedia' ) diff --git a/tests/cypress/integration/Home/homePageWithWoo.cy.js b/tests/cypress/integration/Home/homePageWithWoo.cy.js index 2061609e..c2b781d6 100644 --- a/tests/cypress/integration/Home/homePageWithWoo.cy.js +++ b/tests/cypress/integration/Home/homePageWithWoo.cy.js @@ -4,7 +4,7 @@ import { installWoo, viewCompletedTasks, viewRemainingTasks, - waitForNextSteps + waitForNextSteps, } from '../wp-module-support/utils.cy'; const customCommandTimeout = 20000; @@ -23,7 +23,7 @@ describe( 'Commerce Home Page- When WooCommerce is installed', () => { } ); it( 'Verify next steps "Add your store info"', () => { - waitForNextSteps() + waitForNextSteps(); cy.get( '#add-your-store-info a', { timeout: customCommandTimeout, } ) @@ -77,23 +77,18 @@ describe( 'Commerce Home Page- When WooCommerce is installed', () => { it( 'Verify next step "Connect a payment processor"', () => { cy.reload(); waitForNextSteps(); - cy.get( - '#connect-a-payment-processor a', - { - timeout: customCommandTimeout, - } - ) + cy.get( '#connect-a-payment-processor a', { + timeout: customCommandTimeout, + } ) .as( 'paymentStep' ) .should( 'exist' ) .scrollIntoView() .click(); cy.get( `.${ appId }-app-subnavitem-Payments.active`, { - timeout: customCommandTimeout - }).should( - 'exist' - ); - cy.contains( 'section', 'Razorpay' ).as( 'razorpayBlock' ); - cy.get( '@razorpayBlock' ).find( '.nfd-button--primary' ).click(); + timeout: customCommandTimeout, + } ).should( 'exist' ); + cy.get( '#razorpay-section' ).as( 'razorpayBlock' ); + cy.get( '@razorpayBlock' ).find( '#install-razorpay' ).click(); cy.get( '[data-id="rzpTestModeToggle"]', { timeout: customCommandTimeout, @@ -104,8 +99,8 @@ describe( 'Commerce Home Page- When WooCommerce is installed', () => { cy.get( '.nfd-border-t .nfd-button--primary' ).click(); - cy.get( '@razorpayBlock' , { timeout: customCommandTimeout } ) - .find( '.nfd-badge--upsell' , { timeout: customCommandTimeout }) + cy.get( '@razorpayBlock', { timeout: customCommandTimeout } ) + .find( '.nfd-badge--upsell', { timeout: customCommandTimeout } ) .should( 'exist' ); cy.get( `.${ appId }-app-navitem-Home` ).click(); @@ -127,25 +122,18 @@ describe( 'Commerce Home Page- When WooCommerce is installed', () => { it( ' Verify next step "Set up Shipping options" ', () => { if ( pluginId == 'bluehost' ) { waitForNextSteps(); - cy.get( - '#setup-shipping-options a', - { - timeout: customCommandTimeout, - } - ) + cy.get( '#setup-shipping-options a', { + timeout: customCommandTimeout, + } ) .as( 'paymentStep' ) .should( 'exist' ) .scrollIntoView() .click(); - cy.get( '.nfd-app-section-content .nfd-button--primary', { + cy.get( '#install-shippo', { timeout: customCommandTimeout, - } ) - .contains( 'Install' ) - .click(); - cy.get( '.nfd-app-section-content .nfd-button--primary' ) - .contains( 'Installing' ) - .should( 'not.exist' ); + } ).click(); + cy.get( '#installing-shippo' ).should( 'not.exist' ); cy.window().then( ( win ) => { cy.spy( win, 'open', ( url ) => { @@ -154,11 +142,9 @@ describe( 'Commerce Home Page- When WooCommerce is installed', () => { } ).as( 'windowOpen' ); } ); - cy.get( '.nfd-app-section-content .nfd-button--primary', { + cy.get( '#connect-to-shippo-btn', { timeout: customCommandTimeout, - } ) - .contains( 'Connect' ) - .click(); + } ).click(); cy.get( '@windowOpen', { timeout: customCommandTimeout } ).should( 'be.called' ); @@ -174,7 +160,9 @@ describe( 'Commerce Home Page- When WooCommerce is installed', () => { .should( 'exist' ) .scrollIntoView() .click(); - cy.get( `.${ appId }-app-subnavitem-Store.active`, { timeout : customCommandTimeout } ).should( 'exist' ); + cy.get( `.${ appId }-app-subnavitem-Store.active`, { + timeout: customCommandTimeout, + } ).should( 'exist' ); cy.get( '#tax-yes' ).click(); cy.get( '.nfd-border-t .nfd-button--primary' ).click(); @@ -183,12 +171,10 @@ describe( 'Commerce Home Page- When WooCommerce is installed', () => { } ).should( 'exist' ); cy.get( '.nfd-w-0 p' ).should( 'exist' ); - cy.get(`.${appId}-app-navitem-Home`).click(); - cy.reload() - waitForNextSteps() - cy.get( '@taxStep', { timeout: 30000 } ).should( - 'not.exist' - ); + cy.get( `.${ appId }-app-navitem-Home` ).click(); + cy.reload(); + waitForNextSteps(); + cy.get( '@taxStep', { timeout: 30000 } ).should( 'not.exist' ); viewCompletedTasks(); cy.get( '@taxStep' ).should( 'exist' ); viewRemainingTasks(); @@ -198,10 +184,10 @@ describe( 'Commerce Home Page- When WooCommerce is installed', () => { waitForNextSteps(); cy.get( '#add-a-product a', { timeout: customCommandTimeout, - }) + } ) .as( 'addProduct' ) .should( 'exist' ) - .click(); + .click(); cy.url().should( 'eq', Cypress.config().baseUrl + diff --git a/tests/cypress/integration/Site-Capabilities/siteCapabilities.cy.js b/tests/cypress/integration/Site-Capabilities/siteCapabilities.cy.js index 6b421bc2..dc774f4a 100644 --- a/tests/cypress/integration/Site-Capabilities/siteCapabilities.cy.js +++ b/tests/cypress/integration/Site-Capabilities/siteCapabilities.cy.js @@ -8,23 +8,23 @@ const appId = getAppId(); describe( 'Verify Wondercart accessibility as per site capabilities', () => { const cTBAndYithTrue = JSON.stringify( { - "canAccessAI": true, - "canAccessHelpCenter": true, - "canAccessGlobalCTB": true, - "hasEcomdash": false, - "hasYithExtended": true, - "isEcommerce": true, - "isJarvis": true, + canAccessAI: true, + canAccessHelpCenter: true, + canAccessGlobalCTB: true, + hasEcomdash: false, + hasYithExtended: true, + isEcommerce: true, + isJarvis: true, } ); const cTBTrueYithFalse = JSON.stringify( { - "canAccessAI": true, - "canAccessHelpCenter": true, - "canAccessGlobalCTB": true, - "hasEcomdash": false, - "hasYithExtended": false, - "isEcommerce": false, - "isJarvis": true, + canAccessAI: true, + canAccessHelpCenter: true, + canAccessGlobalCTB: true, + hasEcomdash: false, + hasYithExtended: false, + isEcommerce: false, + isJarvis: true, } ); before( function () { @@ -79,12 +79,12 @@ describe( 'Verify Wondercart accessibility as per site capabilities', () => { .as( 'salesTab' ) .should( 'exist' ); cy.get( '@salesTab' ).click(); - cy.get( '.nfd-button--upsell', { timeout: mediumWait } ).should( + cy.get( '#buynow-wondercart', { timeout: mediumWait } ).should( 'exist' ); } ); - it('Verify clicking on Buy Now leads to cpanel login page', () => { + it( 'Verify clicking on Buy Now leads to cpanel login page', () => { cy.reload(); cy.get( `.${ appId }-app-navitem-Store`, { timeout: customCommandTimeout, @@ -93,9 +93,9 @@ describe( 'Verify Wondercart accessibility as per site capabilities', () => { timeout: customCommandTimeout, } ).click(); cy.get( `.${ appId }-app-subnavitem-Sales` ).click(); - cy.get( '.nfd-button--upsell', { timeout: mediumWait } ) - .eq( 1 ) - .as( 'buyButton' ); + cy.get( '#buynow-wondercart', { timeout: mediumWait } ).as( + 'buyButton' + ); cy.get( '@buyButton' ).should( 'be.visible' ); cy.get( '@buyButton' ) @@ -123,7 +123,7 @@ describe( 'Verify Wondercart accessibility as per site capabilities', () => { .as( 'salesTab' ) .should( 'exist' ); cy.get( '@salesTab' ).click(); - cy.get( '.nfd-button--upsell', { timeout: mediumWait } ).should( + cy.get( '#installnow-wondercart', { timeout: mediumWait } ).should( 'exist' ); } ); @@ -133,8 +133,7 @@ describe( 'Verify Wondercart accessibility as per site capabilities', () => { timeout: customCommandTimeout, } ).click(); cy.get( `.${ appId }-app-subnavitem-Sales` ).click(); - cy.get( '.nfd-button--upsell', { timeout: mediumWait } ) - .eq( 0 ) + cy.get( '#installnow-wondercart', { timeout: mediumWait } ) .scrollIntoView() .click(); cy.get( '.nfd-notification--success', { diff --git a/tests/cypress/integration/wp-module-support/utils.cy.js b/tests/cypress/integration/wp-module-support/utils.cy.js index 9617df82..bbf3c9fe 100644 --- a/tests/cypress/integration/wp-module-support/utils.cy.js +++ b/tests/cypress/integration/wp-module-support/utils.cy.js @@ -2,7 +2,6 @@ import { getAppId } from './pluginID.cy'; const appId = getAppId(); const customCommandTimeout = 30000; -const mediumWait = 60000; const longWait = 120000; export const comingSoon = ( shouldBeComingSoon ) => { @@ -41,9 +40,10 @@ export const comingSoon = ( shouldBeComingSoon ) => { export const installWoo = () => { cy.exec( `npx wp-env run cli wp plugin install woocommerce`, { - timeout: longWait, log: true + timeout: longWait, + log: true, } ); - + cy.exec( `npx wp-env run cli wp plugin activate woocommerce`, { timeout: longWait, } ); @@ -66,7 +66,7 @@ export const viewRemainingTasks = () => { }; export const waitForNextSteps = () => { - cy.get( '.nfd-grid.nfd-gap-4' , { timeout: customCommandTimeout } ) + cy.get( '#next-steps-section', { timeout: customCommandTimeout } ) .as( 'nextSteps' ) .scrollIntoView() .should( 'exist' ); From eebcfd6194c71fc9baaf8c1251211df6408f573e Mon Sep 17 00:00:00 2001 From: sangeetha-nayak Date: Thu, 25 Apr 2024 20:00:17 +0530 Subject: [PATCH 4/4] reference error resolved --- tests/cypress/integration/Home/commerceHomePage.cy.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/cypress/integration/Home/commerceHomePage.cy.js b/tests/cypress/integration/Home/commerceHomePage.cy.js index f98eb9bf..e1b91ff4 100644 --- a/tests/cypress/integration/Home/commerceHomePage.cy.js +++ b/tests/cypress/integration/Home/commerceHomePage.cy.js @@ -143,7 +143,7 @@ describe( 'Commerce Home Page- Next Steps', () => { const novice_step_id_bh = [ 'sign-up-for-bluehost-wordpress-academy', - ...other_step_id, + ...novice_step_id, ]; before( () => {