@elastic/eui-test-helpers 1.4.0 → 1.5.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 (51) hide show
  1. package/README.md +4 -0
  2. package/lib/cjs/components/basic_table/selectors.d.ts +17 -0
  3. package/lib/cjs/components/basic_table/selectors.js +31 -0
  4. package/lib/cjs/components/drag_and_drop/selectors.d.ts +15 -0
  5. package/lib/cjs/components/drag_and_drop/selectors.js +29 -0
  6. package/lib/cjs/components/filter_button/selectors.d.ts +16 -0
  7. package/lib/cjs/components/filter_button/selectors.js +30 -0
  8. package/lib/cjs/components/form/range/selectors.d.ts +11 -0
  9. package/lib/cjs/components/form/range/selectors.js +25 -0
  10. package/lib/cjs/index.d.ts +4 -0
  11. package/lib/cjs/index.js +29 -1
  12. package/lib/cjs/playwright/components/basic_table/object.d.ts +50 -0
  13. package/lib/cjs/playwright/components/basic_table/object.js +93 -0
  14. package/lib/cjs/playwright/components/drag_and_drop/object.d.ts +21 -0
  15. package/lib/cjs/playwright/components/drag_and_drop/object.js +48 -0
  16. package/lib/cjs/playwright/components/filter_button/object.d.ts +31 -0
  17. package/lib/cjs/playwright/components/filter_button/object.js +51 -0
  18. package/lib/cjs/playwright/components/form/range/object.d.ts +25 -0
  19. package/lib/cjs/playwright/components/form/range/object.js +48 -0
  20. package/lib/esm/components/basic_table/selectors.d.ts +17 -0
  21. package/lib/esm/components/basic_table/selectors.js +25 -0
  22. package/lib/esm/components/basic_table/selectors.js.map +1 -0
  23. package/lib/esm/components/drag_and_drop/selectors.d.ts +15 -0
  24. package/lib/esm/components/drag_and_drop/selectors.js +23 -0
  25. package/lib/esm/components/drag_and_drop/selectors.js.map +1 -0
  26. package/lib/esm/components/filter_button/selectors.d.ts +16 -0
  27. package/lib/esm/components/filter_button/selectors.js +24 -0
  28. package/lib/esm/components/filter_button/selectors.js.map +1 -0
  29. package/lib/esm/components/form/range/selectors.d.ts +11 -0
  30. package/lib/esm/components/form/range/selectors.js +19 -0
  31. package/lib/esm/components/form/range/selectors.js.map +1 -0
  32. package/lib/esm/index.d.ts +4 -0
  33. package/lib/esm/index.js +4 -0
  34. package/lib/esm/index.js.map +1 -1
  35. package/lib/esm/playwright/components/basic_table/object.d.ts +50 -0
  36. package/lib/esm/playwright/components/basic_table/object.js +76 -0
  37. package/lib/esm/playwright/components/basic_table/object.js.map +1 -0
  38. package/lib/esm/playwright/components/drag_and_drop/object.d.ts +21 -0
  39. package/lib/esm/playwright/components/drag_and_drop/object.js +40 -0
  40. package/lib/esm/playwright/components/drag_and_drop/object.js.map +1 -0
  41. package/lib/esm/playwright/components/filter_button/object.d.ts +31 -0
  42. package/lib/esm/playwright/components/filter_button/object.js +43 -0
  43. package/lib/esm/playwright/components/filter_button/object.js.map +1 -0
  44. package/lib/esm/playwright/components/form/range/object.d.ts +25 -0
  45. package/lib/esm/playwright/components/form/range/object.js +39 -0
  46. package/lib/esm/playwright/components/form/range/object.js.map +1 -0
  47. package/package.json +1 -1
  48. package/src/components/basic_table/README.md +30 -0
  49. package/src/components/drag_and_drop/README.md +23 -0
  50. package/src/components/filter_button/README.md +29 -0
  51. package/src/components/form/range/README.md +31 -0
package/README.md CHANGED
@@ -51,6 +51,10 @@ their own version at runtime.
51
51
  | `EuiSuperSelectObject` | [src/components/form/super_select/README.md](src/components/form/super_select/README.md) |
52
52
  | `EuiGlobalToastListObject` | [src/components/toast/README.md](src/components/toast/README.md) |
53
53
  | `EuiSelectableObject` | [src/components/selectable/README.md](src/components/selectable/README.md) |
