diff --git a/src/app/pages/pagesAndPosts/ProductsPages.js b/src/app/pages/pagesAndPosts/ProductsPages.js index f9d4f04f6..6bcf6614f 100644 --- a/src/app/pages/pagesAndPosts/ProductsPages.js +++ b/src/app/pages/pagesAndPosts/ProductsPages.js @@ -3,7 +3,7 @@ import { Button, Card, Title } from '@newfold/ui-component-library'; const ProductsPages = () => { return ( { return ( { return ( { return ( { cy.get( '.wppbh-app-pagesAndPosts-page' ) - .contains( __( 'Pages & Posts', 'wp-plugin-bluehost' ) ) + .contains( 'Pages & Posts' ) .scrollIntoView() .should( 'be.visible' ); } ); it( 'site pages Exists', () => { - cy.findByText( __( 'Site Pages', 'wp-plugin-bluehost' ) ).should( - 'exist' - ); - cy.get( 'Card a[href="edit.php?post_type=page"]' ).click(); + 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' ); - // Click on "Add New" button and verify action - cy.get( - '.sitePages a[href="post-new.php?post_type=page"] Button' - ).click(); + 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' ); } ); it( 'Blog posts Exists', () => { - cy.findByText( __( 'Blog Posts', 'wp-plugin-bluehost' ) ).should( - 'exist' - ); - cy.get( 'Card a[href="edit.php"]' ).click(); + 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' ); - // Click on "Add New" button and verify action - cy.get( 'Card a[href="post-new.php"] Button' ).click(); + cy.get( '.wppbh-app-blog-posts' ) + .get( 'a[href="post-new.php"] Button' ) + .click(); cy.url().should( 'include', 'post-new.php' ); + cy.go( 'back' ); } ); it( 'Bookings & Appointments Exists', () => { @@ -53,49 +59,59 @@ describe( 'Pages & Posts', function () { NewfoldRuntime.isYithBookingActive && NewfoldRuntime.isWoocommerceActive ) { - cy.findByText( - __( 'Bookings & Appointments', 'wp-plugin-bluehost' ) - ).should( 'exist' ); - cy.get( - 'Card a[href="edit.php?post_type=yith_booking&yith-plugin-fw-panel-skip-redirect=1"]' - ).click(); + 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"]' + ) + .first() + .click(); cy.url().should( 'include', 'edit.php?post_type=yith_booking&yith-plugin-fw-panel-skip-redirect=1' ); + cy.go( 'back' ); - // Click on "Add New" button and verify action - cy.get( - 'Card a[href="edit.php?post_type=yith_booking&yith-plugin-fw-panel-skip-redirect=1"] Button' - ).click(); + cy.get( '.wppbh-app-bookings' ) + .find( + 'a[href="edit.php?post_type=yith_booking&yith-plugin-fw-panel-skip-redirect=1"] Button' + ) + .last() + .click(); cy.url().should( 'include', 'edit.php?post_type=yith_booking&yith-plugin-fw-panel-skip-redirect=1' ); + cy.go( 'back' ); } else { - cy.findByText( - __( 'Bookings & Appointments', 'wp-plugin-bluehost' ) - ).should( 'not.exist' ); + cy.get( '.wppbh-app-bookings' ) + .findByText( 'Bookings & Appointments' ) + .should( 'not.exist' ); } } ); it( 'Products Exists', () => { if ( NewfoldRuntime.isWoocommerceActive ) { - cy.findByText( __( 'Products', 'wp-plugin-bluehost' ) ).should( - 'exist' - ); - cy.get( 'Card a[href="edit.php?post_type=product"]' ).click(); + 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' ); - // Click on "Add New" button and verify action - cy.get( - 'Card a[href="post-new.php?post_type=product"] Button' - ).click(); + 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' ); } else { - cy.findByText( __( 'Products', 'wp-plugin-bluehost' ) ).should( - 'not.exist' - ); + cy.get( '.wppbh-app-products' ) + .findByText( 'Products' ) + .should( 'not.exist' ); } } ); } );