Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix unreliable link test #13161

Merged
merged 2 commits into from
Apr 16, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions packages/e2e-tests/specs/links.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ describe( 'Links', () => {

// Test for regressions of https://github.com/WordPress/gutenberg/issues/10496.
// Disabled until improved as it wasn't reliable enough.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment should have been removed.

it.skip( 'allows autocomplete suggestions to be selected with the mouse', async () => {
it( 'allows autocomplete suggestions to be selected with the mouse', async () => {
// First create a post that we can search for using the link autocompletion.
const titleText = 'Test post mouse';
const postURL = await createPostWithTitle( titleText );
Expand All @@ -284,11 +284,12 @@ describe( 'Links', () => {
await waitForAutoFocus();

await page.keyboard.type( titleText );
await page.waitForSelector( '.block-editor-url-input__suggestion' );
const autocompleteSuggestions = await page.$x( `//*[contains(@class, "block-editor-url-input__suggestion")]//button[contains(text(), '${ titleText }')]` );
const suggestionXPath = `//*[contains(@class, "block-editor-url-input__suggestion")]//button[contains(text(), '${ titleText }')]`;
await page.waitForXPath( suggestionXPath );
const autocompleteSuggestions = await page.$x( suggestionXPath );

// Expect there to be some autocomplete suggestions.
expect( autocompleteSuggestions.length ).toBeGreaterThan( 0 );
expect( autocompleteSuggestions ).toHaveLength( 1 );

const firstSuggestion = autocompleteSuggestions[ 0 ];

Expand Down Expand Up @@ -330,7 +331,7 @@ describe( 'Links', () => {
const autocompleteSuggestions = await page.$x( `//*[contains(@class, "block-editor-url-input__suggestion")]//button[contains(text(), '${ titleText }')]` );

// Expect there to be some autocomplete suggestions.
expect( autocompleteSuggestions.length ).toBeGreaterThan( 0 );
expect( autocompleteSuggestions ).toHaveLength( 1 );

// Expect the the first suggestion to be selected when pressing the down arrow.
await page.keyboard.press( 'ArrowDown' );
Expand Down