Skip to content
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 html block test case to Playwright #41231

Merged
merged 3 commits into from
May 24, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

31 changes: 0 additions & 31 deletions packages/e2e-tests/specs/editor/blocks/html.test.js

This file was deleted.

31 changes: 31 additions & 0 deletions test/e2e/specs/editor/blocks/html.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/**
* WordPress dependencies
*/
const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' );
test.describe( 'HTML block', () => {
kevin940726 marked this conversation as resolved.
Show resolved Hide resolved
test.beforeEach( async ( { admin } ) => {
await admin.createNewPost();
} );
kevin940726 marked this conversation as resolved.
Show resolved Hide resolved
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
kevin940726 marked this conversation as resolved.
Show resolved Hide resolved
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 -->`
);
} );
} );