-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate 'sidebar permalink' e2e tests to Playwright (#56253)
* Migrate 'sidebar permalink' e2e tests to Playwright Co-authored-by: Pavan Patil <44057535+pavanpatil1@users.noreply.github.com> * Remove old test file * Open document settings sidebar --------- Co-authored-by: Pavan Patil <44057535+pavanpatil1@users.noreply.github.com>
- Loading branch information
1 parent
1587cb9
commit fe958de
Showing
2 changed files
with
81 additions
and
53 deletions.
There are no files selected for viewing
53 changes: 0 additions & 53 deletions
53
packages/e2e-tests/specs/editor/various/sidebar-permalink.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,81 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' ); | ||
|
||
// This tests are not together with the remaining sidebar tests, | ||
// because we need to publish/save a post, to correctly test the permalink row. | ||
// The sidebar test suit enforces that focus is never lost, but during save operations | ||
// the focus is lost and a new element is focused once the save is completed. | ||
test.describe( 'Sidebar Permalink', () => { | ||
test.beforeAll( async ( { requestUtils } ) => { | ||
await requestUtils.activatePlugin( 'gutenberg-test-custom-post-types' ); | ||
} ); | ||
|
||
test.afterAll( async ( { requestUtils } ) => { | ||
await requestUtils.deactivatePlugin( | ||
'gutenberg-test-custom-post-types' | ||
); | ||
} ); | ||
|
||
test( 'should not render URL when post is publicly queryable but not public', async ( { | ||
admin, | ||
editor, | ||
page, | ||
} ) => { | ||
await admin.createNewPost( { postType: 'public_q_not_public' } ); | ||
await editor.openDocumentSettingsSidebar(); | ||
await editor.canvas | ||
.getByRole( 'textbox', { name: 'Add title' } ) | ||
.fill( 'aaaaa' ); | ||
await editor.publishPost(); | ||
// Start editing again. | ||
await editor.canvas | ||
.getByRole( 'textbox', { name: 'Add title' } ) | ||
.fill( 'aaaa (Updated)' ); | ||
await expect( | ||
page.getByRole( 'button', { name: 'Change URL' } ) | ||
).toBeHidden(); | ||
} ); | ||
|
||
test( 'should not render URL when post is public but not publicly queryable', async ( { | ||
admin, | ||
editor, | ||
page, | ||
} ) => { | ||
await admin.createNewPost( { postType: 'not_public_q_public' } ); | ||
await editor.openDocumentSettingsSidebar(); | ||
await editor.canvas | ||
.getByRole( 'textbox', { name: 'Add title' } ) | ||
.fill( 'aaaaa' ); | ||
await editor.saveDraft(); | ||
// Start editing again. | ||
await editor.canvas | ||
.getByRole( 'textbox', { name: 'Add title' } ) | ||
.fill( 'aaaa (Updated)' ); | ||
await expect( | ||
page.getByRole( 'button', { name: 'Change URL' } ) | ||
).toBeHidden(); | ||
} ); | ||
|
||
test( 'should render URL when post is public and publicly queryable', async ( { | ||
admin, | ||
editor, | ||
page, | ||
} ) => { | ||
await admin.createNewPost( { postType: 'public_q_public' } ); | ||
await editor.openDocumentSettingsSidebar(); | ||
await editor.canvas | ||
.getByRole( 'textbox', { name: 'Add title' } ) | ||
.fill( 'aaaaa' ); | ||
await editor.publishPost(); | ||
|
||
// Start editing again. | ||
await editor.canvas | ||
.getByRole( 'textbox', { name: 'Add title' } ) | ||
.fill( 'aaaa (Updated)' ); | ||
await expect( | ||
page.getByRole( 'button', { name: 'Change URL' } ) | ||
).toBeVisible(); | ||
} ); | ||
} ); |