forked from WordPress/gutenberg
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate 'preferences' e2e tests to Playwright (WordPress#57446)
* Migrate 'preferences' e2e tests to Playwright * Remove old test file Co-authored-by: Pooja Killekar <41000648+pooja-muchandikar@users.noreply.github.com> --------- Co-authored-by: Pooja Killekar <41000648+pooja-muchandikar@users.noreply.github.com>
- Loading branch information
1 parent
63a6321
commit fc36077
Showing
2 changed files
with
50 additions
and
62 deletions.
There are no files selected for viewing
62 changes: 0 additions & 62 deletions
62
packages/e2e-tests/specs/editor/various/preferences.test.js
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,50 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' ); | ||
|
||
test.describe( 'Preferences', () => { | ||
test.beforeEach( async ( { admin } ) => { | ||
await admin.createNewPost(); | ||
} ); | ||
|
||
test( 'remembers sidebar dismissal between sessions', async ( { | ||
editor, | ||
page, | ||
} ) => { | ||
await editor.openDocumentSettingsSidebar(); | ||
|
||
const editorSettings = page.getByRole( 'region', { | ||
name: 'Editor settings', | ||
} ); | ||
const activeTab = editorSettings.getByRole( 'tab', { selected: true } ); | ||
|
||
// Open by default. | ||
await expect( activeTab ).toHaveText( 'Post' ); | ||
|
||
// Change to "Block" tab. | ||
await editorSettings.getByRole( 'tab', { name: 'Block' } ).click(); | ||
await expect( activeTab ).toHaveText( 'Block' ); | ||
|
||
/** | ||
* Regression test: Reload resets to document tab. | ||
* | ||
* See: https://github.com/WordPress/gutenberg/issues/6377 | ||
* See: https://github.com/WordPress/gutenberg/pull/8995 | ||
*/ | ||
await page.reload(); | ||
await expect( activeTab ).toHaveText( 'Post' ); | ||
|
||
// Dismiss. | ||
await editorSettings | ||
.getByRole( 'button', { | ||
name: 'Close Settings', | ||
} ) | ||
.click(); | ||
await expect( activeTab ).toBeHidden(); | ||
|
||
// Remember after reload. | ||
await page.reload(); | ||
await expect( activeTab ).toBeHidden(); | ||
} ); | ||
} ); |