-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate 'sidebar permalink' e2e tests to Playwright #56253
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
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(); | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The Failing locator
|
||||||||||
// Start editing again. | ||||||||||
await editor.canvas | ||||||||||
.getByRole( 'textbox', { name: 'Add title' } ) | ||||||||||
.fill( 'aaaa (Updated)' ); | ||||||||||
await expect( | ||||||||||
page.getByRole( 'button', { name: 'Change URL' } ) | ||||||||||
).toBeHidden(); | ||||||||||
Comment on lines
+56
to
+58
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As above! |
||||||||||
} ); | ||||||||||
|
||||||||||
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(); | ||||||||||
Comment on lines
+77
to
+79
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As above, but the other way round 😄 |
||||||||||
} ); | ||||||||||
} ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we ensure this button is visible before the post-publish editing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need to do that.
The button should be rendered at all. Not sure why publishing step was included in the first place. Probably testing some regression.