@elastic/eui-test-helpers 1.4.0-snapshot.1788177701701 → 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 (40) hide show
  1. package/README.md +3 -0
  2. package/lib/cjs/components/drag_and_drop/selectors.d.ts +15 -0
  3. package/lib/cjs/components/drag_and_drop/selectors.js +29 -0
  4. package/lib/cjs/components/filter_button/selectors.d.ts +16 -0
  5. package/lib/cjs/components/filter_button/selectors.js +30 -0
  6. package/lib/cjs/components/form/range/selectors.d.ts +11 -0
  7. package/lib/cjs/components/form/range/selectors.js +25 -0
  8. package/lib/cjs/index.d.ts +3 -0
  9. package/lib/cjs/index.js +23 -2
  10. package/lib/cjs/playwright/components/drag_and_drop/object.d.ts +21 -0
  11. package/lib/cjs/playwright/components/drag_and_drop/object.js +48 -0
  12. package/lib/cjs/playwright/components/filter_button/object.d.ts +31 -0
  13. package/lib/cjs/playwright/components/filter_button/object.js +51 -0
  14. package/lib/cjs/playwright/components/form/range/object.d.ts +25 -0
  15. package/lib/cjs/playwright/components/form/range/object.js +48 -0
  16. package/lib/esm/components/drag_and_drop/selectors.d.ts +15 -0
  17. package/lib/esm/components/drag_and_drop/selectors.js +23 -0
  18. package/lib/esm/components/drag_and_drop/selectors.js.map +1 -0
  19. package/lib/esm/components/filter_button/selectors.d.ts +16 -0
  20. package/lib/esm/components/filter_button/selectors.js +24 -0
  21. package/lib/esm/components/filter_button/selectors.js.map +1 -0
  22. package/lib/esm/components/form/range/selectors.d.ts +11 -0
  23. package/lib/esm/components/form/range/selectors.js +19 -0
  24. package/lib/esm/components/form/range/selectors.js.map +1 -0
  25. package/lib/esm/index.d.ts +3 -0
  26. package/lib/esm/index.js +3 -0
  27. package/lib/esm/index.js.map +1 -1
  28. package/lib/esm/playwright/components/drag_and_drop/object.d.ts +21 -0
  29. package/lib/esm/playwright/components/drag_and_drop/object.js +40 -0
  30. package/lib/esm/playwright/components/drag_and_drop/object.js.map +1 -0
  31. package/lib/esm/playwright/components/filter_button/object.d.ts +31 -0
  32. package/lib/esm/playwright/components/filter_button/object.js +43 -0
  33. package/lib/esm/playwright/components/filter_button/object.js.map +1 -0
  34. package/lib/esm/playwright/components/form/range/object.d.ts +25 -0
  35. package/lib/esm/playwright/components/form/range/object.js +39 -0
  36. package/lib/esm/playwright/components/form/range/object.js.map +1 -0
  37. package/package.json +2 -3
  38. package/src/components/drag_and_drop/README.md +23 -0
  39. package/src/components/filter_button/README.md +29 -0
  40. package/src/components/form/range/README.md +31 -0
package/README.md CHANGED
@@ -51,6 +51,9 @@ 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) |
54
57
  | `EuiBasicTableObject` | [src/components/basic_table/README.md](src/components/basic_table/README.md) |
55
58
 
56
59
  ## Contributing
@@ -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,4 +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';
7
10
  export { EuiBasicTableObject } from './playwright/components/basic_table/object';
