@elastic/eui-test-helpers 2.1.0 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/README.md +6 -0
  2. package/lib/cjs/components/call_out/selectors.d.ts +22 -0
  3. package/lib/cjs/components/call_out/selectors.js +36 -0
  4. package/lib/cjs/components/form/field_search/selectors.d.ts +11 -0
  5. package/lib/cjs/components/form/field_search/selectors.js +25 -0
  6. package/lib/cjs/components/pagination/selectors.d.ts +21 -0
  7. package/lib/cjs/components/pagination/selectors.js +35 -0
  8. package/lib/cjs/components/search_bar/selectors.d.ts +11 -0
  9. package/lib/cjs/components/search_bar/selectors.js +25 -0
  10. package/lib/cjs/components/side_nav/selectors.d.ts +21 -0
  11. package/lib/cjs/components/side_nav/selectors.js +35 -0
  12. package/lib/cjs/components/table/selectors.d.ts +15 -0
  13. package/lib/cjs/components/table/selectors.js +29 -0
  14. package/lib/cjs/index.d.ts +6 -0
  15. package/lib/cjs/index.js +66 -24
  16. package/lib/cjs/playwright/components/basic_table/object.d.ts +7 -12
  17. package/lib/cjs/playwright/components/basic_table/object.js +7 -13
  18. package/lib/cjs/playwright/components/call_out/object.d.ts +36 -0
  19. package/lib/cjs/playwright/components/call_out/object.js +84 -0
  20. package/lib/cjs/playwright/components/form/field_search/object.d.ts +21 -0
  21. package/lib/cjs/playwright/components/form/field_search/object.js +51 -0
  22. package/lib/cjs/playwright/components/pagination/object.d.ts +37 -0
  23. package/lib/cjs/playwright/components/pagination/object.js +121 -0
  24. package/lib/cjs/playwright/components/search_bar/object.d.ts +12 -0
  25. package/lib/cjs/playwright/components/search_bar/object.js +26 -0
  26. package/lib/cjs/playwright/components/side_nav/object.d.ts +34 -0
  27. package/lib/cjs/playwright/components/side_nav/object.js +84 -0
  28. package/lib/cjs/playwright/components/table/object.d.ts +28 -0
  29. package/lib/cjs/playwright/components/table/object.js +57 -0
  30. package/lib/cjs/selectors.d.ts +42 -0
  31. package/lib/cjs/selectors.js +42 -30
  32. package/lib/esm/components/call_out/selectors.d.ts +22 -0
  33. package/lib/esm/components/call_out/selectors.js +30 -0
  34. package/lib/esm/components/call_out/selectors.js.map +1 -0
  35. package/lib/esm/components/form/field_search/selectors.d.ts +11 -0
  36. package/lib/esm/components/form/field_search/selectors.js +19 -0
  37. package/lib/esm/components/form/field_search/selectors.js.map +1 -0
  38. package/lib/esm/components/pagination/selectors.d.ts +21 -0
  39. package/lib/esm/components/pagination/selectors.js +29 -0
  40. package/lib/esm/components/pagination/selectors.js.map +1 -0
  41. package/lib/esm/components/search_bar/selectors.d.ts +11 -0
  42. package/lib/esm/components/search_bar/selectors.js +19 -0
  43. package/lib/esm/components/search_bar/selectors.js.map +1 -0
  44. package/lib/esm/components/side_nav/selectors.d.ts +21 -0
  45. package/lib/esm/components/side_nav/selectors.js +29 -0
  46. package/lib/esm/components/side_nav/selectors.js.map +1 -0
  47. package/lib/esm/components/table/selectors.d.ts +15 -0
  48. package/lib/esm/components/table/selectors.js +23 -0
  49. package/lib/esm/components/table/selectors.js.map +1 -0
  50. package/lib/esm/index.d.ts +6 -0
  51. package/lib/esm/index.js +6 -0
  52. package/lib/esm/index.js.map +1 -1
  53. package/lib/esm/playwright/components/basic_table/object.d.ts +7 -12
  54. package/lib/esm/playwright/components/basic_table/object.js +7 -15
  55. package/lib/esm/playwright/components/basic_table/object.js.map +1 -1
  56. package/lib/esm/playwright/components/call_out/object.d.ts +36 -0
  57. package/lib/esm/playwright/components/call_out/object.js +72 -0
  58. package/lib/esm/playwright/components/call_out/object.js.map +1 -0
  59. package/lib/esm/playwright/components/form/field_search/object.d.ts +21 -0
  60. package/lib/esm/playwright/components/form/field_search/object.js +41 -0
  61. package/lib/esm/playwright/components/form/field_search/object.js.map +1 -0
  62. package/lib/esm/playwright/components/pagination/object.d.ts +37 -0
  63. package/lib/esm/playwright/components/pagination/object.js +118 -0
  64. package/lib/esm/playwright/components/pagination/object.js.map +1 -0
  65. package/lib/esm/playwright/components/search_bar/object.d.ts +12 -0
  66. package/lib/esm/playwright/components/search_bar/object.js +20 -0
  67. package/lib/esm/playwright/components/search_bar/object.js.map +1 -0
  68. package/lib/esm/playwright/components/side_nav/object.d.ts +34 -0
  69. package/lib/esm/playwright/components/side_nav/object.js +76 -0
  70. package/lib/esm/playwright/components/side_nav/object.js.map +1 -0
  71. package/lib/esm/playwright/components/table/object.d.ts +28 -0
  72. package/lib/esm/playwright/components/table/object.js +46 -0
  73. package/lib/esm/playwright/components/table/object.js.map +1 -0
  74. package/lib/esm/selectors.d.ts +42 -0
  75. package/lib/esm/selectors.js +12 -0
  76. package/lib/esm/selectors.js.map +1 -1
  77. package/package.json +1 -1
  78. package/src/components/basic_table/README.md +1 -0
  79. package/src/components/call_out/README.md +29 -0
  80. package/src/components/form/field_search/README.md +29 -0
  81. package/src/components/pagination/README.md +31 -0
  82. package/src/components/search_bar/README.md +18 -0
  83. package/src/components/side_nav/README.md +31 -0
  84. package/src/components/table/README.md +31 -0
