-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate New Default Post Content Test to Playwright (#45267)
* Migrate New Default Post Content Test to Playwright * Addressed feedbacks * Fix StyleLint Issue
- Loading branch information
1 parent
c02421f
commit dd99ea3
Showing
2 changed files
with
39 additions
and
52 deletions.
There are no files selected for viewing
52 changes: 0 additions & 52 deletions
52
packages/e2e-tests/specs/editor/various/new-post-default-content.test.js
This file was deleted.
Oops, something went wrong.
39 changes: 39 additions & 0 deletions
39
test/e2e/specs/editor/various/new-post-default-content.spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' ); | ||
} ); | ||
} ); |