54
+ | `EuiDraggableObject` | [src/components/drag_and_drop/README.md](src/components/drag_and_drop/README.md) |
55
+ | `EuiFilterButtonObject` | [src/components/filter_button/README.md](src/components/filter_button/README.md) |
56
+ | `EuiRangeObject` | [src/components/form/range/README.md](src/components/form/range/README.md) |
57
+ | `EuiBasicTableObject` | [src/components/basic_table/README.md](src/components/basic_table/README.md) |
54
58
 
55
59
  ## Contributing
56
60
 
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Stable selectors for
3
+ * {@link https://eui.elastic.co/docs/components/tabular-content/tables/|EuiBasicTable}
4
+ * (also covers `EuiInMemoryTable`, which renders a `EuiBasicTable` underneath).
5
+ * `*_SELECTOR` values are CSS.
6
+ */
7
+ export declare const EuiBasicTableSelectors: {
8
+ /** Root element (the `.euiBasicTable` container carrying the consumer's `data-test-subj`). */
9
+ ROOT_SELECTOR: string;
10
+ /** A data row. Also matches EUI's own empty/error message row — callers must exclude those. */
11
+ ROW_SELECTOR: string;
12
+ /**
13
+ * A field-data column's header cell. `%s` is the column's `field`. EUI appends a
14
+ * positional index (`tableHeaderCell_<field>_<index>`), so this is a prefix match.
15
+ */
16
+ HEADER_CELL_SELECTOR_PREFIX: string;
17
+ };
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.EuiBasicTableSelectors = void 0;
7
+ /*
8
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
9
+ * or more contributor license agreements. Licensed under the Elastic License
10
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
11
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
12
+ * Side Public License, v 1.
13
+ */
14
+
15
+ /**
16
+ * Stable selectors for
17
+ * {@link https://eui.elastic.co/docs/components/tabular-content/tables/|EuiBasicTable}
18
+ * (also covers `EuiInMemoryTable`, which renders a `EuiBasicTable` underneath).
19
+ * `*_SELECTOR` values are CSS.
20
+ */
21
+ const EuiBasicTableSelectors = exports.EuiBasicTableSelectors = {
22
+ /** Root element (the `.euiBasicTable` container carrying the consumer's `data-test-subj`). */
23
+ ROOT_SELECTOR: '.euiBasicTable',
24
+ /** A data row. Also matches EUI's own empty/error message row — callers must exclude those. */
25
+ ROW_SELECTOR: '.euiTableRow',
26
+ /**
27
+ * A field-data column's header cell. `%s` is the column's `field`. EUI appends a
28
+ * positional index (`tableHeaderCell_<field>_<index>`), so this is a prefix match.
29
+ */
30
+ HEADER_CELL_SELECTOR_PREFIX: 'tableHeaderCell_'
31
+ };
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Stable selectors for
3
+ * {@link https://eui.elastic.co/docs/components/drag-and-drop/|EuiDraggable}.
4
+ * `*_SELECTOR` values are CSS.
5
+ */
6
+ export declare const EuiDraggableSelectors: {
7
+ /**
8
+ * Attribute `@hello-pangea/dnd` (which `EuiDraggable` wraps) spreads onto an
9
+ * enabled drag handle. Used to verify `testSubj` actually points at a handle,
10
+ * not a fixed EUI class — the handle markup itself is consumer-defined.
11
+ */
12
+ HANDLE_SELECTOR: string;
13
+ /** Attribute `@hello-pangea/dnd` spreads onto every draggable item wrapper, enabled or not. */
14
+ ITEM_SELECTOR: string;
15
+ };
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.EuiDraggableSelectors = void 0;
7
+ /*
8
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
9
+ * or more contributor license agreements. Licensed under the Elastic License
10
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
11
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
12
+ * Side Public License, v 1.
13
+ */
14
+
15
+ /**
16
+ * Stable selectors for
17
+ * {@link https://eui.elastic.co/docs/components/drag-and-drop/|EuiDraggable}.
18
+ * `*_SELECTOR` values are CSS.
19
+ */
20
+ const EuiDraggableSelectors = exports.EuiDraggableSelectors = {
21
+ /**
22
+ * Attribute `@hello-pangea/dnd` (which `EuiDraggable` wraps) spreads onto an
23
+ * enabled drag handle. Used to verify `testSubj` actually points at a handle,
24
+ * not a fixed EUI class — the handle markup itself is consumer-defined.
25
+ */
26
+ HANDLE_SELECTOR: '[data-rfd-drag-handle-draggable-id]',
27
+ /** Attribute `@hello-pangea/dnd` spreads onto every draggable item wrapper, enabled or not. */
28
+ ITEM_SELECTOR: '[data-rfd-draggable-id]'
29
+ };
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Stable selectors for
3
+ * {@link https://eui.elastic.co/docs/components/forms/filter-group/|EuiFilterButton}.
4
+ * `*_SELECTOR` values are CSS, `*_CLASS` values are class names to check for
5
+ * membership (e.g. via `toHaveClass`).
6
+ */
7
+ export declare const EuiFilterButtonSelectors: {
8
+ /** Root element (the button itself carries the consumer's `data-test-subj`). */
9
+ ROOT_SELECTOR: string;
10
+ /** The notification badge, present only when `numFilters` or `numActiveFilters` is set. */
11
+ NOTIFICATION_SELECTOR: string;
12
+ /** Set when `hasActiveFilters` is true. */
13
+ HAS_ACTIVE_FILTERS_CLASS: string;
14
+ /** Set when `isSelected` is true (e.g. a popover-toggle button while its popover is open). */
15
+ IS_SELECTED_CLASS: string;
16
+ };
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.EuiFilterButtonSelectors = void 0;
7
+ /*
8
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
9
+ * or more contributor license agreements. Licensed under the Elastic License
10
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
11
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
12
+ * Side Public License, v 1.
13
+ */
14
+
15
+ /**
16
+ * Stable selectors for
17
+ * {@link https://eui.elastic.co/docs/components/forms/filter-group/|EuiFilterButton}.
18
+ * `*_SELECTOR` values are CSS, `*_CLASS` values are class names to check for
19
+ * membership (e.g. via `toHaveClass`).
20
+ */
21
+ const EuiFilterButtonSelectors = exports.EuiFilterButtonSelectors = {
22
+ /** Root element (the button itself carries the consumer's `data-test-subj`). */
23
+ ROOT_SELECTOR: '.euiFilterButton',
24
+ /** The notification badge, present only when `numFilters` or `numActiveFilters` is set. */
25
+ NOTIFICATION_SELECTOR: '.euiFilterButton__notification',
26
+ /** Set when `hasActiveFilters` is true. */
27
+ HAS_ACTIVE_FILTERS_CLASS: 'euiFilterButton-hasActiveFilters',
28
+ /** Set when `isSelected` is true (e.g. a popover-toggle button while its popover is open). */
29
+ IS_SELECTED_CLASS: 'euiFilterButton-isSelected'
30
+ };
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Stable selectors for
3
+ * {@link https://eui.elastic.co/docs/components/forms/range-controls/|EuiRange}
4
+ * and `EuiDualRange`. `*_SELECTOR` values are CSS.
5
+ */
6
+ export declare const EuiRangeSelectors: {
7
+ /** The native `<input type="range">` element that carries the actual value. */
8
+ SLIDER_SELECTOR: string;
9
+ /** The visible number input, rendered on a plain `EuiRange` with `showInput`. See the package README for why it can share `data-test-subj` with {@link SLIDER_SELECTOR}. */
10
+ NUMBER_INPUT_SELECTOR: string;
11
+ };
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.EuiRangeSelectors = void 0;
7
+ /*
8
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
9
+ * or more contributor license agreements. Licensed under the Elastic License
10
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
11
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
12
+ * Side Public License, v 1.
13
+ */
14
+
15
+ /**
16
+ * Stable selectors for
17
+ * {@link https://eui.elastic.co/docs/components/forms/range-controls/|EuiRange}
18
+ * and `EuiDualRange`. `*_SELECTOR` values are CSS.
19
+ */
20
+ const EuiRangeSelectors = exports.EuiRangeSelectors = {
21
+ /** The native `<input type="range">` element that carries the actual value. */
22
+ SLIDER_SELECTOR: '.euiRangeSlider',
23
+ /** The visible number input, rendered on a plain `EuiRange` with `showInput`. See the package README for why it can share `data-test-subj` with {@link SLIDER_SELECTOR}. */
24
+ NUMBER_INPUT_SELECTOR: '.euiRangeInput'
25
+ };
@@ -4,3 +4,7 @@ export { EuiDataGridObject } from './playwright/components/datagrid/object';
4
4
  export { EuiSuperSelectObject } from './playwright/components/form/super_select/object';
5
5
  export { EuiGlobalToastListObject } from './playwright/components/toast/object';
6
6
  export { EuiSelectableObject } from './playwright/components/selectable/object';
7
+ export { EuiDraggableObject } from './playwright/components/drag_and_drop/object';
8
+ export { EuiFilterButtonObject } from './playwright/components/filter_button/object';
9
+ export { EuiRangeObject } from './playwright/components/form/range/object';
10
+ export { EuiBasicTableObject } from './playwright/components/basic_table/object';
package/lib/cjs/index.js CHANGED
@@ -9,6 +9,12 @@ Object.defineProperty(exports, "BaseObject", {
9
9
  return _base_object.BaseObject;
10
10
  }
11
11
  });
12
+ Object.defineProperty(exports, "EuiBasicTableObject", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _object9.EuiBasicTableObject;
16
+ }
17
+ });
12
18
  Object.defineProperty(exports, "EuiComboBoxObject", {
13
19
  enumerable: true,
14
20
  get: function () {
@@ -21,12 +27,30 @@ Object.defineProperty(exports, "EuiDataGridObject", {
21
27
  return _object2.EuiDataGridObject;
22
28
  }
23
29
  });
30
+ Object.defineProperty(exports, "EuiDraggableObject", {
31
+ enumerable: true,
32
+ get: function () {
33
+ return _object6.EuiDraggableObject;
34
+ }
35
+ });
36
+ Object.defineProperty(exports, "EuiFilterButtonObject", {
37
+ enumerable: true,
38
+ get: function () {
39
+ return _object7.EuiFilterButtonObject;
40
+ }
41
+ });
24
42
  Object.defineProperty(exports, "EuiGlobalToastListObject", {
25
43
  enumerable: true,
26
44
  get: function () {
27
45
  return _object4.EuiGlobalToastListObject;
28
46
  }
29
47
  });
48
+ Object.defineProperty(exports, "EuiRangeObject", {
49
+ enumerable: true,
50
+ get: function () {
51
+ return _object8.EuiRangeObject;
52
+ }
53
+ });
30
54
  Object.defineProperty(exports, "EuiSelectableObject", {
31
55
  enumerable: true,
32
56
  get: function () {
@@ -44,4 +68,8 @@ var _object = require("./playwright/components/combo_box/object");
44
68
  var _object2 = require("./playwright/components/datagrid/object");
45
69
  var _object3 = require("./playwright/components/form/super_select/object");
46
70
  var _object4 = require("./playwright/components/toast/object");
47
- var _object5 = require("./playwright/components/selectable/object");
71
+ var _object5 = require("./playwright/components/selectable/object");
72
+ var _object6 = require("./playwright/components/drag_and_drop/object");
73
+ var _object7 = require("./playwright/components/filter_button/object");
74
+ var _object8 = require("./playwright/components/form/range/object");
75
+ var _object9 = require("./playwright/components/basic_table/object");
@@ -0,0 +1,50 @@
1
+ import type { Locator } from '@playwright/test';
2
+ import { BaseObject, type ObjectScope } from '../../base_object';
3
+ /**
4
+ * Playwright Component Object for {@link
5
+ * https://eui.elastic.co/docs/components/tabular-content/tables/ EuiBasicTable}
6
+ * (also covers `EuiInMemoryTable`, which renders a `EuiBasicTable` underneath and
7
+ * passes the `data-test-subj` straight through — there is no separate object for it).
8
+ *
9
+ * `testSubj` must match the `data-test-subj` set by the consumer on the
10
+ * `<EuiBasicTable>`/`<EuiInMemoryTable>` (EUI spreads it onto the `.euiBasicTable`
11
+ * root). See the package README for what's deliberately excluded from v1.
12
+ */
13
+ export declare class EuiBasicTableObject extends BaseObject {
14
+ constructor(scope: ObjectScope, testSubj: string);
15
+ /**
16
+ * The table's data rows, as a `Locator` so callers keep Playwright auto-retry
17
+ * for count and content assertions (e.g. `expect(table.rows).toHaveCount(3)`).
18
+ *
19
+ * Excludes EUI's own "no items found" (and error-message) row: when the table
20
+ * is empty, EUI still renders a single `.euiTableRow` whose one cell spans
21
+ * every column (`colSpan` on `EuiTableRowCell`, the `td[colspan]` HTML
22
+ * attribute). Real data rows don't set `colspan` on their cells, so filtering
23
+ * it out is what keeps `toHaveCount(0)` correct on an empty table instead of
24
+ * reading `1`.
25
+ */
26
+ get rows(): Locator;
27
+ /**
28
+ * The cells of the given field-data column, one per row, as a `Locator` for
29
+ * retrying content/count assertions (e.g.
30
+ * `expect(await table.cells('status')).toHaveText(['Running'])`).
31
+ *
32
+ * Resolves the column's position from EUI's own header cell
33
+ * (`tableHeaderCell_<field>_<index>`, matched exactly so a column named e.g.
34
+ * `status` doesn't also match a `status_detail` header) via its native
35
+ * `cellIndex`, then reads the cell at that position in every row — the same
36
+ * positional alignment EUI itself relies on, so it holds regardless of a
37
+ * leading selection-checkbox column. Matches both `<td>` and `<th>`: EUI
38
+ * renders the `rowHeader` column's body cell as a `<th scope="row">` for
39
+ * accessibility, not a `<td>`. Throws if no column with that `field` is
40
+ * rendered.
41
+ *
42
+ * EUI generates a computed column's header test-subj from its `name` using
43
+ * this exact same `tableHeaderCell_<name>_<index>` shape (there's no `field`
44
+ * to key on), so a computed column whose `name` happens to equal another
45
+ * column's `field` can resolve ambiguously — this method can't distinguish
46
+ * the two from the DOM alone. Not expected in practice; call it out if you
47
+ * hit it.
48
+ */
49
+ cells(field: string): Promise<Locator>;
50
+ }
@@ -0,0 +1,93 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.EuiBasicTableObject = void 0;
7
+ var _base_object = require("../../base_object");
8
+ var _selectors = require("../../../components/basic_table/selectors");
9
+ /*
10
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
11
+ * or more contributor license agreements. Licensed under the Elastic License
12
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
13
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
14
+ * Side Public License, v 1.
15
+ */
16
+
17
+ /**
18
+ * Playwright Component Object for {@link
19
+ * https://eui.elastic.co/docs/components/tabular-content/tables/ EuiBasicTable}
20
+ * (also covers `EuiInMemoryTable`, which renders a `EuiBasicTable` underneath and
21
+ * passes the `data-test-subj` straight through — there is no separate object for it).
22
+ *
23
+ * `testSubj` must match the `data-test-subj` set by the consumer on the
24
+ * `<EuiBasicTable>`/`<EuiInMemoryTable>` (EUI spreads it onto the `.euiBasicTable`
25
+ * root). See the package README for what's deliberately excluded from v1.
26
+ */
27
+ class EuiBasicTableObject extends _base_object.BaseObject {
28
+ constructor(scope, testSubj) {
29
+ super(scope, testSubj, _selectors.EuiBasicTableSelectors.ROOT_SELECTOR);
30
+ }
31
+
32
+ /**
33
+ * The table's data rows, as a `Locator` so callers keep Playwright auto-retry
34
+ * for count and content assertions (e.g. `expect(table.rows).toHaveCount(3)`).
35
+ *
36
+ * Excludes EUI's own "no items found" (and error-message) row: when the table
37
+ * is empty, EUI still renders a single `.euiTableRow` whose one cell spans
38
+ * every column (`colSpan` on `EuiTableRowCell`, the `td[colspan]` HTML
39
+ * attribute). Real data rows don't set `colspan` on their cells, so filtering
40
+ * it out is what keeps `toHaveCount(0)` correct on an empty table instead of
41
+ * reading `1`.
42
+ */
43
+ get rows() {
44
+ return this.root.locator(_selectors.EuiBasicTableSelectors.ROW_SELECTOR).filter({
45
+ hasNot: this.root.page().locator('td[colspan]')
46
+ });
47
+ }
48
+
49
+ /**
50
+ * The cells of the given field-data column, one per row, as a `Locator` for
51
+ * retrying content/count assertions (e.g.
52
+ * `expect(await table.cells('status')).toHaveText(['Running'])`).
53
+ *
54
+ * Resolves the column's position from EUI's own header cell
55
+ * (`tableHeaderCell_<field>_<index>`, matched exactly so a column named e.g.
56
+ * `status` doesn't also match a `status_detail` header) via its native
57
+ * `cellIndex`, then reads the cell at that position in every row — the same
58
+ * positional alignment EUI itself relies on, so it holds regardless of a
59
+ * leading selection-checkbox column. Matches both `<td>` and `<th>`: EUI
60
+ * renders the `rowHeader` column's body cell as a `<th scope="row">` for
61
+ * accessibility, not a `<td>`. Throws if no column with that `field` is
62
+ * rendered.
63
+ *
64
+ * EUI generates a computed column's header test-subj from its `name` using
65
+ * this exact same `tableHeaderCell_<name>_<index>` shape (there's no `field`
66
+ * to key on), so a computed column whose `name` happens to equal another
67
+ * column's `field` can resolve ambiguously — this method can't distinguish
68
+ * the two from the DOM alone. Not expected in practice; call it out if you
69
+ * hit it.
70
+ */
71
+ async cells(field) {
72
+ const escaped = field.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
73
+ const cellIndex = await this.root.evaluate((tableEl, {
74
+ prefix,
75
+ pattern,
76
+ field: originalField
77
+ }) => {
78
+ const regex = new RegExp(`^${prefix}${pattern}_\\d+$`);
79
+ const headers = Array.from(tableEl.querySelectorAll('thead th, thead td'));
80
+ const header = headers.find(el => regex.test(el.getAttribute('data-test-subj') ?? ''));
81
+ if (!header) {
82
+ throw new Error(`EuiBasicTableObject.cells: no column with field "${originalField}" found in this table's header.`);
83
+ }
84
+ return header.cellIndex;
85
+ }, {
86
+ prefix: _selectors.EuiBasicTableSelectors.HEADER_CELL_SELECTOR_PREFIX,
87
+ pattern: escaped,
88
+ field
89
+ });
90
+ return this.rows.locator(`:is(td, th):nth-child(${cellIndex + 1})`);
91
+ }
92
+ }
93
+ exports.EuiBasicTableObject = EuiBasicTableObject;
@@ -0,0 +1,21 @@
1
+ import { BaseObject, type ObjectScope } from '../../base_object';
2
+ /**
3
+ * Playwright Component Object for a keyboard-reorderable {@link
4
+ * https://eui.elastic.co/docs/components/drag-and-drop/ EuiDraggable} item.
5
+ *
6
+ * `testSubj` must be set on the item's own drag handle — with the default
7
+ * `customDragHandle={false}` that's the `EuiDraggable` item itself; with a
8
+ * custom handle it's that inner element instead. See the package README for
9
+ * details, the component-type guard, and why there's no settle-wait after a
10
+ * reorder.
11
+ */
12
+ export declare class EuiDraggableObject extends BaseObject {
13
+ constructor(scope: ObjectScope, testSubj: string);
14
+ /**
15
+ * Reorders the item via keyboard: focus the handle, lift it (`Space`),
16
+ * move it `steps` positions (`ArrowDown` for positive, `ArrowUp` for
17
+ * negative), drop it (`Space`). Keyboard lift, not a simulated mouse drag —
18
+ * `@hello-pangea/dnd`'s own accessible interaction.
19
+ */
20
+ reorder(steps: number): Promise<void>;
21
+ }
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.EuiDraggableObject = void 0;
7
+ var _base_object = require("../../base_object");
8
+ var _selectors = require("../../../components/drag_and_drop/selectors");
9
+ /*
10
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
11
+ * or more contributor license agreements. Licensed under the Elastic License
12
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
13
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
14
+ * Side Public License, v 1.
15
+ */
16
+
17
+ /**
18
+ * Playwright Component Object for a keyboard-reorderable {@link
19
+ * https://eui.elastic.co/docs/components/drag-and-drop/ EuiDraggable} item.
20
+ *
21
+ * `testSubj` must be set on the item's own drag handle — with the default
22
+ * `customDragHandle={false}` that's the `EuiDraggable` item itself; with a
23
+ * custom handle it's that inner element instead. See the package README for
24
+ * details, the component-type guard, and why there's no settle-wait after a
25
+ * reorder.
26
+ */
27
+ class EuiDraggableObject extends _base_object.BaseObject {
28
+ constructor(scope, testSubj) {
29
+ super(scope, testSubj, _selectors.EuiDraggableSelectors.HANDLE_SELECTOR);
30
+ }
31
+
32
+ /**
33
+ * Reorders the item via keyboard: focus the handle, lift it (`Space`),
34
+ * move it `steps` positions (`ArrowDown` for positive, `ArrowUp` for
35
+ * negative), drop it (`Space`). Keyboard lift, not a simulated mouse drag —
36
+ * `@hello-pangea/dnd`'s own accessible interaction.
37
+ */
38
+ async reorder(steps) {
39
+ await this.root.focus();
40
+ await this.root.press('Space');
41
+ const key = steps > 0 ? 'ArrowDown' : 'ArrowUp';
42
+ for (let i = 0; i < Math.abs(steps); i++) {
43
+ await this.root.press(key);
44
+ }
45
+ await this.root.press('Space');
46
+ }
47
+ }
48
+ exports.EuiDraggableObject = EuiDraggableObject;
@@ -0,0 +1,31 @@
1
+ import type { Locator } from '@playwright/test';
2
+ import { BaseObject, type ObjectScope } from '../../base_object';
3
+ /**
4
+ * Playwright Component Object for {@link
5
+ * https://eui.elastic.co/docs/components/forms/filter-group/ EuiFilterButton}.
6
+ *
7
+ * `testSubj` must match the `data-test-subj` set by the consumer on the
8
+ * `<EuiFilterButton>` (EUI spreads it onto the button itself). Deliberately
9
+ * does not own opening/closing a popover triggered by the button — `EuiPopover`
10
+ * already sets `aria-expanded`/`aria-controls` on its toggle synchronously
11
+ * itself, so drive that from the test directly. It also does not own reading
12
+ * or selecting options inside that popover — when the popover content is an
13
+ * `EuiSelectable`, use {@link EuiSelectableObject} scoped to it instead.
14
+ */
15
+ export declare class EuiFilterButtonObject extends BaseObject {
16
+ constructor(scope: ObjectScope, testSubj: string);
17
+ /**
18
+ * The notification badge showing the available/active filter count, as a
19
+ * `Locator` so callers keep Playwright auto-retry for its text
20
+ * (e.g. `expect(filterButton.notificationBadge).toHaveText('2')`). Only
21
+ * present when the consumer passes `numFilters` or `numActiveFilters` —
22
+ * absent otherwise, so assert presence first if that is in question.
23
+ *
24
+ * For the button's own active/selected state, assert directly on
25
+ * {@link BaseObject.locator} rather than through a dedicated method — both
26
+ * are synchronous CSS classes EUI sets on the root
27
+ * (`euiFilterButton-hasActiveFilters`, `euiFilterButton-isSelected`), e.g.
28
+ * `expect(filterButton.locator).toHaveClass(/euiFilterButton-hasActiveFilters/)`.
29
+ */
30
+ get notificationBadge(): Locator;
31
+ }
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.EuiFilterButtonObject = void 0;
7
+ var _base_object = require("../../base_object");
8
+ var _selectors = require("../../../components/filter_button/selectors");
9
+ /*
10
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
11
+ * or more contributor license agreements. Licensed under the Elastic License
12
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
13
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
14
+ * Side Public License, v 1.
15
+ */
16
+
17
+ /**
18
+ * Playwright Component Object for {@link
19
+ * https://eui.elastic.co/docs/components/forms/filter-group/ EuiFilterButton}.
20
+ *
21
+ * `testSubj` must match the `data-test-subj` set by the consumer on the
22
+ * `<EuiFilterButton>` (EUI spreads it onto the button itself). Deliberately
23
+ * does not own opening/closing a popover triggered by the button — `EuiPopover`
24
+ * already sets `aria-expanded`/`aria-controls` on its toggle synchronously
25
+ * itself, so drive that from the test directly. It also does not own reading
26
+ * or selecting options inside that popover — when the popover content is an
27
+ * `EuiSelectable`, use {@link EuiSelectableObject} scoped to it instead.
28
+ */
29
+ class EuiFilterButtonObject extends _base_object.BaseObject {
30
+ constructor(scope, testSubj) {
31
+ super(scope, testSubj, _selectors.EuiFilterButtonSelectors.ROOT_SELECTOR);
32
+ }
33
+
34
+ /**
35
+ * The notification badge showing the available/active filter count, as a
36
+ * `Locator` so callers keep Playwright auto-retry for its text
37
+ * (e.g. `expect(filterButton.notificationBadge).toHaveText('2')`). Only
38
+ * present when the consumer passes `numFilters` or `numActiveFilters` —
39
+ * absent otherwise, so assert presence first if that is in question.
40
+ *
41
+ * For the button's own active/selected state, assert directly on
42
+ * {@link BaseObject.locator} rather than through a dedicated method — both
43
+ * are synchronous CSS classes EUI sets on the root
44
+ * (`euiFilterButton-hasActiveFilters`, `euiFilterButton-isSelected`), e.g.
45
+ * `expect(filterButton.locator).toHaveClass(/euiFilterButton-hasActiveFilters/)`.
46
+ */
47
+ get notificationBadge() {
48
+ return this.root.locator(_selectors.EuiFilterButtonSelectors.NOTIFICATION_SELECTOR);
49
+ }
50
+ }
51
+ exports.EuiFilterButtonObject = EuiFilterButtonObject;
@@ -0,0 +1,25 @@
1
+ import type { Locator } from '@playwright/test';
2
+ import { BaseObject, type ObjectScope } from '../../../base_object';
3
+ /**
4
+ * Playwright Component Object for {@link
5
+ * https://eui.elastic.co/docs/components/forms/range-controls/ EuiRange} and
6
+ * `EuiDualRange`.
7
+ *
8
+ * `testSubj` must match the `data-test-subj` set by the consumer on the
9
+ * `<EuiRange>`/`<EuiDualRange>`. See the package README for why `slider` and
10
+ * `numberInput` disambiguate by class, and what this does not cover.
11
+ */
12
+ export declare class EuiRangeObject extends BaseObject {
13
+ constructor(scope: ObjectScope, testSubj: string);
14
+ /**
15
+ * The native range slider input. Resolves to exactly one element once
16
+ * mounted. With `showInput="inputWithPopover"`, it lives inside the
17
+ * popover panel and is not mounted until the popover opens.
18
+ */
19
+ get slider(): Locator;
20
+ /**
21
+ * The visible number input, present only with `showInput`. Resolves to
22
+ * zero elements otherwise.
23
+ */
24
+ get numberInput(): Locator;
25
+ }
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.EuiRangeObject = void 0;
7
+ var _base_object = require("../../../base_object");
8
+ var _selectors = require("../../../../components/form/range/selectors");
9
+ /*
10
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
11
+ * or more contributor license agreements. Licensed under the Elastic License
12
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
13
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
14
+ * Side Public License, v 1.
15
+ */
16
+
17
+ /**
18
+ * Playwright Component Object for {@link
19
+ * https://eui.elastic.co/docs/components/forms/range-controls/ EuiRange} and
20
+ * `EuiDualRange`.
21
+ *
22
+ * `testSubj` must match the `data-test-subj` set by the consumer on the
23
+ * `<EuiRange>`/`<EuiDualRange>`. See the package README for why `slider` and
24
+ * `numberInput` disambiguate by class, and what this does not cover.
25
+ */
26
+ class EuiRangeObject extends _base_object.BaseObject {
27
+ constructor(scope, testSubj) {
28
+ super(scope, testSubj, _selectors.EuiRangeSelectors.SLIDER_SELECTOR);
29
+ }
30
+
31
+ /**
32
+ * The native range slider input. Resolves to exactly one element once
33
+ * mounted. With `showInput="inputWithPopover"`, it lives inside the
34
+ * popover panel and is not mounted until the popover opens.
35
+ */
36
+ get slider() {
37
+ return this.root.and(this.scope.locator(_selectors.EuiRangeSelectors.SLIDER_SELECTOR));
38
+ }
39
+
40
+ /**
41
+ * The visible number input, present only with `showInput`. Resolves to
42
+ * zero elements otherwise.
43
+ */
44
+ get numberInput() {
45
+ return this.root.and(this.scope.locator(_selectors.EuiRangeSelectors.NUMBER_INPUT_SELECTOR));
46
+ }
47
+ }
48
+ exports.EuiRangeObject = EuiRangeObject;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Stable selectors for
3
+ * {@link https://eui.elastic.co/docs/components/tabular-content/tables/|EuiBasicTable}
4
+ * (also covers `EuiInMemoryTable`, which renders a `EuiBasicTable` underneath).
5
+ * `*_SELECTOR` values are CSS.
6
+ */
7
+ export declare const EuiBasicTableSelectors: {
8
+ /** Root element (the `.euiBasicTable` container carrying the consumer's `data-test-subj`). */
9
+ ROOT_SELECTOR: string;
10
+ /** A data row. Also matches EUI's own empty/error message row — callers must exclude those. */
11
+ ROW_SELECTOR: string;
12
+ /**
13
+ * A field-data column's header cell. `%s` is the column's `field`. EUI appends a
14
+ * positional index (`tableHeaderCell_<field>_<index>`), so this is a prefix match.
15
+ */
16
+ HEADER_CELL_SELECTOR_PREFIX: string;
17
+ };