From f2eaec4f4f573689cbf294b3bd2e536a4cd30729 Mon Sep 17 00:00:00 2001 From: sangeetha-nayak Date: Fri, 15 Mar 2024 16:04:03 +0530 Subject: [PATCH 1/6] Cypress tests to track GA events in site-features step --- .../site-features.cy.js | 17 +++++++++++++- .../wp-module-support/EventsApi.cy.js | 23 +++++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/tests/cypress/integration/3-ecommerce-onboarding-flow/site-features.cy.js b/tests/cypress/integration/3-ecommerce-onboarding-flow/site-features.cy.js index e2b338575..866db3bbc 100644 --- a/tests/cypress/integration/3-ecommerce-onboarding-flow/site-features.cy.js +++ b/tests/cypress/integration/3-ecommerce-onboarding-flow/site-features.cy.js @@ -9,6 +9,7 @@ import { CheckInfoPanel, CheckIntroPanel, } from '../wp-module-support/sidebar.cy'; +import { APIList, SiteFeaturesAPI } from '../wp-module-support/EventsApi.cy'; describe( 'Site Features', function () { before( () => { @@ -59,5 +60,19 @@ describe( 'Site Features', function () { .click(); previewCount += 1; } ); - } ); + }); + + it('Check if site-features GA events are triggerred', () => { + const features = ['jetpack', 'wpforms-lite', 'google-analytics-for-wordpress', 'wordpress-seo', 'creative-mail-by-constant-contact', 'optinmonster'] + // Make sure if all site-features are selected + cy.get('.components-checkbox-control__input').each(($checkbox) => { + if (!$checkbox.is(':checked')) { + cy.wrap($checkbox).click(); + } + }); + + cy.intercept( APIList.site_features_ecomm ).as( 'events' ); + cy.get('.navigation-buttons_next').click(); + SiteFeaturesAPI( 'feature', features ); + }) } ); diff --git a/tests/cypress/integration/wp-module-support/EventsApi.cy.js b/tests/cypress/integration/wp-module-support/EventsApi.cy.js index b83473289..d06e8b576 100644 --- a/tests/cypress/integration/wp-module-support/EventsApi.cy.js +++ b/tests/cypress/integration/wp-module-support/EventsApi.cy.js @@ -18,6 +18,8 @@ export const APIList = { basic_info: '/index.php?rest_route=%2Fnewfold-onboarding%2Fv1%2Fevents%2Fbatch&flow=wp-setup&_locale=user', basic_info_ecomm: + '/index.php?rest_route=%2Fnewfold-onboarding%2Fv1%2Fevents%2Fbatch&flow=ecommerce&_locale=user', + site_features_ecomm: '/index.php?rest_route=%2Fnewfold-onboarding%2Fv1%2Fevents%2Fbatch&flow=ecommerce&_locale=user' }; @@ -101,3 +103,24 @@ export const BasicInfoAPI = ( } ); } ); }; + +export const SiteFeaturesAPI = ( + label_key_value, + features = [] +) => { + let index = 0; + + cy.wait( '@events' ).then( ( requestObject ) => { + const requestBody = requestObject.request.body; + expect( requestBody[ index ].action ).to.eq( 'feature_added' ); + + requestBody.forEach(() => { + + const requestBodyData = requestBody[index].data; + expect(requestBodyData.label_key).to.eq(label_key_value) + expect(requestBodyData[label_key_value]).to.eq(features[index]) + index += 1; + }) + } ); +}; + From c1b80aa7974064fe201e2f990b62c3a585acf8e7 Mon Sep 17 00:00:00 2001 From: sangeetha-nayak Date: Fri, 15 Mar 2024 16:30:48 +0530 Subject: [PATCH 2/6] Added GA events tracker for general onboarding and fixed linting --- .../site-features.cy.js | 46 ++++++++++++++----- .../site-features.cy.js | 34 ++++++++------ .../wp-module-support/EventsApi.cy.js | 25 +++++----- 3 files changed, 66 insertions(+), 39 deletions(-) diff --git a/tests/cypress/integration/2-general-onboarding-flow/site-features.cy.js b/tests/cypress/integration/2-general-onboarding-flow/site-features.cy.js index d08ca7034..6780fb2fa 100644 --- a/tests/cypress/integration/2-general-onboarding-flow/site-features.cy.js +++ b/tests/cypress/integration/2-general-onboarding-flow/site-features.cy.js @@ -9,6 +9,7 @@ import { CheckInfoPanel, CheckIntroPanel, } from '../wp-module-support/sidebar.cy'; +import { APIList, SiteFeaturesAPI } from '../wp-module-support/EventsApi.cy'; describe( 'Site Features', function () { before( () => { @@ -24,8 +25,8 @@ describe( 'Site Features', function () { it( 'Check if Header has text `site` in it', () => { cy.get( '.nfd-main-heading__title' ) - .should('be.visible') - .contains('site'); + .should( 'be.visible' ) + .contains( 'site' ); } ); it( 'Check Drawer Activity', () => { @@ -36,19 +37,18 @@ describe( 'Site Features', function () { ); } ); - if(GetPluginId()=='bluehost'){ - it( 'Check to make sure sidebar opens, content is in place and close sidebar', () => { - CheckIntroPanel( '__site-features', 'Features' ); - CheckIllustrationPanel(); - CheckInfoPanel(); - CheckHelpPanelLinks(); - } ); - } - else{ + if ( GetPluginId() == 'bluehost' ) { + it( 'Check to make sure sidebar opens, content is in place and close sidebar', () => { + CheckIntroPanel( '__site-features', 'Features' ); + CheckIllustrationPanel(); + CheckInfoPanel(); + CheckHelpPanelLinks(); + } ); + } else { it( 'Check to make sure Sidebar opens', () => { BasicSidebarCheck(); } ); - }; + } it( 'Check if Site Features list exists and select them', () => { let previewCount = 0; @@ -65,4 +65,26 @@ describe( 'Site Features', function () { previewCount += 1; } ); } ); + + it( 'Check if site-features GA events are triggerred', () => { + const features = [ + 'jetpack', + 'wpforms-lite', + 'google-analytics-for-wordpress', + 'wordpress-seo', + 'creative-mail-by-constant-contact', + 'optinmonster', + ]; + + // Make sure if all site-features are selected + cy.get( '.components-checkbox-control__input' ).each( ( $checkbox ) => { + if ( ! $checkbox.is( ':checked' ) ) { + cy.wrap( $checkbox ).click(); + } + } ); + + cy.intercept( APIList.site_features ).as( 'events' ); + cy.get( '.navigation-buttons_next' ).click(); + SiteFeaturesAPI( 'feature', features ); + } ); } ); diff --git a/tests/cypress/integration/3-ecommerce-onboarding-flow/site-features.cy.js b/tests/cypress/integration/3-ecommerce-onboarding-flow/site-features.cy.js index 866db3bbc..1a8b4ded8 100644 --- a/tests/cypress/integration/3-ecommerce-onboarding-flow/site-features.cy.js +++ b/tests/cypress/integration/3-ecommerce-onboarding-flow/site-features.cy.js @@ -31,20 +31,18 @@ describe( 'Site Features', function () { ); } ); - if(GetPluginId()=='bluehost'){ + if ( GetPluginId() == 'bluehost' ) { it( 'Check to make sure sidebar opens, content is in place and close sidebar', () => { CheckIntroPanel( '__site-features', 'Features' ); CheckIllustrationPanel(); CheckInfoPanel(); CheckHelpPanelLinks(); } ); - } - else{ + } else { it( 'Check to make sure Sidebar opens', () => { BasicSidebarCheck(); } ); } - it( 'Check if Site Features list exists and select them', () => { let previewCount = 0; @@ -60,19 +58,27 @@ describe( 'Site Features', function () { .click(); previewCount += 1; } ); - }); - - it('Check if site-features GA events are triggerred', () => { - const features = ['jetpack', 'wpforms-lite', 'google-analytics-for-wordpress', 'wordpress-seo', 'creative-mail-by-constant-contact', 'optinmonster'] + } ); + + it( 'Check if site-features GA events are triggerred', () => { + const features = [ + 'jetpack', + 'wpforms-lite', + 'google-analytics-for-wordpress', + 'wordpress-seo', + 'creative-mail-by-constant-contact', + 'optinmonster', + ]; + // Make sure if all site-features are selected - cy.get('.components-checkbox-control__input').each(($checkbox) => { - if (!$checkbox.is(':checked')) { - cy.wrap($checkbox).click(); + cy.get( '.components-checkbox-control__input' ).each( ( $checkbox ) => { + if ( ! $checkbox.is( ':checked' ) ) { + cy.wrap( $checkbox ).click(); } - }); + } ); cy.intercept( APIList.site_features_ecomm ).as( 'events' ); - cy.get('.navigation-buttons_next').click(); + cy.get( '.navigation-buttons_next' ).click(); SiteFeaturesAPI( 'feature', features ); - }) + } ); } ); diff --git a/tests/cypress/integration/wp-module-support/EventsApi.cy.js b/tests/cypress/integration/wp-module-support/EventsApi.cy.js index d06e8b576..2601a5c8b 100644 --- a/tests/cypress/integration/wp-module-support/EventsApi.cy.js +++ b/tests/cypress/integration/wp-module-support/EventsApi.cy.js @@ -19,8 +19,10 @@ export const APIList = { '/index.php?rest_route=%2Fnewfold-onboarding%2Fv1%2Fevents%2Fbatch&flow=wp-setup&_locale=user', basic_info_ecomm: '/index.php?rest_route=%2Fnewfold-onboarding%2Fv1%2Fevents%2Fbatch&flow=ecommerce&_locale=user', + site_features: + '/index.php?rest_route=%2Fnewfold-onboarding%2Fv1%2Fevents%2Fbatch&flow=ecommerce&_locale=user', site_features_ecomm: - '/index.php?rest_route=%2Fnewfold-onboarding%2Fv1%2Fevents%2Fbatch&flow=ecommerce&_locale=user' + '/index.php?rest_route=%2Fnewfold-onboarding%2Fv1%2Fevents%2Fbatch&flow=ecommerce&_locale=user', }; export const EventsAPI = ( events_name, card_val, api_name ) => { @@ -104,23 +106,20 @@ export const BasicInfoAPI = ( } ); }; -export const SiteFeaturesAPI = ( - label_key_value, - features = [] -) => { +export const SiteFeaturesAPI = ( label_key_value, features = [] ) => { let index = 0; - + cy.wait( '@events' ).then( ( requestObject ) => { const requestBody = requestObject.request.body; expect( requestBody[ index ].action ).to.eq( 'feature_added' ); - requestBody.forEach(() => { - - const requestBodyData = requestBody[index].data; - expect(requestBodyData.label_key).to.eq(label_key_value) - expect(requestBodyData[label_key_value]).to.eq(features[index]) + requestBody.forEach( () => { + const requestBodyData = requestBody[ index ].data; + expect( requestBodyData.label_key ).to.eq( label_key_value ); + expect( requestBodyData[ label_key_value ] ).to.eq( + features[ index ] + ); index += 1; - }) + } ); } ); }; - From 03e13cd77d32535e33bc622b7b724a940654f219 Mon Sep 17 00:00:00 2001 From: sangeetha-nayak Date: Fri, 15 Mar 2024 17:17:09 +0530 Subject: [PATCH 3/6] small wait --- .../integration/2-general-onboarding-flow/site-features.cy.js | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/cypress/integration/2-general-onboarding-flow/site-features.cy.js b/tests/cypress/integration/2-general-onboarding-flow/site-features.cy.js index 6780fb2fa..156daabc7 100644 --- a/tests/cypress/integration/2-general-onboarding-flow/site-features.cy.js +++ b/tests/cypress/integration/2-general-onboarding-flow/site-features.cy.js @@ -85,6 +85,7 @@ describe( 'Site Features', function () { cy.intercept( APIList.site_features ).as( 'events' ); cy.get( '.navigation-buttons_next' ).click(); + cy.wait( 2000 ) SiteFeaturesAPI( 'feature', features ); } ); } ); From 0772074100192008ba8853a2690839e3ff75ba68 Mon Sep 17 00:00:00 2001 From: sangeetha-nayak Date: Fri, 15 Mar 2024 17:39:52 +0530 Subject: [PATCH 4/6] testing failure in first attempt --- .../2-general-onboarding-flow/site-features.cy.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/cypress/integration/2-general-onboarding-flow/site-features.cy.js b/tests/cypress/integration/2-general-onboarding-flow/site-features.cy.js index 156daabc7..065fcb3d6 100644 --- a/tests/cypress/integration/2-general-onboarding-flow/site-features.cy.js +++ b/tests/cypress/integration/2-general-onboarding-flow/site-features.cy.js @@ -76,6 +76,11 @@ describe( 'Site Features', function () { 'optinmonster', ]; + cy.visit( + 'wp-admin/?page=nfd-onboarding#/wp-setup/step/site-features' + ); + cy.wait( 10000 ); + // Make sure if all site-features are selected cy.get( '.components-checkbox-control__input' ).each( ( $checkbox ) => { if ( ! $checkbox.is( ':checked' ) ) { @@ -85,7 +90,6 @@ describe( 'Site Features', function () { cy.intercept( APIList.site_features ).as( 'events' ); cy.get( '.navigation-buttons_next' ).click(); - cy.wait( 2000 ) SiteFeaturesAPI( 'feature', features ); } ); } ); From 3341a51f6693626dd8a2f3ff71efed088b387cd6 Mon Sep 17 00:00:00 2001 From: sangeetha-nayak Date: Fri, 15 Mar 2024 17:54:15 +0530 Subject: [PATCH 5/6] correct api request url for general onboarding --- .../2-general-onboarding-flow/site-features.cy.js | 5 ----- tests/cypress/integration/wp-module-support/EventsApi.cy.js | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/tests/cypress/integration/2-general-onboarding-flow/site-features.cy.js b/tests/cypress/integration/2-general-onboarding-flow/site-features.cy.js index 065fcb3d6..6780fb2fa 100644 --- a/tests/cypress/integration/2-general-onboarding-flow/site-features.cy.js +++ b/tests/cypress/integration/2-general-onboarding-flow/site-features.cy.js @@ -76,11 +76,6 @@ describe( 'Site Features', function () { 'optinmonster', ]; - cy.visit( - 'wp-admin/?page=nfd-onboarding#/wp-setup/step/site-features' - ); - cy.wait( 10000 ); - // Make sure if all site-features are selected cy.get( '.components-checkbox-control__input' ).each( ( $checkbox ) => { if ( ! $checkbox.is( ':checked' ) ) { diff --git a/tests/cypress/integration/wp-module-support/EventsApi.cy.js b/tests/cypress/integration/wp-module-support/EventsApi.cy.js index 2601a5c8b..d49824acb 100644 --- a/tests/cypress/integration/wp-module-support/EventsApi.cy.js +++ b/tests/cypress/integration/wp-module-support/EventsApi.cy.js @@ -20,7 +20,7 @@ export const APIList = { basic_info_ecomm: '/index.php?rest_route=%2Fnewfold-onboarding%2Fv1%2Fevents%2Fbatch&flow=ecommerce&_locale=user', site_features: - '/index.php?rest_route=%2Fnewfold-onboarding%2Fv1%2Fevents%2Fbatch&flow=ecommerce&_locale=user', + '/index.php?rest_route=%2Fnewfold-onboarding%2Fv1%2Fevents%2Fbatch&flow=wp-setup&_locale=user', site_features_ecomm: '/index.php?rest_route=%2Fnewfold-onboarding%2Fv1%2Fevents%2Fbatch&flow=ecommerce&_locale=user', }; From 6c40c68eee4a450d0675b4b2e0bbaae163c6374c Mon Sep 17 00:00:00 2001 From: sangeetha-nayak Date: Mon, 18 Mar 2024 17:27:18 +0530 Subject: [PATCH 6/6] Addressed review comments --- .../basic-info.cy.js | 2 +- .../get-started-experience.cy.js | 6 ++--- .../site-features.cy.js | 2 +- .../sitetype-primary.cy.js | 4 +-- .../sitetype-secondary.cy.js | 4 +-- .../top-priority.cy.js | 6 ++--- .../basic-info.cy.js | 2 +- .../get-started-experience.cy.js | 6 ++--- .../site-features.cy.js | 2 +- .../sitetype-primary.cy.js | 4 +-- .../sitetype-secondary.cy.js | 4 +-- .../wp-module-support/EventsApi.cy.js | 26 ++----------------- 12 files changed, 23 insertions(+), 45 deletions(-) diff --git a/tests/cypress/integration/2-general-onboarding-flow/basic-info.cy.js b/tests/cypress/integration/2-general-onboarding-flow/basic-info.cy.js index b22f05e3c..3f0eeb45d 100644 --- a/tests/cypress/integration/2-general-onboarding-flow/basic-info.cy.js +++ b/tests/cypress/integration/2-general-onboarding-flow/basic-info.cy.js @@ -299,7 +299,7 @@ describe( 'Basic Info Page', function () { cy.get( socialTest7 ).type( 'https://www.tiktok.com/testTikTok' ); cy.wait( 2000 ); - cy.intercept( APIList.basic_info ).as( 'events' ); + cy.intercept( APIList.events_api_general_onb ).as( 'events' ); cy.get( '.navigation-buttons_next' ).click(); BasicInfoAPI( 'basic_info', label_keys, actual_values ); } ); diff --git a/tests/cypress/integration/2-general-onboarding-flow/get-started-experience.cy.js b/tests/cypress/integration/2-general-onboarding-flow/get-started-experience.cy.js index 975404122..ead064356 100644 --- a/tests/cypress/integration/2-general-onboarding-flow/get-started-experience.cy.js +++ b/tests/cypress/integration/2-general-onboarding-flow/get-started-experience.cy.js @@ -72,14 +72,14 @@ describe( 'Start Setup WP Experience Page', function () { .eq( radioCount ) .click( { force: true } ); if ( radioCount == 0 ) { - EventsAPI( 'experience_level', 'novice', APIList.get_started_experience ); + EventsAPI( 'experience_level', 'novice', APIList.events_api_general_onb ); } if ( radioCount == 1 ) { - EventsAPI( 'experience_level', 'intermediate', APIList.get_started_experience ); + EventsAPI( 'experience_level', 'intermediate', APIList.events_api_general_onb ); } if ( radioCount > 1 ) { cy.wait( 5000 ); - EventsAPI( 'experience_level', 'expert', APIList.get_started_experience ); + EventsAPI( 'experience_level', 'expert', APIList.events_api_general_onb ); } radioCount += 1; } ); diff --git a/tests/cypress/integration/2-general-onboarding-flow/site-features.cy.js b/tests/cypress/integration/2-general-onboarding-flow/site-features.cy.js index 6780fb2fa..ee3a5e647 100644 --- a/tests/cypress/integration/2-general-onboarding-flow/site-features.cy.js +++ b/tests/cypress/integration/2-general-onboarding-flow/site-features.cy.js @@ -83,7 +83,7 @@ describe( 'Site Features', function () { } } ); - cy.intercept( APIList.site_features ).as( 'events' ); + cy.intercept( APIList.events_api_general_onb ).as( 'events' ); cy.get( '.navigation-buttons_next' ).click(); SiteFeaturesAPI( 'feature', features ); } ); diff --git a/tests/cypress/integration/2-general-onboarding-flow/sitetype-primary.cy.js b/tests/cypress/integration/2-general-onboarding-flow/sitetype-primary.cy.js index 65cb3e615..05fec67ac 100644 --- a/tests/cypress/integration/2-general-onboarding-flow/sitetype-primary.cy.js +++ b/tests/cypress/integration/2-general-onboarding-flow/sitetype-primary.cy.js @@ -56,7 +56,7 @@ describe( 'Get Started Site Type Primary', function () { if(num>=2){ cy.wait(4000); } - EventsAPI('primary_type', dataSlugText, APIList.site_primary); + EventsAPI('primary_type', dataSlugText, APIList.events_api_general_onb); num+=1; }); categoryCount += 1; @@ -68,7 +68,7 @@ describe( 'Get Started Site Type Primary', function () { .scrollIntoView() .should( 'be.visible' ) .type( 'Test' ); - EventsAPI('primary_type', 'Test', APIList.site_primary); + EventsAPI('primary_type', 'Test', APIList.events_api_general_onb); } ); it( 'Check different Categories exist and is selectable', () => { diff --git a/tests/cypress/integration/2-general-onboarding-flow/sitetype-secondary.cy.js b/tests/cypress/integration/2-general-onboarding-flow/sitetype-secondary.cy.js index 08a956ef7..e66959fd4 100644 --- a/tests/cypress/integration/2-general-onboarding-flow/sitetype-secondary.cy.js +++ b/tests/cypress/integration/2-general-onboarding-flow/sitetype-secondary.cy.js @@ -56,7 +56,7 @@ describe( 'Get Started Site Type Secondary', function () { if(num>=2){ cy.wait(5000); } - EventsAPI('secondary_type', dataSlugText, APIList.site_secondary); + EventsAPI('secondary_type', dataSlugText, APIList.events_api_general_onb); num+=1; }); SubcategoryCount += 1; @@ -68,7 +68,7 @@ describe( 'Get Started Site Type Secondary', function () { .scrollIntoView() .should( 'be.visible' ) .type( 'Test' ); - EventsAPI('secondary_type', 'Test', APIList.site_secondary); + EventsAPI('secondary_type', 'Test', APIList.events_api_general_onb); } ); it( 'Check different categories exist using `<` and `>`', () => { diff --git a/tests/cypress/integration/2-general-onboarding-flow/top-priority.cy.js b/tests/cypress/integration/2-general-onboarding-flow/top-priority.cy.js index 8980a2b0c..5800c4af1 100644 --- a/tests/cypress/integration/2-general-onboarding-flow/top-priority.cy.js +++ b/tests/cypress/integration/2-general-onboarding-flow/top-priority.cy.js @@ -38,14 +38,14 @@ describe( 'Top Priority Page', function () { .should( 'be.visible' ) .click(); if ( previewCount == 0 ) { - EventsAPI( 'top_priority', 'content', APIList.top_priority ); + EventsAPI( 'top_priority', 'content', APIList.events_api_general_onb ); } if ( previewCount == 1 ) { - EventsAPI( 'top_priority', 'store', APIList.top_priority ); + EventsAPI( 'top_priority', 'store', APIList.events_api_general_onb ); } if ( previewCount > 1 ) { cy.wait( 5000 ); - EventsAPI( 'top_priority', 'design', APIList.top_priority ); + EventsAPI( 'top_priority', 'design', APIList.events_api_general_onb ); } previewCount += 1; }); diff --git a/tests/cypress/integration/3-ecommerce-onboarding-flow/basic-info.cy.js b/tests/cypress/integration/3-ecommerce-onboarding-flow/basic-info.cy.js index 66fab3e97..d5ca4b330 100644 --- a/tests/cypress/integration/3-ecommerce-onboarding-flow/basic-info.cy.js +++ b/tests/cypress/integration/3-ecommerce-onboarding-flow/basic-info.cy.js @@ -303,7 +303,7 @@ describe( 'Basic Info Page', function () { cy.get( socialTest7 ).type( 'https://www.tiktok.com/testTikTok' ); cy.wait( 2000 ); - cy.intercept( APIList.basic_info_ecomm ).as( 'events' ); + cy.intercept( APIList.events_api_ecomm ).as( 'events' ); cy.get( '.navigation-buttons_next' ).click(); BasicInfoAPI( 'basic_info_ecomm', label_keys, actual_values ); } ); diff --git a/tests/cypress/integration/3-ecommerce-onboarding-flow/get-started-experience.cy.js b/tests/cypress/integration/3-ecommerce-onboarding-flow/get-started-experience.cy.js index 0ff33ad1b..18deb99af 100644 --- a/tests/cypress/integration/3-ecommerce-onboarding-flow/get-started-experience.cy.js +++ b/tests/cypress/integration/3-ecommerce-onboarding-flow/get-started-experience.cy.js @@ -70,14 +70,14 @@ describe( 'Start Setup WP Experience Page', function () { .eq( radioCount ) .click( { force: true } ); if ( radioCount == 0 ) { - EventsAPI( 'experience_level', 'novice', APIList.get_started_experience_ecomm ); + EventsAPI( 'experience_level', 'novice', APIList.events_api_ecomm ); } if ( radioCount == 1 ) { - EventsAPI( 'experience_level', 'intermediate', APIList.get_started_experience_ecomm ); + EventsAPI( 'experience_level', 'intermediate', APIList.events_api_ecomm ); } if ( radioCount > 1 ) { cy.wait( 5000 ); - EventsAPI( 'experience_level', 'expert', APIList.get_started_experience_ecomm ); + EventsAPI( 'experience_level', 'expert', APIList.events_api_ecomm ); } radioCount += 1; } ); diff --git a/tests/cypress/integration/3-ecommerce-onboarding-flow/site-features.cy.js b/tests/cypress/integration/3-ecommerce-onboarding-flow/site-features.cy.js index 1a8b4ded8..30d29d368 100644 --- a/tests/cypress/integration/3-ecommerce-onboarding-flow/site-features.cy.js +++ b/tests/cypress/integration/3-ecommerce-onboarding-flow/site-features.cy.js @@ -77,7 +77,7 @@ describe( 'Site Features', function () { } } ); - cy.intercept( APIList.site_features_ecomm ).as( 'events' ); + cy.intercept( APIList.events_api_ecomm ).as( 'events' ); cy.get( '.navigation-buttons_next' ).click(); SiteFeaturesAPI( 'feature', features ); } ); diff --git a/tests/cypress/integration/3-ecommerce-onboarding-flow/sitetype-primary.cy.js b/tests/cypress/integration/3-ecommerce-onboarding-flow/sitetype-primary.cy.js index 60805caa7..7c0272b14 100644 --- a/tests/cypress/integration/3-ecommerce-onboarding-flow/sitetype-primary.cy.js +++ b/tests/cypress/integration/3-ecommerce-onboarding-flow/sitetype-primary.cy.js @@ -68,7 +68,7 @@ describe( 'Get Started Site Type Primary', function () { if(num>=2){ cy.wait(4000); } - EventsAPI('primary_type', dataSlugText, APIList.site_primary_ecomm); + EventsAPI('primary_type', dataSlugText, APIList.events_api_ecomm); num+=1; }); categoryCount += 1; @@ -80,7 +80,7 @@ describe( 'Get Started Site Type Primary', function () { .scrollIntoView() .should( 'be.visible' ) .type( 'Test' ); - EventsAPI('primary_type', 'Test', APIList.site_primary_ecomm); + EventsAPI('primary_type', 'Test', APIList.events_api_ecomm); } ); it( 'Check different Categories exist and is selectable', () => { diff --git a/tests/cypress/integration/3-ecommerce-onboarding-flow/sitetype-secondary.cy.js b/tests/cypress/integration/3-ecommerce-onboarding-flow/sitetype-secondary.cy.js index 13cb808d7..cd474bdd9 100644 --- a/tests/cypress/integration/3-ecommerce-onboarding-flow/sitetype-secondary.cy.js +++ b/tests/cypress/integration/3-ecommerce-onboarding-flow/sitetype-secondary.cy.js @@ -70,7 +70,7 @@ describe( 'Get Started Site Type Secondary', function () { if(num>=2){ cy.wait(5000); } - EventsAPI('secondary_type', dataSlugText, APIList.site_secondary_ecomm); + EventsAPI('secondary_type', dataSlugText, APIList.events_api_ecomm); num+=1; }); SubcategoryCount += 1; @@ -82,7 +82,7 @@ describe( 'Get Started Site Type Secondary', function () { .scrollIntoView() .should( 'be.visible' ) .type( 'Test' ); - EventsAPI('secondary_type', 'Test', APIList.site_secondary_ecomm); + EventsAPI('secondary_type', 'Test', APIList.events_api_ecomm); } ); it( 'Check different subCategories exist and is selectable', () => { diff --git a/tests/cypress/integration/wp-module-support/EventsApi.cy.js b/tests/cypress/integration/wp-module-support/EventsApi.cy.js index d49824acb..a9cc22211 100644 --- a/tests/cypress/integration/wp-module-support/EventsApi.cy.js +++ b/tests/cypress/integration/wp-module-support/EventsApi.cy.js @@ -1,28 +1,6 @@ -import { forEach } from 'lodash'; - export const APIList = { - get_started_experience: - '/index.php?rest_route=%2Fnewfold-onboarding%2Fv1%2Fevents%2Fbatch&flow=wp-setup&_locale=user', - get_started_experience_ecomm: - '/index.php?rest_route=%2Fnewfold-onboarding%2Fv1%2Fevents%2Fbatch&flow=ecommerce&_locale=user', - top_priority: - '/index.php?rest_route=%2Fnewfold-onboarding%2Fv1%2Fevents%2Fbatch&flow=wp-setup&_locale=user', - site_primary: - '/index.php?rest_route=%2Fnewfold-onboarding%2Fv1%2Fevents%2Fbatch&flow=wp-setup&_locale=user', - site_primary_ecomm: - '/index.php?rest_route=%2Fnewfold-onboarding%2Fv1%2Fevents%2Fbatch&flow=ecommerce&_locale=user', - site_secondary: - '/index.php?rest_route=%2Fnewfold-onboarding%2Fv1%2Fevents%2Fbatch&flow=wp-setup&_locale=user', - site_secondary_ecomm: - '/index.php?rest_route=%2Fnewfold-onboarding%2Fv1%2Fevents%2Fbatch&flow=ecommerce&_locale=user', - basic_info: - '/index.php?rest_route=%2Fnewfold-onboarding%2Fv1%2Fevents%2Fbatch&flow=wp-setup&_locale=user', - basic_info_ecomm: - '/index.php?rest_route=%2Fnewfold-onboarding%2Fv1%2Fevents%2Fbatch&flow=ecommerce&_locale=user', - site_features: - '/index.php?rest_route=%2Fnewfold-onboarding%2Fv1%2Fevents%2Fbatch&flow=wp-setup&_locale=user', - site_features_ecomm: - '/index.php?rest_route=%2Fnewfold-onboarding%2Fv1%2Fevents%2Fbatch&flow=ecommerce&_locale=user', + events_api_general_onb: '/index.php?rest_route=%2Fnewfold-onboarding%2Fv1%2Fevents%2Fbatch&flow=wp-setup&_locale=user', + events_api_ecomm: '/index.php?rest_route=%2Fnewfold-onboarding%2Fv1%2Fevents%2Fbatch&flow=ecommerce&_locale=user' }; export const EventsAPI = ( events_name, card_val, api_name ) => {