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

Migrate wp editor meta box test to Playwright #41519

Merged
merged 6 commits into from
Aug 11, 2022
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

This file was deleted.

42 changes: 42 additions & 0 deletions test/e2e/specs/editor/plugins/wp-editor-meta-box.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/**
* WordPress dependencies
*/
const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' );

test.describe( 'WP Editor Meta Boxes', () => {
test.beforeAll( async ( { requestUtils } ) => {
await requestUtils.activatePlugin(
'gutenberg-test-plugin-wp-editor-meta-box'
);
} );

test.afterAll( async ( { requestUtils } ) => {
await requestUtils.deactivatePlugin(
'gutenberg-test-plugin-wp-editor-meta-box'
);
} );

test( 'Should save the changes', async ( { admin, editor, page } ) => {
await admin.createNewPost();

// Add title to enable valid non-empty post save.
await page.type( 'role=textbox[name="Add title"i]', 'Hello Meta' );

// Type something.
await page.click( 'role=button[name="Text"i]' );
await page.click( '#test_tinymce_id' );
await page.keyboard.type( 'Typing in a metabox' );
await page.type( '#test_tinymce_id-html', 'Typing in a metabox' );
await page.click( 'role=button[name="Visual"i]' );

await editor.publishPost();

await expect( page.locator( '.edit-post-layout' ) ).toBeVisible();

await page.click( 'role=button[name="Text"i]' );

// Expect the typed text on the tinymce editor
const content = page.locator( '#test_tinymce_id' );
await expect( content ).toHaveValue( 'Typing in a metabox' );
} );
} );