diff --git a/packages/e2e-tests/specs/editor/various/__snapshots__/links.test.js.snap b/packages/e2e-tests/specs/editor/various/__snapshots__/links.test.js.snap index 6ee8866064493..a123fba6a8e4c 100644 --- a/packages/e2e-tests/specs/editor/various/__snapshots__/links.test.js.snap +++ b/packages/e2e-tests/specs/editor/various/__snapshots__/links.test.js.snap @@ -6,12 +6,6 @@ exports[`Links allows use of escape key to dismiss the url popover 1`] = ` " `; -exports[`Links can be edited 1`] = ` -" -
This is Gutenberg
-" -`; - exports[`Links can be edited with collapsed selection 1`] = ` "This is Gutenberg
diff --git a/packages/e2e-tests/specs/editor/various/links.test.js b/packages/e2e-tests/specs/editor/various/links.test.js index e761c56fd565a..904d552e17db4 100644 --- a/packages/e2e-tests/specs/editor/various/links.test.js +++ b/packages/e2e-tests/specs/editor/various/links.test.js @@ -54,28 +54,6 @@ describe( 'Links', () => { await pressKeyWithModifier( 'shiftAlt', 'ArrowLeft' ); }; - it( 'can be edited', async () => { - await createAndReselectLink(); - - // Click on the Edit button. - const [ editButton ] = await page.$x( - '//button[contains(@aria-label, "Edit")]' - ); - await editButton.click(); - - // Wait for the URL field to auto-focus. - await waitForURLFieldAutoFocus(); - - // Change the URL. - await page.keyboard.type( '/handbook' ); - - // Submit the link. - await page.keyboard.press( 'Enter' ); - - // The link should have been updated. - expect( await getEditedPostContent() ).toMatchSnapshot(); - } ); - it( 'can be removed', async () => { await createAndReselectLink(); diff --git a/test/e2e/specs/editor/blocks/links.spec.js b/test/e2e/specs/editor/blocks/links.spec.js index 50bc501f5b9a3..3f06d38d1afc3 100644 --- a/test/e2e/specs/editor/blocks/links.spec.js +++ b/test/e2e/specs/editor/blocks/links.spec.js @@ -215,6 +215,49 @@ test.describe( 'Links', () => { ] ); } ); + test( `can be edited`, async ( { page, editor, pageUtils } ) => { + // Create a block with some text. + await editor.insertBlock( { + name: 'core/paragraph', + } ); + await page.keyboard.type( 'This is Gutenberg' ); + + // Select some text. + await pageUtils.pressKeys( 'shiftAlt+ArrowLeft' ); + + // Click on the Link button. + await page.getByRole( 'button', { name: 'Link' } ).click(); + + // Type a URL. + await page.keyboard.type( 'https://wordpress.org/gutenberg' ); + + // Click on the Submit button. + await pageUtils.pressKeys( 'Enter' ); + + // Reselect the link. + await pageUtils.pressKeys( 'shiftAlt+ArrowLeft' ); + + // Click on the Edit button. + await page.getByRole( 'button', { name: 'Edit' } ).click(); + + // Change the URL. + await page.getByPlaceholder( 'Search or type url' ).fill( '' ); + await page.keyboard.type( '/handbook' ); + + // Submit the link. + await pageUtils.pressKeys( 'Enter' ); + + // The link should have been updated. + await expect.poll( editor.getBlocks ).toMatchObject( [ + { + name: 'core/paragraph', + attributes: { + content: 'This is Gutenberg', + }, + }, + ] ); + } ); + test( `can be created by selecting text and using keyboard shortcuts`, async ( { page, editor,