From 32065072ef1f092909b5db828389c3f8aa03c125 Mon Sep 17 00:00:00 2001 From: Avneet Raj Date: Thu, 1 Feb 2024 15:48:45 +0530 Subject: [PATCH 1/2] Add Tests for SiteDetails step --- .../site-details.cy.js | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 tests/cypress/integration/5-AI-SiteGen-onboarding-flow/site-details.cy.js diff --git a/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/site-details.cy.js b/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/site-details.cy.js new file mode 100644 index 000000000..9f613bf03 --- /dev/null +++ b/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/site-details.cy.js @@ -0,0 +1,65 @@ +// + +import { AdminBarCheck, BackButtonCheck, DarkBGCheck, LightBGChcek, ProgressBarCheck, SiteDescription} from "../wp-module-support/siteGen.cy"; + +describe( 'SiteGen Site Details Step', function () { + before( () => { + cy.visit( + 'wp-admin/index.php?page=nfd-onboarding#/sitegen/step/site-details' + ); + } ); + + it( 'Check for the header admin bar', () => { + AdminBarCheck(); + } ); + + it( 'Check for the existing dark background', () => { + DarkBGCheck(); + } ); + + it( 'Check for the light background', () => { + LightBGChcek(); + } ); + + it( 'Check the Progress Bar Value', () => { + ProgressBarCheck('12.5%'); + }); + + it( 'Check if the Next Button is disabled when no prompt is entered', () => { + cy.get( '.nfd-onboarding-button--site-gen-next--disabled' ).should('be.visible'); + } ); + + it( 'Check for back button and go back', () => { + BackButtonCheck('sitegen/step/site-details'); + } ); + + it( 'Check for the header to be visible', () => { + cy.get( '.ai-heading' ).should('be.visible'); + } ); + + it( 'Check for the placeholder text & input box hint to be visible before the prompt', () => { + cy.get('.nfd-sg-input-box__field') + .should('have.attr', 'placeholder', 'I want a site for my company that sells…'); + cy.get( '.nfd-sg-input-box__hint' ).should('be.visible'); + } ); + + it( 'Enter the prompt and see the box-info progress', () => { + cy.get('.nfd-sg-input-box__field').type('I have a Yoga Studio called Asana,located in Cocoa Beach, Florida. We prioritize sustainibility '); + cy.get('.nfd-sg-input-box__info-icon') + .should('be.visible') + .should('have.length',3); + cy.get( '.nfd-onboarding-button--site-gen-next--disabled' ).should('be.visible'); + cy.get('.nfd-sg-input-box__field').type('and source our yoga mats from co-consious suppliers here in the USA. '); + cy.get('.nfd-sg-input-box__info-icon--selected') + .should('be.visible') + .should('have.length', 2); + cy.get('.nfd-sg-input-box__field').type('In addition to our classes, we also provide a curated selection of yoga attire and access'); + cy.get('.nfd-sg-input-box__info-icon--selected') + .should('be.visible') + .should('have.length', 3); + cy.get('.nfd-sg-site-details--next-btn') + .should('be.visible') + .click(); + cy.url().should('not.contain','sitegen/step/site-details'); + } ); +}); From 767fc3c69099a0b7ca6ac41cc4206b032c61f996 Mon Sep 17 00:00:00 2001 From: Avneet Raj Date: Tue, 6 Feb 2024 13:24:54 +0530 Subject: [PATCH 2/2] update typo --- .../integration/5-AI-SiteGen-onboarding-flow/fork.cy.js | 4 ++-- .../5-AI-SiteGen-onboarding-flow/site-details.cy.js | 4 ++-- .../integration/5-AI-SiteGen-onboarding-flow/site-logo.cy.js | 4 ++-- .../integration/5-AI-SiteGen-onboarding-flow/welcome.cy.js | 4 ++-- tests/cypress/integration/wp-module-support/siteGen.cy.js | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/fork.cy.js b/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/fork.cy.js index 98b9db108..68e664288 100644 --- a/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/fork.cy.js +++ b/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/fork.cy.js @@ -1,6 +1,6 @@ // -import { AdminBarCheck, DarkBGCheck, LightBGChcek, OptionsDetails } from "../wp-module-support/siteGen.cy"; +import { AdminBarCheck, DarkBGCheck, LightBGCheck, OptionsDetails } from "../wp-module-support/siteGen.cy"; describe( 'SiteGen Fork Step', function () { before( () => { @@ -18,7 +18,7 @@ describe( 'SiteGen Fork Step', function () { } ); it( 'Check for the light background', () => { - LightBGChcek(); + LightBGCheck(); } ); it( 'Check for the heading and the title', () => { diff --git a/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/site-details.cy.js b/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/site-details.cy.js index 9f613bf03..e26e8cb6c 100644 --- a/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/site-details.cy.js +++ b/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/site-details.cy.js @@ -1,6 +1,6 @@ // -import { AdminBarCheck, BackButtonCheck, DarkBGCheck, LightBGChcek, ProgressBarCheck, SiteDescription} from "../wp-module-support/siteGen.cy"; +import { AdminBarCheck, BackButtonCheck, DarkBGCheck, LightBGCheck, ProgressBarCheck, SiteDescription} from "../wp-module-support/siteGen.cy"; describe( 'SiteGen Site Details Step', function () { before( () => { @@ -18,7 +18,7 @@ describe( 'SiteGen Site Details Step', function () { } ); it( 'Check for the light background', () => { - LightBGChcek(); + LightBGCheck(); } ); it( 'Check the Progress Bar Value', () => { diff --git a/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/site-logo.cy.js b/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/site-logo.cy.js index 1b151b9a2..738d56e7f 100644 --- a/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/site-logo.cy.js +++ b/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/site-logo.cy.js @@ -1,6 +1,6 @@ // -import { AdminBarCheck, BackButtonCheck, DarkBGCheck, DisabledNextButton, LightBGChcek, ProgressBarCheck, SkipButtonCheck } from '../wp-module-support/siteGen.cy'; +import { AdminBarCheck, BackButtonCheck, DarkBGCheck, DisabledNextButton, LightBGCheck, ProgressBarCheck, SkipButtonCheck } from '../wp-module-support/siteGen.cy'; describe( 'SiteGen Site Logo Step', function() { before( () => { @@ -18,7 +18,7 @@ describe( 'SiteGen Site Logo Step', function() { } ); it( 'Check for the light background', () => { - LightBGChcek(); + LightBGCheck(); } ); it( 'Check the Progress Bar Value', () => { diff --git a/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/welcome.cy.js b/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/welcome.cy.js index 82f824cf1..ff63ddc58 100644 --- a/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/welcome.cy.js +++ b/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/welcome.cy.js @@ -1,6 +1,6 @@ // -import { AdminBarCheck, BackButtonCheck, DarkBGCheck, LightBGChcek, ProgressBarCheck} from "../wp-module-support/siteGen.cy"; +import { AdminBarCheck, BackButtonCheck, DarkBGCheck, LightBGCheck, ProgressBarCheck} from "../wp-module-support/siteGen.cy"; describe( 'SiteGen Welcome Step', function () { before( () => { @@ -18,7 +18,7 @@ describe( 'SiteGen Welcome Step', function () { } ); it( 'Check for the light background', () => { - LightBGChcek(); + LightBGCheck(); } ); it( 'Check the Progress Bar Value', () => { diff --git a/tests/cypress/integration/wp-module-support/siteGen.cy.js b/tests/cypress/integration/wp-module-support/siteGen.cy.js index 3c09adb65..b8ea9b8ac 100644 --- a/tests/cypress/integration/wp-module-support/siteGen.cy.js +++ b/tests/cypress/integration/wp-module-support/siteGen.cy.js @@ -10,7 +10,7 @@ export const DarkBGCheck = () => { cy.get('.nfd-onboarding-sitegen-dark').should('be.visible'); }; -export const LightBGChcek = () => { +export const LightBGCheck = () => { cy.get( '.nfd-onboarding-toggle__theme__button__dark' ) .should( 'exist' ) .click();