Skip to content

Commit

Permalink
Merge pull request #53 from newfold-labs/fix/tests
Browse files Browse the repository at this point in the history
Fix premium plugins test
  • Loading branch information
wpscholar authored Feb 21, 2024
2 parents bdf2f27 + f77e5ff commit 536fd8c
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions tests/cypress/integration/premium-plugins-tab.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
const marketplaceProductsFixture = require( '../fixtures/marketplace-products.json' );

describe( 'Plugins Premium Tab', () => {
before( () => {
cy.exec( 'npx wp-env run cli wp transient delete newfold_marketplace' );

beforeEach( () => {
cy.intercept(
{
method: 'GET',
Expand All @@ -14,9 +13,9 @@ describe( 'Plugins Premium Tab', () => {
body: marketplaceProductsFixture,
delay: 1000,
}
);
).as('getMarketplaceProducts');
cy.visit( '/wp-admin/plugin-install.php?tab=premium-marketplace' );
} );
});

it( 'Premium tab exist', () => {
cy.get( '.wrap' )
Expand All @@ -34,10 +33,12 @@ describe( 'Plugins Premium Tab', () => {
} );

it( 'Should have products', () => {
cy.wait('@getMarketplaceProducts');
cy.get( '#the-list' ).children( '.plugin-card' ).should( 'be.visible' );
} );

it( 'Product should display thumbnail', () => {
cy.wait('@getMarketplaceProducts');
cy.get( '.plugin-card:first-of-type' )
.find( '.nfd-plugin-card-thumbnail img' )
.scrollIntoView()
Expand All @@ -46,20 +47,23 @@ describe( 'Plugins Premium Tab', () => {
} );

it( 'Product should have a name', () => {
cy.wait('@getMarketplaceProducts');
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.wait('@getMarketplaceProducts');
cy.get( '.plugin-card:first-of-type' )
.find( '.nfd-plugin-card-desc p' )
.invoke( 'text' )
.should( 'not.be.empty' );
} );

it( 'Product should have actions', () => {
cy.wait('@getMarketplaceProducts');
// primary action
cy.get( '.plugin-card:first-of-type' )
.find( '.nfd-plugin-card-actions a:first-of-type' )
Expand Down

0 comments on commit 536fd8c

Please sign in to comment.