Skip to content

Commit

Permalink
Make all plugin API e2e test independent
Browse files Browse the repository at this point in the history
  • Loading branch information
gziolo committed Oct 25, 2018
1 parent ddc5d2f commit f2d5e89
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions test/e2e/specs/plugins-api.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,16 @@ import { activatePlugin, deactivatePlugin } from '../support/plugins';
describe( 'Using Plugins API', () => {
beforeAll( async () => {
await activatePlugin( 'gutenberg-test-plugin-plugins-api' );
await newPost();
} );

afterAll( async () => {
await deactivatePlugin( 'gutenberg-test-plugin-plugins-api' );
} );

beforeEach( async () => {
await newPost();
} );

describe( 'Post Status Info', () => {
it( 'Should render post status info inside Document Setting sidebar', async () => {
await openDocumentSettingsSidebar();
Expand All @@ -31,16 +34,13 @@ describe( 'Using Plugins API', () => {
} );

describe( 'Publish Panel', () => {
afterEach( async () => {
// Close Publish panel.
await page.click( '.editor-post-publish-panel__header button[aria-label="Close panel"]' );
} );

it( 'Should render publish panel inside Pre-publish sidebar', async () => {
beforeEach( async () => {
// Type something first to activate Publish button.
await clickBlockAppender();
await page.keyboard.type( 'First paragraph' );
} );

it( 'Should render publish panel inside Pre-publish sidebar', async () => {
await openPublishPanel();

const pluginPublishPanelText = await page.$eval( '.editor-post-publish-panel .my-publish-panel-plugin__pre', ( el ) => el.innerText );
Expand All @@ -66,8 +66,13 @@ describe( 'Using Plugins API', () => {
it( 'Should close plugins sidebar using More Menu item', async () => {
await clickOnMoreMenuItem( 'Sidebar title plugin' );

const pluginSidebar = await page.$( '.edit-post-sidebar' );
expect( pluginSidebar ).toBeNull();
const pluginSidebarOpened = await page.$( '.edit-post-sidebar' );
expect( pluginSidebarOpened ).not.toBeNull();

await clickOnMoreMenuItem( 'Sidebar title plugin' );

const pluginSidebarClosed = await page.$( '.edit-post-sidebar' );
expect( pluginSidebarClosed ).toBeNull();
} );
} );
} );

0 comments on commit f2d5e89

Please sign in to comment.