Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test integration updates #33

Merged
merged 2 commits into from
Feb 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/brand-plugin-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ jobs:
module-repo: ${{ github.repository }}
module-branch: ${{ needs.setup.outputs.branch }}
plugin-repo: 'bluehost/bluehost-wordpress-plugin'
plugin-branch: 'release/3.9.0'
secrets: inherit

hostgator:
Expand Down
107 changes: 68 additions & 39 deletions tests/cypress/integration/coming-soon.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,19 @@ describe( 'Coming Soon', function () {
const appClass = '.' + Cypress.env( 'appId' );

before( () => {
// Set coming soon to true
// Set coming soon option to true to start with
cy.exec( `npx wp-env run cli wp option update mm_coming_soon true` );
cy.exec( `npx wp-env run cli wp option update nfd_coming_soon true` );
cy.exec( `npx wp-env run cli wp option update nfd_coming_soon true` );
} );

it( 'Coming Soon is active', () => {
cy.visit(
'/wp-admin/admin.php?page=' +
Cypress.env( 'pluginId' ) +
'#/settings'
);
} );
cy.reload();

it( 'Coming Soon Toggle Functions', () => {
// Initial Coming Soon State
cy.get( '#wp-toolbar #wp-admin-bar-site-status #nfd-site-status-coming-soon' )
.scrollIntoView()
Expand All @@ -34,35 +35,7 @@ describe( 'Coming Soon', function () {
cy.get( '[data-id="coming-soon-toggle"]' )
.should( 'have.attr', 'aria-checked' )
.and( 'include', 'true' );

// Deactivate coming soon - Launch Site
cy.get( '[data-id="coming-soon-toggle"]' ).click();
cy.wait( 500 );

cy.get( '[data-id="coming-soon-toggle"]' )
.should( 'have.attr', 'aria-checked' )
.and( 'include', 'false' );
cy.get( '#wp-toolbar #wp-admin-bar-site-status #nfd-site-status-live' )
.scrollIntoView()
.should( 'be.visible' );
cy.get( '.nfd-notifications' )
.contains( '.nfd-notification', 'Coming soon deactivated' )
.should( 'be.visible' );

// Activate Coming Soon - Unlaunch Site
cy.get( '[data-id="coming-soon-toggle"]' ).click();
cy.wait( 500 );

cy.get( '[data-id="coming-soon-toggle"]' )
.should( 'have.attr', 'aria-checked' )
.and( 'include', 'true' );
cy.get( '#wp-toolbar #wp-admin-bar-site-status #nfd-site-status-coming-soon' )
.scrollIntoView()
.should( 'be.visible' );
cy.get( '.nfd-notifications' )
.contains( '.nfd-notification', 'Coming soon activated' )
.should( 'be.visible' );
} );
});

it( 'Displays Coming Soon in Site Status Admin Toolbar', () => {
// Admin bar contains label
Expand Down Expand Up @@ -96,6 +69,67 @@ describe( 'Coming Soon', function () {
.first()
.contains( 'button', 'Launch' )
.should( 'exist' );

} );

it( 'Coming Soon Admin bar links to setting', () => {
cy.get( '#wp-toolbar #wp-admin-bar-site-status #nfd-site-status-coming-soon' ).click();
cy.location().should( ( loc ) => {
expect( loc.hash ).to.eq( '#/settings' )
});
} );

it( 'Coming Soon Toggle Turns Coming Soon Off', () => {
cy.visit(
'/wp-admin/admin.php?page=' +
Cypress.env( 'pluginId' ) +
'#/settings'
);
// Deactivate coming soon - Launch Site
cy.get( '[data-id="coming-soon-toggle"]' ).click();
cy.wait( 500 );

// Toggle is false
cy.get( '[data-id="coming-soon-toggle"]' )
.should( 'have.attr', 'aria-checked' )
.and( 'include', 'false' );

// Admin bar is updated
cy.get( '#wp-toolbar #wp-admin-bar-site-status #nfd-site-status-live' )
.scrollIntoView()
.should( 'be.visible' );

// Snackbar notice displays properly
cy.get( '.nfd-notifications' )
.contains( '.nfd-notification', 'Coming soon deactivated' )
.should( 'be.visible' );
} );

it( 'Coming Soon Toggle Turns Coming Soon On', () => {
cy.visit(
'/wp-admin/admin.php?page=' +
Cypress.env( 'pluginId' ) +
'#/settings'
);

// Activate Coming Soon - Unlaunch Site
cy.get( '[data-id="coming-soon-toggle"]' ).click();
cy.wait( 500 );

// Toggle is true
cy.get( '[data-id="coming-soon-toggle"]' )
.should( 'have.attr', 'aria-checked' )
.and( 'include', 'true' );

// Admin bar is updated
cy.get( '#wp-toolbar #wp-admin-bar-site-status #nfd-site-status-coming-soon' )
.scrollIntoView()
.should( 'be.visible' );

// Snackbar notice displays properly
cy.get( '.nfd-notifications' )
.contains( '.nfd-notification', 'Coming soon activated' )
.should( 'be.visible' );
} );

it( 'Displays admin coming soon notice', () => {
Expand Down Expand Up @@ -154,11 +188,6 @@ describe( 'Coming Soon', function () {
cy.get( '[data-id="coming-soon-toggle"]' )
.should( 'have.attr', 'aria-checked' )
.and( 'include', 'false' );
// Re-Activate Coming Soon
cy.get( '[data-id="coming-soon-toggle"]' ).click();
cy.wait( 500 );
cy.get( '[data-id="coming-soon-toggle"]' )
.should( 'have.attr', 'aria-checked' )
.and( 'include', 'true' );

} );
} );
Loading