@@ -7,18 +7,24 @@
7
7
  */
8
8
  import { EuiAccordionSelectors } from './components/accordion/selectors';
9
9
  import { EuiBasicTableSelectors } from './components/basic_table/selectors';
10
+ import { EuiCallOutSelectors } from './components/call_out/selectors';
10
11
  import { EuiColorPickerSelectors } from './components/color_picker/selectors';
11
12
  import { EuiComboBoxSelectors } from './components/combo_box/selectors';
12
13
  import { EuiContextMenuSelectors } from './components/context_menu/selectors';
13
14
  import { EuiDataGridSelectors } from './components/datagrid/selectors';
14
15
  import { EuiDraggableSelectors } from './components/drag_and_drop/selectors';
16
+ import { EuiFieldSearchSelectors } from './components/form/field_search/selectors';
15
17
  import { EuiFilterButtonSelectors } from './components/filter_button/selectors';
16
18
  import { EuiFlyoutSelectors } from './components/flyout/selectors';
17
19
  import { EuiModalSelectors } from './components/modal/selectors';
20
+ import { EuiPaginationSelectors } from './components/pagination/selectors';
18
21
  import { EuiPopoverSelectors } from './components/popover/selectors';
19
22
  import { EuiRangeSelectors } from './components/form/range/selectors';
23
+ import { EuiSearchBarSelectors } from './components/search_bar/selectors';
20
24
  import { EuiSelectableSelectors } from './components/selectable/selectors';
25
+ import { EuiSideNavSelectors } from './components/side_nav/selectors';
21
26
  import { EuiSuperSelectSelectors } from './components/form/super_select/selectors';
27
+ import { EuiTableSelectors } from './components/table/selectors';
22
28
  import { EuiGlobalToastListSelectors } from './components/toast/selectors';
23
29
  import { EuiToolTipSelectors } from './components/tool_tip/selectors';
24
30
  import { EuiTreeViewSelectors } from './components/tree_view/selectors';
