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

update tests #36

Merged
merged 1 commit into from
Nov 18, 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
10 changes: 5 additions & 5 deletions tests/cypress/integration/modal-notification.cy.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

63 changes: 52 additions & 11 deletions tests/cypress/integration/notifications.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,20 +84,11 @@ describe( 'Notifications', { testIsolation: true }, () => {
beforeEach( () => {
wpLogin();
wpCli( 'transient delete newfold_notifications' );
cy.intercept(
{
method: 'GET',
url: /newfold-notifications(\/|%2F)v1(\/|%2F)notifications/,
},
notifications
).as( 'notifications' );
cy.visit(
'/wp-admin/admin.php?page=' + Cypress.env( 'pluginId' ) + '#/home'
);
cy.visit( '/wp-admin/index.php' );
} );

it( 'Container Exists in plugin app and is accessible', () => {
cy.wait( '@notifications' );
cy.visit( '/wp-admin/index.php' );
cy.injectAxe();
cy.wait( 1000 );
cy.get( '.newfold-notifications-wrapper' ).should( 'have.length', 1 );
Expand All @@ -106,6 +97,16 @@ describe( 'Notifications', { testIsolation: true }, () => {

// notification renders in all app for `all`
it( 'Test notification displays in plugin app with `all`', () => {
cy.intercept(
{
method: 'GET',
url: /newfold-notifications(\/|%2F)v1(\/|%2F)notifications/,
},
notifications
).as( 'notifications' );
cy.visit(
'/wp-admin/admin.php?page=' + Cypress.env( 'pluginId' ) + '#/home'
);
cy.wait( '@notifications' );
cy.get( '.newfold-notifications-wrapper #notification-test-everywhere' )
.should( 'be.visible' )
Expand All @@ -119,6 +120,16 @@ describe( 'Notifications', { testIsolation: true }, () => {

// notification renders only on specified app page
it( 'Test notification displays in plugin app for specific page (settings)', () => {
cy.intercept(
{
method: 'GET',
url: /newfold-notifications(\/|%2F)v1(\/|%2F)notifications/,
},
notifications
).as( 'notifications' );
cy.visit(
'/wp-admin/admin.php?page=' + Cypress.env( 'pluginId' ) + '#/home'
);
cy.wait( '@notifications' );
cy.get( 'body' ).then( ( $body ) => {
if (
Expand Down Expand Up @@ -152,6 +163,16 @@ describe( 'Notifications', { testIsolation: true }, () => {

// notification renders on the side nav
it( 'Test notification displays in app side nav', () => {
cy.intercept(
{
method: 'GET',
url: /newfold-notifications(\/|%2F)v1(\/|%2F)notifications/,
},
notifications
).as( 'notifications' );
cy.visit(
'/wp-admin/admin.php?page=' + Cypress.env( 'pluginId' ) + '#/home'
);
cy.wait( '@notifications' );
cy.get(
'.newfold-nav-notifications-wrapper #notification-test-side-nav'
Expand All @@ -167,6 +188,16 @@ describe( 'Notifications', { testIsolation: true }, () => {

// expired notification should not show
it( 'Test expired notification does not display in plugin app', () => {
cy.intercept(
{
method: 'GET',
url: /newfold-notifications(\/|%2F)v1(\/|%2F)notifications/,
},
notifications
).as( 'notifications' );
cy.visit(
'/wp-admin/admin.php?page=' + Cypress.env( 'pluginId' ) + '#/home'
);
cy.wait( '@notifications' );
cy.get(
'.newfold-notifications-wrapper #notification-test-expired'
Expand All @@ -175,6 +206,16 @@ describe( 'Notifications', { testIsolation: true }, () => {

// dismiss events triggered
it( 'Dismissing notification removes it from the page', () => {
cy.intercept(
{
method: 'GET',
url: /newfold-notifications(\/|%2F)v1(\/|%2F)notifications/,
},
notifications
).as( 'notifications' );
cy.visit(
'/wp-admin/admin.php?page=' + Cypress.env( 'pluginId' ) + '#/home'
);
cy.wait( '@notifications' );
cy.get( 'body' ).then( ( $body ) => {
if (
Expand Down
Loading