Skip to content

Commit

Permalink
Migrate New Default Post Content Test to Playwright (#45267)
Browse files Browse the repository at this point in the history
* Migrate New Default Post Content Test to Playwright
* Addressed feedbacks
* Fix StyleLint Issue
  • Loading branch information
pooja-muchandikar authored Oct 26, 2022
1 parent c02421f commit dd99ea3
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 52 deletions.

This file was deleted.

39 changes: 39 additions & 0 deletions test/e2e/specs/editor/various/new-post-default-content.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 filtered state', () => {
test.beforeAll( async ( { requestUtils } ) => {
await requestUtils.activatePlugin(
'gutenberg-test-plugin-default-post-content'
);
} );

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

test.afterAll( async ( { requestUtils } ) => {
await requestUtils.deactivatePlugin(
'gutenberg-test-plugin-default-post-content'
);
await requestUtils.deleteAllPosts();
} );

test( 'should respect default content', async ( { editor, page } ) => {
await editor.openDocumentSettingsSidebar();
await page.click( 'role=button[name="Excerpt"i]' );

// Assert they match what the plugin set.
await expect(
page.locator( 'role=textbox[name="Add title"i]' )
).toHaveText( 'My default title' );
await expect
.poll( editor.getEditedPostContent )
.toBe( 'My default content' );
await expect(
page.locator( 'role=textbox[name="Write an excerpt (optional)"i]' )
).toHaveText( 'My default excerpt' );
} );
} );

0 comments on commit dd99ea3

Please sign in to comment.