package/lib/cjs/index.js CHANGED
@@ -12,7 +12,7 @@ Object.defineProperty(exports, "BaseObject", {
12
12
  Object.defineProperty(exports, "EuiBasicTableObject", {
13
13
  enumerable: true,
14
14
  get: function () {
15
- return _object6.EuiBasicTableObject;
15
+ return _object9.EuiBasicTableObject;
16
16
  }
17
17
  });
18
18
  Object.defineProperty(exports, "EuiComboBoxObject", {
@@ -27,12 +27,30 @@ Object.defineProperty(exports, "EuiDataGridObject", {
27
27
  return _object2.EuiDataGridObject;
28
28
  }
29
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
+ });
30
42
  Object.defineProperty(exports, "EuiGlobalToastListObject", {
31
43
  enumerable: true,
32
44
  get: function () {
33
45
  return _object4.EuiGlobalToastListObject;
34
46
  }
35
47
  });
48
+ Object.defineProperty(exports, "EuiRangeObject", {
49
+ enumerable: true,
50
+ get: function () {
51
+ return _object8.EuiRangeObject;
52
+ }
53
+ });
36
54
  Object.defineProperty(exports, "EuiSelectableObject", {
37
55
  enumerable: true,
38
56
  get: function () {
@@ -51,4 +69,7 @@ var _object2 = require("./playwright/components/datagrid/object");
51
69
  var _object3 = require("./playwright/components/form/super_select/object");
52
70
  var _object4 = require("./playwright/components/toast/object");
53
71
  var _object5 = require("./playwright/components/selectable/object");
54
- var _object6 = require("./playwright/components/basic_table/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,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,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,23 @@
1
+ /*
2
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3
+ * or more contributor license agreements. Licensed under the Elastic License
4
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
5
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
6
+ * Side Public License, v 1.
7
+ */
8
+ /**
9
+ * Stable selectors for
10
+ * {@link https://eui.elastic.co/docs/components/drag-and-drop/|EuiDraggable}.
11
+ * `*_SELECTOR` values are CSS.
12
+ */
13
+ export const EuiDraggableSelectors = {
14
+ /**
15
+ * Attribute `@hello-pangea/dnd` (which `EuiDraggable` wraps) spreads onto an
16
+ * enabled drag handle. Used to verify `testSubj` actually points at a handle,
17
+ * not a fixed EUI class — the handle markup itself is consumer-defined.
18
+ */
19
+ HANDLE_SELECTOR: '[data-rfd-drag-handle-draggable-id]',
20
+ /** Attribute `@hello-pangea/dnd` spreads onto every draggable item wrapper, enabled or not. */
21
+ ITEM_SELECTOR: '[data-rfd-draggable-id]',
22
+ };
23
+ //# sourceMappingURL=selectors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"selectors.js","sourceRoot":"","sources":["../../../../src/components/drag_and_drop/selectors.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC;;;;OAIG;IACH,eAAe,EAAE,qCAAqC;IAEtD,+FAA+F;IAC/F,aAAa,EAAE,yBAAyB;CACzC,CAAC"}
@@ -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,24 @@
1
+ /*
2
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3
+ * or more contributor license agreements. Licensed under the Elastic License
4
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
5
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
6
+ * Side Public License, v 1.
7
+ */
8
+ /**
9
+ * Stable selectors for
10
+ * {@link https://eui.elastic.co/docs/components/forms/filter-group/|EuiFilterButton}.
11
+ * `*_SELECTOR` values are CSS, `*_CLASS` values are class names to check for
12
+ * membership (e.g. via `toHaveClass`).
13
+ */
14
+ export const EuiFilterButtonSelectors = {
15
+ /** Root element (the button itself carries the consumer's `data-test-subj`). */
16
+ ROOT_SELECTOR: '.euiFilterButton',
17
+ /** The notification badge, present only when `numFilters` or `numActiveFilters` is set. */
18
+ NOTIFICATION_SELECTOR: '.euiFilterButton__notification',
19
+ /** Set when `hasActiveFilters` is true. */
20
+ HAS_ACTIVE_FILTERS_CLASS: 'euiFilterButton-hasActiveFilters',
21
+ /** Set when `isSelected` is true (e.g. a popover-toggle button while its popover is open). */
22
+ IS_SELECTED_CLASS: 'euiFilterButton-isSelected',
23
+ };
24
+ //# sourceMappingURL=selectors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"selectors.js","sourceRoot":"","sources":["../../../../src/components/filter_button/selectors.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,gFAAgF;IAChF,aAAa,EAAE,kBAAkB;IAEjC,2FAA2F;IAC3F,qBAAqB,EAAE,gCAAgC;IAEvD,2CAA2C;IAC3C,wBAAwB,EAAE,kCAAkC;IAE5D,8FAA8F;IAC9F,iBAAiB,EAAE,4BAA4B;CAChD,CAAC"}
@@ -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,19 @@
1
+ /*
2
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3
+ * or more contributor license agreements. Licensed under the Elastic License
4
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
5
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
6
+ * Side Public License, v 1.
7
+ */
8
+ /**
9
+ * Stable selectors for
10
+ * {@link https://eui.elastic.co/docs/components/forms/range-controls/|EuiRange}
11
+ * and `EuiDualRange`. `*_SELECTOR` values are CSS.
12
+ */
13
+ export const EuiRangeSelectors = {
14
+ /** The native `<input type="range">` element that carries the actual value. */
15
+ SLIDER_SELECTOR: '.euiRangeSlider',
16
+ /** 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}. */
17
+ NUMBER_INPUT_SELECTOR: '.euiRangeInput',
18
+ };
19
+ //# sourceMappingURL=selectors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"selectors.js","sourceRoot":"","sources":["../../../../../src/components/form/range/selectors.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,+EAA+E;IAC/E,eAAe,EAAE,iBAAiB;IAElC,4KAA4K;IAC5K,qBAAqB,EAAE,gBAAgB;CACxC,CAAC"}
@@ -4,4 +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';
7
10
  export { EuiBasicTableObject } from './playwright/components/basic_table/object';
package/lib/esm/index.js CHANGED
@@ -11,5 +11,8 @@ export { EuiDataGridObject } from './playwright/components/datagrid/object';
11
11
  export { EuiSuperSelectObject } from './playwright/components/form/super_select/object';
12
12
  export { EuiGlobalToastListObject } from './playwright/components/toast/object';
13
13
  export { EuiSelectableObject } from './playwright/components/selectable/object';
14
+ export { EuiDraggableObject } from './playwright/components/drag_and_drop/object';
15
+ export { EuiFilterButtonObject } from './playwright/components/filter_button/object';
16
+ export { EuiRangeObject } from './playwright/components/form/range/object';
14
17
  export { EuiBasicTableObject } from './playwright/components/basic_table/object';
15
18
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,UAAU,EAAoB,MAAM,0BAA0B,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,MAAM,0CAA0C,CAAC;AAC7E,OAAO,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AAC5E,OAAO,EAAE,oBAAoB,EAAE,MAAM,kDAAkD,CAAC;AACxF,OAAO,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AAChF,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAChF,OAAO,EAAE,mBAAmB,EAAE,MAAM,4CAA4C,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,UAAU,EAAoB,MAAM,0BAA0B,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,MAAM,0CAA0C,CAAC;AAC7E,OAAO,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AAC5E,OAAO,EAAE,oBAAoB,EAAE,MAAM,kDAAkD,CAAC;AACxF,OAAO,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AAChF,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAChF,OAAO,EAAE,kBAAkB,EAAE,MAAM,8CAA8C,CAAC;AAClF,OAAO,EAAE,qBAAqB,EAAE,MAAM,8CAA8C,CAAC;AACrF,OAAO,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAC;AAC3E,OAAO,EAAE,mBAAmB,EAAE,MAAM,4CAA4C,CAAC"}
@@ -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,40 @@
1
+ /*
2
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3
+ * or more contributor license agreements. Licensed under the Elastic License
4
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
5
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
6
+ * Side Public License, v 1.
7
+ */
8
+ import { BaseObject } from '../../base_object';
9
+ import { EuiDraggableSelectors } from '../../../components/drag_and_drop/selectors';
10
+ /**
11
+ * Playwright Component Object for a keyboard-reorderable {@link
12
+ * https://eui.elastic.co/docs/components/drag-and-drop/ EuiDraggable} item.
13
+ *
14
+ * `testSubj` must be set on the item's own drag handle — with the default
15
+ * `customDragHandle={false}` that's the `EuiDraggable` item itself; with a
16
+ * custom handle it's that inner element instead. See the package README for
17
+ * details, the component-type guard, and why there's no settle-wait after a
18
+ * reorder.
19
+ */
20
+ export class EuiDraggableObject extends BaseObject {
21
+ constructor(scope, testSubj) {
22
+ super(scope, testSubj, EuiDraggableSelectors.HANDLE_SELECTOR);
23
+ }
24
+ /**
25
+ * Reorders the item via keyboard: focus the handle, lift it (`Space`),
26
+ * move it `steps` positions (`ArrowDown` for positive, `ArrowUp` for
27
+ * negative), drop it (`Space`). Keyboard lift, not a simulated mouse drag —
28
+ * `@hello-pangea/dnd`'s own accessible interaction.
29
+ */
30
+ async reorder(steps) {
31
+ await this.root.focus();
32
+ await this.root.press('Space');
33
+ const key = steps > 0 ? 'ArrowDown' : 'ArrowUp';
34
+ for (let i = 0; i < Math.abs(steps); i++) {
35
+ await this.root.press(key);
36
+ }
37
+ await this.root.press('Space');
38
+ }
39
+ }
40
+ //# sourceMappingURL=object.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"object.js","sourceRoot":"","sources":["../../../../../src/playwright/components/drag_and_drop/object.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,UAAU,EAAoB,MAAM,mBAAmB,CAAC;AACjE,OAAO,EAAE,qBAAqB,EAAE,MAAM,6CAA6C,CAAC;AAEpF;;;;;;;;;GASG;AACH,MAAM,OAAO,kBAAmB,SAAQ,UAAU;IAChD,YAAY,KAAkB,EAAE,QAAgB;QAC9C,KAAK,CAAC,KAAK,EAAE,QAAQ,EAAE,qBAAqB,CAAC,eAAe,CAAC,CAAC;IAChE,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,OAAO,CAAC,KAAa;QACzB,MAAM,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;QACxB,MAAM,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAC/B,MAAM,GAAG,GAAG,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC;QAChD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;YACzC,MAAM,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC7B,CAAC;QACD,MAAM,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACjC,CAAC;CACF"}
@@ -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,43 @@
1
+ /*
2
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3
+ * or more contributor license agreements. Licensed under the Elastic License
4
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
5
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
6
+ * Side Public License, v 1.
7
+ */
8
+ import { BaseObject } from '../../base_object';
9
+ import { EuiFilterButtonSelectors } from '../../../components/filter_button/selectors';
10
+ /**
11
+ * Playwright Component Object for {@link
12
+ * https://eui.elastic.co/docs/components/forms/filter-group/ EuiFilterButton}.
13
+ *
14
+ * `testSubj` must match the `data-test-subj` set by the consumer on the
15
+ * `<EuiFilterButton>` (EUI spreads it onto the button itself). Deliberately
16
+ * does not own opening/closing a popover triggered by the button — `EuiPopover`
17
+ * already sets `aria-expanded`/`aria-controls` on its toggle synchronously
18
+ * itself, so drive that from the test directly. It also does not own reading
19
+ * or selecting options inside that popover — when the popover content is an
20
+ * `EuiSelectable`, use {@link EuiSelectableObject} scoped to it instead.
21
+ */
22
+ export class EuiFilterButtonObject extends BaseObject {
23
+ constructor(scope, testSubj) {
24
+ super(scope, testSubj, EuiFilterButtonSelectors.ROOT_SELECTOR);
25
+ }
26
+ /**
27
+ * The notification badge showing the available/active filter count, as a
28
+ * `Locator` so callers keep Playwright auto-retry for its text
29
+ * (e.g. `expect(filterButton.notificationBadge).toHaveText('2')`). Only
30
+ * present when the consumer passes `numFilters` or `numActiveFilters` —
31
+ * absent otherwise, so assert presence first if that is in question.
32
+ *
33
+ * For the button's own active/selected state, assert directly on
34
+ * {@link BaseObject.locator} rather than through a dedicated method — both
35
+ * are synchronous CSS classes EUI sets on the root
36
+ * (`euiFilterButton-hasActiveFilters`, `euiFilterButton-isSelected`), e.g.
37
+ * `expect(filterButton.locator).toHaveClass(/euiFilterButton-hasActiveFilters/)`.
38
+ */
39
+ get notificationBadge() {
40
+ return this.root.locator(EuiFilterButtonSelectors.NOTIFICATION_SELECTOR);
41
+ }
42
+ }
43
+ //# sourceMappingURL=object.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"object.js","sourceRoot":"","sources":["../../../../../src/playwright/components/filter_button/object.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,EAAE,UAAU,EAAoB,MAAM,mBAAmB,CAAC;AACjE,OAAO,EAAE,wBAAwB,EAAE,MAAM,6CAA6C,CAAC;AAEvF;;;;;;;;;;;GAWG;AACH,MAAM,OAAO,qBAAsB,SAAQ,UAAU;IACnD,YAAY,KAAkB,EAAE,QAAgB;QAC9C,KAAK,CAAC,KAAK,EAAE,QAAQ,EAAE,wBAAwB,CAAC,aAAa,CAAC,CAAC;IACjE,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,IAAW,iBAAiB;QAC1B,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,wBAAwB,CAAC,qBAAqB,CAAC,CAAC;IAC3E,CAAC;CACF"}
@@ -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,39 @@
1
+ /*
2
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3
+ * or more contributor license agreements. Licensed under the Elastic License
4
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
5
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
6
+ * Side Public License, v 1.
7
+ */
8
+ import { BaseObject } from '../../../base_object';
9
+ import { EuiRangeSelectors } from '../../../../components/form/range/selectors';
10
+ /**
11
+ * Playwright Component Object for {@link
12
+ * https://eui.elastic.co/docs/components/forms/range-controls/ EuiRange} and
13
+ * `EuiDualRange`.
14
+ *
15
+ * `testSubj` must match the `data-test-subj` set by the consumer on the
16
+ * `<EuiRange>`/`<EuiDualRange>`. See the package README for why `slider` and
17
+ * `numberInput` disambiguate by class, and what this does not cover.
18
+ */
19
+ export class EuiRangeObject extends BaseObject {
20
+ constructor(scope, testSubj) {
21
+ super(scope, testSubj, EuiRangeSelectors.SLIDER_SELECTOR);
22
+ }
23
+ /**
24
+ * The native range slider input. Resolves to exactly one element once
25
+ * mounted. With `showInput="inputWithPopover"`, it lives inside the
26
+ * popover panel and is not mounted until the popover opens.
27
+ */
28
+ get slider() {
29
+ return this.root.and(this.scope.locator(EuiRangeSelectors.SLIDER_SELECTOR));
30
+ }
31
+ /**
32
+ * The visible number input, present only with `showInput`. Resolves to
33
+ * zero elements otherwise.
34
+ */
35
+ get numberInput() {
36
+ return this.root.and(this.scope.locator(EuiRangeSelectors.NUMBER_INPUT_SELECTOR));
37
+ }
38
+ }
39
+ //# sourceMappingURL=object.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"object.js","sourceRoot":"","sources":["../../../../../../src/playwright/components/form/range/object.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,EAAE,UAAU,EAAoB,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,6CAA6C,CAAC;AAEhF;;;;;;;;GAQG;AACH,MAAM,OAAO,cAAe,SAAQ,UAAU;IAC5C,YAAY,KAAkB,EAAE,QAAgB;QAC9C,KAAK,CAAC,KAAK,EAAE,QAAQ,EAAE,iBAAiB,CAAC,eAAe,CAAC,CAAC;IAC5D,CAAC;IAED;;;;OAIG;IACH,IAAW,MAAM;QACf,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,iBAAiB,CAAC,eAAe,CAAC,CAAC,CAAC;IAC9E,CAAC;IAED;;;OAGG;IACH,IAAW,WAAW;QACpB,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,iBAAiB,CAAC,qBAAqB,CAAC,CAAC,CAAC;IACpF,CAAC;CACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elastic/eui-test-helpers",
3
- "version": "1.4.0-snapshot.1788177701701",
3
+ "version": "1.5.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": {
@@ -57,6 +57,5 @@
57
57
  "!**/*.spec.js.map",
58
58
  "README.md",
59
59
  "licenses"
60
- ],
61
- "stableVersion": "1.4.0"
60
+ ]
62
61
  }
@@ -0,0 +1,23 @@
1
+ # EuiDraggableObject
2
+
3
+ Playwright Component Object for [EuiDraggable](https://eui.elastic.co/docs/components/drag-and-drop/), keyboard-reordering items instead of simulating a mouse drag.
4
+
5
+ ## Usage
6
+
7
+ ```ts
8
+ import { EuiDraggableObject } from '@elastic/eui-test-helpers';
9
+
10
+ const item = new EuiDraggableObject(page, 'myItemDragHandle');
11
+ await item.reorder(2); // move 2 positions later
12
+ await item.reorder(-1); // move 1 position earlier
13
+ ```
14
+
15
+ Set `data-test-subj` on the item's own drag handle — the element EUI's `provided.dragHandleProps` are spread onto. With the default `customDragHandle={false}`, that's the `<EuiDraggable>` item itself (as in the usage example above and the `Playground` story), since EUI spreads `dragHandleProps` onto the same element as `draggableProps` in that case. Only with a `customDragHandle` does the handle become a distinct inner element, and `data-test-subj` must move there instead. The component-type guard checks for the `data-rfd-drag-handle-draggable-id` attribute `@hello-pangea/dnd` spreads onto an *enabled* handle, since the handle markup itself is consumer-defined, not a fixed EUI class. A disabled draggable's handle lacks that attribute, so pointing this object at one throws the same "wrong component" error as pointing it at a non-handle element — a disabled item can't be reordered either way.
16
+
17
+ ## API
18
+
19
+ | Member | Description |
20
+ |---|---|
21
+ | `reorder(steps)` | Focuses the handle, lifts it, moves it `steps` positions (`ArrowDown` for positive, `ArrowUp` for negative), drops it. |
22
+
23
+ `reorder` drives `EuiDraggable` (which wraps `@hello-pangea/dnd`) via its keyboard interaction — the library's own accessible alternative to a mouse drag, and one that doesn't require simulating drag events. It does not wait for a settle signal after dropping: EUI doesn't expose a synchronous, stable one (the `euiDraggable--isDragging` class some consumers checked for hasn't existed since this styling moved to Emotion — that check was always a no-op). Assert the resulting order with a retrying `expect`, which settles on its own.
@@ -0,0 +1,29 @@
1
+ # EuiFilterButtonObject
2
+
3
+ Playwright Component Object for [EuiFilterButton](https://eui.elastic.co/docs/components/forms/filter-group/).
4
+
5
+ ## Usage
6
+
7
+ ```ts
8
+ import { EuiFilterButtonObject } from '@elastic/eui-test-helpers';
9
+
10
+ const filterButton = new EuiFilterButtonObject(page, 'myFilterButton');
11
+ await expect(filterButton.locator).toHaveClass(/euiFilterButton-hasActiveFilters/);
12
+ await expect(filterButton.notificationBadge).toHaveText('2');
13
+ ```
14
+
15
+ Set `data-test-subj` on the `<EuiFilterButton>` (EUI spreads it onto the button itself, which the component-type guard verifies).
16
+
17
+ ## API
18
+
19
+ | Member | Description |
20
+ |---|---|
21
+ | `locator` | Inherited root `Locator`. Assert the button's active/selected state directly on it, e.g. `toHaveClass(/euiFilterButton-hasActiveFilters/)` or `toHaveClass(/euiFilterButton-isSelected/)` — both are synchronous CSS classes EUI sets, not async state. |
22
+ | `notificationBadge` | `Locator` for the filter-count badge. Only present when the consumer passes `numFilters` or `numActiveFilters`. |
23
+
24
+ ## Deliberately out of scope
25
+
26
+ This component does not own opening or closing a popover the button triggers, or reading/selecting options inside it:
27
+
28
+ - **Popover mechanics**: `EuiPopover` already sets `aria-expanded`/`aria-controls` on its toggle button synchronously itself. Drive open/close from your test directly against those, or the popover's own `isOpen` prop in your app.
29
+ - **Option selection**: when the popover content is an `EuiSelectable`, scope [`EuiSelectableObject`](../selectable/README.md) to it instead of reimplementing option matching here.
@@ -0,0 +1,31 @@
1
+ # EuiRangeObject
2
+
3
+ Playwright Component Object for [EuiRange](https://eui.elastic.co/docs/components/forms/range-controls/) and `EuiDualRange`.
4
+
5
+ ## Usage
6
+
7
+ ```ts
8
+ import { EuiRangeObject } from '@elastic/eui-test-helpers';
9
+
10
+ const range = new EuiRangeObject(page, 'myRange');
11
+ await range.slider.fill('50'); // or press arrow keys, drag, etc.
12
+ ```
13
+
14
+ Set `data-test-subj` on the `<EuiRange>`/`<EuiDualRange>` (EUI spreads it onto the native range slider, which the component-type guard verifies).
15
+
16
+ ## Why this exists
17
+
18
+ On a plain `EuiRange` rendered with `showInput`, EUI spreads the *same* `data-test-subj` onto both the native slider and the visible number input. A plain `page.getByTestId(x)` then resolves to two elements and throws in Playwright's strict mode. That is a real, non-obvious EUI gap this component exists to hide.
19
+
20
+ ## API
21
+
22
+ | Member | Description |
23
+ |---|---|
24
+ | `slider` | `Locator` for the native `<input type="range">`. Resolves to exactly one element once mounted. With `showInput="inputWithPopover"`, the slider lives inside the popover panel and is not mounted until the popover opens (focus/click `numberInput` to open it). |
25
+ | `numberInput` | `Locator` for the visible number input. Only present on a plain `EuiRange` with `showInput` set, resolves to zero elements otherwise. |
26
+
27
+ ## Deliberately out of scope
28
+
29
+ - **`EuiDualRange`'s min/max number inputs**: rendered only with `showInput`, and need their own `data-test-subj` via `minInputProps`/`maxInputProps`. That is the consumer's own test-subj to target directly, not ambiguous the way the plain `EuiRange` case is.
30
+ - **`inputWithPopover` open/close** (`EuiRange` and `EuiDualRange` both support this mode): the popover only opens by clicking a number input, not the delimiter between them. That is a real EUI behavioral quirk, but a single documented fact rather than DOM ambiguity, and popover mechanics are already exposed synchronously by `EuiPopover` itself (`aria-expanded`/`aria-controls`). Drive it from your test directly.
31
+ - **Reading the current value**: use `slider.inputValue()` or `numberInput.inputValue()` directly, no wrapper needed.