Skip to content

Commit

Permalink
Increase test timeout to give time for an ajax to finish
Browse files Browse the repository at this point in the history
  • Loading branch information
wpalani committed Nov 8, 2024
1 parent b8d9bd0 commit c3d3f86
Showing 1 changed file with 20 additions and 15 deletions.
35 changes: 20 additions & 15 deletions tests/cypress/integration/coming-soon-woo.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ describe( 'Coming Soon with WooCommerce', function () {
timeout: 40000,
log: true,
} );

// reload the page
cy.reload();
} );

after( () => {
Expand Down Expand Up @@ -38,24 +41,26 @@ describe( 'Coming Soon with WooCommerce', function () {
.should( 'be.visible' );
});

it ( 'Our plugin settings should toggle WooCommerce admin bar badge', () => {
// Deactivate coming soon - Launch Site
cy.get( '[data-id="coming-soon-toggle"]' ).click();
cy.wait( 2000 );
it ( 'Our plugin settings should toggle WooCommerce admin bar badge',
{ defaultCommandTimeout: 10000 },
() => {
// Deactivate coming soon - Launch Site
cy.get( '[data-id="coming-soon-toggle"]' ).click();
cy.wait( 1000 );

// WooCommerce badge should now be live
cy.get( '#wp-toolbar .woocommerce-site-status-badge-live a.ab-item' )
.contains( 'a', 'Live' )
.should( 'be.visible' );
// WooCommerce badge should now be live
cy.get( '#wp-toolbar .woocommerce-site-status-badge-live a.ab-item' )
.contains( 'a', 'Live' )
.should( 'be.visible' );

// Re-enable coming soon mode
cy.get( '[data-id="coming-soon-toggle"]' )
.click();
// Re-enable coming soon mode
cy.get( '[data-id="coming-soon-toggle"]' )
.click();

// WooCommerce badge should now be coming soon
cy.get( '#wp-toolbar .woocommerce-site-status-badge-coming-soon a.ab-item' )
.contains( 'a', 'Coming soon' )
.should( 'be.visible' );
// WooCommerce badge should now be coming soon
cy.get( '#wp-toolbar .woocommerce-site-status-badge-coming-soon a.ab-item' )
.contains( 'a', 'Coming soon' )
.should( 'be.visible' );
});

it( 'Hide our site preview notice when WooCommerce is active', () => {
Expand Down

0 comments on commit c3d3f86

Please sign in to comment.