Skip to content

Commit

Permalink
Migrate 'Post Title block' e2e tests to Playwright (#55297)
Browse files Browse the repository at this point in the history
* Migrate 'Post Title block' e2e tests to Playwright

Co-authored-by: Justin Ahinon <justiny.ahinon@gmail.com>
Co-authored-by: Alvi Tazwar <55917380+alvitazwar@users.noreply.github.com>
  • Loading branch information
3 people authored Oct 12, 2023
1 parent c0f7916 commit 0e2e554
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 36 deletions.
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' );
} );
} );

1 comment on commit 0e2e554

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flaky tests detected in 0e2e554.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/6495125118
📝 Reported issues:

Please sign in to comment.