From 78ebdae5e8d3f87e3482c69f68c5e289336d9c21 Mon Sep 17 00:00:00 2001 From: Dave Smith Date: Wed, 1 Feb 2023 12:43:18 +0000 Subject: [PATCH] Add e2e test --- test/e2e/specs/editor/blocks/buttons.spec.js | 24 ++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/test/e2e/specs/editor/blocks/buttons.spec.js b/test/e2e/specs/editor/blocks/buttons.spec.js index cf4f56174f47f..43230bf0f87bb 100644 --- a/test/e2e/specs/editor/blocks/buttons.spec.js +++ b/test/e2e/specs/editor/blocks/buttons.spec.js @@ -100,6 +100,30 @@ test.describe( 'Buttons', () => { ).toBeVisible(); } ); + test( 'appends http protocol to links added which are missing a protocol', async ( { + editor, + page, + pageUtils, + } ) => { + // Regression: https://github.com/WordPress/gutenberg/issues/34307 + await editor.insertBlock( { name: 'core/buttons' } ); + await pageUtils.pressKeyWithModifier( 'primary', 'k' ); + await expect( + page.locator( 'role=combobox[name="URL"i]' ) + ).toBeFocused(); + await page.keyboard.type( 'example.com' ); + await page.keyboard.press( 'Enter' ); + + // Move to "Edit" and switch back to edit + await page.keyboard.press( 'Tab' ); + await page.keyboard.press( 'Enter' ); + + // Check the value of the URL input has had http:// prepended. + const urlInput = await page.locator( 'role=combobox[name="URL"i]' ); + + await expect( urlInput ).toHaveValue( 'http://example.com' ); + } ); + test( 'can jump to the link editor using the keyboard shortcut', async ( { editor, page,