Skip to content

[table_list_view_table] stabilize jest test#254991

Merged
tsullivan merged 7 commits intoelastic:mainfrom
tsullivan:fix-jest/253562
Mar 11, 2026
Merged

[table_list_view_table] stabilize jest test#254991
tsullivan merged 7 commits intoelastic:mainfrom
tsullivan:fix-jest/253562

Conversation

@tsullivan
Copy link
Copy Markdown
Member

@tsullivan tsullivan commented Feb 25, 2026

Summary

Closes #253562

Stabilizes the created_by filter Jest tests for TableListViewTable by making user interactions more deterministic and splitting assertions into smaller, focused test cases.

Checklist

Check the PR satisfies following conditions.

Reviewers should verify this PR satisfies this list as well.

  • [ ] Any text added follows EUI's writing guidelines, uses sentence case text and includes i18n support
  • [ ] Documentation was added for features that require explanation or tutorials
  • [ ] Unit or functional tests were updated or added to match the most common scenarios
  • [ ] If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the docker list
  • [ ] This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The release_note:breaking label should be applied in these situations.
  • [ ] Flaky Test Runner was used on any tests changed
  • The PR description includes the appropriate Release Notes section, and the correct release_note:* label is applied per the guidelines
  • Review the backport guidelines and apply applicable backport:* labels.

@tsullivan tsullivan requested a review from a team as a code owner February 25, 2026 18:28
@tsullivan tsullivan added release_note:skip Skip the PR/issue when compiling release notes backport:skip This PR does not require backporting labels Feb 25, 2026
@tsullivan tsullivan requested a review from Copilot February 25, 2026 18:28
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Stabilizes the created_by filter Jest tests for TableListViewTable by making user interactions more deterministic and splitting assertions into smaller, focused test cases.

Changes:

  • Switches to a shared userEvent instance initialized via userEvent.setup({ delay: null }).
  • Refactors and splits the creator-filter test into multiple targeted tests (options shown, single creator filter, multiple creators filter).
  • Makes the “no creators” assertion more robust by asserting on the rendered message container/text.

Comment on lines 135 to 136
const userSelectablePopover = screen.getByTestId('userSelectableList');
const popover = within(userSelectablePopover);
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

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

To improve test stability, avoid getByTestId for elements that may render asynchronously after a click. Using await screen.findByTestId('userSelectableList') here will better align with the PR’s goal of reducing flakiness (this pattern also repeats in other tests in this file).

Copilot uses AI. Check for mistakes.
Comment on lines +237 to +242
const messageContainer = await popover.findByTestId(
'euiSelectableMessage',
{},
{ timeout: 3000 }
);
expect(within(messageContainer).getByText(/none of the.*have creators/i)).toBeVisible();
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

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

This assertion relies on an EUI-internal test id (euiSelectableMessage) and a hard-coded timeout (3000ms), both of which can make tests brittle/slow over time. Prefer asserting via user-visible content/roles (e.g., findByText for the empty-state copy) and avoid custom timeouts unless there’s a strong need (or centralize the timeout in a shared constant).

Suggested change
const messageContainer = await popover.findByTestId(
'euiSelectableMessage',
{},
{ timeout: 3000 }
);
expect(within(messageContainer).getByText(/none of the.*have creators/i)).toBeVisible();
const emptyStateMessage = await popover.findByText(/none of the.*have creators/i);
expect(emptyStateMessage).toBeVisible();

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

👎 findByText throws when multiple elements match

});

test('should be able to filter by creators', async () => {
test('shows creator filter options when popover is opened', async () => {
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

single long-running test has been split up into 3

Copy link
Copy Markdown
Contributor

@Dosant Dosant left a comment

Choose a reason for hiding this comment

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

Thank you, Tim!

Dosant and others added 3 commits February 26, 2026 11:06
…w_table/src/__jest__/created_by_filter.test.tsx

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@tsullivan tsullivan enabled auto-merge (squash) March 6, 2026 17:12
@tsullivan
Copy link
Copy Markdown
Member Author

/ci

@tsullivan
Copy link
Copy Markdown
Member Author

/sync-ci

@tsullivan tsullivan disabled auto-merge March 6, 2026 20:23
@tsullivan tsullivan enabled auto-merge (squash) March 6, 2026 20:24
@tsullivan tsullivan merged commit c2ab4d1 into elastic:main Mar 11, 2026
19 checks passed
@elasticmachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

Metrics [docs]

✅ unchanged

History

mbondyra added a commit to mbondyra/kibana that referenced this pull request Mar 11, 2026
…e_fix

* commit '565f7545c422192218b803874fbdf93e8d8f08ee': (27 commits)
  [Lens API] ESQL schema for XY separately for Agent and some small token optimizations (elastic#256885)
  Fix "Accessing resource attributes before async attributes settled" telemetry error (elastic#256880)
  [Security Solution][Attacks/Alerts][Attacks page][Table section] Preserver "Sort by" state on Attacks page (elastic#256717) (elastic#256795)
  [APM] Improve redirect with default date range guard (elastic#256887)
  [Security Solution][Attacks/Alerts][Attacks page][Table section] Add assignees avatars to the group component (elastic#250126) (elastic#256901)
  [Docs] add xpack.alerting.rules.maxScheduledPerMinute setting description (elastic#257041)
  [SO] Fix non-deterministic ordering in nested find API integration tests (elastic#256447)
  [Write-restricted dashboards] Update user profile retrieval for getShouldAddAccessControl (elastic#255065)
  [One Workflow] Add Scout API test scaffold and execution tests (elastic#256300)
  [Fleet] add use_apm if dynamic_signal_types are enabled (elastic#256429)
  [Fleet] ignore data streams starting with `.` in Fleet API (elastic#256625)
  [ES|QL] METRICS_INFO support: columns_after & summary (elastic#256758)
  [Agent Builder] Agent plugins: initial installation support (elastic#256478)
  [Streams] Add field descriptions and documentation-only field overrides (elastic#255136)
  [api-docs] 2026-03-11 Daily api_docs build (elastic#257023)
  [Security Solution] fix alerts page infinite loading state due to data view error (elastic#256983)
  [Logging] Add `service.*` global fields (elastic#256878)
  [Canvas] Apply embeddable transforms to embeddable elements (elastic#252191)
  [table_list_view_table] stabilize jest test (elastic#254991)
  [Obs AI] get_index_info: add unit tests (elastic#256802)
  ...
sorenlouv pushed a commit that referenced this pull request Mar 17, 2026
## Summary

Closes #253562

Stabilizes the `created_by` filter Jest tests for `TableListViewTable`
by making user interactions more deterministic and splitting assertions
into smaller, focused test cases.

### Checklist

Check the PR satisfies following conditions. 

Reviewers should verify this PR satisfies this list as well.

- ~[ ] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)~
- ~[ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials~
- ~[ ] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios~
- ~[ ] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)~
- ~[ ] This was checked for breaking HTTP API changes, and any breaking
changes have been approved by the breaking-change committee. The
`release_note:breaking` label should be applied in these situations.~
- ~[ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed~
- [x] The PR description includes the appropriate Release Notes section,
and the correct `release_note:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
- [x] Review the [backport
guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)
and apply applicable `backport:*` labels.

---------

Co-authored-by: Anton Dosov <anton.dosov@elastic.co>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting release_note:skip Skip the PR/issue when compiling release notes v9.4.0

Projects

None yet

5 participants