Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update SiteGen Cypress Tests #489

Merged
merged 7 commits into from
Feb 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18,941 changes: 10,263 additions & 8,678 deletions package-lock.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ import { AdminBarCheck, DarkBGCheck, LightBGCheck, OptionsDetails } from "../wp-

describe( 'SiteGen Fork Step', function () {
before( () => {
cy.exec(`npx wp-env run cli wp option set _transient_nfd_site_capabilities '{"hasAISitegGen": true, "canAccessAI": true}' --format=json`);
cy.exec(`npx wp-env run cli wp option set _transient_nfd_site_capabilities '{"hasAISiteGen": true, "canAccessAI": true}' --format=json`);
cy.exec(`npx wp-env run cli wp option set _transient_timeout_nfd_site_capabilities 4102444800`);
cy.wait(10000);
cy.visit(
'wp-admin/?page=nfd-onboarding#/wp-setup/step/fork'
);
cy.timeout(60000);
cy.wait(5000);
} );

Expand Down Expand Up @@ -47,7 +48,7 @@ describe( 'SiteGen Fork Step', function () {
const arr = cy.get( className );
arr.each( () => {
if(options == 0){
OptionsDetails(className,'Build it myself',options);
OptionsDetails(className,'Guided Configuration',options);
cy.url().should('include', 'get-started/welcome',{
timeout: 10000,
} );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ describe( 'SiteGen Welcome Step', function () {
} );

it( 'Check the Progress Bar Value', () => {
ProgressBarCheck('11.1111%');
ProgressBarCheck('0%');
});

it( 'Check for back button and go back', () => {
BackButtonCheck('sitegen/step/welcome');
} );

it( 'Check for the animation', () => {
cy.get( '.nfd-onboarding-step--site-gen__welcome__container__animation' )
it( 'Check if the orb is visible', () => {
cy.get( '.nfd-onboarding-step--site-gen__welcome__container__orb' )
.should('be.visible');
} );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ describe( 'SiteGen Site Details Step', function () {
cy.get('.nfd-sg-input-box__info-icon--selected')
.should('be.visible')
.should('have.length', 3);
} );

it.skip( 'Check if the Next Button is enabled and click Next', () => {
cy.get('.nfd-sg-site-details--next-btn')
.should('be.visible')
.click();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ describe( 'SiteGen Site Logo Step', function() {
} );

it( 'Check the Progress Bar Value', () => {
ProgressBarCheck( '33.3333%' );
ProgressBarCheck( '37.5%' );
} );

it( 'Check for back button and go back', () => {
Expand All @@ -41,7 +41,7 @@ describe( 'SiteGen Site Logo Step', function() {
DisabledNextButton();
} );

it( 'Check if Image gets uploaded and Next button is enabled', () => {
it( 'Check if Image gets uploaded', () => {
const sampleLogoPath = `vendor/newfold-labs/wp-module-onboarding/tests/cypress/fixtures/image.png`;
const LogoPreviewClass = '.nfd-onboarding-image-uploader--with-text__site_logo__preview';
if (
Expand All @@ -61,6 +61,9 @@ describe( 'SiteGen Site Logo Step', function() {
.scrollIntoView()
.should( 'be.visible' );
} );
} );

it.skip( 'Check if the Next Button is enabled and go next', () => {
cy.get( '.nfd-onboarding-button--site-gen-next' )
.should( 'not.be.disabled' )
.click();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,34 +9,34 @@ describe( 'SiteGen Experience & Site Building Step', function () {
);
} );

it( 'Check for the header admin bar', () => {
it.skip( 'Check for the header admin bar', () => {
AdminBarCheck();
} );

it( 'Check for the existing dark background', () => {
it.skip( 'Check for the existing dark background', () => {
DarkBGCheck();
} );

it( 'Check for the light background', () => {
it.skip( 'Check for the light background', () => {
LightBGChcek();
} );

it( 'Check the Progress Bar Value', () => {
it.skip( 'Check the Progress Bar Value', () => {
ProgressBarCheck('50%');
});

it( 'Check for back button and go back', () => {
it.skip( 'Check for back button and go back', () => {
BackButtonCheck('sitegen/step/experience');
} );

it( 'Check for the existence & the count of experience level cards', () => {
it.skip( 'Check for the existence & the count of experience level cards', () => {
cy.get( '.nfd-sg-experience-level' ).should('be.visible');
cy.get( '.nfd-sg-loader' ).should('be.visible');
cy.get( '.nfd-sg-card' ).should('be.visible');
cy.get( '.nfd-sg-card__data__option' ).should('have.length',3)
} );

it( 'Check and click each experience cards', () => {
it.skip( 'Check and click each experience cards', () => {
const className = '.nfd-sg-card__data__option'
let options = 0;
const arr = cy.get( className );
Expand All @@ -54,7 +54,7 @@ describe( 'SiteGen Experience & Site Building Step', function () {
});
} );

it( 'Check for the existence of skip button and click', () => {
it.skip( 'Check for the existence of skip button and click', () => {
cy.get( '.nfd-sg-card__skip' )
.scrollIntoView()
.should('be.visible')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,35 +10,35 @@ describe( 'SiteGen Site Preview Step', function () {
cy.wait(5000);
} );

it( 'Check for the header admin bar', () => {
it.skip( 'Check for the header admin bar', () => {
AdminBarCheck();
} );

it( 'Check for the existing dark background', () => {
it.skip( 'Check for the existing dark background', () => {
DarkBGCheck();
} );

it( 'Check for the light background', () => {
it.skip( 'Check for the light background', () => {
LightBGCheck();
} );

it( 'Check the Progress Bar Value', () => {
it.skip( 'Check the Progress Bar Value', () => {
ProgressBarCheck('75%');
});

it( 'Check for back button and go back', () => {
it.skip( 'Check for back button and go back', () => {
BackButtonCheck('sitegen/step/preview');
cy.visit('wp-admin/index.php?page=nfd-onboarding#/sitegen/step/preview');
cy.reload();
} );

it( 'Check for by default 3 versions should be there', () => {
it.skip( 'Check for by default 3 versions should be there', () => {
cy.get('.live-preview-sitegen--selectable-card', {timeout:20000})
.should('be.visible')
.should('have.length', 3);
} );

it( 'Check for the favourited theme versions', () => {
it.skip( 'Check for the favourited theme versions', () => {
cy.get('g[clip-path="url(#heart-filled_svg__a)"]').should('not.exist'); // when no fav theme is selected
cy.get( '.live-preview-sitegen--selectable-card__live-preview-container-buttons__button__icon' )
.eq(0)
Expand All @@ -59,7 +59,7 @@ describe( 'SiteGen Site Preview Step', function () {
cy.reload();
} );

it( 'Check for regenerating the new theme versions', () => {
it.skip( 'Check for regenerating the new theme versions', () => {
cy.get('[aria-label="Regenerate Content"]', {timeout:10000})
.eq(2)
.scrollIntoView()
Expand All @@ -70,15 +70,15 @@ describe( 'SiteGen Site Preview Step', function () {
.should('have.length', 4);
} );

it( 'Check for the preview note at the bottom', () => {
it.skip( 'Check for the preview note at the bottom', () => {
cy.get('.nfd-onboarding-step--site-gen__preview__note')
.scrollIntoView()
.should('be.visible');
cy.get('g[id="State\\=Active"]').should('exist');
cy.get('.nfd-onboarding-step--site-gen__preview__note span').scrollIntoView().contains('Favorite');
} );

it( 'Select any theme and go forward to the next step', () => {
it.skip( 'Select any theme and go forward to the next step', () => {
cy.get('.live-preview-sitegen--selectable-card')
.eq(0)
.scrollIntoView()
Expand Down
2 changes: 1 addition & 1 deletion tests/cypress/integration/wp-module-support/siteGen.cy.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// <reference types="Cypress" />

export const AdminBarCheck = () => {
cy.get( '.nfd-onboarding-header__admin-bar', {timeout:15000} ).should('be.visible');
cy.get( '.nfd-onboarding-header__admin-bar', {timeout:60000} ).should('be.visible');
};

export const DarkBGCheck = () => {
Expand Down
6 changes: 3 additions & 3 deletions tests/cypress/integration/wp-module-support/socialMedia.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const SocialMediaTextValidations = ( URL, ToolTipText, ModalHeaderText )
const NextButton = '.navigation-buttons_next';
const socialTest = '#facebook';
if ( cy.get(socialTest).should( 'exist' ) ) {
cy.get(socialTest).clear();
cy.get(socialTest).clear({force: true});
cy.wait(200);
cy.get(socialTest).type( URL );
cy.wait(200);
Expand All @@ -28,15 +28,15 @@ export const SocialMediaTextValidations = ( URL, ToolTipText, ModalHeaderText )
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.get('.components-button-group.nfd-onboarding-etw__buttons > .components-button.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.get('.components-button-group.nfd-onboarding-etw__buttons > .components-button.is-primary').click();
cy.wait(200);
cy.url().should('not.contain', 'wp-setup/step/basic-info');
cy.wait(200);
Expand Down
Loading