-
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 'Comments Form' e2e tests to Playwright (#57337)
* Migrate 'Comments Form' e2e tests to Playwright * Add comment * Use getSiteSettings and updateSiteSettings
- Loading branch information
Showing
2 changed files
with
49 additions
and
53 deletions.
There are no files selected for viewing
53 changes: 0 additions & 53 deletions
53
packages/e2e-tests/specs/experiments/blocks/post-comments-form.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,49 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' ); | ||
|
||
test.describe( 'Comments Form', () => { | ||
let originalCommentStatus; | ||
|
||
test.beforeAll( async ( { requestUtils } ) => { | ||
await requestUtils.activateTheme( 'emptytheme' ); | ||
await requestUtils.deleteAllTemplates( 'wp_template' ); | ||
} ); | ||
|
||
test.beforeEach( async ( { requestUtils } ) => { | ||
const siteSettings = await requestUtils.getSiteSettings(); | ||
originalCommentStatus = siteSettings.default_comment_status; | ||
} ); | ||
|
||
test.afterEach( async ( { requestUtils } ) => { | ||
await requestUtils.updateSiteSettings( { | ||
default_comment_status: originalCommentStatus, | ||
} ); | ||
} ); | ||
|
||
test.afterAll( async ( { requestUtils } ) => { | ||
await requestUtils.activateTheme( 'twentytwentyone' ); | ||
} ); | ||
|
||
test( 'placeholder displays in the site editor even when comments are closed by default', async ( { | ||
admin, | ||
editor, | ||
} ) => { | ||
// Navigate to "Singular" post template | ||
await admin.visitSiteEditor( { | ||
postId: 'emptytheme//singular', | ||
postType: 'wp_template', | ||
canvas: 'edit', | ||
} ); | ||
|
||
// Insert post comments form | ||
await editor.insertBlock( { name: 'core/post-comments-form' } ); | ||
|
||
// Ensure the placeholder is there | ||
const postCommentsFormBlock = editor.canvas.locator( | ||
'role=document[name="Block: Comments Form"i]' | ||
); | ||
await expect( postCommentsFormBlock.locator( 'form' ) ).toBeVisible(); | ||
} ); | ||
} ); |
57fc637
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.
Flaky tests detected in 57fc637.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.
🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/7327783777
📝 Reported issues:
specs/editor/various/block-switcher.test.js