Skip to content

Commit

Permalink
Attempt 4 to fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
wpalani committed Nov 8, 2024
1 parent 8d6ed92 commit bcdb98b
Showing 1 changed file with 20 additions and 21 deletions.
41 changes: 20 additions & 21 deletions tests/cypress/integration/coming-soon-woo.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@ describe( 'Coming Soon with WooCommerce', function () {
} );
} );

it( 'Replace our admin bar site status badge with WooCommerce\'s when active',
it( 'Replace our admin bar site status badge with WooCommerce\'s when active',
{ defaultCommandTimeout: 15000 },
() => {
// reload the page
cy.reload();

// Visit settings page
cy.visit(
'/wp-admin/admin.php?page=' +
Cypress.env( 'pluginId' ) +
'#/settings'
);

// reload the page
cy.reload();

// Our badge shouldn't be visible
cy.get( '#wp-toolbar #wp-admin-bar-nfd-site-visibility-badge' )
.should( 'not.exist' );
Expand All @@ -43,26 +43,25 @@ describe( 'Coming Soon with WooCommerce', function () {
.should( 'be.visible' );
});

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 );
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( 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();
cy.wait( 1000 );

// 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 bcdb98b

Please sign in to comment.