From 8498fa2d0ec5930f9f034092e8c9303cf5fe8cd6 Mon Sep 17 00:00:00 2001 From: Avneet Raj Date: Fri, 5 Apr 2024 17:29:04 +0530 Subject: [PATCH 1/6] add tests for sitegen editor step --- .../7-editor.cy.js | 258 ++++++++++++++++++ 1 file changed, 258 insertions(+) create mode 100644 tests/cypress/integration/5-AI-SiteGen-onboarding-flow/7-editor.cy.js diff --git a/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/7-editor.cy.js b/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/7-editor.cy.js new file mode 100644 index 000000000..6a20b3827 --- /dev/null +++ b/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/7-editor.cy.js @@ -0,0 +1,258 @@ +// +import { + AdminBarCheck, + DarkBGCheck, + ProgressBarCheck, +} from '../wp-module-support/siteGen.cy'; + +describe( 'SiteGen Site Editor Step', function () { + before( () => { + cy.visit( + 'wp-admin/index.php?page=nfd-onboarding#/sitegen/step/editor' + ); + cy.wait( 5000 ); + } ); + + it( 'Check for the header admin bar', () => { + AdminBarCheck(); + } ); + + it( 'Check for the existing dark background', () => { + DarkBGCheck(); + } ); + + it( 'Check if we cannot change to light background', () => { + cy.get( '.nfd-onboarding-toggle__theme__button__dark' ).should( + 'not.exist' + ); + cy.get( '.nfd-onboarding-sitegen-light' ).should( 'not.exist' ); + } ); + + it( 'Check the Progress Bar Value', () => { + ProgressBarCheck( '85.7143%' ); + } ); + + it( 'Check if the sidebar is closed upon landing', () => { + cy.get( 'nfd-onboarding-sidebar__panel is-open' ).should( 'not.exist' ); + } ); + + it( 'Check if rename functionality works as expected', () => { + let existing_theme_name; + cy.get( '.nfd-onboarding-header__center-input' ) + .invoke( 'attr', 'value' ) + .then( ( value ) => { + existing_theme_name = value; + cy.get( '.nfd-onboarding-header__center-input' ).should( + 'be.disabled' + ); // not able to rename + cy.get( '.nfd-onboarding-header__center-dropdown_icon' ) + .should( 'be.visible' ) + .click(); + cy.get( + '.nfd-onboarding-header__version_dropdown-menu' + ).should( 'be.visible' ); + cy.get( '.components-menu-item__button' ) + .eq( 0 ) + .should( 'be.visible' ) + .should( 'have.text', 'Rename' ) + .click(); + cy.get( '.nfd-onboarding-header__center-input' ) + .clear() + .type( 'New Theme Name' ); + cy.get( '.nfd-onboarding-header__progress-bar' ).click(); + let NewVal; + cy.get( '.nfd-onboarding-header__center-input' ) + .invoke( 'attr', 'value' ) + .then( ( value ) => { + NewVal = value; + expect( existing_theme_name ).to.not.equal( NewVal ); + } ); + } ); + } ); + + it( 'Check for all the themes to be visible inside sidebar', () => { + cy.get( '.nfd-onboarding-header__center-dropdown_icon' ) + .should( 'be.visible' ) + .click(); + cy.get( '.components-menu-item__button' ) + .eq( 1 ) + .should( 'be.visible' ) + .should( 'have.text', 'View All' ) + .click(); + cy.get( '.nfd-onboarding-sidebar__panel.is-open' ).should( + 'be.visible' + ); + cy.get( + '.nfd-onboarding-sidebar--sitegen-editor-patterns__header__tab-panel__versions-tab__preview-container' + ) + .should( 'be.visible' ) + .should( 'have.length', 3 ); // as we are not currently regenrating new themes + } ); + + it( 'Check for favoriting a theme and it appears everywhere', () => { + cy.get( + '.nfd-onboarding-sidebar--sitegen-editor-patterns__header__tab-panel__versions-tab__preview-container' + ) + .eq( 2 ) + .click(); + cy.get( 'g[clip-path="url(#heart-filled_svg__a)"]' ).should( + 'not.exist' + ); + cy.get( + ':nth-child(4) > .nfd-onboarding-sidebar--sitegen-editor-patterns__header__tab-panel__versions-tab__preview-container__context > .nfd-onboarding-sidebar--sitegen-editor-patterns__header__tab-panel__versions-tab__preview-container__context__icon__fill' + ).should( 'not.exist' ); + cy.get( '.navigation-buttons-editor__favorite' ) + .should( 'be.visible' ) + .click(); + cy.get( 'g[clip-path="url(#heart-filled_svg__a)"]', { + timeout: 20000, + } ).should( 'exist' ); + cy.get( + ':nth-child(4) > .nfd-onboarding-sidebar--sitegen-editor-patterns__header__tab-panel__versions-tab__preview-container__context > .nfd-onboarding-sidebar--sitegen-editor-patterns__header__tab-panel__versions-tab__preview-container__context__icon__fill' + ).should( 'exist' ); + } ); + + it( 'Check for favorite themes inside favorite tab', () => { + cy.get( + '.nfd-onboarding-sidebar--sitegen-editor-patterns__header__tab-panel__favorites-tab' + ) + .should( 'be.visible' ) + .click(); + cy.get( + '.nfd-onboarding-sidebar--sitegen-editor-patterns__header__tab-panel__versions-tab__preview-container' + ) + .should( 'be.visible' ) + .should( 'have.length', 2 ); + cy.get( + '.components-button.nfd-onboarding-sidebar--sitegen-editor-patterns__header__icon' + ).should( 'be.visible' ); + } ); + + it( 'Check changing the existing fonts from sidebar', () => { + cy.wait( 2000 ); + cy.get( + '.nfd-onboarding-header--sitegen__editor__end__customize-button' + ).click(); + cy.get( + '.components-panel__body.nfd-onboarding-sidebar-learn-more.is-opened', + { timeout: 20000 } + ).should( 'be.visible' ); + cy.get( + '.components-panel__body.nfd-onboarding-sidebar--customize__design-fonts-panel.is-opened', + { timeout: 20000 } + ).should( 'be.visible' ); + let FontsCount = 0; + const FontsClass = + '.nfd-onboarding-sidebar--customize__design-fonts-panel__font-group__container__button__font-name__container'; + const arr = cy.get( FontsClass, { timeout: 20000 } ); + arr.each( () => { + cy.get( FontsClass ).eq( FontsCount ).scrollIntoView().click(); + FontsCount += 1; + } ); + } ); + + it( 'Check changing the custom fonts from sidebar', () => { + const CustomeFontsClass = + '.nfd-onboarding-sidebar--customize__design-fonts-panel__fonts-form__container'; + cy.get( CustomeFontsClass ).should( 'not.exist' ); + cy.get( + '.nfd-onboarding-sidebar--customize__design-fonts-panel__container > .components-button' + ) + .scrollIntoView() + .click(); + cy.get( CustomeFontsClass ).should( 'exist' ); + cy.get( '#headings' ) + .scrollIntoView() + .should( 'be.visible' ) + .select( 'poppins' ); + cy.get( '#body' ) + .scrollIntoView() + .should( 'be.visible' ) + .select( 'oswald' ); + cy.get( '.components-button.apply.is-primary' ) + .scrollIntoView() + .should( 'be.visible' ) + .click(); + cy.get( + '.nfd-onboarding-sidebar--customize__design-fonts-panel__custom-fonts__container > .nfd-onboarding-sidebar--customize__design-fonts-panel__font-group__container > .nfd-onboarding-sidebar--customize__design-fonts-panel__font-group__container__button > .nfd-onboarding-sidebar--customize__design-fonts-panel__font-group__container__button__icon' + ) + .scrollIntoView() + .should( 'exist' ); + cy.get( + '.nfd-onboarding-sidebar--customize__design-fonts-panel__font-group__container__button__font-name__container' + ).should( 'have.length', 6 ); + } ); + + it( 'Check changing the existing colors from sidebar', () => { + cy.get( + '.components-panel__body.nfd-onboarding-sidebar--customize__design-colors-panel.is-opened' + ).should( 'exist' ); + const ColorPalleteClass = + '.nfd-onboarding-sidebar--customize__color-palette-icon__container'; + let ColorCount = 0; + const arr = cy.get( ColorPalleteClass, { timeout: 20000 } ); + arr.each( () => { + cy.get( ColorPalleteClass ) + .eq( ColorCount ) + .scrollIntoView() + .click(); + ColorCount += 1; + } ); + } ); + + it( 'Check changing the custom colors from sidebar', () => { + const CustomColorClass = + '.nfd-onboarding-sidebar--customize__design-colors-panel__custom__colors__container'; + cy.get( CustomColorClass ).should( 'not.exist' ); + cy.get( + '.nfd-onboarding-sidebar--customize__design-colors-panel__custom__colors__button__container' + ) + .scrollIntoView() + .should( 'be.visible' ) + .click(); + cy.get( CustomColorClass ).should( 'exist' ); + let previewCount = 0; + const className = '.custom-palette__below__row'; + const array = cy.get( className ); + const colors = [ 'F31267', '1E5B32', '331E5C', 'E00505', 'EB22E9' ]; + array.each( () => { + const randomIndex = Math.floor( Math.random() * colors.length ); + cy.get( className ).eq( previewCount ).click(); + cy.get( '.components-color-palette__custom-color-button' ).click(); + cy.get( '.components-input-control__input' ).clear(); + cy.get( '.components-input-control__input' ).type( + colors[ randomIndex ] + ); + cy.get( className ).eq( previewCount ).click(); + previewCount += 1; + } ); + cy.get( '.components-button.is-primary' ).scrollIntoView().click(); + cy.get( + '.nfd-onboarding-sidebar--customize__color-palette-icon__container' + ) + .should( 'be.visible' ) + .should( 'have.length', 6 ); + } ); + + it( 'Check clicking the reset button', () => { + cy.get( '.components-panel__header > :nth-child(2)' ) + .scrollIntoView() + .should( 'exist' ) + .click(); + cy.get( + '.nfd-onboarding-sidebar--customize__design-colors-panel__custom__colors__container' + ).should( 'not.exist' ); + } ); + + it( 'Check for the existence of Regenerate button', () => { + cy.get( '.nfd-onboarding-header--sitegen__editor__start__regenerate' ) + .scrollIntoView() + .should( 'be.visible' ); + } ); + + it( 'Check existence of Save & Continue button', () => { + cy.get( '.nfd-onboarding-header--sitegen__editor__end__save-button' ) + .scrollIntoView() + .should( 'exist' ); + } ); +} ); From 1422c2943bd9996e61311769018191443a849a6d Mon Sep 17 00:00:00 2001 From: Avneet Raj Date: Fri, 5 Apr 2024 18:31:57 +0530 Subject: [PATCH 2/6] update editor step --- .../7-editor.cy.js | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/7-editor.cy.js b/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/7-editor.cy.js index 6a20b3827..ac2f55b4c 100644 --- a/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/7-editor.cy.js +++ b/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/7-editor.cy.js @@ -86,7 +86,7 @@ describe( 'SiteGen Site Editor Step', function () { '.nfd-onboarding-sidebar--sitegen-editor-patterns__header__tab-panel__versions-tab__preview-container' ) .should( 'be.visible' ) - .should( 'have.length', 3 ); // as we are not currently regenrating new themes + .should( 'have.length', 3 ); // as we are not currently regenrating new themes } ); it( 'Check for favoriting a theme and it appears everywhere', () => { @@ -128,7 +128,19 @@ describe( 'SiteGen Site Editor Step', function () { ).should( 'be.visible' ); } ); - it( 'Check changing the existing fonts from sidebar', () => { + it( 'Check for the existence of Regenerate button', () => { + cy.get( '.nfd-onboarding-header--sitegen__editor__start__regenerate' ) + .scrollIntoView() + .should( 'be.visible' ); + } ); + + it( 'Check existence of Save & Continue button', () => { + cy.get( '.nfd-onboarding-header--sitegen__editor__end__save-button' ) + .scrollIntoView() + .should( 'exist' ); + } ); + + it.skip( 'Check changing the existing fonts from sidebar', () => { cy.wait( 2000 ); cy.get( '.nfd-onboarding-header--sitegen__editor__end__customize-button' @@ -151,7 +163,7 @@ describe( 'SiteGen Site Editor Step', function () { } ); } ); - it( 'Check changing the custom fonts from sidebar', () => { + it.skip( 'Check changing the custom fonts from sidebar', () => { const CustomeFontsClass = '.nfd-onboarding-sidebar--customize__design-fonts-panel__fonts-form__container'; cy.get( CustomeFontsClass ).should( 'not.exist' ); @@ -183,7 +195,7 @@ describe( 'SiteGen Site Editor Step', function () { ).should( 'have.length', 6 ); } ); - it( 'Check changing the existing colors from sidebar', () => { + it.skip( 'Check changing the existing colors from sidebar', () => { cy.get( '.components-panel__body.nfd-onboarding-sidebar--customize__design-colors-panel.is-opened' ).should( 'exist' ); @@ -200,7 +212,7 @@ describe( 'SiteGen Site Editor Step', function () { } ); } ); - it( 'Check changing the custom colors from sidebar', () => { + it.skip( 'Check changing the custom colors from sidebar', () => { const CustomColorClass = '.nfd-onboarding-sidebar--customize__design-colors-panel__custom__colors__container'; cy.get( CustomColorClass ).should( 'not.exist' ); @@ -234,7 +246,7 @@ describe( 'SiteGen Site Editor Step', function () { .should( 'have.length', 6 ); } ); - it( 'Check clicking the reset button', () => { + it.skip( 'Check clicking the reset button', () => { cy.get( '.components-panel__header > :nth-child(2)' ) .scrollIntoView() .should( 'exist' ) @@ -243,16 +255,4 @@ describe( 'SiteGen Site Editor Step', function () { '.nfd-onboarding-sidebar--customize__design-colors-panel__custom__colors__container' ).should( 'not.exist' ); } ); - - it( 'Check for the existence of Regenerate button', () => { - cy.get( '.nfd-onboarding-header--sitegen__editor__start__regenerate' ) - .scrollIntoView() - .should( 'be.visible' ); - } ); - - it( 'Check existence of Save & Continue button', () => { - cy.get( '.nfd-onboarding-header--sitegen__editor__end__save-button' ) - .scrollIntoView() - .should( 'exist' ); - } ); } ); From 4b17e7e71860449627aa965076d3907c3d393185 Mon Sep 17 00:00:00 2001 From: Avneet Raj Date: Tue, 9 Apr 2024 12:18:27 +0530 Subject: [PATCH 3/6] update editor step with remaining steps --- tests/cypress/fixtures/customize-data.json | 128 ++ tests/cypress/fixtures/theme-style.json | 1148 +++++++++++++++++ .../7-editor.cy.js | 19 +- .../wp-module-support/MockApi.cy.js | 25 + 4 files changed, 1315 insertions(+), 5 deletions(-) create mode 100644 tests/cypress/fixtures/customize-data.json create mode 100644 tests/cypress/fixtures/theme-style.json diff --git a/tests/cypress/fixtures/customize-data.json b/tests/cypress/fixtures/customize-data.json new file mode 100644 index 000000000..e8489a10f --- /dev/null +++ b/tests/cypress/fixtures/customize-data.json @@ -0,0 +1,128 @@ +{ + "design": { + "name": "Modern Foodie", + "style": { + "aesthetics": "modern", + "fonts_heading": "Arial", + "fonts_content": "Times New Roman", + "spacing": 6, + "radius": 4 + }, + "color_palette": { + "base": "#F0F0F0", + "contrast": "#333333", + "primary": "#09728C", + "secondary": "#C79E10", + "tertiary": "#F5EBB8", + "header_background": "#09728C", + "header_foreground": "#F5EBB8", + "header_titles": "#F5EBB8", + "secondary_background": "#09728C", + "secondary_foreground": "#F5EBB8" + } + }, + "colorPalettes": [ + { + "base": "#3D352A", + "contrast": "#F2E9E1", + "primary": "#8C6D5C", + "tertiary": "#D9C7B1", + "header_background": "#F2E9E1", + "header_foreground": "#3D352A", + "header_tiles": "#8C6D5C", + "secondary_background": "#D9C7B1", + "secondary_foreground": "#3D352A" + }, + { + "base": "#2E383F", + "contrast": "#F2F2F2", + "primary": "#6D7D87", + "tertiary": "#B1C2CA", + "header_background": "#F2F2F2", + "header_foreground": "#2E383F", + "header_tiles": "#6D7D87", + "secondary_background": "#B1C2CA", + "secondary_foreground": "#2E383F" + }, + { + "base": "#2A3D35", + "contrast": "#E1F2E9", + "primary": "#5C8C6D", + "tertiary": "#B1D9C7", + "header_background": "#E1F2E9", + "header_foreground": "#2A3D35", + "header_tiles": "#5C8C6D", + "secondary_background": "#B1D9C7", + "secondary_foreground": "#2A3D35" + }, + { + "base": "#3F2E38", + "contrast": "#F2F2F2", + "primary": "#876D7D", + "tertiary": "#CAB1C2", + "header_background": "#F2F2F2", + "header_foreground": "#3F2E38", + "header_tiles": "#876D7D", + "secondary_background": "#CAB1C2", + "secondary_foreground": "#3F2E38" + }, + { + "base": "#352A3D", + "contrast": "#E9E1F2", + "primary": "#6D5C8C", + "tertiary": "#C7B1D9", + "header_background": "#E9E1F2", + "header_foreground": "#352A3D", + "header_tiles": "#6D5C8C", + "secondary_background": "#C7B1D9", + "secondary_foreground": "#352A3D" + } + ], + "designStyles": [ + { + "aesthetics": "modern", + "font_heading": "poppins", + "font_content": "mulish", + "spacing": 2, + "radius": 5, + "font_heading_name": "Poppins", + "font_content_name": "Mulish" + }, + { + "aesthetics": "vintage", + "font_heading": "playfair", + "font_content": "forum", + "spacing": 3, + "radius": 10, + "font_heading_name": "Playfair Display", + "font_content_name": "Forum" + }, + { + "aesthetics": "retro", + "font_heading": "oswald", + "font_content": "roboto-slab", + "spacing": 4, + "radius": 8, + "font_heading_name": "Oswald", + "font_content_name": "Roboto Slab" + }, + { + "aesthetics": "minimalist", + "font_heading": "raleway", + "font_content": "source-sans-pro", + "spacing": 2, + "radius": 5, + "font_heading_name": "Raleway", + "font_content_name": "Source Sans Pro" + }, + { + "aesthetics": "typographic", + "font_heading": "jost", + "font_content": "merriweather", + "spacing": 3, + "radius": 10, + "font_heading_name": "Jost", + "font_content_name": "Merriweather" + } + ] +} diff --git a/tests/cypress/fixtures/theme-style.json b/tests/cypress/fixtures/theme-style.json new file mode 100644 index 000000000..588b69c26 --- /dev/null +++ b/tests/cypress/fixtures/theme-style.json @@ -0,0 +1,1148 @@ +[ + { + "id": 0, + "title": "Default", + "version": 2, + "settings": { + "appearanceTools": true, + "color": { + "custom": true, + "customGradient": true, + "gradients": [ + { + "gradient": "linear-gradient(to bottom, #00a79c 0%,#01af8d 100%)", + "name": "Vertical tertiary to primary", + "slug": "v-tertiary-primary" + } + ], + "palette": [ + { + "color": "#2E383F", + "name": "Base", + "slug": "base" + }, + { + "color": "#F2E9E1", + "name": "Contrast", + "slug": "contrast" + }, + { + "color": "#6D7D87", + "name": "Primary", + "slug": "primary" + }, + { + "color": "#B1C2CA", + "name": "Tertiary", + "slug": "tertiary" + }, + { + "color": "#F2E9E1", + "name": "Header Background", + "slug": "header-background" + }, + { + "color": "#3D352A", + "name": "Header Foreground", + "slug": "header-foreground" + }, + { + "color": "#8C6D5C", + "name": "Header Tiles", + "slug": "header-tiles" + }, + { + "color": "#D9C7B1", + "name": "Secondary Background", + "slug": "secondary-background" + }, + { + "color": "#3D352A", + "name": "Secondary Foreground", + "slug": "secondary-foreground" + }, + { + "color": "#2E383F", + "name": "Secondary", + "slug": "secondary" + } + ] + }, + "custom": { + "3-xs-spacing": "clamp(0.19rem, calc(0.14rem + 0.24vw), 0.31rem)", + "4-xl-spacing": "clamp(5.63rem, calc(4.41rem + 6.1vw), 8.75rem)", + "button-border-radius": "4px", + "button-padding": "0.5rem 1rem;", + "colum-negative-horizontal-margin": "-100px", + "input-border-color": "rgba(0, 0, 0, 0.2)", + "input-border-width": "2px", + "input-min-height": "2.5em", + "single-post-feature-image-orverlap-vertical-margin": "-250px", + "vertical-spacing": "1.25rem", + "xl-spacing": "clamp(2.5rem, calc(2.01rem + 2.44vw), 3.75rem)" + }, + "layout": { + "contentSize": "1510px", + "wideSize": "1800px" + }, + "spacing": { + "spacingScale": { + "steps": 0 + }, + "spacingSizes": [ + { + "name": "2XS", + "size": "clamp(0.44rem, calc(0.36rem + 0.37vw), 0.63rem)", + "slug": "10" + }, + { + "name": "XS", + "size": "clamp(0.75rem, calc(0.68rem + 0.37vw), 0.94rem)", + "slug": "20" + }, + { + "name": "S", + "size": "clamp(1.25rem, calc(1.13rem + 0.61vw), 1.56rem)", + "slug": "30" + }, + { + "name": "M", + "size": "clamp(1.88rem, calc(1.75rem + 0.61vw), 2.19rem)", + "slug": "40" + }, + { + "name": "L", + "size": "clamp(2.19rem, calc(1.82rem + 1.83vw), 3.13rem)", + "slug": "50" + }, + { + "name": "2XL", + "size": "clamp(3.75rem, calc(3.26rem + 2.44vw), 5rem)", + "slug": "70" + }, + { + "name": "3XL", + "size": "clamp(4.38rem, calc(3.64rem + 3.66vw), 6.25rem)", + "slug": "80" + } + ], + "units": [ + "px", + "em", + "rem", + "vh", + "vw", + "%" + ] + }, + "typography": { + "customFontSize": true, + "fluid": true, + "fontFamilies": [ + { + "fontFamily": "-apple-system,BlinkMacSystemFont,\"Segoe UI\",Roboto,Oxygen-Sans,Ubuntu,Cantarell,\"Helvetica Neue\",sans-serif", + "name": "System", + "slug": "system" + }, + { + "fontFamily": "\"Times New Roman\",\"New York\",Times,\"Noto Serif\",serif", + "name": "Serif", + "slug": "serif" + }, + { + "fontFamily": "Consolas,Menlo,Monaco,\"SF Mono\",\"DejaVu Sans Mono\",\"Roboto Mono\",\"Courier New\",Courier,monospace", + "name": "Monospace", + "slug": "monospace" + }, + { + "fontFace": [ + { + "fontFamily": "Mulish", + "fontStretch": "normal", + "fontStyle": "normal", + "fontWeight": "200 900", + "src": [ + "file:.\/assets\/fonts\/Mulish-VariableFont_wght.ttf" + ] + }, + { + "fontFamily": "Mulish", + "fontStretch": "normal", + "fontStyle": "italic", + "fontWeight": "200 900", + "src": [ + "file:.\/assets\/fonts\/Mulish-Italic-VariableFont_wght.ttf" + ] + } + ], + "fontFamily": "Mulish", + "name": "Mulish, sans-serif", + "slug": "mulish" + }, + { + "fontFace": [ + { + "fontFamily": "Raleway", + "fontStretch": "normal", + "fontStyle": "normal", + "fontWeight": "100 900", + "src": [ + "file:.\/assets\/fonts\/Raleway-VariableFont_wght.ttf" + ] + }, + { + "fontFamily": "Raleway", + "fontStretch": "normal", + "fontStyle": "italic", + "fontWeight": "100 900", + "src": [ + "file:.\/assets\/fonts\/Raleway-Italic-VariableFont_wght.ttf" + ] + } + ], + "fontFamily": "Raleway", + "name": "Raleway, sans-serif", + "slug": "raleway" + }, + { + "fontFace": [ + { + "fontFamily": "Roboto Slab", + "fontStretch": "normal", + "fontStyle": "normal", + "fontWeight": "100 900", + "src": [ + "file:.\/assets\/fonts\/RobotoSlab-VariableFont_wght.ttf" + ] + } + ], + "fontFamily": "Roboto Slab", + "name": "Roboto Slab, serif", + "slug": "roboto-slab" + }, + { + "fontFace": [ + { + "fontFamily": "Jost", + "fontStretch": "normal", + "fontStyle": "normal", + "fontWeight": "100 900", + "src": [ + "file:.\/assets\/fonts\/Jost-VariableFont_wght.ttf" + ] + }, + { + "fontFamily": "Jost", + "fontStretch": "normal", + "fontStyle": "italic", + "fontWeight": "100 900", + "src": [ + "file:.\/assets\/fonts\/Jost-Italic-VariableFont_wght.ttf" + ] + } + ], + "fontFamily": "Jost", + "name": "Jost, sans-serif", + "slug": "jost" + }, + { + "fontFace": [ + { + "fontFamily": "Montserrat", + "fontStretch": "normal", + "fontStyle": "normal", + "fontWeight": "100 900", + "src": [ + "file:.\/assets\/fonts\/Montserrat-VariableFont_wght.ttf" + ] + }, + { + "fontFamily": "Montserrat", + "fontStretch": "normal", + "fontStyle": "italic", + "fontWeight": "100 900", + "src": [ + "file:.\/assets\/fonts\/Montserrat-Italic-VariableFont_wght.ttf" + ] + } + ], + "fontFamily": "Montserrat", + "name": "Montserrat, sans-serif", + "slug": "montserrat" + }, + { + "fontFace": [ + { + "fontFamily": "Nunito", + "fontStretch": "normal", + "fontStyle": "normal", + "fontWeight": "200 900", + "src": [ + "file:.\/assets\/fonts\/Nunito-VariableFont_wght.ttf" + ] + }, + { + "fontFamily": "Nunito", + "fontStretch": "normal", + "fontStyle": "italic", + "fontWeight": "200 900", + "src": [ + "file:.\/assets\/fonts\/Nunito-Italic-VariableFont_wght.ttf" + ] + } + ], + "fontFamily": "Nunito", + "name": "Nunito, sans-serif", + "slug": "nunito" + }, + { + "fontFace": [ + { + "fontFamily": "Solway", + "fontStyle": "normal", + "fontWeight": "300", + "src": [ + "file:.\/assets\/fonts\/solway-v15-latin-300.woff2" + ] + }, + { + "fontFamily": "Solway", + "fontStyle": "normal", + "fontWeight": "400", + "src": [ + "file:.\/assets\/fonts\/solway-v15-latin-regular.woff2" + ] + }, + { + "fontFamily": "Solway", + "fontStyle": "normal", + "fontWeight": "500", + "src": [ + "file:.\/assets\/fonts\/solway-v15-latin-500.woff2" + ] + }, + { + "fontFamily": "Solway", + "fontStyle": "normal", + "fontWeight": "700", + "src": [ + "file:.\/assets\/fonts\/solway-v15-latin-700.woff2" + ] + }, + { + "fontFamily": "Solway", + "fontStyle": "normal", + "fontWeight": "800", + "src": [ + "file:.\/assets\/fonts\/solway-v15-latin-800.woff2" + ] + } + ], + "fontFamily": "Solway", + "name": "Solway, serif", + "slug": "solway" + }, + { + "fontFace": [ + { + "fontFamily": "Changa One", + "fontStyle": "normal", + "fontWeight": "400", + "src": [ + "file:.\/assets\/fonts\/changa-one-v18-latin-regular.woff2" + ] + }, + { + "fontFamily": "Changa One", + "fontStyle": "italic", + "fontWeight": "400", + "src": [ + "file:.\/assets\/fonts\/changa-one-v18-latin-italic.woff2" + ] + } + ], + "fontFamily": "Changa One", + "name": "Changa One, display", + "slug": "changa-one" + }, + { + "fontFace": [ + { + "fontFamily": "Source Sans Pro", + "fontStyle": "normal", + "fontWeight": "200", + "src": [ + "file:.\/assets\/fonts\/source-sans-pro-v21-latin-200.woff2" + ] + }, + { + "fontFamily": "Source Sans Pro", + "fontStyle": "italic", + "fontWeight": "200", + "src": [ + "file:.\/assets\/fonts\/source-sans-pro-v21-latin-200italic.woff2" + ] + }, + { + "fontFamily": "Source Sans Pro", + "fontStyle": "normal", + "fontWeight": "300", + "src": [ + "file:.\/assets\/fonts\/source-sans-pro-v21-latin-300.woff2" + ] + }, + { + "fontFamily": "Source Sans Pro", + "fontStyle": "italic", + "fontWeight": "300", + "src": [ + "file:.\/assets\/fonts\/source-sans-pro-v21-latin-300italic.woff2" + ] + }, + { + "fontFamily": "Source Sans Pro", + "fontStyle": "normal", + "fontWeight": "400", + "src": [ + "file:.\/assets\/fonts\/source-sans-pro-v21-latin-regular.woff2" + ] + }, + { + "fontFamily": "Source Sans Pro", + "fontStyle": "italic", + "fontWeight": "400", + "src": [ + "file:.\/assets\/fonts\/source-sans-pro-v21-latin-italic.woff2" + ] + }, + { + "fontFamily": "Source Sans Pro", + "fontStyle": "normal", + "fontWeight": "600", + "src": [ + "file:.\/assets\/fonts\/source-sans-pro-v21-latin-600.woff2" + ] + }, + { + "fontFamily": "Source Sans Pro", + "fontStyle": "italic", + "fontWeight": "600", + "src": [ + "file:.\/assets\/fonts\/source-sans-pro-v21-latin-600italic.woff2" + ] + }, + { + "fontFamily": "Source Sans Pro", + "fontStyle": "normal", + "fontWeight": "700", + "src": [ + "file:.\/assets\/fonts\/source-sans-pro-v21-latin-700.woff2" + ] + }, + { + "fontFamily": "Source Sans Pro", + "fontStyle": "italic", + "fontWeight": "700", + "src": [ + "file:.\/assets\/fonts\/source-sans-pro-v21-latin-700italic.woff2" + ] + }, + { + "fontFamily": "Source Sans Pro", + "fontStyle": "normal", + "fontWeight": "900", + "src": [ + "file:.\/assets\/fonts\/source-sans-pro-v21-latin-900.woff2" + ] + }, + { + "fontFamily": "Source Sans Pro", + "fontStyle": "italic", + "fontWeight": "900", + "src": [ + "file:.\/assets\/fonts\/source-sans-pro-v21-latin-900italic.woff2" + ] + } + ], + "fontFamily": "Source Sans Pro", + "name": "Source Sans Pro, sans-serif", + "slug": "source-sans-pro" + }, + { + "fontFace": [ + { + "fontFamily": "Merriweather", + "fontStyle": "normal", + "fontWeight": "300", + "src": [ + "file:.\/assets\/fonts\/merriweather-v30-latin-300.woff2" + ] + }, + { + "fontFamily": "Merriweather", + "fontStyle": "italic", + "fontWeight": "300", + "src": [ + "file:.\/assets\/fonts\/merriweather-v30-latin-300italic.woff2" + ] + }, + { + "fontFamily": "Merriweather", + "fontStyle": "normal", + "fontWeight": "400", + "src": [ + "file:.\/assets\/fonts\/merriweather-v30-latin-regular.woff2" + ] + }, + { + "fontFamily": "Merriweather", + "fontStyle": "italic", + "fontWeight": "400", + "src": [ + "file:.\/assets\/fonts\/merriweather-v30-latin-italic.woff2" + ] + }, + { + "fontFamily": "Merriweather", + "fontStyle": "normal", + "fontWeight": "700", + "src": [ + "file:.\/assets\/fonts\/merriweather-v30-latin-700.woff2" + ] + }, + { + "fontFamily": "Merriweather", + "fontStyle": "italic", + "fontWeight": "700", + "src": [ + "file:.\/assets\/fonts\/merriweather-v30-latin-700italic.woff2" + ] + }, + { + "fontFamily": "Merriweather", + "fontStyle": "normal", + "fontWeight": "900", + "src": [ + "file:.\/assets\/fonts\/merriweather-v30-latin-900.woff2" + ] + }, + { + "fontFamily": "Merriweather", + "fontStyle": "italic", + "fontWeight": "900", + "src": [ + "file:.\/assets\/fonts\/merriweather-v30-latin-900italic.woff2" + ] + } + ], + "fontFamily": "Merriweather", + "name": "Merriweather, serif", + "slug": "merriweather" + }, + { + "fontFace": [ + { + "fontFamily": "Poppins", + "fontStyle": "normal", + "fontWeight": "100", + "src": [ + "file:.\/assets\/fonts\/poppins-v20-latin-100.woff2" + ] + }, + { + "fontFamily": "Poppins", + "fontStyle": "italic", + "fontWeight": "100", + "src": [ + "file:.\/assets\/fonts\/poppins-v20-latin-100italic.woff2" + ] + }, + { + "fontFamily": "Poppins", + "fontStyle": "normal", + "fontWeight": "200", + "src": [ + "file:.\/assets\/fonts\/poppins-v20-latin-200.woff2" + ] + }, + { + "fontFamily": "Poppins", + "fontStyle": "italic", + "fontWeight": "200", + "src": [ + "file:.\/assets\/fonts\/poppins-v20-latin-200italic.woff2" + ] + }, + { + "fontFamily": "Poppins", + "fontStyle": "normal", + "fontWeight": "300", + "src": [ + "file:.\/assets\/fonts\/poppins-v20-latin-300.woff2" + ] + }, + { + "fontFamily": "Poppins", + "fontStyle": "italic", + "fontWeight": "300", + "src": [ + "file:.\/assets\/fonts\/poppins-v20-latin-300italic.woff2" + ] + }, + { + "fontFamily": "Poppins", + "fontStyle": "normal", + "fontWeight": "400", + "src": [ + "file:.\/assets\/fonts\/poppins-v20-latin-regular.woff2" + ] + }, + { + "fontFamily": "Poppins", + "fontStyle": "italic", + "fontWeight": "400", + "src": [ + "file:.\/assets\/fonts\/poppins-v20-latin-italic.woff2" + ] + }, + { + "fontFamily": "Poppins", + "fontStyle": "normal", + "fontWeight": "500", + "src": [ + "file:.\/assets\/fonts\/poppins-v20-latin-500.woff2" + ] + }, + { + "fontFamily": "Poppins", + "fontStyle": "italic", + "fontWeight": "500", + "src": [ + "file:.\/assets\/fonts\/poppins-v20-latin-500italic.woff2" + ] + }, + { + "fontFamily": "Poppins", + "fontStyle": "normal", + "fontWeight": "600", + "src": [ + "file:.\/assets\/fonts\/poppins-v20-latin-600.woff2" + ] + }, + { + "fontFamily": "Poppins", + "fontStyle": "italic", + "fontWeight": "600", + "src": [ + "file:.\/assets\/fonts\/poppins-v20-latin-600italic.woff2" + ] + }, + { + "fontFamily": "Poppins", + "fontStyle": "normal", + "fontWeight": "700", + "src": [ + "file:.\/assets\/fonts\/poppins-v20-latin-700.woff2" + ] + }, + { + "fontFamily": "Poppins", + "fontStyle": "italic", + "fontWeight": "700", + "src": [ + "file:.\/assets\/fonts\/poppins-v20-latin-700italic.woff2" + ] + }, + { + "fontFamily": "Poppins", + "fontStyle": "normal", + "fontWeight": "800", + "src": [ + "file:.\/assets\/fonts\/poppins-v20-latin-800.woff2" + ] + }, + { + "fontFamily": "Poppins", + "fontStyle": "italic", + "fontWeight": "800", + "src": [ + "file:.\/assets\/fonts\/poppins-v20-latin-800italic.woff2" + ] + }, + { + "fontFamily": "Poppins", + "fontStyle": "normal", + "fontWeight": "900", + "src": [ + "file:.\/assets\/fonts\/poppins-v20-latin-900.woff2" + ] + }, + { + "fontFamily": "Poppins", + "fontStyle": "italic", + "fontWeight": "900", + "src": [ + "file:.\/assets\/fonts\/poppins-v20-latin-900italic.woff2" + ] + } + ], + "fontFamily": "Poppins", + "name": "Poppins", + "slug": "poppins" + }, + { + "fontFace": [ + { + "fontFamily": "Satisfy", + "fontStyle": "normal", + "fontWeight": "400", + "src": [ + "file:.\/assets\/fonts\/satisfy-v17-latin-regular.woff2" + ] + } + ], + "fontFamily": "Satisfy", + "name": "Satisfy", + "slug": "satisfy" + }, + { + "fontFace": [ + { + "fontFamily": "Forum", + "fontStyle": "normal", + "fontWeight": "400", + "src": [ + "file:.\/assets\/fonts\/forum-v16-latin-regular.woff2" + ] + } + ], + "fontFamily": "Forum", + "name": "Forum", + "slug": "forum" + }, + { + "fontFace": [ + { + "fontFamily": "Oswald", + "fontStyle": "normal", + "fontWeight": "200", + "src": [ + "file:.\/assets\/fonts\/oswald-v48-latin-200.woff2" + ] + }, + { + "fontFamily": "Oswald", + "fontStyle": "normal", + "fontWeight": "300", + "src": [ + "file:.\/assets\/fonts\/oswald-v48-latin-300.woff2" + ] + }, + { + "fontFamily": "Oswald", + "fontStyle": "normal", + "fontWeight": "400", + "src": [ + "file:.\/assets\/fonts\/oswald-v48-latin-regular.woff2" + ] + }, + { + "fontFamily": "Oswald", + "fontStyle": "normal", + "fontWeight": "500", + "src": [ + "file:.\/assets\/fonts\/oswald-v48-latin-500.woff2" + ] + }, + { + "fontFamily": "Oswald", + "fontStyle": "normal", + "fontWeight": "600", + "src": [ + "file:.\/assets\/fonts\/oswald-v48-latin-600.woff2" + ] + } + ], + "fontFamily": "Oswald", + "name": "Oswald", + "slug": "oswald" + }, + { + "fontFace": [ + { + "fontFamily": "Playfair Display", + "fontStyle": "normal", + "fontWeight": "400", + "src": [ + "file:.\/assets\/fonts\/playfair-display-v29-latin-regular.woff2" + ] + }, + { + "fontFamily": "Playfair Display", + "fontStyle": "italic", + "fontWeight": "400", + "src": [ + "file:.\/assets\/fonts\/playfair-display-v29-latin-italic.woff2" + ] + }, + { + "fontFamily": "Playfair Display", + "fontStyle": "normal", + "fontWeight": "500", + "src": [ + "file:.\/assets\/fonts\/playfair-display-v29-latin-500.woff2" + ] + }, + { + "fontFamily": "Playfair Display", + "fontStyle": "italic", + "fontWeight": "500", + "src": [ + "file:.\/assets\/fonts\/playfair-display-v29-latin-500italic.woff2" + ] + }, + { + "fontFamily": "Playfair Display", + "fontStyle": "normal", + "fontWeight": "600", + "src": [ + "file:.\/assets\/fonts\/playfair-display-v29-latin-600.woff2" + ] + }, + { + "fontFamily": "Playfair Display", + "fontStyle": "italic", + "fontWeight": "600", + "src": [ + "file:.\/assets\/fonts\/playfair-display-v29-latin-600italic.woff2" + ] + }, + { + "fontFamily": "Playfair Display", + "fontStyle": "normal", + "fontWeight": "700", + "src": [ + "file:.\/assets\/fonts\/playfair-display-v29-latin-700.woff2" + ] + }, + { + "fontFamily": "Playfair Display", + "fontStyle": "italic", + "fontWeight": "700", + "src": [ + "file:.\/assets\/fonts\/playfair-display-v29-latin-700italic.woff2" + ] + }, + { + "fontFamily": "Playfair Display", + "fontStyle": "normal", + "fontWeight": "800", + "src": [ + "file:.\/assets\/fonts\/playfair-display-v29-latin-800.woff2" + ] + }, + { + "fontFamily": "Playfair Display", + "fontStyle": "italic", + "fontWeight": "800", + "src": [ + "file:.\/assets\/fonts\/playfair-display-v29-latin-800italic.woff2" + ] + }, + { + "fontFamily": "Playfair Display", + "fontStyle": "normal", + "fontWeight": "900", + "src": [ + "file:.\/assets\/fonts\/playfair-display-v29-latin-900.woff2" + ] + }, + { + "fontFamily": "Playfair Display", + "fontStyle": "italic", + "fontWeight": "900", + "src": [ + "file:.\/assets\/fonts\/playfair-display-v29-latin-900italic.woff2" + ] + } + ], + "fontFamily": "Playfair Display", + "name": "Playfair Display", + "slug": "playfair" + } + ], + "fontSizes": [ + { + "fluid": { + "max": "0.875rem", + "min": "0.875rem" + }, + "name": "Extra Small", + "size": "0.875rem", + "slug": "x-small" + }, + { + "fluid": { + "max": "1.08rem", + "min": "1rem" + }, + "name": "Small", + "size": "1rem", + "slug": "small" + }, + { + "fluid": { + "max": "1.125rem", + "min": "1rem" + }, + "name": "Normal", + "size": "1.125rem", + "slug": "normal" + }, + { + "fluid": { + "max": "1.5rem", + "min": "1.3rem" + }, + "name": "Medium", + "size": "1.5rem", + "slug": "medium" + }, + { + "fluid": { + "max": "1.75rem", + "min": "1.3125rem" + }, + "name": "Large", + "size": "1.75rem", + "slug": "large" + }, + { + "fluid": { + "max": "2rem", + "min": "1.5rem" + }, + "name": "Extra Large", + "size": "2rem", + "slug": "x-large" + }, + { + "fluid": { + "max": "3rem", + "min": "2.1875rem" + }, + "name": "Huge", + "size": "3rem", + "slug": "huge" + } + ] + } + }, + "styles": { + "blocks": { + "core\/button": { + "border": { + "radius": "var(--wp--custom--button-border-radius)", + "style": "solid", + "width": "0" + }, + "color": { + "background": "var(--wp--preset--color--primary)", + "text": "var(--wp--preset--color--base)" + }, + "spacing": { + "padding": { + "bottom": "0.5rem", + "left": "1rem", + "right": "1rem", + "top": "0.5rem" + } + }, + "typography": { + "fontSize": "var(--wp--preset--font-size--small)", + "fontWeight": "500" + } + }, + "core\/heading": { + "color": { + "text": "var(--wp--preset--color--primary)" + }, + "elements": { + "link": { + "color": { + "text": "var(--wp--preset--color--primary)" + }, + "typography": { + "textDecoration": "none" + } + } + }, + "typography": { + "fontFamily": "var(--wp--preset--font-family--poppins)", + "textDecoration": "none" + } + }, + "core\/latest-posts": { + "elements": { + "link": { + "color": { + "text": "var(--wp--preset--color--tertiary)" + }, + "typography": { + "textDecoration": "none" + } + } + } + }, + "core\/navigation": { + "elements": { + "link": { + ":active": { + "typography": { + "textDecoration": "none" + } + }, + ":focus": { + "typography": { + "textDecoration": "underline dashed" + } + }, + ":hover": { + "color": { + "text": "var(--wp--preset--color--primary)" + }, + "typography": { + "textDecoration": "none" + } + }, + "typography": { + "textDecoration": "none" + } + } + }, + "typography": { + "lineHeight": "1.75" + } + }, + "core\/site-tagline": { + "typography": { + "fontSize": "var(--wp--preset--font-size--x-small)" + } + }, + "core\/site-title": { + "color": { + "text": "var(--wp--preset--color--secondary-foreground)" + }, + "elements": { + "link": { + "color": { + "text": "var(--wp--preset--color--secondary-foreground)" + }, + "typography": { + "textDecoration": "none" + } + } + } + } + }, + "color": { + "background": "var(--wp--preset--color--base)", + "text": "var(--wp--preset--color--contrast)" + }, + "elements": { + "button": { + ":active": { + "color": { + "background": "var(--wp--preset--color--primary)", + "text": "var(--wp--preset--color--base)" + } + }, + ":focus": { + "color": { + "background": "var(--wp--preset--color--primary)", + "text": "var(--wp--preset--color--base)" + } + }, + ":hover": { + "color": { + "background": "var(--wp--preset--color--primary)", + "text": "var(--wp--preset--color--base)" + } + }, + ":visited": { + "color": { + "text": "var(--wp--preset--color--base)" + } + }, + "border": { + "radius": "var(--wp--custom--button-border-radius)", + "style": "solid", + "width": "0" + }, + "color": { + "background": "var(--wp--preset--color--primary)", + "text": "var(--wp--preset--color--base)" + }, + "spacing": { + "padding": { + "bottom": "0.5rem", + "left": "1rem", + "right": "1rem", + "top": "0.5rem" + } + }, + "typography": { + "fontFamily": "inherit", + "fontSize": "var(--wp--preset--font-size--small)", + "fontWeight": "500", + "lineHeight": "inherit", + "textDecoration": "none" + } + }, + "heading": { + "color": { + "text": "var(--wp--preset--color--primary)" + }, + "typography": { + "fontFamily": "var(--wp--preset--font-family--poppins)", + "textDecoration": "none" + } + }, + "link": { + ":active": { + "typography": { + "textDecoration": "none" + } + }, + ":focus": { + "typography": { + "textDecoration": "underline dashed" + } + }, + ":hover": { + "color": { + "text": "var(--wp--preset--color--primary)" + }, + "typography": { + "textDecoration": "underline" + } + }, + "color": { + "text": "var(--wp--preset--color--primary)" + }, + "typography": { + "textDecoration": "none" + } + } + }, + "spacing": { + "blockGap": "var(--wp--custom--vertical-spacing)" + }, + "typography": { + "fontFamily": "var(--wp--preset--font-family--mulish)", + "fontSize": "var(--wp--preset--font-size--normal)", + "lineHeight": "1.5" + } + } + } +] diff --git a/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/7-editor.cy.js b/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/7-editor.cy.js index ac2f55b4c..fd407017f 100644 --- a/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/7-editor.cy.js +++ b/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/7-editor.cy.js @@ -1,4 +1,5 @@ // +import { apiList, customizeDataMock, themeStyleMock } from '../wp-module-support/MockApi.cy'; import { AdminBarCheck, DarkBGCheck, @@ -140,11 +141,19 @@ describe( 'SiteGen Site Editor Step', function () { .should( 'exist' ); } ); - it.skip( 'Check changing the existing fonts from sidebar', () => { + it( 'Check changing the existing fonts from sidebar', () => { + cy.intercept( apiList.themestyle, ( req ) => { + themeStyleMock( req ); + } ).as( 'themeStyleCalls' ); + cy.intercept( apiList.customizedata, ( req ) => { + customizeDataMock( req ); + } ).as( 'customizeDataCall' ); cy.wait( 2000 ); cy.get( '.nfd-onboarding-header--sitegen__editor__end__customize-button' ).click(); + cy.wait( '@themeStyleCalls', { timeout: 60000 } ); + cy.wait( '@customizeDataCall', { timeout: 60000 } ); cy.get( '.components-panel__body.nfd-onboarding-sidebar-learn-more.is-opened', { timeout: 20000 } @@ -163,7 +172,7 @@ describe( 'SiteGen Site Editor Step', function () { } ); } ); - it.skip( 'Check changing the custom fonts from sidebar', () => { + it( 'Check changing the custom fonts from sidebar', () => { const CustomeFontsClass = '.nfd-onboarding-sidebar--customize__design-fonts-panel__fonts-form__container'; cy.get( CustomeFontsClass ).should( 'not.exist' ); @@ -195,7 +204,7 @@ describe( 'SiteGen Site Editor Step', function () { ).should( 'have.length', 6 ); } ); - it.skip( 'Check changing the existing colors from sidebar', () => { + it( 'Check changing the existing colors from sidebar', () => { cy.get( '.components-panel__body.nfd-onboarding-sidebar--customize__design-colors-panel.is-opened' ).should( 'exist' ); @@ -212,7 +221,7 @@ describe( 'SiteGen Site Editor Step', function () { } ); } ); - it.skip( 'Check changing the custom colors from sidebar', () => { + it( 'Check changing the custom colors from sidebar', () => { const CustomColorClass = '.nfd-onboarding-sidebar--customize__design-colors-panel__custom__colors__container'; cy.get( CustomColorClass ).should( 'not.exist' ); @@ -246,7 +255,7 @@ describe( 'SiteGen Site Editor Step', function () { .should( 'have.length', 6 ); } ); - it.skip( 'Check clicking the reset button', () => { + it( 'Check clicking the reset button', () => { cy.get( '.components-panel__header > :nth-child(2)' ) .scrollIntoView() .should( 'exist' ) diff --git a/tests/cypress/integration/wp-module-support/MockApi.cy.js b/tests/cypress/integration/wp-module-support/MockApi.cy.js index 3e3822c39..dc7c4e94a 100644 --- a/tests/cypress/integration/wp-module-support/MockApi.cy.js +++ b/tests/cypress/integration/wp-module-support/MockApi.cy.js @@ -8,6 +8,8 @@ const sitemap_mock = require( '../../fixtures/sitemap.json' ); const plugin_recommendation_mock = require( '../../fixtures/plugin-recommendation.json' ); const font_pair_mock = require( '../../fixtures/font-pair.json' ); const homepages_mock = require( '../../fixtures/homepages.json' ); +const theme_style_mock = require( '../../fixtures/theme-style.json' ); +const customize_data_mock = require( '../../fixtures/customize-data.json' ); export const apiList = { sitegen: @@ -16,6 +18,10 @@ export const apiList = { '/index.php?rest_route=%2Fnewfold-onboarding%2Fv1%2Fsitegen%2Fhomepages&flow=sitegen&_locale=user', homepagesRegenerate: '/index.php?rest_route=%2Fnewfold-onboarding%2Fv1%2Fsitegen%2Fhomepages%2Fregenerate&flow=sitegen&_locale=user', + themestyle: + '/index.php?rest_route=%2Fnewfold-onboarding%2Fv1%2Fthemes%2Fvariations&variations=false&flow=sitegen&_locale=user', + customizedata: + '/index.php?rest_route=%2Fnewfold-onboarding%2Fv1%2Fsitegen%2Fcustomize-data&flow=sitegen&_locale=user' }; export const siteGenMockAll = ( req ) => { @@ -52,3 +58,22 @@ export const homePagesMock = ( req ) => { }, } ); }; + +export const themeStyleMock = ( req ) => { + req.reply({ + method: 'GET', + statusCode: 200, + body: theme_style_mock, + }); +}; + +export const customizeDataMock = ( req ) => { + req.reply({ + method: 'GET', + statusCode: 200, + body: customize_data_mock, + headers: { + 'content-type': 'application/json', + }, + }); +}; From f1269010e56b36e5ffa5017c42d93a657f71a2b0 Mon Sep 17 00:00:00 2001 From: Avneet Raj Date: Wed, 10 Apr 2024 09:58:42 +0530 Subject: [PATCH 4/6] Mock APIs better --- .../5-AI-SiteGen-onboarding-flow/4-site-logo.cy.js | 10 ++++------ .../5-experience.cy.js | 14 ++++++++++++++ .../5-AI-SiteGen-onboarding-flow/6-preview.cy.js | 14 ++++++++++++++ 3 files changed, 32 insertions(+), 6 deletions(-) diff --git a/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/4-site-logo.cy.js b/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/4-site-logo.cy.js index abaf39c81..ce68845d7 100644 --- a/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/4-site-logo.cy.js +++ b/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/4-site-logo.cy.js @@ -17,6 +17,7 @@ import { describe( 'SiteGen Site Logo Step', function () { before( () => { + cy.visit( 'wp-admin/?page=nfd-onboarding#/sitegen/step/site-logo' ); cy.intercept( apiList.sitegen, ( req ) => { siteGenMockAll( req ); } ).as( 'sitegenCalls' ); @@ -24,10 +25,7 @@ describe( 'SiteGen Site Logo Step', function () { cy.intercept( apiList.homepages, ( req ) => { homePagesMock( req ); } ).as( 'homePageCall' ); - - cy.visit( 'wp-admin/?page=nfd-onboarding#/sitegen/step/site-logo' ); - cy.wait( '@sitegenCalls', { timeout: 60000 } ); - cy.wait( '@homePageCall', { timeout: 60000 } ); + cy.timeout(120000); } ); it( 'Check for the header admin bar', () => { @@ -62,7 +60,7 @@ describe( 'SiteGen Site Logo Step', function () { DisabledNextButton(); } ); - it.skip( 'Check if Image gets uploaded', () => { + 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'; @@ -92,7 +90,7 @@ describe( 'SiteGen Site Logo Step', function () { ); } ); - it.skip( 'Check if the Next Button is enabled and go next', () => { + it( 'Check if the Next Button is enabled and go next', () => { cy.get( '.nfd-onboarding-button--site-gen-next' ) .should( 'not.be.disabled' ) .click(); diff --git a/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/5-experience.cy.js b/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/5-experience.cy.js index 7e90ecb9e..b46e36dde 100644 --- a/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/5-experience.cy.js +++ b/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/5-experience.cy.js @@ -7,12 +7,26 @@ import { LightBGCheck, ProgressBarCheck, } from '../wp-module-support/siteGen.cy'; +import { + apiList, + siteGenMockAll, + homePagesMock, +} from '../wp-module-support/MockApi.cy'; describe( 'SiteGen Experience & Site Building Step', function () { before( () => { cy.visit( 'wp-admin/index.php?page=nfd-onboarding#/sitegen/step/experience' ); + cy.intercept( apiList.sitegen, ( req ) => { + siteGenMockAll( req ); + } ).as( 'sitegenCalls' ); + + cy.intercept( apiList.homepages, ( req ) => { + homePagesMock( req ); + } ).as( 'homePageCall' ); + cy.timeout(120000); + cy.wait(5000); } ); it( 'Check for the header admin bar', () => { diff --git a/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/6-preview.cy.js b/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/6-preview.cy.js index 708616f94..aac009ba5 100644 --- a/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/6-preview.cy.js +++ b/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/6-preview.cy.js @@ -6,12 +6,26 @@ import { LightBGCheck, ProgressBarCheck, } from '../wp-module-support/siteGen.cy'; +import { + apiList, + siteGenMockAll, + homePagesMock, +} from '../wp-module-support/MockApi.cy'; describe( 'SiteGen Site Preview Step', function () { before( () => { cy.visit( 'wp-admin/index.php?page=nfd-onboarding#/sitegen/step/preview' ); + cy.intercept( apiList.sitegen, ( req ) => { + siteGenMockAll( req ); + } ).as( 'sitegenCalls' ); + + cy.intercept( apiList.homepages, ( req ) => { + homePagesMock( req ); + } ).as( 'homePageCall' ); + cy.timeout(120000); + cy.wait(5000); cy.wait( 5000 ); } ); From 00ddf803a46e2c3c9f313a954aee54eb7c550350 Mon Sep 17 00:00:00 2001 From: Allen Benny Date: Wed, 10 Apr 2024 11:54:44 +0530 Subject: [PATCH 5/6] Fixed Tests Finally :100: --- .../steps/SiteGen/Preview/index.js | 1 + .../5-AI-SiteGen-onboarding-flow/1-fork.cy.js | 1 - .../2-welcome.cy.js | 106 ++++++++------- .../3-site-details.cy.js | 127 ++++++++++-------- .../4-site-logo.cy.js | 6 +- .../5-experience.cy.js | 4 +- .../6-preview.cy.js | 6 +- .../7-editor.cy.js | 34 +++-- .../wp-module-support/MockApi.cy.js | 29 ++-- 9 files changed, 181 insertions(+), 133 deletions(-) diff --git a/src/OnboardingSPA/steps/SiteGen/Preview/index.js b/src/OnboardingSPA/steps/SiteGen/Preview/index.js index 02829dc0f..312dc4148 100644 --- a/src/OnboardingSPA/steps/SiteGen/Preview/index.js +++ b/src/OnboardingSPA/steps/SiteGen/Preview/index.js @@ -78,6 +78,7 @@ const SiteGenPreview = () => { setHeaderActiveView( HEADER_SITEGEN ); setDrawerActiveView( false ); updateInitialize( true ); + setIsHeaderNavigationEnabled( false ); }, [] ); useEffect( () => { diff --git a/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/1-fork.cy.js b/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/1-fork.cy.js index c6ac7a19f..15b1758cb 100644 --- a/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/1-fork.cy.js +++ b/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/1-fork.cy.js @@ -20,7 +20,6 @@ describe( 'SiteGen Fork Step', function () { cy.wait( 10000 ); cy.visit( 'wp-admin/?page=nfd-onboarding#/wp-setup/step/fork' ); cy.timeout( 60000 ); - cy.wait( 25000 ); } ); it( 'Check for the header admin bar', () => { diff --git a/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/2-welcome.cy.js b/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/2-welcome.cy.js index fbad5bc39..28fc5bafe 100644 --- a/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/2-welcome.cy.js +++ b/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/2-welcome.cy.js @@ -1,59 +1,69 @@ // -import { AdminBarCheck, BackButtonCheck, DarkBGCheck, LightBGCheck, 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( () => { - cy.visit( - 'wp-admin/?page=nfd-onboarding#/sitegen/step/welcome' - ); + cy.visit( 'wp-admin/?page=nfd-onboarding#/sitegen/step/welcome' ); } ); - it( 'Check for the header admin bar', () => { - AdminBarCheck(); - } ); + it( 'Check for the header admin bar', () => { + AdminBarCheck(); + } ); - it( 'Check for the existing dark background', () => { + it( 'Check for the existing dark background', () => { DarkBGCheck(); } ); - it( 'Check for the light background', () => { - LightBGCheck(); - } ); - - it( 'Check the Progress Bar Value', () => { - ProgressBarCheck('0%'); - }); - - it( 'Check for back button and go back', () => { - BackButtonCheck('sitegen/step/welcome'); - } ); - - it( 'Check if the orb is visible', () => { - cy.get( '.nfd-onboarding-step--site-gen__welcome__container__orb' ) - .should('be.visible'); - } ); - - it( 'Check for the heading title', () => { - cy.get( '.nfd-onboarding-step--site-gen__welcome__container__heading__text' ) - .should('be.visible') - .contains('WordPress'); - } ); - - it( 'Check for the subheading title', () => { - cy.get('.nfd-onboarding-step--site-gen__welcome__container__sub-heading') - .should('exist'); - cy.get( '.nfd-onboarding-step--site-gen__welcome__container__sub-heading__text' ) - .should('be.visible') - .contains('AI'); - } ); - - it( 'Check the Get Started button', () => { - cy.get( '.nfd-onboarding-button--site-gen-next' ) - .should('be.visible') - .should('have.text','Get Started') - .click(); - cy.wait(2000); - cy.url().should('not.contain', 'sitegen/step/welcome'); - } ); -}); + it( 'Check for the light background', () => { + LightBGCheck(); + } ); + + it( 'Check the Progress Bar Value', () => { + ProgressBarCheck( '0%' ); + } ); + + it( 'Check for back button and go back', () => { + BackButtonCheck( 'sitegen/step/welcome' ); + } ); + + it( 'Check if the orb is visible', () => { + cy.get( + '.nfd-onboarding-step--site-gen__welcome__container__orb' + ).should( 'be.visible' ); + } ); + + it( 'Check for the heading title', () => { + cy.get( + '.nfd-onboarding-step--site-gen__welcome__container__heading__text' + ) + .should( 'be.visible' ) + .contains( 'WordPress' ); + } ); + + it( 'Check for the subheading title', () => { + cy.get( + '.nfd-onboarding-step--site-gen__welcome__container__sub-heading' + ).should( 'exist' ); + cy.get( + '.nfd-onboarding-step--site-gen__welcome__container__sub-heading__text' + ) + .should( 'be.visible' ) + .contains( 'AI' ); + } ); + + it( 'Check the Get Started button', () => { + cy.get( '.nfd-onboarding-button--site-gen-next' ) + .should( 'be.visible' ) + .should( 'have.text', 'Get Started' ) + .click(); + cy.wait( 2000 ); + cy.url().should( 'not.contain', 'sitegen/step/welcome' ); + } ); +} ); diff --git a/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/3-site-details.cy.js b/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/3-site-details.cy.js index b07ca89d1..d25000ae4 100644 --- a/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/3-site-details.cy.js +++ b/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/3-site-details.cy.js @@ -1,68 +1,87 @@ // -import { AdminBarCheck, BackButtonCheck, DarkBGCheck, LightBGCheck, ProgressBarCheck} 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( () => { - cy.visit( - 'wp-admin/index.php?page=nfd-onboarding#/sitegen/step/site-details' - ); - } ); + 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 header admin bar', () => { + AdminBarCheck(); + } ); - it( 'Check for the existing dark background', () => { - DarkBGCheck(); - } ); + it( 'Check for the existing dark background', () => { + DarkBGCheck(); + } ); - it( 'Check for the light background', () => { - LightBGCheck(); - } ); + it( 'Check for the light background', () => { + LightBGCheck(); + } ); - it( 'Check the Progress Bar Value', () => { - ProgressBarCheck('14.2857%'); - }); + it( 'Check the Progress Bar Value', () => { + ProgressBarCheck( '14.2857%' ); + } ); - 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 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 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 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( '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); - } ); + 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 ); + } ); - it.skip( 'Check if the Next Button is enabled and click Next', () => { - cy.get('.nfd-sg-site-details--next-btn') - .should('be.visible') - .click(); - cy.url().should('not.contain','sitegen/step/site-details'); - } ); -}); + it( 'Check if the Next Button is enabled and click Next', () => { + cy.get( '.nfd-sg-site-details--next-btn' ) + .should( 'be.visible' ) + .click(); + cy.url().should( 'not.contain', 'sitegen/step/site-details' ); + } ); +} ); diff --git a/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/4-site-logo.cy.js b/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/4-site-logo.cy.js index ce68845d7..dab62baee 100644 --- a/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/4-site-logo.cy.js +++ b/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/4-site-logo.cy.js @@ -17,7 +17,6 @@ import { describe( 'SiteGen Site Logo Step', function () { before( () => { - cy.visit( 'wp-admin/?page=nfd-onboarding#/sitegen/step/site-logo' ); cy.intercept( apiList.sitegen, ( req ) => { siteGenMockAll( req ); } ).as( 'sitegenCalls' ); @@ -25,7 +24,10 @@ describe( 'SiteGen Site Logo Step', function () { cy.intercept( apiList.homepages, ( req ) => { homePagesMock( req ); } ).as( 'homePageCall' ); - cy.timeout(120000); + cy.visit( 'wp-admin/?page=nfd-onboarding#/sitegen/step/site-logo' ); + cy.wait( '@sitegenCalls', { timeout: 60000 } ); + cy.wait( '@homePageCall', { timeout: 60000 } ); + cy.timeout( 120000 ); } ); it( 'Check for the header admin bar', () => { diff --git a/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/5-experience.cy.js b/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/5-experience.cy.js index b46e36dde..50db95d42 100644 --- a/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/5-experience.cy.js +++ b/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/5-experience.cy.js @@ -25,8 +25,8 @@ describe( 'SiteGen Experience & Site Building Step', function () { cy.intercept( apiList.homepages, ( req ) => { homePagesMock( req ); } ).as( 'homePageCall' ); - cy.timeout(120000); - cy.wait(5000); + cy.timeout( 120000 ); + cy.wait( 5000 ); } ); it( 'Check for the header admin bar', () => { diff --git a/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/6-preview.cy.js b/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/6-preview.cy.js index aac009ba5..8f8780b18 100644 --- a/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/6-preview.cy.js +++ b/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/6-preview.cy.js @@ -24,8 +24,8 @@ describe( 'SiteGen Site Preview Step', function () { cy.intercept( apiList.homepages, ( req ) => { homePagesMock( req ); } ).as( 'homePageCall' ); - cy.timeout(120000); - cy.wait(5000); + cy.timeout( 120000 ); + cy.wait( 5000 ); cy.wait( 5000 ); } ); @@ -51,7 +51,7 @@ describe( 'SiteGen Site Preview Step', function () { .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 diff --git a/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/7-editor.cy.js b/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/7-editor.cy.js index fd407017f..76870310a 100644 --- a/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/7-editor.cy.js +++ b/tests/cypress/integration/5-AI-SiteGen-onboarding-flow/7-editor.cy.js @@ -1,5 +1,9 @@ // -import { apiList, customizeDataMock, themeStyleMock } from '../wp-module-support/MockApi.cy'; +import { + apiList, + customizeDataMock, + themeStyleMock, +} from '../wp-module-support/MockApi.cy'; import { AdminBarCheck, DarkBGCheck, @@ -9,9 +13,21 @@ import { describe( 'SiteGen Site Editor Step', function () { before( () => { cy.visit( - 'wp-admin/index.php?page=nfd-onboarding#/sitegen/step/editor' + 'wp-admin/index.php?page=nfd-onboarding#/sitegen/step/preview' ); - cy.wait( 5000 ); + cy.wait( 15000 ); + } ); + + it( 'Select any theme and go forward to the next step', () => { + cy.get( + '.live-preview-sitegen--selectable-card__live-preview-container__overlay', + { timeout: 10000 } + ) + .eq( 0 ) + .click(); + cy.url().should( 'not.contain', 'sitegen/step/preview', { + timeout: 20000, + } ); } ); it( 'Check for the header admin bar', () => { @@ -87,14 +103,14 @@ describe( 'SiteGen Site Editor Step', function () { '.nfd-onboarding-sidebar--sitegen-editor-patterns__header__tab-panel__versions-tab__preview-container' ) .should( 'be.visible' ) - .should( 'have.length', 3 ); // as we are not currently regenrating new themes + .should( 'have.length', 3 ); // as we are not currently regenrating new themes } ); - it( 'Check for favoriting a theme and it appears everywhere', () => { + it.skip( 'Check for favoriting a theme and it appears everywhere', () => { cy.get( '.nfd-onboarding-sidebar--sitegen-editor-patterns__header__tab-panel__versions-tab__preview-container' ) - .eq( 2 ) + .eq( 1 ) .click(); cy.get( 'g[clip-path="url(#heart-filled_svg__a)"]' ).should( 'not.exist' @@ -113,7 +129,7 @@ describe( 'SiteGen Site Editor Step', function () { ).should( 'exist' ); } ); - it( 'Check for favorite themes inside favorite tab', () => { + it.skip( 'Check for favorite themes inside favorite tab', () => { cy.get( '.nfd-onboarding-sidebar--sitegen-editor-patterns__header__tab-panel__favorites-tab' ) @@ -123,13 +139,13 @@ describe( 'SiteGen Site Editor Step', function () { '.nfd-onboarding-sidebar--sitegen-editor-patterns__header__tab-panel__versions-tab__preview-container' ) .should( 'be.visible' ) - .should( 'have.length', 2 ); + .should( 'have.length', 1 ); cy.get( '.components-button.nfd-onboarding-sidebar--sitegen-editor-patterns__header__icon' ).should( 'be.visible' ); } ); - it( 'Check for the existence of Regenerate button', () => { + it( 'Check for the existence of Regenerate button', () => { cy.get( '.nfd-onboarding-header--sitegen__editor__start__regenerate' ) .scrollIntoView() .should( 'be.visible' ); diff --git a/tests/cypress/integration/wp-module-support/MockApi.cy.js b/tests/cypress/integration/wp-module-support/MockApi.cy.js index dc7c4e94a..2a5b009cb 100644 --- a/tests/cypress/integration/wp-module-support/MockApi.cy.js +++ b/tests/cypress/integration/wp-module-support/MockApi.cy.js @@ -21,21 +21,21 @@ export const apiList = { themestyle: '/index.php?rest_route=%2Fnewfold-onboarding%2Fv1%2Fthemes%2Fvariations&variations=false&flow=sitegen&_locale=user', customizedata: - '/index.php?rest_route=%2Fnewfold-onboarding%2Fv1%2Fsitegen%2Fcustomize-data&flow=sitegen&_locale=user' + '/index.php?rest_route=%2Fnewfold-onboarding%2Fv1%2Fsitegen%2Fcustomize-data&flow=sitegen&_locale=user', }; export const siteGenMockAll = ( req ) => { const requestBody = req.body; const sitegen_identifiers = { - 'site_config': site_config_mock, - 'site_classification': site_classification_mock, - 'target_audience': target_audience_mock, - 'content_tones': content_tones_mock, - 'content_structure': content_structure_mock, - 'color_palette': color_palette_mock, - 'sitemap': sitemap_mock, - 'plugin_recommendation': plugin_recommendation_mock, - 'font_pair': font_pair_mock, + site_config: site_config_mock, + site_classification: site_classification_mock, + target_audience: target_audience_mock, + content_tones: content_tones_mock, + content_structure: content_structure_mock, + color_palette: color_palette_mock, + sitemap: sitemap_mock, + plugin_recommendation: plugin_recommendation_mock, + font_pair: font_pair_mock, }; if ( sitegen_identifiers.hasOwnProperty( requestBody.identifier ) ) { @@ -45,6 +45,7 @@ export const siteGenMockAll = ( req ) => { headers: { 'content-type': 'application/json', }, + delay: 2000, } ); } }; @@ -60,20 +61,20 @@ export const homePagesMock = ( req ) => { }; export const themeStyleMock = ( req ) => { - req.reply({ + req.reply( { method: 'GET', statusCode: 200, body: theme_style_mock, - }); + } ); }; export const customizeDataMock = ( req ) => { - req.reply({ + req.reply( { method: 'GET', statusCode: 200, body: customize_data_mock, headers: { 'content-type': 'application/json', }, - }); + } ); }; From a6fa506a974dbc8974b907e085a60e346f64a0f9 Mon Sep 17 00:00:00 2001 From: arunshenoy99 Date: Wed, 10 Apr 2024 12:00:58 +0530 Subject: [PATCH 6/6] Update build --- build/2.1.9/619.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/2.1.9/619.js b/build/2.1.9/619.js index d7ad61670..11ea1bdfb 100644 --- a/build/2.1.9/619.js +++ b/build/2.1.9/619.js @@ -1 +1 @@ -"use strict";(globalThis.webpackChunknewfold_Onboarding=globalThis.webpackChunknewfold_Onboarding||[]).push([[619],{619:(e,t,n)=>{n.r(t),n.d(t,{default:()=>E});var a=n(1609),r=n(8468),i=n(7143),s=n(148),o=n(6087),d=n(7723);var l=n(7708),g=n(7517),c=n(1056),p=n(3988),m=n(7044);const u=()=>(0,a.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"30",height:"24",viewBox:"-5 -2 36 24",fill:"none",className:"heart"},(0,a.createElement)("g",{id:"State=Active"},(0,a.createElement)("path",{id:"Vector",d:"M10 19.1585L8.975 18.2335C7.20833 16.6168 5.75 15.221 4.6 14.046C3.45 12.871 2.53333 11.821 1.85 10.896C1.16667 9.971 0.6875 9.1335 0.4125 8.3835C0.1375 7.6335 0 6.87516 0 6.1085C0 4.6085 0.504167 3.35433 1.5125 2.346C2.52083 1.33766 3.76667 0.833496 5.25 0.833496C6.2 0.833496 7.07917 1.0585 7.8875 1.5085C8.69583 1.9585 9.4 2.6085 10 3.4585C10.7 2.5585 11.4417 1.896 12.225 1.471C13.0083 1.046 13.85 0.833496 14.75 0.833496C16.2333 0.833496 17.4792 1.33766 18.4875 2.346C19.4958 3.35433 20 4.6085 20 6.1085C20 6.87516 19.8625 7.6335 19.5875 8.3835C19.3125 9.1335 18.8333 9.971 18.15 10.896C17.4667 11.821 16.55 12.871 15.4 14.046C14.25 15.221 12.7917 16.6168 11.025 18.2335L10 19.1585Z",fill:"#EF4A71"}))),_=function({count:e=1,isRegenerating:t}){const n=[];for(let r=0;r{const[e,t]=(0,r.useState)(!1),[n,E]=(0,r.useState)(!1),[C,S]=(0,r.useState)(!1),[N,k]=(0,r.useState)(!1),F=(0,s.Zp)(),D=(0,r.useRef)(),{currentData:G,nextStep:x,siteGenErrorStatus:I,themeStatus:R}=(0,i.useSelect)((e=>({currentData:e(f.M).getCurrentOnboardingData(),nextStep:e(f.M).getNextStep(),siteGenErrorStatus:e(f.M).getSiteGenErrorStatus(),themeStatus:e(f.M).getThemeStatus()}))),{setIsHeaderEnabled:A,setSidebarActiveView:O,setHeaderActiveView:M,setDrawerActiveView:H,setCurrentOnboardingData:T,updateInitialize:V,setHideFooterNav:B,updateSiteGenErrorStatus:Z,setIsHeaderNavigationEnabled:z}=(0,i.useDispatch)(f.M);(0,r.useEffect)((()=>{A(!0),B(!0),O(!1),M(y.Ix),H(!1),V(!0)}),[]),(0,r.useEffect)((()=>{!0===D.current&&!1===I&&(L(),W(),z(!1)),D.current=I}),[I]);const L=async()=>{if(S(!0),!(0,o.isEmpty)(G.sitegen.homepages.data))return t(G.sitegen.homepages.data),S(!1),void P();if(""===G.sitegen.siteDetails?.prompt)return void S(!1);const e=await(0,l.c7)(G.sitegen.siteDetails.prompt);if(e.error)return S(!1),void Z(!0);G.sitegen.homepages.data=e.body,t(e.body),T(G),S(!1),P()},P=()=>{window.nfdOnboarding.siteGenTimerInterval&&(clearInterval(window.nfdOnboarding.siteGenTimerInterval),(0,c.v)(new c.iC(b.uv,window.nfdOnboarding.siteGenTime,{source:h.d0})))},W=async()=>{const e=await(0,g.w6)();e.error?S(!1):k(e.body)};(0,r.useEffect)((()=>{y.Er===R&&(L(),W())}),[R]);const j=(t,n)=>{if(!(t in e))return!1;G.sitegen.homepages.active=e[t],G.sitegen.skipCache=!1,T(G),(0,c.v)(new c.iC(b.Wi,t,{position:n,source:h.d0})),F(x.path)},q=(n,a)=>{if(!(n in e))return;const r=!e[n].isFavorite;e[n].isFavorite=r,G.sitegen.homepages.data=e,t(e),T(G),(0,c.v)(new c.iC(b.Nz,n,{favorite:r,placement:"preview_grid",position:a,source:h.d0}))},U=async(n,a,r,i)=>{if(document.getElementsByClassName("nfd-onboarding-step--site-gen__preview__note")&&document.getElementsByClassName("nfd-onboarding-step--site-gen__preview__note")[0].scrollIntoView({behavior:"smooth",block:"end"}),E(!0),!(n in e))return void E(!1);if(""===G.sitegen.siteDetails?.prompt)return void E(!1);const s=await(0,l.HA)(G.sitegen.siteDetails.prompt,n,a,r);if(s.error)return void E(!1);const o=s.body;e[o.slug]=o,G.sitegen.homepages.data=e,t(e),T(G),E(!1),(0,c.v)(new c.iC(b.Hf,n,{position:i,source:h.d0,placement:"preview_grid"}))},X={heading:(0,d.__)("Presto, here are 3 versions","wp-module-onboarding"),subheading:(0,d.__)("We've created 3 unique website designs for you to start with, preview click around or start over.","wp-module-onboarding"),favouriteNote:(0,d.__)("Favorite a generated version to find and use again in the future.","wp-module-onboarding"),generating:(0,d.__)("Generating Site","wp-module-onboarding"),regenerating:(0,d.__)("Regenerating Site","wp-module-onboarding")};return(0,a.createElement)(w.UX,{render:!1},(0,a.createElement)(w.tR,null,(0,a.createElement)(p.A,{className:"nfd-onboarding-step--site-gen__preview"},(0,a.createElement)("div",{className:"nfd-onboarding-step--site-gen__preview__container"},!C&&(0,a.createElement)(v.A,{type:"fade-in"},(0,a.createElement)("div",{className:"nfd-onboarding-step--site-gen__preview__container__heading"},(0,a.createElement)("p",{className:"nfd-onboarding-step--site-gen__preview__container__heading__text"},X.heading)),(0,a.createElement)("div",{className:"nfd-onboarding-step--site-gen__preview__container__sub-heading"},(0,a.createElement)("p",{className:"nfd-onboarding-step--site-gen__preview__container__sub-heading__text"},X.subheading)))),(0,a.createElement)("div",{className:"nfd-onboarding-step--site-gen__preview__options"},e&&N&&!C?Object.keys(e).map(((t,r)=>{const i=e[t],s=(0,o.cloneDeep)(N[0]);s.settings.color.palette=i.color.palette;const d=i.styles?.blocks[0]?.["core/body"]?.typography?.fontFamily,l=i.styles?.blocks[0]?.["core/heading"]?.typography?.fontFamily;s.styles.typography&&d&&(s.styles.typography.fontFamily=d),s.styles.blocks["core/heading"].typography&&l&&(s.styles.blocks["core/heading"].typography.fontFamily=l);let g="";return["header","content","footer"].forEach((e=>{e in i&&(g+=i[e])})),(0,a.createElement)(m.GZ,{key:r,blockGrammar:g,previewSettings:s,slug:t,position:r+1,title:i.title,isFavorite:i.isFavorite,palette:i.color,styling:"custom",overlay:!0,tabIndex:"0",role:"button",handleFavorite:q,handleRegenerate:U,handlePreview:j,isRegenerating:n})})):(0,a.createElement)(_,{count:3,isRegenerating:!1}),n&&(0,a.createElement)(_,{count:1,isRegenerating:!0})),(0,a.createElement)("div",{className:"nfd-onboarding-step--site-gen__preview__note"},(0,a.createElement)(u,null),(0,a.createElement)("span",null,X.favouriteNote)))))}}}]); \ No newline at end of file +"use strict";(globalThis.webpackChunknewfold_Onboarding=globalThis.webpackChunknewfold_Onboarding||[]).push([[619],{619:(e,t,n)=>{n.r(t),n.d(t,{default:()=>E});var a=n(1609),r=n(8468),i=n(7143),s=n(148),o=n(6087),d=n(7723);var l=n(7708),g=n(7517),c=n(1056),p=n(3988),m=n(7044);const u=()=>(0,a.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"30",height:"24",viewBox:"-5 -2 36 24",fill:"none",className:"heart"},(0,a.createElement)("g",{id:"State=Active"},(0,a.createElement)("path",{id:"Vector",d:"M10 19.1585L8.975 18.2335C7.20833 16.6168 5.75 15.221 4.6 14.046C3.45 12.871 2.53333 11.821 1.85 10.896C1.16667 9.971 0.6875 9.1335 0.4125 8.3835C0.1375 7.6335 0 6.87516 0 6.1085C0 4.6085 0.504167 3.35433 1.5125 2.346C2.52083 1.33766 3.76667 0.833496 5.25 0.833496C6.2 0.833496 7.07917 1.0585 7.8875 1.5085C8.69583 1.9585 9.4 2.6085 10 3.4585C10.7 2.5585 11.4417 1.896 12.225 1.471C13.0083 1.046 13.85 0.833496 14.75 0.833496C16.2333 0.833496 17.4792 1.33766 18.4875 2.346C19.4958 3.35433 20 4.6085 20 6.1085C20 6.87516 19.8625 7.6335 19.5875 8.3835C19.3125 9.1335 18.8333 9.971 18.15 10.896C17.4667 11.821 16.55 12.871 15.4 14.046C14.25 15.221 12.7917 16.6168 11.025 18.2335L10 19.1585Z",fill:"#EF4A71"}))),_=function({count:e=1,isRegenerating:t}){const n=[];for(let r=0;r{const[e,t]=(0,r.useState)(!1),[n,E]=(0,r.useState)(!1),[C,S]=(0,r.useState)(!1),[N,k]=(0,r.useState)(!1),F=(0,s.Zp)(),D=(0,r.useRef)(),{currentData:G,nextStep:x,siteGenErrorStatus:I,themeStatus:R}=(0,i.useSelect)((e=>({currentData:e(f.M).getCurrentOnboardingData(),nextStep:e(f.M).getNextStep(),siteGenErrorStatus:e(f.M).getSiteGenErrorStatus(),themeStatus:e(f.M).getThemeStatus()}))),{setIsHeaderEnabled:A,setSidebarActiveView:O,setHeaderActiveView:M,setDrawerActiveView:H,setCurrentOnboardingData:T,updateInitialize:V,setHideFooterNav:B,updateSiteGenErrorStatus:Z,setIsHeaderNavigationEnabled:z}=(0,i.useDispatch)(f.M);(0,r.useEffect)((()=>{A(!0),B(!0),O(!1),M(y.Ix),H(!1),V(!0),z(!1)}),[]),(0,r.useEffect)((()=>{!0===D.current&&!1===I&&(L(),W(),z(!1)),D.current=I}),[I]);const L=async()=>{if(S(!0),!(0,o.isEmpty)(G.sitegen.homepages.data))return t(G.sitegen.homepages.data),S(!1),void P();if(""===G.sitegen.siteDetails?.prompt)return void S(!1);const e=await(0,l.c7)(G.sitegen.siteDetails.prompt);if(e.error)return S(!1),void Z(!0);G.sitegen.homepages.data=e.body,t(e.body),T(G),S(!1),P()},P=()=>{window.nfdOnboarding.siteGenTimerInterval&&(clearInterval(window.nfdOnboarding.siteGenTimerInterval),(0,c.v)(new c.iC(b.uv,window.nfdOnboarding.siteGenTime,{source:h.d0})))},W=async()=>{const e=await(0,g.w6)();e.error?S(!1):k(e.body)};(0,r.useEffect)((()=>{y.Er===R&&(L(),W())}),[R]);const j=(t,n)=>{if(!(t in e))return!1;G.sitegen.homepages.active=e[t],G.sitegen.skipCache=!1,T(G),(0,c.v)(new c.iC(b.Wi,t,{position:n,source:h.d0})),F(x.path)},q=(n,a)=>{if(!(n in e))return;const r=!e[n].isFavorite;e[n].isFavorite=r,G.sitegen.homepages.data=e,t(e),T(G),(0,c.v)(new c.iC(b.Nz,n,{favorite:r,placement:"preview_grid",position:a,source:h.d0}))},U=async(n,a,r,i)=>{if(document.getElementsByClassName("nfd-onboarding-step--site-gen__preview__note")&&document.getElementsByClassName("nfd-onboarding-step--site-gen__preview__note")[0].scrollIntoView({behavior:"smooth",block:"end"}),E(!0),!(n in e))return void E(!1);if(""===G.sitegen.siteDetails?.prompt)return void E(!1);const s=await(0,l.HA)(G.sitegen.siteDetails.prompt,n,a,r);if(s.error)return void E(!1);const o=s.body;e[o.slug]=o,G.sitegen.homepages.data=e,t(e),T(G),E(!1),(0,c.v)(new c.iC(b.Hf,n,{position:i,source:h.d0,placement:"preview_grid"}))},X={heading:(0,d.__)("Presto, here are 3 versions","wp-module-onboarding"),subheading:(0,d.__)("We've created 3 unique website designs for you to start with, preview click around or start over.","wp-module-onboarding"),favouriteNote:(0,d.__)("Favorite a generated version to find and use again in the future.","wp-module-onboarding"),generating:(0,d.__)("Generating Site","wp-module-onboarding"),regenerating:(0,d.__)("Regenerating Site","wp-module-onboarding")};return(0,a.createElement)(w.UX,{render:!1},(0,a.createElement)(w.tR,null,(0,a.createElement)(p.A,{className:"nfd-onboarding-step--site-gen__preview"},(0,a.createElement)("div",{className:"nfd-onboarding-step--site-gen__preview__container"},!C&&(0,a.createElement)(v.A,{type:"fade-in"},(0,a.createElement)("div",{className:"nfd-onboarding-step--site-gen__preview__container__heading"},(0,a.createElement)("p",{className:"nfd-onboarding-step--site-gen__preview__container__heading__text"},X.heading)),(0,a.createElement)("div",{className:"nfd-onboarding-step--site-gen__preview__container__sub-heading"},(0,a.createElement)("p",{className:"nfd-onboarding-step--site-gen__preview__container__sub-heading__text"},X.subheading)))),(0,a.createElement)("div",{className:"nfd-onboarding-step--site-gen__preview__options"},e&&N&&!C?Object.keys(e).map(((t,r)=>{const i=e[t],s=(0,o.cloneDeep)(N[0]);s.settings.color.palette=i.color.palette;const d=i.styles?.blocks[0]?.["core/body"]?.typography?.fontFamily,l=i.styles?.blocks[0]?.["core/heading"]?.typography?.fontFamily;s.styles.typography&&d&&(s.styles.typography.fontFamily=d),s.styles.blocks["core/heading"].typography&&l&&(s.styles.blocks["core/heading"].typography.fontFamily=l);let g="";return["header","content","footer"].forEach((e=>{e in i&&(g+=i[e])})),(0,a.createElement)(m.GZ,{key:r,blockGrammar:g,previewSettings:s,slug:t,position:r+1,title:i.title,isFavorite:i.isFavorite,palette:i.color,styling:"custom",overlay:!0,tabIndex:"0",role:"button",handleFavorite:q,handleRegenerate:U,handlePreview:j,isRegenerating:n})})):(0,a.createElement)(_,{count:3,isRegenerating:!1}),n&&(0,a.createElement)(_,{count:1,isRegenerating:!0})),(0,a.createElement)("div",{className:"nfd-onboarding-step--site-gen__preview__note"},(0,a.createElement)(u,null),(0,a.createElement)("span",null,X.favouriteNote)))))}}}]); \ No newline at end of file