diff --git a/cypress.config.js b/cypress.config.js index 810a1df..225c8bb 100644 --- a/cypress.config.js +++ b/cypress.config.js @@ -78,10 +78,7 @@ module.exports = defineConfig({ ], supportFile: 'tests/cypress/support/index.js', testIsolation: false, - excludeSpecPattern: [ - 'vendor/newfold-labs/wp-module-coming-soon/tests/cypress/integration/', // until ecommerce module is added use the local coming soon test instead - 'vendor/newfold-labs/wp-module-marketplace/tests/cypress/integration/', // until ui is updated use local marketplace tests instead - ], + excludeSpecPattern: [], }, retries: 1, experimentalMemoryManagement: true, diff --git a/tests/cypress/integration/coming-soon.cy.js b/tests/cypress/integration/coming-soon.cy.js deleted file mode 100644 index 0eaf7f2..0000000 --- a/tests/cypress/integration/coming-soon.cy.js +++ /dev/null @@ -1,117 +0,0 @@ -// - -describe('Coming Soon', function () { - - before(() => { - cy.visit('/wp-admin/admin.php?page=mojo#/settings'); - }); - - it('Coming Soon Toggle Works', () => { - - cy.get('.coming-soon-toggle input[type="checkbox"]').uncheck(); - cy.get('.coming-soon-toggle input[type="checkbox"]').check(); - cy.wait(100); - cy - .get('.edit-site-notices .components-snackbar__content') - .contains('div', 'Coming soon activated') - .should('be.visible'); - - cy - .get('.coming-soon-protip .accordion-summary') - .contains('p', 'Pro Tip') - .should('be.visible'); - cy.get('.coming-soon-protip').should('not.have.attr', 'open'); - cy.get('.coming-soon-protip summary').click(); - cy.wait(100); - cy.get('.coming-soon-protip').should('have.attr', 'open'); - }); - - it('Has Coming Soon Section on Home', () => { - cy.visit('/wp-admin/admin.php?page=mojo#/home'); - cy - .get('.wppm-section-coming-soon') - .scrollIntoView() - .contains('h3', 'Coming Soon') - .should('be.visible'); - - }); - - it('Has Coming Soon in Admin Toolbar', () => { - cy.reload(); - cy - .get('#wp-toolbar #wp-admin-bar-mojo-coming_soon') - .contains('div', 'Coming Soon Active') - .should('be.visible'); - }); - - it('Home Coming Soon Section Launches', () => { - cy.get('.wppm-section-coming-soon button.is-primary').click(); - cy.wait(500); - cy - .get('#wp-toolbar #wp-admin-bar-mojo-coming_soon') - .contains('div', 'Coming Soon Active') - .should('not.be.visible'); - - cy - .get('.wppm-section-coming-soon') - .scrollIntoView() - .contains('h3', 'Site Launched') - .should('be.visible'); - - cy.get('.wppm-section-coming-soon button.is-secondary').click(); - - - cy - .get('.wppm-section-coming-soon') - .scrollIntoView() - .contains('h3', 'Coming Soon') - .should('be.visible'); - }); - - it('Displays admin coming soon notice', () => { - cy.visit('/wp-admin/index.php'); - cy - .get('.notice-warning') - .contains('p', 'coming') - .should('be.visible'); - }); - - it('Displays Coming Soon on Frontend', () => { - cy.logout(); - cy.visit('/'); - cy - .get('body') - .contains('h1', 'Coming') - .should('be.visible'); - }); - - it('Launching launches site', () => { - cy.login(Cypress.env('wpUsername'), Cypress.env('wpPassword')); - cy.visit('/wp-admin/admin.php?page=mojo#/settings'); - cy.get('.coming-soon-toggle input[type="checkbox"]').should('be.checked'); - - cy.visit('/wp-admin/admin.php?page=mojo#/home'); - cy - .get('.wppm-section-coming-soon') - .scrollIntoView() - .contains('h3', 'Coming Soon') - .should('be.visible'); - - cy.get('.wppm-section-coming-soon button.is-primary').click(); - cy.get('.wppm-section-coming-soon button.is-link').click(); //dismiss - - cy - .get('.wppm-section-coming-soon') - .should('not.exist'); - - cy.logout(); - cy.visit('/'); - cy - .get('body') - .contains('h1', 'Coming soon') - .should('not.exist'); - - cy.login(Cypress.env('wpUsername'), Cypress.env('wpPassword')); - cy.visit('/wp-admin/admin.php?page=mojo#/settings'); - }) -}); diff --git a/tests/cypress/integration/marketplace.cy.js b/tests/cypress/integration/marketplace.cy.js deleted file mode 100644 index 2b61fbb..0000000 --- a/tests/cypress/integration/marketplace.cy.js +++ /dev/null @@ -1,138 +0,0 @@ -// - -describe('Marketplace Page', function () { - - before(() => { - cy.intercept({ - method: 'GET', - url: /newfold-marketplace(\/|%2F)v1(\/|%2F)marketplace/ - }, { - fixture: 'products' - }).as('products'); - cy.visit('/wp-admin/admin.php?page=mojo#/marketplace'); - cy.wait('@products') - }); - - it('Exists', () => { - cy.contains('button', 'Featured'); - }); - - it('Is Accessible', () => { - cy.injectAxe(); - cy.wait(1000); - cy.a11y('.wppm-app-body'); - }); - - it('Product grid has 2 items', () => { - cy.get('.marketplace-item').should('have.length', 2); - }); - - it('First product card renders correctly', () => { - cy.get('#marketplace-item-a1ff70f1-9670-4e25-a0e1-a068d3e43a45').as('card'); - - cy.get('@card') - .findByRole('link', {name: 'Learn More'}) - .scrollIntoView() - .should('be.visible') - .should('have.attr', 'href') - .and('include', 'https://yoast.com/wordpress/plugins/seo/'); - - cy.get('@card').first().within(() => { - cy.get('.components-card__header') - .contains('Yoast Premium') - .should('be.visible'); - cy.get('.components-card__media').should('be.visible'); - cy.get('.components-card__header .price') - .contains('$99.00') - .should('be.visible'); - }); - }); - - it('Second product card render correctly', () => { - cy.get('#marketplace-item-2a1dadb5-f58d-4ae4-a26b-27efb09136eb').as('card'); - - cy.get('@card') - .findByRole('link', {name: 'Buy Now'}) - .scrollIntoView() - .should('be.visible') - .should('have.attr', 'href') - .and('include', 'https://www.mojomarketplace.com/cart?item_id=5377b431-d8a8-431b-a711-50c10a141528'); - - cy.get('@card').first().within(() => { - cy.get('.components-card__header') - .contains('Highend') - .should('be.visible'); - cy.get('.components-card__media').should('be.visible'); - cy.get('.components-card__header .price') - .contains('$59.00') - .should('be.visible'); - }); - }); - - it('CTA links have target=_blank', () => { - cy.get('#marketplace-item-a1ff70f1-9670-4e25-a0e1-a068d3e43a45').as('card'); - - cy.get('@card') - .findByRole('link', {name: 'Learn More'}) - .scrollIntoView() - .should('have.attr', 'target') - .and('include', '_blank'); - }); - - it('Category Tab Filters properly', () => { - - cy.get('.newfold-marketplace-tab-services').click(); - cy.get('.marketplace-item').should('have.length', 10); - cy.get('#marketplace-item-521e79e6-cc93-46eb-842b-472da626e683 h2') - .scrollIntoView() - .should('be.visible') - .should('have.text', 'WP Live'); - - cy.get('.newfold-marketplace-tab-seo').click(); - cy.get('.marketplace-item').should('have.length', 5); - cy.get('#marketplace-item-a1ff70f1-9670-4e25-a0e1-a068d3e43a45 h2') - .scrollIntoView() - .should('be.visible') - .should('have.text', 'Yoast Premium'); - }); - - it('Category tabs update path', () => { - cy.get('.newfold-marketplace-tab-services').click(); - cy.location().should((loc) => { - expect(loc.hash).to.eq('#/marketplace/services') - }); - }); - - it.skip('Load more button loads more products', () => { - - cy.get('.newfold-marketplace-tab-services').click(); - cy.wait(300); - - cy.get('.marketplace-item').should('have.length', 12); - cy.contains('button', 'Load More'); - cy.get('.marketplace-list button') - .scrollIntoView() - .click(); - cy.wait(300); - - cy.get('.marketplace-item').should('have.length', 23); - }); - - // CTB Not supported yet - it.skip('Product CTB cards render correctly', () => { - cy.get('.marketplace-item-ec14a614-8672-4094-8310-cb0b1eb0f176').as('card'); - - cy.get('@card') - .findByRole('button', {name: 'Buy Now'}) - .scrollIntoView() - .should('be.visible') - .should('have.attr', 'data-action') - .and('include', 'load-nfd-ctb'); - - cy.get('@card').first().within(() => { - cy.get('.components-card__header').should('be.visible'); - cy.get('.components-card__media').should('be.visible'); - }); - }); - -}); diff --git a/tests/cypress/integration/performance.cy.js b/tests/cypress/integration/performance.cy.js deleted file mode 100644 index 5272f2b..0000000 --- a/tests/cypress/integration/performance.cy.js +++ /dev/null @@ -1,81 +0,0 @@ -// - -describe('Performance Page', function () { - - before(() => { - cy.visit('/wp-admin/admin.php?page=mojo#/performance'); - }); - - it('Is Accessible', () => { - cy.injectAxe(); - cy.wait(500); - cy.a11y('.wppm-app-body'); - }); - - it('Has Cache Settings', () => { - cy - .get('.card-cache-settings') - .scrollIntoView() - .should('be.visible'); - }); - - it('Has Clear Cache Settings', () => { - cy - .get('.card-clear-cache') - .scrollIntoView() - .should('be.visible'); - }); - - it('Clear Cache Disabled when Cache is Disabled', () => { - - cy - .get('.input-cache-settings input[type="radio"]') - .first().check(); - - cy.wait(500); - - cy - .get('.card-clear-cache') - .scrollIntoView() - .should('have.class', 'disabled'); - - cy.get('.input-cache-settings input[type="radio"]').check('1'); - - cy - .get('.card-clear-cache') - .scrollIntoView() - .should('not.have.class', 'disabled'); - - cy - .get('.edit-site-notices .components-snackbar__content') - .contains('div', 'Cache') - .should('be.visible'); - }); - - it('Settings Callout Navigates to Settings Page', () => { - cy.hash().should('eq', '#/performance'); - cy.get('a.callout-link-settings').click(); - cy.wait(500); - cy.hash().should('eq', '#/settings'); - cy.get('a.callout-link-performance').click(); - cy.wait(500); - cy.hash().should('eq', '#/performance'); - cy - .get('.card-cache-settings') - .should('be.visible'); - }); - - // can't test clear cache without endurance page cache being installed - // how to do in cypress env? - // it('Clear Cache Button Functions', () => { - // cy - // .get('.card-clear-cache button') - // .click(); - - // cy - // .get('.edit-site-notices .components-snackbar__content') - // .contains('div', 'Cache cleared') - // .should('be.visible'); - // }); - -}); diff --git a/tests/cypress/integration/premium-plugins-tab.cy.js b/tests/cypress/integration/premium-plugins-tab.cy.js deleted file mode 100644 index 6a1fab8..0000000 --- a/tests/cypress/integration/premium-plugins-tab.cy.js +++ /dev/null @@ -1,76 +0,0 @@ -// - -describe('Plugins Premium Tab', () => { - - before(() => { - cy.intercept({ - method: 'GET', - url: /newfold-marketplace(\/|%2F)v1(\/|%2F)marketplace/ - }, { - fixture: 'products', - delay: 1000 - }).as('products'); - cy.visit('/wp-admin/plugin-install.php?tab=premium-marketplace'); - cy.wait('@products'); - }); - - it('Premium tab exist', () => { - cy.get('.wrap') - .find('.nfd-premium-plugins-marketplace') - .contains('Unlock the full potential of your WordPress website with premium plugins') - .should('be.visible'); - }); - - it('Is Accessible', () => { - cy.injectAxe(); - cy.wait(1000); - cy.a11y('.nfd-premium-plugins-marketplace'); - }); - - it('Should have products', () => { - cy.get('#the-list') - .children('.plugin-card') - .should('be.visible') - }); - - it('Product should display thumbnail', () => { - cy.get('.plugin-card:first-of-type') - .find('.nfd-plugin-card-thumbnail img') - .scrollIntoView() - .should('be.visible') - .should('have.attr', 'src') - }) - - it('Product should have a name', () => { - cy.get('.plugin-card:first-of-type') - .find('.nfd-plugin-card-title h3') - .invoke('text') - .should('not.be.empty') - }); - - it('Product should have description', () => { - cy.get('.plugin-card:first-of-type') - .find('.nfd-plugin-card-desc p') - .invoke('text') - .should('not.be.empty') - }) - - it('Product should have actions', () => { - // primary action - cy.get('.plugin-card:first-of-type') - .find('.nfd-plugin-card-actions a:first-of-type') - .scrollIntoView() - .should('be.visible') - .should('have.attr', 'href') - - // secondary action - cy.get('.plugin-card:first-of-type') - .find('.nfd-plugin-card-actions a:last-of-type') - .scrollIntoView() - .should('be.visible') - .should('have.text', 'More Details') - .should('have.attr', 'href') - - }) - -}) \ No newline at end of file