From db860a99b2e9779814951c407b74dc46c9f17289 Mon Sep 17 00:00:00 2001 From: arunshenoy99 Date: Fri, 20 Oct 2023 15:11:01 +0530 Subject: [PATCH] lint fixes --- .../get-started-experience.cy.js | 55 ++++++++++--------- .../get-started-experience.cy.js | 55 ++++++++++--------- 2 files changed, 58 insertions(+), 52 deletions(-) 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 c7787c24c..a506e7b8f 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 @@ -35,9 +35,9 @@ describe( 'Start Setup WP Experience Page', function () { } ); it( 'Check if `site` appears in heading', () => { - cy.get('.nfd-step-card-heading') - .should('be.visible') - .contains('site'); + cy.get( '.nfd-step-card-heading' ) + .should( 'be.visible' ) + .contains( 'site' ); } ); it( 'Check if Radio Options load', () => { @@ -53,20 +53,23 @@ describe( 'Start Setup WP Experience Page', function () { } ); const EventsAPI = ( experience_val ) => { - cy.intercept(APIList.get_started_experience).as('events'); - cy.wait('@events').then((requestObject) => { + cy.intercept( APIList.get_started_experience ).as( 'events' ); + cy.wait( '@events' ).then( ( requestObject ) => { const responseBody = requestObject.request.body; - const responseData1 = responseBody[0].data; - if("experience_level" in responseData1){ - expect(responseData1.experience_level).equal(experience_val); + const responseData1 = responseBody[ 0 ].data; + if ( 'experience_level' in responseData1 ) { + expect( responseData1.experience_level ).equal( + experience_val + ); + } else { + const responseData2 = responseBody[ 1 ].data; + if ( 'experience_level' in responseData2 ) { + expect( responseData2.experience_level ).equal( + experience_val + ); } - else{ - const responseData2 = responseBody[1].data; - if("experience_level" in responseData2){ - expect(responseData2.experience_level).equal(experience_val); - }; - }; - }); + } + } ); }; it( 'Check if events API call being made after radio buttons are clicked', () => { @@ -76,17 +79,17 @@ describe( 'Start Setup WP Experience Page', function () { arr.each( () => { cy.get( '[type="radio"]' ) .eq( radioCount ) - .click( { force: true } ) - if(radioCount==0){ - EventsAPI("novice"); - }; - if(radioCount==1){ - EventsAPI("intermediate"); - }; - if(radioCount>1){ - cy.wait(5000); - EventsAPI("expert"); - }; + .click( { force: true } ); + if ( radioCount == 0 ) { + EventsAPI( 'novice' ); + } + if ( radioCount == 1 ) { + EventsAPI( 'intermediate' ); + } + if ( radioCount > 1 ) { + cy.wait( 5000 ); + EventsAPI( 'expert' ); + } radioCount += 1; } ); } ); 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 cdc4bf3fd..b14420fa6 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 @@ -35,9 +35,9 @@ describe( 'Start Setup WP Experience Page', function () { } ); it( 'Check if `store` appears in heading', () => { - cy.get('.nfd-step-card-heading') - .should('be.visible') - .contains('store'); + cy.get( '.nfd-step-card-heading' ) + .should( 'be.visible' ) + .contains( 'store' ); } ); it( 'Check if Radio Options load', () => { @@ -53,20 +53,23 @@ describe( 'Start Setup WP Experience Page', function () { } ); const EventsAPI = ( experience_val ) => { - cy.intercept(APIList.get_started_experience_ecomm).as('events'); - cy.wait('@events').then((requestObject) => { + cy.intercept( APIList.get_started_experience_ecomm ).as( 'events' ); + cy.wait( '@events' ).then( ( requestObject ) => { const responseBody = requestObject.request.body; - const responseData1 = responseBody[0].data; - if("experience_level" in responseData1){ - expect(responseData1.experience_level).equal(experience_val); + const responseData1 = responseBody[ 0 ].data; + if ( 'experience_level' in responseData1 ) { + expect( responseData1.experience_level ).equal( + experience_val + ); + } else { + const responseData2 = responseBody[ 1 ].data; + if ( 'experience_level' in responseData2 ) { + expect( responseData2.experience_level ).equal( + experience_val + ); } - else{ - const responseData2 = responseBody[1].data; - if("experience_level" in responseData2){ - expect(responseData2.experience_level).equal(experience_val); - }; - }; - }); + } + } ); }; it( 'Check if events API call being made after radio buttons are clicked', () => { @@ -76,17 +79,17 @@ describe( 'Start Setup WP Experience Page', function () { arr.each( () => { cy.get( '[type="radio"]' ) .eq( radioCount ) - .click( { force: true } ) - if(radioCount==0){ - EventsAPI("novice"); - }; - if(radioCount==1){ - EventsAPI("intermediate"); - }; - if(radioCount>1){ - cy.wait(5000); - EventsAPI("expert"); - }; + .click( { force: true } ); + if ( radioCount == 0 ) { + EventsAPI( 'novice' ); + } + if ( radioCount == 1 ) { + EventsAPI( 'intermediate' ); + } + if ( radioCount > 1 ) { + cy.wait( 5000 ); + EventsAPI( 'expert' ); + } radioCount += 1; } ); } );