From b026e5d3aefb033ccb799173508907ded2be9d25 Mon Sep 17 00:00:00 2001 From: wpalani Date: Wed, 24 Jul 2024 15:02:28 -0700 Subject: [PATCH] Fix conflict --- .wp-env.json | 2 +- assets/svg/transformStore.svg | 9 ++ .../pages/pages-and-posts/TransformStore.js | 35 +++++ src/app/pages/pages-and-posts/index.js | 9 +- .../cypress/integration/pages-and-posts.cy.js | 141 ++++++++++-------- 5 files changed, 128 insertions(+), 68 deletions(-) create mode 100644 assets/svg/transformStore.svg create mode 100644 src/app/pages/pages-and-posts/TransformStore.js diff --git a/.wp-env.json b/.wp-env.json index ec625b24d..5a4b2ab44 100644 --- a/.wp-env.json +++ b/.wp-env.json @@ -1,5 +1,5 @@ { - "core": "WordPress/WordPress#tags/6.6.1", + "core": "WordPress/WordPress#tags/6.6", "config": { "WP_DEBUG": true, "WP_DEBUG_LOG": true, diff --git a/assets/svg/transformStore.svg b/assets/svg/transformStore.svg new file mode 100644 index 000000000..862a93f7b --- /dev/null +++ b/assets/svg/transformStore.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/src/app/pages/pages-and-posts/TransformStore.js b/src/app/pages/pages-and-posts/TransformStore.js new file mode 100644 index 000000000..cb0a92264 --- /dev/null +++ b/src/app/pages/pages-and-posts/TransformStore.js @@ -0,0 +1,35 @@ +import { Button, Card, Title } from '@newfold/ui-component-library'; +import { ReactComponent as TransformLogo } from '../../../../assets/svg/transformStore.svg'; + +const TransformStore = () => { + return ( + + + + + { __( 'Transform your store!', 'wp-plugin-bluehost' ) } + +

+ { __( + 'Our eCommerce bundle includes a comprehensive suite of advanced tools designed to boost the performance of your WooCommerce store.', + 'wp-plugin-bluehost' + ) } +

+
+
+ + + +
+
+ ); +}; + +export default TransformStore; diff --git a/src/app/pages/pages-and-posts/index.js b/src/app/pages/pages-and-posts/index.js index ea359e715..bf31cf92b 100644 --- a/src/app/pages/pages-and-posts/index.js +++ b/src/app/pages/pages-and-posts/index.js @@ -6,6 +6,7 @@ import BlogPosts from './blogPosts'; import BookingAndAppointments from './bookingAndAppointments'; import ProductsPages from './ProductsPages'; import AppStore from '../../data/store'; +import TransformStore from './TransformStore'; const PagesAndPosts = () => { const { store } = useContext( AppStore ); @@ -78,9 +79,11 @@ const PagesAndPosts = () => { ) } { window.NewfoldRuntime.isYithBookingActive && - window.NewfoldRuntime.isWoocommerceActive && ( - - ) } + window.NewfoldRuntime.isWoocommerceActive ? ( + + ) : ( + + ) } diff --git a/tests/cypress/integration/pages-and-posts.cy.js b/tests/cypress/integration/pages-and-posts.cy.js index fe5dd6e05..8230d9fac 100644 --- a/tests/cypress/integration/pages-and-posts.cy.js +++ b/tests/cypress/integration/pages-and-posts.cy.js @@ -1,68 +1,68 @@ -describe( 'Pages & Posts', function () { +describe('Pages & Posts', function () { let NewfoldRuntime; - before( () => { + before(() => { cy.visit( '/wp-admin/admin.php?page=' + - Cypress.env( 'pluginId' ) + - '#/pages-and-posts' + Cypress.env('pluginId') + + '#/pages-and-posts' ); cy.window() - .its( 'NewfoldRuntime' ) - .then( ( data ) => { + .its('NewfoldRuntime') + .then((data) => { NewfoldRuntime = data; - } ); + }); cy.injectAxe(); - } ); + }); - it( 'Pages & Posts Exists', () => { - cy.get( '.wppbh-app-pagesAndPosts-page' ) - .contains( 'Pages & Posts' ) + it('Pages & Posts Exists', () => { + cy.get('.wppbh-app-pagesAndPosts-page') + .contains('Pages & Posts') .scrollIntoView() - .should( 'be.visible' ); - } ); + .should('be.visible'); + }); - it( 'site pages Exists', () => { - cy.get( '.wppbh-app-site-page' ) - .findByText( 'Site Pages' ) - .should( 'exist' ); - cy.get( '.wppbh-app-site-page' ) - .find( 'a[href="edit.php?post_type=page"]' ) + it('site pages Exists', () => { + cy.get('.wppbh-app-site-page') + .findByText('Site Pages') + .should('exist'); + cy.get('.wppbh-app-site-page') + .find('a[href="edit.php?post_type=page"]') .click(); - cy.url().should( 'include', 'edit.php?post_type=page' ); - cy.go( 'back' ); + cy.url().should('include', 'edit.php?post_type=page'); + cy.go('back'); - cy.get( '.wppbh-app-site-page' ) - .find( 'a[href="post-new.php?post_type=page"] Button' ) + cy.get('.wppbh-app-site-page') + .find('a[href="post-new.php?post_type=page"] Button') .click(); - cy.url().should( 'include', 'post-new.php?post_type=page' ); - cy.go( 'back' ); - } ); + cy.url().should('include', 'post-new.php?post_type=page'); + cy.go('back'); + }); - it( 'Blog posts Exists', () => { - cy.get( '.wppbh-app-blog-posts' ) - .findByText( 'Blog Posts' ) - .should( 'exist' ); - cy.get( '.wppbh-app-blog-posts' ).find( 'a[href="edit.php"]' ).click(); - cy.url().should( 'include', 'edit.php' ); - cy.go( 'back' ); + it('Blog posts Exists', () => { + cy.get('.wppbh-app-blog-posts') + .findByText('Blog Posts') + .should('exist'); + cy.get('.wppbh-app-blog-posts').find('a[href="edit.php"]').click(); + cy.url().should('include', 'edit.php'); + cy.go('back'); - cy.get( '.wppbh-app-blog-posts' ) - .get( 'a[href="post-new.php"] Button' ) + cy.get('.wppbh-app-blog-posts') + .get('a[href="post-new.php"] Button') .click(); - cy.url().should( 'include', 'post-new.php' ); - cy.go( 'back' ); - } ); + cy.url().should('include', 'post-new.php'); + cy.go('back'); + }); - it( 'Bookings & Appointments Exists', () => { + it('Bookings & Appointments Exists', () => { if ( NewfoldRuntime.isYithBookingActive && NewfoldRuntime.isWoocommerceActive ) { - cy.get( '.wppbh-app-bookings' ) - .findByText( 'Bookings & Appointments' ) - .should( 'exist' ); - cy.get( '.wppbh-app-bookings' ) + cy.get('.wppbh-app-bookings') + .findByText('Bookings & Appointments') + .should('exist'); + cy.get('.wppbh-app-bookings') .find( 'a[href="edit.php?post_type=yith_booking&yith-plugin-fw-panel-skip-redirect=1"]' ) @@ -72,9 +72,9 @@ describe( 'Pages & Posts', function () { 'include', 'edit.php?post_type=yith_booking&yith-plugin-fw-panel-skip-redirect=1' ); - cy.go( 'back' ); + cy.go('back'); - cy.get( '.wppbh-app-bookings' ) + cy.get('.wppbh-app-bookings') .find( 'a[href="edit.php?post_type=yith_booking&yith-plugin-fw-panel-skip-redirect=1"] Button' ) @@ -84,30 +84,43 @@ describe( 'Pages & Posts', function () { 'include', 'edit.php?post_type=yith_booking&yith-plugin-fw-panel-skip-redirect=1' ); - cy.go( 'back' ); + cy.go('back'); } else { - cy.findByText( 'Bookings & Appointments' ).should( 'not.exist' ); + cy.get('.wppbh-app-transform') + .findByText('Transform your store!') + .should('exist'); + cy.get('.wppbh-app-transform') + .find( + 'a[href="admin.php?page=bluehost#/marketplace/product/6049dddb-1303-4c41-b3c0-242881697860"]' + ) + .first() + .click(); + cy.url().should( + 'include', + 'admin.php?page=bluehost#/marketplace/product/6049dddb-1303-4c41-b3c0-242881697860' + ); + cy.go('back'); } - } ); + }); - it( 'Products Exists', () => { - if ( NewfoldRuntime.isWoocommerceActive ) { - cy.get( '.wppbh-app-products' ) - .findByText( 'Products' ) - .should( 'exist' ); - cy.get( '.wppbh-app-products' ) - .find( 'a[href="edit.php?post_type=product"]' ) + it('Products Exists', () => { + if (NewfoldRuntime.isWoocommerceActive) { + cy.get('.wppbh-app-products') + .findByText('Products') + .should('exist'); + cy.get('.wppbh-app-products') + .find('a[href="edit.php?post_type=product"]') .click(); - cy.url().should( 'include', 'edit.php?post_type=product' ); - cy.go( 'back' ); + cy.url().should('include', 'edit.php?post_type=product'); + cy.go('back'); - cy.get( '.wppbh-app-products' ) - .find( 'a[href="post-new.php?post_type=product"] Button' ) + cy.get('.wppbh-app-products') + .find('a[href="post-new.php?post_type=product"] Button') .click(); - cy.url().should( 'include', 'post-new.php?post_type=product' ); - cy.go( 'back' ); + cy.url().should('include', 'post-new.php?post_type=product'); + cy.go('back'); } else { - cy.findByText( 'Products' ).should( 'not.exist' ); + cy.findByText('Products').should('not.exist'); } - } ); -} ); + }); +});