Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

feature / bookings ctb added in pages and posts #1183

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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added assets/images/ecomm-addon-ctb-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
44 changes: 44 additions & 0 deletions src/app/pages/pages-and-posts/ecommAddonCTB.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import { Button, Card, Title } from '@newfold/ui-component-library';
import ecommAddonIconUrl from 'Assets/images/ecomm-addon-ctb-icon.png';

const EcommAddonCTB = () => {
const EcommAddonCtbIcon = () => (
<img
src={ ecommAddonIconUrl }
width="44px"
height="48px"
alt={ __( 'eCommerce bundle upgrade icon', 'wp-plugin-bluehost' ) }
/>
);

return (
<Card
className="wppbh-app-transform nfd-border-0 nfd-border-t md:nfd-border-t-0 nfd-shadow-none hover:nfd-bg-[#F2F9FE]"
style={ {
borderRadius: 0,
} }
>
<Card.Content>
<EcommAddonCtbIcon />
<Title size="4" className="nfd-leading-normal nfd-my-4">
{ __( 'Transform your store!', 'wp-plugin-bluehost' ) }
</Title>
<p>
{ __(
'Our eCommerce bundle includes a comprehensive suite of advanced tools designed to boost the performance of your WooCommerce store.',
'wp-plugin-bluehost'
) }
</p>
</Card.Content>
<div className="nfd-flex nfd-justify-end nfd-gap-6 nfd-items-center">
<a href="admin.php?page=bluehost#/marketplace/product/6049dddb-1303-4c41-b3c0-242881697860">
<Button variant="secondary">
{ __( 'Learn More', 'wp-plugin-bluehost' ) }
</Button>
</a>
</div>
</Card>
);
};

export default EcommAddonCTB;
11 changes: 7 additions & 4 deletions src/app/pages/pages-and-posts/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import BlogPosts from './blogPosts';
import BookingAndAppointments from './bookingAndAppointments';
import ProductsPages from './ProductsPages';
import AppStore from '../../data/store';
import EcommAddonCTB from './ecommAddonCTB';

const PagesAndPosts = () => {
const { store } = useContext( AppStore );
Expand Down Expand Up @@ -77,10 +78,12 @@ const PagesAndPosts = () => {
{ window.NewfoldRuntime.isWoocommerceActive && (
<ProductsPages />
) }
{ window.NewfoldRuntime.isYithBookingActive &&
window.NewfoldRuntime.isWoocommerceActive && (
<BookingAndAppointments />
) }
{ window.NewfoldRuntime.capabilities.hasYithExtended &&
window.NewfoldRuntime.isWoocommerceActive ? (
<BookingAndAppointments />
) : (
<EcommAddonCTB />
) }
</div>
</Container>
</Page>
Expand Down
143 changes: 78 additions & 65 deletions tests/cypress/integration/pages-and-posts.cy.js
Original file line number Diff line number Diff line change
@@ -1,68 +1,68 @@
describe( 'Pages & Posts', function () {
describe('Pages & Posts', function () {
let NewfoldRuntime;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Please update the tests in this file to reflect the story requirements accurately.
  • Please revert the spaces of the lint.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed


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.capabilities.hasYithExtended &&
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"]'
)
Expand All @@ -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'
)
Expand All @@ -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');
}
} );
} );
});
});
Loading