-
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 html block test case to Playwright (#41231)
* Migrate html spec test case * Address Review Feedbacks * Apply suggestions from code review Co-authored-by: Pooja Killekar <poojakillekar@Poojas-MacBook-Air.local> Co-authored-by: Kai Hao <kevin830726@gmail.com>
- Loading branch information
1 parent
161e5e4
commit 9f1ca90
Showing
3 changed files
with
33 additions
and
39 deletions.
There are no files selected for viewing
8 changes: 0 additions & 8 deletions
8
packages/e2e-tests/specs/editor/blocks/__snapshots__/html.test.js.snap
This file was deleted.
Oops, something went wrong.
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,33 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' ); | ||
|
||
test.describe( 'HTML block', () => { | ||
test.beforeEach( async ( { admin } ) => { | ||
await admin.createNewPost(); | ||
} ); | ||
|
||
test( 'can be created by typing "/html"', async ( { editor, page } ) => { | ||
// Create a Custom HTML block with the slash shortcut. | ||
await page.click( 'role=button[name="Add default block"i]' ); | ||
await page.keyboard.type( '/html' ); | ||
await expect( | ||
page.locator( 'role=option[name="Custom HTML"i][selected]' ) | ||
).toBeVisible(); | ||
await page.keyboard.press( 'Enter' ); | ||
await page.keyboard.type( '<p>Pythagorean theorem: ' ); | ||
await page.keyboard.press( 'Enter' ); | ||
await page.keyboard.type( | ||
'<var>a</var><sup>2</sup> + <var>b</var><sup>2</sup> = <var>c</var><sup>2</sup> </p>' | ||
); | ||
// Check the content. | ||
const content = await editor.getEditedPostContent(); | ||
expect( content ).toBe( | ||
`<!-- wp:html --> | ||
<p>Pythagorean theorem: | ||
<var>a</var><sup>2</sup> + <var>b</var><sup>2</sup> = <var>c</var><sup>2</sup> </p> | ||
<!-- /wp:html -->` | ||
); | ||
} ); | ||
} ); |