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 'Post Title block' e2e tests to Playwright #55297

Merged
merged 3 commits into from
Oct 12, 2023
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
36 changes: 0 additions & 36 deletions packages/e2e-tests/specs/editor/blocks/post-title.test.js

This file was deleted.

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

test.describe( 'Post Title block', () => {
test.beforeEach( async ( { admin } ) => {
await admin.createNewPost();
} );

test( 'Can edit the post title', async ( { editor, page } ) => {
await editor.insertBlock( { name: 'core/post-title' } );

// Add the post title
await editor.canvas
.getByRole( 'textbox', {
name: 'Add title',
} )
.fill( 'Just tweaking the post title' );

// Save the post draft and reload.
await page.getByRole( 'button', { name: 'Save draft' } ).click();
await expect(
page
.getByRole( 'button', { name: 'Dismiss this notice' } )
.filter( { hasText: 'Draft saved' } )
).toBeVisible();
await page.reload();

const titleBlock = editor.canvas.getByRole( 'document', {
name: 'Block: Title',
} );
await expect( titleBlock ).toBeVisible();
await expect( titleBlock ).toHaveText( 'Just tweaking the post title' );
} );
} );
Loading