From 656fdae498026aa8c9bf92803f6003f16c40ead6 Mon Sep 17 00:00:00 2001 From: ajayadav09 Date: Thu, 12 Dec 2024 21:51:34 +0530 Subject: [PATCH 1/5] updated failing test for wonderHelp As the input is being reset after the search. The cypress test in ecomm module fails as it looks for a persisted value in the input box. This change will fix that. Co-Authored-By: Emanuela Antonina Castorina <434283+kreamweb@users.noreply.github.com> --- .../cypress/integration/Home/migration.cy.js | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/tests/cypress/integration/Home/migration.cy.js b/tests/cypress/integration/Home/migration.cy.js index c15e2277..ddd7e5c0 100644 --- a/tests/cypress/integration/Home/migration.cy.js +++ b/tests/cypress/integration/Home/migration.cy.js @@ -69,12 +69,14 @@ describe( cy.get( '.help-container', { timeout: customCommandTimeout, } ).should( 'be.visible' ); - cy.get( '#search-input-box' ) - .should( 'have.attr', 'value' ) - .then( ( value ) => { - expect( value.toLowerCase() ).to.contain( 'nameserver' ); + cy.get( 'div.helpcenter-question-block' ) + .children() + .last() + .invoke( 'text' ) + .then( ( text ) => { + expect( text.toLowerCase() ).to.contain( 'nameserver' ); } ); - } ); + } ); it( 'Verify when connect domain to site clicked', () => { cy.intercept( APIList.connect_domain ).as( 'events' ); @@ -90,11 +92,14 @@ describe( cy.get( '.help-container', { timeout: customCommandTimeout, } ).should( 'be.visible' ); - cy.get( '#search-input-box' ) - .should( 'have.attr', 'value' ) - .then( ( value ) => { - expect( value.toLowerCase() ).to.contain( 'domain' ); + cy.get( 'div.helpcenter-question-block' ) + .children() + .last() + .invoke( 'text' ) + .then( ( text ) => { + expect( text.toLowerCase() ).to.contain( 'domain' ); } ); + } ); } ); it( 'Verify when continue with store setup clicked', () => { From 858b14ffc6c3f9e6de4597538a845fb28b08ba2c Mon Sep 17 00:00:00 2001 From: ajayadav09 Date: Thu, 12 Dec 2024 22:10:03 +0530 Subject: [PATCH 2/5] fixed lint --- tests/cypress/integration/Home/migration.cy.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/cypress/integration/Home/migration.cy.js b/tests/cypress/integration/Home/migration.cy.js index ddd7e5c0..ebfe115a 100644 --- a/tests/cypress/integration/Home/migration.cy.js +++ b/tests/cypress/integration/Home/migration.cy.js @@ -76,7 +76,7 @@ describe( .then( ( text ) => { expect( text.toLowerCase() ).to.contain( 'nameserver' ); } ); - } ); + } ); it( 'Verify when connect domain to site clicked', () => { cy.intercept( APIList.connect_domain ).as( 'events' ); @@ -99,7 +99,6 @@ describe( .then( ( text ) => { expect( text.toLowerCase() ).to.contain( 'domain' ); } ); - } ); } ); it( 'Verify when continue with store setup clicked', () => { From 07c89398515c73c485b49c8b62bdc207c208cc60 Mon Sep 17 00:00:00 2001 From: ajayadav09 Date: Thu, 12 Dec 2024 23:44:35 +0530 Subject: [PATCH 3/5] test --- tests/cypress/integration/Home/migration.cy.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/cypress/integration/Home/migration.cy.js b/tests/cypress/integration/Home/migration.cy.js index ebfe115a..ec9196d1 100644 --- a/tests/cypress/integration/Home/migration.cy.js +++ b/tests/cypress/integration/Home/migration.cy.js @@ -69,6 +69,7 @@ describe( cy.get( '.help-container', { timeout: customCommandTimeout, } ).should( 'be.visible' ); + cy.wait( 1000 ); cy.get( 'div.helpcenter-question-block' ) .children() .last() @@ -92,6 +93,7 @@ describe( cy.get( '.help-container', { timeout: customCommandTimeout, } ).should( 'be.visible' ); + cy.wait( 1000 ); cy.get( 'div.helpcenter-question-block' ) .children() .last() From 9fabf5290349749763a17dbd6bce43091f8e782b Mon Sep 17 00:00:00 2001 From: ajayadav09 Date: Fri, 13 Dec 2024 21:45:42 +0530 Subject: [PATCH 4/5] added localstorage currentquery check --- .../cypress/integration/Home/migration.cy.js | 44 +++++++++++++------ 1 file changed, 30 insertions(+), 14 deletions(-) diff --git a/tests/cypress/integration/Home/migration.cy.js b/tests/cypress/integration/Home/migration.cy.js index ec9196d1..55bcb33e 100644 --- a/tests/cypress/integration/Home/migration.cy.js +++ b/tests/cypress/integration/Home/migration.cy.js @@ -70,13 +70,21 @@ describe( timeout: customCommandTimeout, } ).should( 'be.visible' ); cy.wait( 1000 ); - cy.get( 'div.helpcenter-question-block' ) - .children() - .last() - .invoke( 'text' ) - .then( ( text ) => { - expect( text.toLowerCase() ).to.contain( 'nameserver' ); - } ); + cy.get( 'div.helpcenter-question-block' ).then( ( $el ) => { + if ( $el.length ) { + cy.wrap( $el ).children().last().invoke( 'text' ).then( ( text ) => { + expect( text.toLowerCase() ).to.contain( 'nameserver' ); + }); + } else { + cy.window().then( ( win ) => { + const localStorageValue = win.localStorage.getItem( 'nfdHelpCurrentQuery' ); + const localStorageContainsNameserver = localStorageValue + ? localStorageValue.toLowerCase().includes( 'nameserver' ) + : false; + expect( localStorageContainsNameserver ).to.be.true; + }); + } + }); } ); it( 'Verify when connect domain to site clicked', () => { @@ -94,13 +102,21 @@ describe( timeout: customCommandTimeout, } ).should( 'be.visible' ); cy.wait( 1000 ); - cy.get( 'div.helpcenter-question-block' ) - .children() - .last() - .invoke( 'text' ) - .then( ( text ) => { - expect( text.toLowerCase() ).to.contain( 'domain' ); - } ); + cy.get( 'div.helpcenter-question-block' ).then( ( $el ) => { + if ( $el.length ) { + cy.wrap( $el ).children().last().invoke( 'text' ).then( ( text ) => { + expect( text.toLowerCase() ).to.contain( 'domain' ); + }); + } else { + cy.window().then( ( win ) => { + const localStorageValue = win.localStorage.getItem( 'nfdHelpCurrentQuery' ); + const localStorageContainsDomain = localStorageValue + ? localStorageValue.toLowerCase().includes( 'domain' ) + : false; + expect( localStorageContainsDomain ).to.be.true; + }); + } + }); } ); it( 'Verify when continue with store setup clicked', () => { From 9d435b4e33cb0fb242f93d84cfa6ccfa424502a1 Mon Sep 17 00:00:00 2001 From: ajayadav09 Date: Mon, 16 Dec 2024 15:19:37 +0530 Subject: [PATCH 5/5] removed localstorage check --- tests/cypress/integration/Home/migration.cy.js | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/tests/cypress/integration/Home/migration.cy.js b/tests/cypress/integration/Home/migration.cy.js index 55bcb33e..a744be7e 100644 --- a/tests/cypress/integration/Home/migration.cy.js +++ b/tests/cypress/integration/Home/migration.cy.js @@ -75,14 +75,6 @@ describe( cy.wrap( $el ).children().last().invoke( 'text' ).then( ( text ) => { expect( text.toLowerCase() ).to.contain( 'nameserver' ); }); - } else { - cy.window().then( ( win ) => { - const localStorageValue = win.localStorage.getItem( 'nfdHelpCurrentQuery' ); - const localStorageContainsNameserver = localStorageValue - ? localStorageValue.toLowerCase().includes( 'nameserver' ) - : false; - expect( localStorageContainsNameserver ).to.be.true; - }); } }); } ); @@ -107,14 +99,6 @@ describe( cy.wrap( $el ).children().last().invoke( 'text' ).then( ( text ) => { expect( text.toLowerCase() ).to.contain( 'domain' ); }); - } else { - cy.window().then( ( win ) => { - const localStorageValue = win.localStorage.getItem( 'nfdHelpCurrentQuery' ); - const localStorageContainsDomain = localStorageValue - ? localStorageValue.toLowerCase().includes( 'domain' ) - : false; - expect( localStorageContainsDomain ).to.be.true; - }); } }); } );