Skip to content

Commit

Permalink
Merge pull request #441 from newfold-labs/fix/basic-info-tests
Browse files Browse the repository at this point in the history
Fix basic info tests
  • Loading branch information
arunshenoy99 authored Jan 31, 2024
2 parents 1932200 + 96876a3 commit 5eee8d8
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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' )
Expand Down Expand Up @@ -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 } )
Expand All @@ -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

Expand All @@ -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'
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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' )
Expand Down Expand Up @@ -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' );
Expand All @@ -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'
);
Expand Down
11 changes: 11 additions & 0 deletions tests/cypress/integration/wp-module-support/socialMedia.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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);
}
};

0 comments on commit 5eee8d8

Please sign in to comment.