Skip to content

[test-helpers] Add EuiBasicTableObject - #9933

Merged
steliosmavro merged 4 commits into
elastic:mainfrom
steliosmavro:stelios/test-helpers-basic-table
Aug 25, 2026
Merged

[test-helpers] Add EuiBasicTableObject#9933
steliosmavro merged 4 commits into
elastic:mainfrom
steliosmavro:stelios/test-helpers-basic-table

Conversation

@steliosmavro

Copy link
Copy Markdown
Contributor

Summary

Adds EuiBasicTableObject, a Playwright Component Object for EuiBasicTable (also covers EuiInMemoryTable, which renders a EuiBasicTable underneath and passes data-test-subj straight through), following the package's CONTRIBUTING guide.

Prototyped and validated against a real Kibana consumer first per the guide's lifecycle. Kibana PR: elastic/kibana#285999 (CI green, 8/8 + 24/24 on a repeat-3 flake check).

API

Deliberately minimal, per the package's "minimal public API" principle — only what the validating consumer (a maintenance windows table) actually needed:

  • rows: a Locator for the table's data rows, excluding EUI's own "no items found"/error-message row (detected via the colspan HTML attribute EUI sets on that row's single cell — real data rows don't set it).
  • cells(field): a Locator for a field-data column's cells across all rows, resolved from EUI's own header test-subj (tableHeaderCell_<field>_<digits>, matched exactly to avoid a status/status_detail-style collision) via the header's native cellIndex, then read positionally — matches both <td> and <th> since a rowHeader column renders as <th scope="row">.

Both return Locators rather than value snapshots, so callers get retrying assertions for free.

Deliberately excluded from v1

  • Row actions: app-supplied test-subjs from a custom-rendered column in the validating consumer, not EUI-internal DOM.
  • Sorting: no evidenced Scout consumer sorts a table yet.
  • Pagination: the one candidate consumer is closer to testing EUI's own pagination through the app than app behavior, and its test-subjs are already stable/EUI-owned.

Testing

tsc --noEmit clean. Playwright validation specs pass against Storybook (Tabular Content/EuiBasicTable Playground + EmptyTable stories): 5/5, covering checkbox-offset column resolution, the rowHeader/<th> case (caught a real off-by-selector-tag bug during authoring — fixed), the empty-state row exclusion, and an unknown-field rejection.

@steliosmavro steliosmavro self-assigned this Aug 20, 2026
@steliosmavro
steliosmavro marked this pull request as ready for review August 20, 2026 05:56
@steliosmavro
steliosmavro requested a review from a team as a code owner August 20, 2026 05:56
@mgadewoll
mgadewoll self-requested a review August 24, 2026 13:24
Comment thread packages/test-helpers/src/playwright/components/basic_table/object.ts Outdated
…ame collision

- The 'no column with field' error surfaced the internally-escaped
  regex pattern instead of the original field string (e.g. a caller
  passing 'a.b' would see 'a\.b' in the message). Pass the original
  field through separately and use it in the message.
- Document that a computed column's data-test-subj is generated from
  its 'name' using the same tableHeaderCell_<x>_<index> shape a
  field-data column uses for 'field' — cells() can't distinguish the
  two from the DOM alone, so a same-named computed column is an
  edge case worth knowing about.

Addresses review feedback from @mgadewoll.
@steliosmavro
steliosmavro requested a review from mgadewoll August 25, 2026 07:12
@infra-vault-gh-plugin-prod

Copy link
Copy Markdown

💚 Build Succeeded

History

cc @steliosmavro

@infra-vault-gh-plugin-prod

Copy link
Copy Markdown

💚 Build Succeeded

History

cc @steliosmavro

@mgadewoll mgadewoll left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 LGTM. Thanks for the updates!

@steliosmavro
steliosmavro merged commit 1d0f9ff into elastic:main Aug 25, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants