From d41d7b2afc192b9b17c45cf8a839dc2617ed5df2 Mon Sep 17 00:00:00 2001 From: Avneet Raj Date: Wed, 7 Feb 2024 19:10:12 +0530 Subject: [PATCH 1/3] initial commit --- .../preview.cy.js | 71 +++++++++++++++++++ .../site-details.cy.js | 2 +- 2 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 tests/cypress/integration/5-AI-SiteGen-onboarding-flow/preview.cy.js diff --git a/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/preview.cy.js b/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/preview.cy.js new file mode 100644 index 000000000..20168154c --- /dev/null +++ b/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/preview.cy.js @@ -0,0 +1,71 @@ +// + +import { AdminBarCheck, BackButtonCheck, DarkBGCheck, LightBGCheck, ProgressBarCheck } from "../wp-module-support/siteGen.cy"; + +describe( 'SiteGen Site Preview Step', function () { + before( () => { + cy.visit( + 'wp-admin/index.php?page=nfd-onboarding#/sitegen/step/preview' + ); + cy.wait(5000); + } ); + + it( 'Check for the header admin bar', () => { + AdminBarCheck(); + } ); + + it( 'Check for the existing dark background', () => { + DarkBGCheck(); + } ); + + it( 'Check for the light background', () => { + LightBGCheck(); + } ); + + it( 'Check the Progress Bar Value', () => { + ProgressBarCheck('75%'); + }); + + it( 'Check for back button and go back', () => { + BackButtonCheck('sitegen/step/site-details'); + cy.visit('wp-admin/index.php?page=nfd-onboarding#/sitegen/step/preview'); + cy.reload(); + } ); + + it( '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', () => { + cy.get('g[clip-path="url(#heart-filled_svg__a)"]').should('not.exist'); // when no fav theme is there + cy.get( '.live-preview-sitegen--selectable-card__live-preview-container-buttons__button__icon' ) + .eq(0) + .scrollIntoView() + .should('be.visible') + .click(); + cy.get('g[clip-path="url(#heart-filled_svg__a)"]' , {timeout:10000} ) + .should('exist'); + } ); + + it( 'Check for regenerating the new theme versions', () => { + cy.get('[aria-label="Regenerate Content"]') + .eq(2) + .scrollIntoView() + .click(); + cy.wait(3000); + cy.get('.live-preview-sitegen--selectable-card') + .should('be.visible') + .should('have.length', 4); + } ); + + it( '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'); + } ); + +}); 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 e26e8cb6c..e7c79871f 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, LightBGCheck, ProgressBarCheck, SiteDescription} from "../wp-module-support/siteGen.cy"; +import { AdminBarCheck, BackButtonCheck, DarkBGCheck, LightBGCheck, ProgressBarCheck} from "../wp-module-support/siteGen.cy"; describe( 'SiteGen Site Details Step', function () { before( () => { From 6f69120ff5769e59d118a9b2905ca8193a47c956 Mon Sep 17 00:00:00 2001 From: Avneet Raj Date: Thu, 8 Feb 2024 16:02:18 +0530 Subject: [PATCH 2/3] add remaining tests --- .../5-AI-SiteGen-onboarding-flow/preview.cy.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/preview.cy.js b/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/preview.cy.js index 20168154c..4e6996dab 100644 --- a/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/preview.cy.js +++ b/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/preview.cy.js @@ -27,7 +27,7 @@ describe( 'SiteGen Site Preview Step', function () { }); it( 'Check for back button and go back', () => { - BackButtonCheck('sitegen/step/site-details'); + BackButtonCheck('sitegen/step/preview'); cy.visit('wp-admin/index.php?page=nfd-onboarding#/sitegen/step/preview'); cy.reload(); } ); @@ -39,7 +39,7 @@ describe( 'SiteGen Site Preview Step', function () { } ); it( 'Check for the favourited theme versions', () => { - cy.get('g[clip-path="url(#heart-filled_svg__a)"]').should('not.exist'); // when no fav theme is there + 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) .scrollIntoView() @@ -68,4 +68,12 @@ describe( 'SiteGen Site Preview Step', function () { cy.get('.nfd-onboarding-step--site-gen__preview__note span').scrollIntoView().contains('Favorite'); } ); + it( 'Select any theme and go forward to the next step', () => { + cy.get('.live-preview-sitegen--selectable-card') + .eq(0) + .scrollIntoView() + .click(); + cy.wait(5000); + cy.url().should('not.contain', 'sitegen/step/preview'); + } ); }); From c064b42842facc3c79797e4eabaf817de1a70117 Mon Sep 17 00:00:00 2001 From: Avneet Raj Date: Fri, 9 Feb 2024 17:09:57 +0530 Subject: [PATCH 3/3] update preview.cy.js --- .../5-AI-SiteGen-onboarding-flow/preview.cy.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/preview.cy.js b/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/preview.cy.js index 4e6996dab..63e2aa888 100644 --- a/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/preview.cy.js +++ b/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/preview.cy.js @@ -47,10 +47,20 @@ describe( 'SiteGen Site Preview Step', function () { .click(); cy.get('g[clip-path="url(#heart-filled_svg__a)"]' , {timeout:10000} ) .should('exist'); + cy.get('.live-preview-sitegen--selectable-card__live-preview-container__overlay') + .eq(0) + .scrollIntoView() + .click(); + cy.reload(); + cy.wait(5000); + cy.get('g[clip-path="url(#heart-filled_svg__a)"]' , {timeout:10000} ) + .should('exist'); + cy.go('back'); + cy.reload(); } ); it( 'Check for regenerating the new theme versions', () => { - cy.get('[aria-label="Regenerate Content"]') + cy.get('[aria-label="Regenerate Content"]', {timeout:10000}) .eq(2) .scrollIntoView() .click();