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

Fix e2e test: ”WP Editor Meta Boxes > Should save the changes” #51884

Merged
merged 1 commit into from
Sep 20, 2023
Merged
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
37 changes: 16 additions & 21 deletions test/e2e/specs/editor/plugins/wp-editor-meta-box.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,31 +20,26 @@ test.describe( 'WP Editor Meta Boxes', () => {
await admin.createNewPost();

// Add title to enable valid non-empty post save.
await editor.canvas.type(
'role=textbox[name="Add title"i]',
'Hello Meta'
);
await editor.canvas
.locator( 'role=textbox[name="Add title"i]' )
.type( '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]' );
// Switch tinymce to Text mode, first waiting for it to initialize
// because otherwise it will flip back to Visual mode once initialized.
await page.locator( '#test_tinymce_id_ifr' ).waitFor();
await page.locator( 'role=button[name="Text"i]' ).click();

await editor.publishPost();
// Type something in the tinymce Text mode textarea.
const metaBoxField = page.locator( '#test_tinymce_id' );
await metaBoxField.type( 'Typing in a metabox' );

// Close the publish panel so that it won't cover the tinymce editor.
await page.click(
'role=region[name="Editor publish"i] >> role=button[name="Close panel"i]'
);
// Switch tinymce back to Visual mode.
await page.locator( 'role=button[name="Visual"i]' ).click();

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

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

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