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

CustomSelectControlV2: Stabilize tests #60133

Merged
merged 2 commits into from
Mar 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -388,8 +388,10 @@ describe.each( [
await sleep();
await press.Tab();
expect( currentSelectedItem ).toHaveFocus();
expect( currentSelectedItem ).toHaveTextContent( 'violets' );

await type( 'aq' );
Copy link
Member Author

Choose a reason for hiding this comment

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

Apparently the multi-character typeahead is causing the flakiness. I think it'd be an acceptable compromise to test only a single-character typeahead.

Copy link
Contributor

Choose a reason for hiding this comment

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

Is it worth adding an inline comment here, and in the non-legacy component test, flagging this as deliberately avoiding the multi-character typeahead?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good idea, will do 👍

// Ideally we would test a multi-character typeahead, but anything more than a single character is flaky
await type( 'a' );

expect(
screen.queryByRole( 'listbox', {
Expand All @@ -398,8 +400,10 @@ describe.each( [
} )
).not.toBeInTheDocument();

// This Enter is a workaround for flakiness, and shouldn't be necessary in an actual browser
await press.Enter();
expect( currentSelectedItem ).toHaveTextContent( 'aquamarine' );

expect( currentSelectedItem ).toHaveTextContent( 'amber' );
} );

it( 'Should have correct aria-selected value for selections', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,10 @@ describe.each( [
await sleep();
await press.Tab();
expect( currentSelectedItem ).toHaveFocus();
expect( currentSelectedItem ).toHaveTextContent( 'violets' );

await type( 'aq' );
// Ideally we would test a multi-character typeahead, but anything more than a single character is flaky
await type( 'a' );

expect(
screen.queryByRole( 'listbox', {
Expand All @@ -185,8 +187,10 @@ describe.each( [
} )
).not.toBeInTheDocument();

// This Enter is a workaround for flakiness, and shouldn't be necessary in an actual browser
await press.Enter();
expect( currentSelectedItem ).toHaveTextContent( 'aquamarine' );

expect( currentSelectedItem ).toHaveTextContent( 'amber' );
} );

it( 'Should have correct aria-selected value for selections', async () => {
Expand Down