From 96876a30a9ecb49c49590a5d3470661d3ac199c5 Mon Sep 17 00:00:00 2001 From: Evan Mullins Date: Tue, 30 Jan 2024 11:42:00 -0500 Subject: [PATCH] add slight waits in the test to allow modal time to appear and dissapear ensure modal gets closed --- .../2-general-onboarding-flow/basic-info.cy.js | 15 +++++++++++---- .../3-ecommerce-onboarding-flow/basic-info.cy.js | 7 ++++++- .../wp-module-support/socialMedia.cy.js | 11 +++++++++++ 3 files changed, 28 insertions(+), 5 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 48b5b8042..09ae733bd 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 @@ -136,6 +136,7 @@ describe( 'Basic Info Page', function () { if ( cy.get( socialTest3 , { timeout: customCommandTimeout} ).should( 'exist' ) ) { cy.get( socialTest3 ).clear({ force: true }); cy.get( socialTest3 ).type( sampleID ); + cy.wait(200); cy.get( '#facebook' ).focus(); cy.get( socialTest3 ) .invoke( 'val' ) @@ -165,7 +166,9 @@ describe( 'Basic Info Page', function () { socialTest2.focus(); socialTest.type( invalidURL ); + cy.wait(200); socialTest2.focus(); + cy.wait(200); if(GetPluginId()!='hostgator'){ cy.get( '.Tooltip-Wrapper', { timeout: 3000 } ).should( 'exist' ); cy.get( '.Tooltip-Tip', { timeout: 3000 } ) @@ -177,16 +180,18 @@ describe( 'Basic Info Page', function () { 'have.text', ModalText2 ); - cy.get( '.components-modal__header button' , { timeout: customCommandTimeout } ).click() - cy.get( - '.browser-content_social_icon[style="background-image: var(--facebook-icon);"]' - ).should( 'have.css', 'opacity', '0.75' ); } else{ cy.get( '.Tooltip-Wrapper', { timeout: 3000 } ).should( 'exist' ); cy.get( '.Tooltip-Tip', { timeout: 3000 } ) .should( 'be.visible' ); }; + + cy.get( '.components-modal__header button' , { timeout: customCommandTimeout } ).click(); + cy.wait(200); + cy.get( + '.browser-content_social_icon[style="background-image: var(--facebook-icon);"]' + ).should( 'have.css', 'opacity', '0.75' ); // The URL Checker runs on a debounce // Shows the message to the User in case of Invalid URL @@ -195,8 +200,10 @@ describe( 'Basic Info Page', function () { socialTest.focus(); socialTest.clear(); + cy.wait(200); socialTest.type( validURL ); socialTest2.focus(); + cy.wait(200); cy.get( '.Tooltip-Wrapper', { timeout: 3000 } ).should( 'not.exist' ); 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 90cac13ff..66fab3e97 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 @@ -144,6 +144,7 @@ describe( 'Basic Info Page', function () { if ( cy.get( socialTest3 , { timeout: customCommandTimeout } ).should( 'exist' ) ) { cy.get( socialTest3 ).clear( { force: true } ); cy.get( socialTest3 ).type( sampleID ); + cy.wait(200); cy.get( '#facebook' ).focus(); cy.get( socialTest3 ) .invoke( 'val' ) @@ -172,8 +173,9 @@ describe( 'Basic Info Page', function () { socialTest2.focus(); socialTest.type( invalidURL ); + cy.wait(200); socialTest2.focus(); - + cy.wait(200); // The URL Checker runs on a debounce // Shows the message to the User in case of Invalid URL cy.get( '.Tooltip-Wrapper', { timeout: 3000 } ).should( 'exist' ); @@ -195,14 +197,17 @@ describe( 'Basic Info Page', function () { } cy.get( '.components-modal__header button' , { timeout: customCommandTimeout } ).click() + cy.wait(200); cy.get( '.browser-content_social_icon[style="background-image: var(--facebook-icon);"]' ).should( 'have.css', 'opacity', '0.75' ); socialTest.focus(); socialTest.clear(); + cy.wait(200); socialTest.type( validURL ); socialTest2.focus(); + cy.wait(200); cy.get( '.Tooltip-Wrapper', { timeout: 3000 } ).should( 'not.exist' ); diff --git a/tests/cypress/integration/wp-module-support/socialMedia.cy.js b/tests/cypress/integration/wp-module-support/socialMedia.cy.js index b837d59dc..1121db1da 100644 --- a/tests/cypress/integration/wp-module-support/socialMedia.cy.js +++ b/tests/cypress/integration/wp-module-support/socialMedia.cy.js @@ -7,8 +7,11 @@ export const SocialMediaTextValidations = ( URL, ToolTipText, ModalHeaderText ) const socialTest = '#facebook'; if ( cy.get(socialTest).should( 'exist' ) ) { cy.get(socialTest).clear(); + cy.wait(200); cy.get(socialTest).type( URL ); + cy.wait(200); cy.get('#twitter').focus(); + cy.wait(200); if(GetPluginId()=='hostgator'){ cy.get( '.Tooltip-Tip' , { timeout: 3000 }) .should('be.visible'); @@ -20,17 +23,25 @@ export const SocialMediaTextValidations = ( URL, ToolTipText, ModalHeaderText ) cy.get( '.Tooltip-Tip' , { timeout: 3000 }) .should('be.visible') .should('contain', ToolTipText); + cy.wait(200); cy.get(NextButton).click(); cy.get( '.components-modal__content' ).should('be.visible'); cy.get( '.components-modal__header-heading' ).should('have.text', ModalHeaderText); }; cy.get(':nth-child(2) > .components-button-group > .is-secondary').click(); + cy.wait(200); cy.get(NextButton).click(); + cy.wait(200); cy.get('.components-modal__header button', {timeout: 10000}).click() + cy.wait(200); cy.get(NextButton).click(); + cy.wait(200); cy.get(':nth-child(2) > .components-button-group > .is-primary').click(); + cy.wait(200); cy.url().should('not.contain', 'wp-setup/step/basic-info'); + cy.wait(200); cy.go('back'); cy.get( '.nfd-onboarding-drawer__toggle-button', { timeout: 10000 } ).click(); + cy.wait(200); } };