@@ -31,18 +37,24 @@ import { EuiTreeViewSelectors } from './components/tree_view/selectors';
31
37
  export const selectors = {
32
38
  accordion: EuiAccordionSelectors,
33
39
  basicTable: EuiBasicTableSelectors,
40
+ callOut: EuiCallOutSelectors,
34
41
  colorPicker: EuiColorPickerSelectors,
35
42
  comboBox: EuiComboBoxSelectors,
36
43
  contextMenu: EuiContextMenuSelectors,
37
44
  dataGrid: EuiDataGridSelectors,
38
45
  draggable: EuiDraggableSelectors,
46
+ fieldSearch: EuiFieldSearchSelectors,
39
47
  filterButton: EuiFilterButtonSelectors,
40
48
  flyout: EuiFlyoutSelectors,
41
49
  modal: EuiModalSelectors,
50
+ pagination: EuiPaginationSelectors,
42
51
  popover: EuiPopoverSelectors,
43
52
  range: EuiRangeSelectors,
53
+ searchBar: EuiSearchBarSelectors,
44
54
  selectable: EuiSelectableSelectors,
55
+ sideNav: EuiSideNavSelectors,
45
56
  superSelect: EuiSuperSelectSelectors,
57
+ table: EuiTableSelectors,
46
58
  globalToastList: EuiGlobalToastListSelectors,
47
59
  toolTip: EuiToolTipSelectors,
48
60
  treeView: EuiTreeViewSelectors,
@@ -1 +1 @@
1
- {"version":3,"file":"selectors.js","sourceRoot":"","sources":["../../src/selectors.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC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AM,8BAA8B,CAAC;AACjE,OAAO,EAAE,2BAA2B,EAAE,MAAM,8BAA8B,CAAC;AAC3E,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAExE;;;;;GAKG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,SAAS,EAAE,qBAAqB;IAChC,UAAU,EAAE,sBAAsB;IAClC,OAAO,EAAE,mBAAmB;IAC5B,WAAW,EAAE,uBAAuB;IACpC,QAAQ,EAAE,oBAAoB;IAC9B,WAAW,EAAE,uBAAuB;IACpC,QAAQ,EAAE,oBAAoB;IAC9B,SAAS,EAAE,qBAAqB;IAChC,WAAW,EAAE,uBAAuB;IACpC,YAAY,EAAE,wBAAwB;IACtC,MAAM,EAAE,kBAAkB;IAC1B,KAAK,EAAE,iBAAiB;IACxB,UAAU,EAAE,sBAAsB;IAClC,OAAO,EAAE,mBAAmB;IAC5B,KAAK,EAAE,iBAAiB;IACxB,SAAS,EAAE,qBAAqB;IAChC,UAAU,EAAE,sBAAsB;IAClC,OAAO,EAAE,mBAAmB;IAC5B,WAAW,EAAE,uBAAuB;IACpC,KAAK,EAAE,iBAAiB;IACxB,eAAe,EAAE,2BAA2B;IAC5C,OAAO,EAAE,mBAAmB;IAC5B,QAAQ,EAAE,oBAAoB;CACtB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elastic/eui-test-helpers",
3
- "version": "2.1.0",
3
+ "version": "2.2.0",
4
4
  "description": "A library of EUI test helpers for RTL, Cypress and Scout",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "repository": {
@@ -20,6 +20,7 @@ Set `data-test-subj` on the `<EuiBasicTable>`/`<EuiInMemoryTable>` (EUI spreads
20
20
  |---|---|
21
21
  | `rows` | `Locator` for the table's data rows, excluding EUI's own "no items found"/error-message row. |
22
22
  | `cells(field)` | `Locator` for a field-data column's cells across all rows, resolved from EUI's own header `data-test-subj`. |
23
+ | `headerCells`, `column(index)`, `cell(row, column)` | Inherited from [EuiTableObject](../table/README.md), positional access when no `field` is available. |
23
24
 
24
25
  `rows` excludes EUI's empty/error message row by filtering out any row whose cell carries a `colspan` — real data rows don't set one, EUI's own placeholder row always does (it spans every column).
25
26
 
@@ -0,0 +1,29 @@
1
+ # EuiCallOutObject
2
+
3
+ Playwright Component Object for [EuiCallOut](https://eui.elastic.co/docs/components/display/callout/).
4
+
5
+ ## Usage
6
+
7
+ ```ts
8
+ import { EuiCallOutObject } from '@elastic/eui-test-helpers';
9
+
10
+ const callOut = new EuiCallOutObject(page, 'myCallOut');
11
+ expect(await callOut.getColor()).toBe('warning');
12
+ expect(await callOut.getTitle()).toBe('Index is read only');
13
+ ```
14
+
15
+ Set `data-test-subj` on `<EuiCallOut>`. EUI puts it on the panel root and derives `<subj>__message`, `<subj>__content` and `<subj>__actions` for the inner blocks. The root lookup matches whole tokens, so those derived values are not mistaken for the root.
16
+
17
+ ## API
18
+
19
+ | Member | Description |
20
+ |---|---|
21
+ | `getTitle()` | The title text, or an empty string without a `title`. |
22
+ | `getText()` | The `text` block, or an empty string without a `text`. |
23
+ | `getColor()` | The color variant read from the root class: `primary`, `success`, `warning` or `danger`. |
24
+ | `dismissButton` | `Locator` for the dismiss button, found by its test subj or its cross icon so a `dismissButtonProps` test subj override still works. Zero elements without `onDismiss`. |
25
+ | `dismiss()` | Click the dismiss button. What follows is the consumer's `onDismiss`, nothing is asserted. |
26
+
27
+ ## Deliberately excluded
28
+
29
+ Custom `children` and `actions` are consumer content, use `locator` to reach them. The `announceOnMount` live region renders a second, off-screen copy of the content under `role="status"`, it is outside the root and does not affect this object.
@@ -0,0 +1,29 @@
1
+ # EuiFieldSearchObject
2
+
3
+ Playwright Component Object for [EuiFieldSearch](https://eui.elastic.co/docs/components/forms/search-and-filter/search/).
4
+
5
+ ## Usage
6
+
7
+ ```ts
8
+ import { EuiFieldSearchObject } from '@elastic/eui-test-helpers';
9
+
10
+ const search = new EuiFieldSearchObject(page, 'mySearch');
11
+ await search.setQuery('logs');
12
+ expect(await search.getQuery()).toBe('logs');
13
+ ```
14
+
15
+ Set `data-test-subj` on `<EuiFieldSearch>`. EUI spreads it onto the `<input type="search">`, which the component-type guard verifies.
16
+
17
+ ## API
18
+
19
+ | Member | Description |
20
+ |---|---|
21
+ | `setQuery(text)` | Replace the text and submit it with Enter. Triggers `onSearch` for both the incremental and the plain variant. |
22
+ | `getQuery()` | The current text of the input. |
23
+ | `clear()` | Empty the input and submit, so `onSearch` receives an empty query. |
24
+
25
+ `clear()` does not use the clear button since it only renders with `isClearable` and a value. Submitting an empty query has the same effect.
26
+
27
+ ## Deliberately excluded
28
+
29
+ Per keystroke `onSearch` of the incremental variant. `setQuery` fills the text in one go and submits once. Use `locator.pressSequentially()` if a test needs every keystroke.
@@ -0,0 +1,31 @@
1
+ # EuiPaginationObject
2
+
3
+ Playwright Component Object for [EuiPagination](https://eui.elastic.co/docs/components/navigation/pagination/). Covers the numbered and the compressed variant.
4
+
5
+ ## Usage
6
+
7
+ ```ts
8
+ import { EuiPaginationObject } from '@elastic/eui-test-helpers';
9
+
10
+ const pagination = new EuiPaginationObject(page, 'myPagination');
11
+ await pagination.goToPage(2);
12
+ expect(await pagination.getActivePage()).toBe(2);
13
+ ```
14
+
15
+ Set `data-test-subj` on `<EuiPagination>`. EUI spreads it onto the `<nav>`, which the component-type guard verifies. Page indexes are 0-based, matching EUI's `activePage` prop and the `pagination-button-<index>` test subjs.
16
+
17
+ ## API
18
+
19
+ | Member | Description |
20
+ |---|---|
21
+ | `getActivePage()` | The 0-based index of the active page. |
22
+ | `getPageCount()` | The total number of pages. |
23
+ | `goToPage(index)` | Go to a page and wait for it to become active. Clicks the page button when rendered, otherwise steps through next or previous. No-op if already active, throws if out of range. |
24
+ | `next()` | Click the next arrow and wait for the page to advance. |
25
+ | `previous()` | Click the previous arrow and wait for the page to go back. |
26
+
27
+ The numbered variant is read from the `aria-current="page"` button and the last page button. The compressed variant is read from its "page of total" text.
28
+
29
+ ## Deliberately excluded
30
+
31
+ `pageCount={0}` (unknown total, "page X of collection") is not covered, `getPageCount` and `goToPage` have nothing to read there. The first and last arrows exist only in the compressed variant, `goToPage(0)` and `goToPage(count - 1)` cover the same need.
@@ -0,0 +1,18 @@
1
+ # EuiSearchBarObject
2
+
3
+ Playwright Component Object for [EuiSearchBar](https://eui.elastic.co/docs/components/forms/search-and-filter/search-bar/).
4
+
5
+ ## Usage
6
+
7
+ ```ts
8
+ import { EuiSearchBarObject } from '@elastic/eui-test-helpers';
9
+
10
+ const searchBar = new EuiSearchBarObject(page, 'mySearchBar');
11
+ await searchBar.setQuery('type:dashboard');
12
+ ```
13
+
14
+ The search bar has no root of its own. Pass the subj through the `box` prop, `box={{ 'data-test-subj': 'mySearchBar' }}`, EUI puts it on the search input. This object is [EuiFieldSearchObject](../form/field_search/README.md) under the search bar's own name, same API: `setQuery(text)`, `getQuery()`, `clear()`.
15
+
16
+ ## Deliberately excluded
17
+
18
+ The filter buttons next to the box are `EuiFilterButton`, use `EuiFilterButtonObject`. Query parsing and the error tooltip are consumer facing results of `onChange`, assert on them in the test.
@@ -0,0 +1,31 @@
1
+ # EuiSideNavObject
2
+
3
+ Playwright Component Object for [EuiSideNav](https://eui.elastic.co/docs/components/navigation/side-nav/).
4
+
5
+ ## Usage
6
+
7
+ ```ts
8
+ import { EuiSideNavObject } from '@elastic/eui-test-helpers';
9
+
10
+ const sideNav = new EuiSideNavObject(page, 'mySideNav');
11
+ await sideNav.expand('Data');
12
+ await sideNav.select('Index Management');
13
+ ```
14
+
15
+ Set `data-test-subj` on `<EuiSideNav>`. EUI spreads it onto the `<nav>`, which the component-type guard verifies. Items are addressed by their exact label.
16
+
17
+ ## API
18
+
19
+ | Member | Description |
20
+ |---|---|
21
+ | `getItems()` | The labels of every rendered item, in document order. |
22
+ | `item(label)` | `Locator` for the clickable element of the item with exactly this label. |
23
+ | `select(label)` | Click the item. Selection is owned by the consumer, usually a route change, so nothing is asserted afterwards. |
24
+ | `getSelected()` | The label of the selected item, or `null`. |
25
+ | `expand(label)` | Expand an accordion item (children, no link or click handler) and wait for its children. No-op if already open. |
26
+
27
+ Closed branches are not in the DOM at all, so `item()` and `getItems()` only see what is rendered. Expand the parent first.
28
+
29
+ ## Deliberately excluded
30
+
31
+ The mobile toggle (`isOpenOnMobile`), the responsive variant is a Kibana layout concern. Custom `renderItem` output is supported only as far as it keeps EUI's item classes.
@@ -0,0 +1,31 @@
1
+ # EuiTableObject
2
+
3
+ Playwright Component Object for [EuiTable](https://eui.elastic.co/docs/components/tabular-content/tables/), the low level table built from `EuiTableHeader`, `EuiTableRow` and `EuiTableRowCell`. `EuiBasicTableObject` extends it for `EuiBasicTable` and `EuiInMemoryTable`, use that one when the table has field based columns.
4
+
5
+ ## Usage
6
+
7
+ ```ts
8
+ import { EuiTableObject } from '@elastic/eui-test-helpers';
9
+
10
+ const table = new EuiTableObject(page, 'myTable');
11
+ await expect(table.rows).toHaveCount(3);
12
+ await expect(table.column(1)).toHaveText(['Running', 'Finished', 'Archived']);
13
+ await expect(table.cell(0, 1)).toHaveText('Running');
14
+ ```
15
+
16
+ Set `data-test-subj` on `<EuiTable>`. EUI spreads it onto the `<table>`, which the component-type guard verifies.
17
+
18
+ ## API
19
+
20
+ | Member | Description |
21
+ |---|---|
22
+ | `rows` | `Locator` for the body rows. |
23
+ | `headerCells` | `Locator` for the header cells, in column order, including a selection checkbox cell. |
24
+ | `column(index)` | `Locator` for one column's cells across all body rows, by 0-based position. |
25
+ | `cell(row, column)` | `Locator` for one body cell, by 0-based row and column position. |
26
+
27
+ Columns are addressed by position because a plain `EuiTable` has no field names. `column` and `cell` match direct children of a row only, both `<td>` and `<th>` since EUI renders a row header cell as `<th scope="row">`.
28
+
29
+ ## Deliberately excluded
30
+
31
+ Sorting, selection and pagination are not covered. Sorting and selection are consumer wiring on a plain table, and pagination is a separate component.