-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
try local wonder block test replacement
- Loading branch information
1 parent
2c528d7
commit 5b715c1
Showing
2 changed files
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// <reference types="Cypress" /> | ||
|
||
describe( 'Wonder Blocks', function () { | ||
before( () => { | ||
cy.visit( '/wp-admin/post-new.php' ); | ||
} ); | ||
|
||
it( 'Wonder Blocks button exists', () => { | ||
cy.get( '#nfd-wba-toolbar-button' ).should( 'exist' ); | ||
} ); | ||
|
||
it( 'Wonder Blocks button opens modal', () => { | ||
cy.wait( 1000 ); | ||
cy.get( 'body' ).click( { force: true } ); // clear welcome guide | ||
cy.wait( 100 ); | ||
cy.get( '#nfd-wba-toolbar-button' ).click( { force: true } ); | ||
cy.wait( 100 ); | ||
// body has class modal-open | ||
cy.get( 'body' ).should( 'have.class', 'modal-open' ); | ||
// modal window exists | ||
cy.get( '.nfd-wba-modal[role="dialog"]' ).should( 'be.visible' ); | ||
} ); | ||
|
||
it( 'Close buttons closes modal', () => { | ||
cy.get( | ||
'.nfd-wba-modal__header button[aria-label="Close dialog"]' | ||
).should( 'exist' ); | ||
cy.get( | ||
'.nfd-wba-modal__header button[aria-label="Close dialog"]' | ||
).click( { force: true } ); | ||
cy.wait( 100 ); | ||
cy.get( 'body' ).should( 'not.have.class', 'modal-open' ); | ||
cy.get( '.nfd-wba-modal[role="dialog"]' ).should( 'not.exist' ); | ||
} ); | ||
|
||
it( 'ESC button closes modal too', () => { | ||
cy.get( '#nfd-wba-toolbar-button' ).click( { force: true } ); | ||
cy.wait( 100 ); | ||
cy.get( '.nfd-wba-modal[role="dialog"]' ).should( 'be.visible' ); | ||
cy.get( 'body' ).type( '{esc}' ); | ||
cy.wait( 100 ); | ||
cy.get( '.nfd-wba-modal[role="dialog"]' ).should( 'not.exist' ); | ||
} ); | ||
} ); |