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

Migrated popovers.test.js to Playwright #39910

Merged
merged 9 commits into from
May 8, 2022
39 changes: 39 additions & 0 deletions test/e2e/specs/editor/various/popovers.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/**
* WordPress dependencies
*/
const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' );

test.describe( 'new editor state', () => {
kevin940726 marked this conversation as resolved.
Show resolved Hide resolved
test.beforeAll( async ( { requestUtils } ) => {
await requestUtils.activatePlugin(
'gutenberg-test-plugin-post-formats-support'
);
kevin940726 marked this conversation as resolved.
Show resolved Hide resolved
} );

test.beforeEach( async ( { pageUtils } ) => {
await pageUtils.createNewPost();
} );

test.afterAll( async ( { requestUtils } ) => {
await requestUtils.deactivatePlugin(
'gutenberg-test-plugin-post-formats-support'
);
} );

test.describe( 'dropdown', () => {
test( 'toggles via click', async ( { page } ) => {
const moreMenu = page.locator( 'role=menu[name="Options"i]' );
const moreMenuToggleButton = page.locator(
'role=button[name="Options"i]'
);
await expect( moreMenu ).not.toBeVisible();
// Toggle opened.
kevin940726 marked this conversation as resolved.
Show resolved Hide resolved
await moreMenuToggleButton.click();
await expect( moreMenu ).toBeVisible();

//Toggle closed.
kevin940726 marked this conversation as resolved.
Show resolved Hide resolved
await moreMenuToggleButton.click();
await expect( moreMenu ).not.toBeVisible();
} );
} );
} );