-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate demo page tests to Playwright (#55054)
* Migrate demo page tests to Playwright * Remove old test file * make check more strict Co-authored-by: Bart Kalisz <[email protected]>
- Loading branch information
1 parent
9ef96c5
commit c0cacda
Showing
2 changed files
with
38 additions
and
50 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,38 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' ); | ||
|
||
test.describe( 'New editor state', () => { | ||
test( 'content should load, making the post dirty', async ( { | ||
page, | ||
admin, | ||
} ) => { | ||
await admin.visitAdminPage( 'post-new.php', 'gutenberg-demo' ); | ||
await page.waitForFunction( () => { | ||
if ( ! window?.wp?.data?.dispatch ) { | ||
return false; | ||
} | ||
window.wp.data | ||
.dispatch( 'core/preferences' ) | ||
.set( 'core/edit-post', 'welcomeGuide', false ); | ||
|
||
window.wp.data | ||
.dispatch( 'core/preferences' ) | ||
.set( 'core/edit-post', 'fullscreenMode', false ); | ||
|
||
return true; | ||
} ); | ||
|
||
const isDirty = await page.evaluate( () => { | ||
return window.wp.data.select( 'core/editor' ).isEditedPostDirty(); | ||
} ); | ||
expect( isDirty ).toBe( true ); | ||
|
||
await expect( | ||
page | ||
.getByRole( 'region', { name: 'Editor top bar' } ) | ||
.getByRole( 'button', { name: 'Save draft' } ) | ||
).toBeEnabled(); | ||
} ); | ||
} ); |