diff --git a/packages/e2e-tests/specs/editor/blocks/__snapshots__/html.test.js.snap b/packages/e2e-tests/specs/editor/blocks/__snapshots__/html.test.js.snap deleted file mode 100644 index b72664d021276..0000000000000 --- a/packages/e2e-tests/specs/editor/blocks/__snapshots__/html.test.js.snap +++ /dev/null @@ -1,8 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`HTML block can be created by typing "/html" 1`] = ` -" -

Pythagorean theorem: -a2 + b2 = c2

-" -`; diff --git a/packages/e2e-tests/specs/editor/blocks/html.test.js b/packages/e2e-tests/specs/editor/blocks/html.test.js deleted file mode 100644 index df2492aaa51bb..0000000000000 --- a/packages/e2e-tests/specs/editor/blocks/html.test.js +++ /dev/null @@ -1,31 +0,0 @@ -/** - * WordPress dependencies - */ -import { - clickBlockAppender, - getEditedPostContent, - createNewPost, -} from '@wordpress/e2e-test-utils'; - -describe( 'HTML block', () => { - beforeEach( async () => { - await createNewPost(); - } ); - - it( 'can be created by typing "/html"', async () => { - // Create a Custom HTML block with the slash shortcut. - await clickBlockAppender(); - await page.keyboard.type( '/html' ); - await page.waitForXPath( - `//*[contains(@class, "components-autocomplete__result") and contains(@class, "is-selected") and contains(text(), 'Custom HTML')]` - ); - await page.keyboard.press( 'Enter' ); - await page.keyboard.type( '

Pythagorean theorem: ' ); - await page.keyboard.press( 'Enter' ); - await page.keyboard.type( - 'a2 + b2 = c2

' - ); - - expect( await getEditedPostContent() ).toMatchSnapshot(); - } ); -} ); diff --git a/test/e2e/specs/editor/blocks/html.spec.js b/test/e2e/specs/editor/blocks/html.spec.js new file mode 100644 index 0000000000000..dedb9197984fc --- /dev/null +++ b/test/e2e/specs/editor/blocks/html.spec.js @@ -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( '

Pythagorean theorem: ' ); + await page.keyboard.press( 'Enter' ); + await page.keyboard.type( + 'a2 + b2 = c2

' + ); + // Check the content. + const content = await editor.getEditedPostContent(); + expect( content ).toBe( + ` +

Pythagorean theorem: +a2 + b2 = c2

+` + ); + } ); +} );