@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
@@ -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.