diff --git a/packages/e2e-tests/specs/editor/various/__snapshots__/convert-block-type.test.js.snap b/packages/e2e-tests/specs/editor/various/__snapshots__/convert-block-type.test.js.snap deleted file mode 100644 index 830161bea53c9..0000000000000 --- a/packages/e2e-tests/specs/editor/various/__snapshots__/convert-block-type.test.js.snap +++ /dev/null @@ -1,13 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`Code block should convert to a preformatted block 1`] = ` -" -
print \\"Hello Dolly!\\"
-" -`; - -exports[`Code block should convert to a preformatted block 2`] = ` -" -
print \\"Hello Dolly!\\"
-" -`; diff --git a/packages/e2e-tests/specs/editor/various/convert-block-type.test.js b/packages/e2e-tests/specs/editor/various/convert-block-type.test.js deleted file mode 100644 index 101a40b6dd229..0000000000000 --- a/packages/e2e-tests/specs/editor/various/convert-block-type.test.js +++ /dev/null @@ -1,32 +0,0 @@ -/** - * WordPress dependencies - */ -import { - getEditedPostContent, - createNewPost, - insertBlock, - transformBlockTo, -} from '@wordpress/e2e-test-utils'; - -describe( 'Code block', () => { - beforeEach( async () => { - await createNewPost(); - } ); - - it( 'should convert to a preformatted block', async () => { - const code = 'print "Hello Dolly!"'; - - await insertBlock( 'Code' ); - await page.keyboard.type( code ); - - // Verify the content starts out as a Code block. - const originalPostContent = await getEditedPostContent(); - expect( originalPostContent ).toMatchSnapshot(); - - await transformBlockTo( 'Preformatted' ); - - // The content should now be a Preformatted block with no data loss. - const convertedPostContent = await getEditedPostContent(); - expect( convertedPostContent ).toMatchSnapshot(); - } ); -} ); diff --git a/test/e2e/specs/editor/various/convert-block-type.spec.js b/test/e2e/specs/editor/various/convert-block-type.spec.js new file mode 100644 index 0000000000000..b26cc6124f831 --- /dev/null +++ b/test/e2e/specs/editor/various/convert-block-type.spec.js @@ -0,0 +1,38 @@ +/** + * WordPress dependencies + */ +const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' ); + +test.describe( 'Code block', () => { + test.beforeEach( async ( { admin } ) => { + await admin.createNewPost(); + } ); + + test.afterEach( async ( { requestUtils } ) => { + await requestUtils.deleteAllPosts(); + } ); + + test( 'should convert to a preformatted block', async ( { + page, + editor, + } ) => { + const code = 'print "Hello Dolly!"'; + + await editor.insertBlock( { name: 'core/code' } ); + await page.keyboard.type( code ); + + // Verify the content starts out as a Code block. + + await expect.poll( editor.getEditedPostContent ).toBe( ` +
${ code }
+` ); + + await editor.transformBlockTo( 'core/preformatted' ); + + // The content should now be a Preformatted block with no data loss. + await expect.poll( editor.getEditedPostContent ) + .toBe( ` +
${ code }
+` ); + } ); +} );