Skip to content

Commit

Permalink
Add regression test
Browse files Browse the repository at this point in the history
  • Loading branch information
jeryj authored and scruffian committed Feb 9, 2024
1 parent 0078724 commit e0f4252
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions test/e2e/specs/editor/blocks/links.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -878,6 +878,48 @@ test.describe( 'Links', () => {
] );
} );

// Fix for https://github.com/WordPress/gutenberg/issues/58322
test( 'can click links within the same paragraph to open the correct link preview (@firefox)', async ( {
editor,
LinkUtils,
} ) => {
// Create a paragraph with two links
await editor.insertBlock( {
name: 'core/paragraph',
attributes: {
content: `<a href="https://wordpressfoundation.org/donate/">Donate to the Wordpress Foundation</a> to support <a href="https://wordpress.org/gutenberg">Gutenberg</a>`,
},
} );

// Click on "Gutenberg" link in the canvas
await editor.canvas
.getByRole( 'link', {
name: 'Gutenberg',
} )
.click();

const linkPopover = LinkUtils.getLinkPopover();
await expect( linkPopover ).toBeVisible();
await expect(
linkPopover.getByText( 'wordpress.org/gutenberg' )
).toBeVisible();

// Click the other link in the same paragraph. We need a short delay between mousdown and mouseup to get the popover to show
await editor.canvas
.getByRole( 'link', {
name: 'WordPress',
} )
.click( { delay: 10 } );

await expect( linkPopover ).toBeVisible();

Check failure on line 914 in test/e2e/specs/editor/blocks/links.spec.js

View workflow job for this annotation

GitHub Actions / Playwright - 8

[firefox] › editor/blocks/links.spec.js:882:2 › Links › can click links within the same paragraph to open the correct link preview (@firefox)

1) [firefox] › editor/blocks/links.spec.js:882:2 › Links › can click links within the same paragraph to open the correct link preview (@Firefox) Error: Timed out 5000ms waiting for expect(locator).toBeVisible() Locator: locator('.components-popover__content .block-editor-link-control') Expected: visible Received: hidden Call log: - expect.toBeVisible with timeout 5000ms - waiting for locator('.components-popover__content .block-editor-link-control') 912 | .click( { delay: 10 } ); 913 | > 914 | await expect( linkPopover ).toBeVisible(); | ^ 915 | await expect( 916 | linkPopover.getByText( 'wordpress.org/gutenberg' ) 917 | ).toBeHidden(); at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/blocks/links.spec.js:914:31

Check failure on line 914 in test/e2e/specs/editor/blocks/links.spec.js

View workflow job for this annotation

GitHub Actions / Playwright - 8

[firefox] › editor/blocks/links.spec.js:882:2 › Links › can click links within the same paragraph to open the correct link preview (@firefox)

1) [firefox] › editor/blocks/links.spec.js:882:2 › Links › can click links within the same paragraph to open the correct link preview (@Firefox) Retry #1 ─────────────────────────────────────────────────────────────────────────────────────── Error: Timed out 5000ms waiting for expect(locator).toBeVisible() Locator: locator('.components-popover__content .block-editor-link-control') Expected: visible Received: hidden Call log: - expect.toBeVisible with timeout 5000ms - waiting for locator('.components-popover__content .block-editor-link-control') 912 | .click( { delay: 10 } ); 913 | > 914 | await expect( linkPopover ).toBeVisible(); | ^ 915 | await expect( 916 | linkPopover.getByText( 'wordpress.org/gutenberg' ) 917 | ).toBeHidden(); at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/blocks/links.spec.js:914:31

Check failure on line 914 in test/e2e/specs/editor/blocks/links.spec.js

View workflow job for this annotation

GitHub Actions / Playwright - 8

[firefox] › editor/blocks/links.spec.js:882:2 › Links › can click links within the same paragraph to open the correct link preview (@firefox)

1) [firefox] › editor/blocks/links.spec.js:882:2 › Links › can click links within the same paragraph to open the correct link preview (@Firefox) Retry #2 ─────────────────────────────────────────────────────────────────────────────────────── Error: Timed out 5000ms waiting for expect(locator).toBeVisible() Locator: locator('.components-popover__content .block-editor-link-control') Expected: visible Received: hidden Call log: - expect.toBeVisible with timeout 5000ms - waiting for locator('.components-popover__content .block-editor-link-control') 912 | .click( { delay: 10 } ); 913 | > 914 | await expect( linkPopover ).toBeVisible(); | ^ 915 | await expect( 916 | linkPopover.getByText( 'wordpress.org/gutenberg' ) 917 | ).toBeHidden(); at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/blocks/links.spec.js:914:31
await expect(
linkPopover.getByText( 'wordpress.org/gutenberg' )
).toBeHidden();
await expect(
linkPopover.getByText( 'wordpressfoundation.org/donate/' )
).toBeVisible();
} );

test.describe( 'Editing link text', () => {
test( 'should allow for modification of link text via the Link UI', async ( {
page,
Expand Down

0 comments on commit e0f4252

Please sign in to comment.