@elastic/eui-test-helpers 1.6.0 → 1.7.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 (56) hide show
  1. package/README.md +4 -0
  2. package/lib/cjs/components/color_picker/selectors.d.ts +13 -0
  3. package/lib/cjs/components/color_picker/selectors.js +27 -0
  4. package/lib/cjs/components/context_menu/selectors.d.ts +22 -0
  5. package/lib/cjs/components/context_menu/selectors.js +36 -0
  6. package/lib/cjs/components/tool_tip/selectors.d.ts +9 -0
  7. package/lib/cjs/components/tool_tip/selectors.js +23 -0
  8. package/lib/cjs/components/tree_view/selectors.d.ts +10 -0
  9. package/lib/cjs/components/tree_view/selectors.js +24 -0
  10. package/lib/cjs/index.d.ts +4 -0
  11. package/lib/cjs/index.js +32 -4
  12. package/lib/cjs/playwright/base_object.d.ts +3 -0
  13. package/lib/cjs/playwright/base_object.js +11 -1
  14. package/lib/cjs/playwright/components/color_picker/object.d.ts +20 -0
  15. package/lib/cjs/playwright/components/color_picker/object.js +43 -0
  16. package/lib/cjs/playwright/components/context_menu/object.d.ts +19 -0
  17. package/lib/cjs/playwright/components/context_menu/object.js +40 -0
  18. package/lib/cjs/playwright/components/tool_tip/object.d.ts +13 -0
  19. package/lib/cjs/playwright/components/tool_tip/object.js +31 -0
  20. package/lib/cjs/playwright/components/tree_view/object.d.ts +17 -0
  21. package/lib/cjs/playwright/components/tree_view/object.js +37 -0
  22. package/lib/esm/components/color_picker/selectors.d.ts +13 -0
  23. package/lib/esm/components/color_picker/selectors.js +21 -0
  24. package/lib/esm/components/color_picker/selectors.js.map +1 -0
  25. package/lib/esm/components/context_menu/selectors.d.ts +22 -0
  26. package/lib/esm/components/context_menu/selectors.js +30 -0
  27. package/lib/esm/components/context_menu/selectors.js.map +1 -0
  28. package/lib/esm/components/tool_tip/selectors.d.ts +9 -0
  29. package/lib/esm/components/tool_tip/selectors.js +17 -0
  30. package/lib/esm/components/tool_tip/selectors.js.map +1 -0
  31. package/lib/esm/components/tree_view/selectors.d.ts +10 -0
  32. package/lib/esm/components/tree_view/selectors.js +18 -0
  33. package/lib/esm/components/tree_view/selectors.js.map +1 -0
  34. package/lib/esm/index.d.ts +4 -0
  35. package/lib/esm/index.js +4 -0
  36. package/lib/esm/index.js.map +1 -1
  37. package/lib/esm/playwright/base_object.d.ts +3 -0
  38. package/lib/esm/playwright/base_object.js +10 -1
  39. package/lib/esm/playwright/base_object.js.map +1 -1
  40. package/lib/esm/playwright/components/color_picker/object.d.ts +20 -0
  41. package/lib/esm/playwright/components/color_picker/object.js +34 -0
  42. package/lib/esm/playwright/components/color_picker/object.js.map +1 -0
  43. package/lib/esm/playwright/components/context_menu/object.d.ts +19 -0
  44. package/lib/esm/playwright/components/context_menu/object.js +36 -0
  45. package/lib/esm/playwright/components/context_menu/object.js.map +1 -0
  46. package/lib/esm/playwright/components/tool_tip/object.d.ts +13 -0
  47. package/lib/esm/playwright/components/tool_tip/object.js +24 -0
  48. package/lib/esm/playwright/components/tool_tip/object.js.map +1 -0
  49. package/lib/esm/playwright/components/tree_view/object.d.ts +17 -0
  50. package/lib/esm/playwright/components/tree_view/object.js +29 -0
  51. package/lib/esm/playwright/components/tree_view/object.js.map +1 -0
  52. package/package.json +1 -1
  53. package/src/components/color_picker/README.md +30 -0
  54. package/src/components/context_menu/README.md +26 -0
  55. package/src/components/tool_tip/README.md +24 -0
  56. package/src/components/tree_view/README.md +28 -0
package/README.md CHANGED
@@ -57,8 +57,12 @@ their own version at runtime.
57
57
  | `EuiPopoverObject` | [src/components/popover/README.md](src/components/popover/README.md) |
58
58
  | `EuiFlyoutObject` | [src/components/flyout/README.md](src/components/flyout/README.md) |
59
59
  | `EuiAccordionObject` | [src/components/accordion/README.md](src/components/accordion/README.md) |
60
+ | `EuiContextMenuObject` | [src/components/context_menu/README.md](src/components/context_menu/README.md) |
60
61
  | `EuiModalObject` | [src/components/modal/README.md](src/components/modal/README.md) |
61
62
  | `EuiBasicTableObject` | [src/components/basic_table/README.md](src/components/basic_table/README.md) |
63
+ | `EuiColorPickerObject` | [src/components/color_picker/README.md](src/components/color_picker/README.md) |
64
+ | `EuiTreeViewObject` | [src/components/tree_view/README.md](src/components/tree_view/README.md) |
65
+ | `EuiToolTipObject` | [src/components/tool_tip/README.md](src/components/tool_tip/README.md) |
62
66
 
63
67
  ## Contributing
64
68
 
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Stable selectors for
3
+ * {@link https://eui.elastic.co/docs/components/forms/color-picker/|EuiColorPicker}.
4
+ * `*_SELECTOR` values are CSS.
5
+ */
6
+ export declare const EuiColorPickerSelectors: {
7
+ /** The default text-input anchor. A custom `button` prop has no class of its own. */
8
+ ANCHOR_SELECTOR: string;
9
+ /** The popover panel, rendered in a portal and only while open. */
10
+ PANEL_SELECTOR: string;
11
+ /** A swatch button inside the panel. */
12
+ SWATCH_SELECTOR: string;
13
+ };
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.EuiColorPickerSelectors = 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/color-picker/|EuiColorPicker}.
18
+ * `*_SELECTOR` values are CSS.
19
+ */
20
+ const EuiColorPickerSelectors = exports.EuiColorPickerSelectors = {
21
+ /** The default text-input anchor. A custom `button` prop has no class of its own. */
22
+ ANCHOR_SELECTOR: '.euiColorPicker__input',
23
+ /** The popover panel, rendered in a portal and only while open. */
24
+ PANEL_SELECTOR: '[data-popover-panel].euiColorPicker__popoverPanel',
25
+ /** A swatch button inside the panel. */
26
+ SWATCH_SELECTOR: '.euiColorPickerSwatch'
27
+ };
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Stable selectors for
3
+ * {@link https://eui.elastic.co/docs/components/navigation/context-menu/|EuiContextMenu}.
4
+ * `*_SELECTOR` values are CSS.
5
+ */
6
+ export declare const EuiContextMenuSelectors: {
7
+ /**
8
+ * Root element carrying the consumer's `data-test-subj`: either a multi
9
+ * panel `EuiContextMenu`, or a single `EuiContextMenuPanel` used on its
10
+ * own, which is the more common Kibana pattern.
11
+ */
12
+ ROOT_SELECTOR: string;
13
+ /**
14
+ * Each panel. Two can exist at once during a panel transition (the
15
+ * outgoing one still animating out, plus the incoming one). Both are
16
+ * rendered outgoing-first in markup, so the last match is always the
17
+ * current panel.
18
+ */
19
+ PANEL_SELECTOR: string;
20
+ /** An item inside a panel. */
21
+ ITEM_SELECTOR: string;
22
+ };
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.EuiContextMenuSelectors = 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/navigation/context-menu/|EuiContextMenu}.
18
+ * `*_SELECTOR` values are CSS.
19
+ */
20
+ const EuiContextMenuSelectors = exports.EuiContextMenuSelectors = {
21
+ /**
22
+ * Root element carrying the consumer's `data-test-subj`: either a multi
23
+ * panel `EuiContextMenu`, or a single `EuiContextMenuPanel` used on its
24
+ * own, which is the more common Kibana pattern.
25
+ */
26
+ ROOT_SELECTOR: '.euiContextMenu, .euiContextMenuPanel',
27
+ /**
28
+ * Each panel. Two can exist at once during a panel transition (the
29
+ * outgoing one still animating out, plus the incoming one). Both are
30
+ * rendered outgoing-first in markup, so the last match is always the
31
+ * current panel.
32
+ */
33
+ PANEL_SELECTOR: '.euiContextMenuPanel',
34
+ /** An item inside a panel. */
35
+ ITEM_SELECTOR: '.euiContextMenuItem'
36
+ };
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Stable selectors for
3
+ * {@link https://eui.elastic.co/docs/components/display/tooltip/|EuiToolTip}.
4
+ * `*_SELECTOR` values are CSS.
5
+ */
6
+ export declare const EuiToolTipSelectors: {
7
+ /** The portaled tooltip. Only mounted while shown. */
8
+ ROOT_SELECTOR: string;
9
+ };
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.EuiToolTipSelectors = 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/display/tooltip/|EuiToolTip}.
18
+ * `*_SELECTOR` values are CSS.
19
+ */
20
+ const EuiToolTipSelectors = exports.EuiToolTipSelectors = {
21
+ /** The portaled tooltip. Only mounted while shown. */
22
+ ROOT_SELECTOR: '.euiToolTip[role="tooltip"]'
23
+ };
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Stable selectors for
3
+ * {@link https://eui.elastic.co/docs/components/navigation/tree-view/|EuiTreeView}.
4
+ * `*_SELECTOR` values are CSS.
5
+ */
6
+ export declare const EuiTreeViewSelectors: {
7
+ ROOT_SELECTOR: string;
8
+ /** Node buttons of this level only. A nested tree renders its own `.euiTreeView` inside a node. */
9
+ ITEM_SELECTOR: string;
10
+ };
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.EuiTreeViewSelectors = 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/navigation/tree-view/|EuiTreeView}.
18
+ * `*_SELECTOR` values are CSS.
19
+ */
20
+ const EuiTreeViewSelectors = exports.EuiTreeViewSelectors = {
21
+ ROOT_SELECTOR: '.euiTreeView',
22
+ /** Node buttons of this level only. A nested tree renders its own `.euiTreeView` inside a node. */
23
+ ITEM_SELECTOR: '> li > .euiTreeView__nodeInner'
24
+ };
@@ -10,5 +10,9 @@ export { EuiRangeObject } from './playwright/components/form/range/object';
10
10
  export { EuiPopoverObject } from './playwright/components/popover/object';
11
11
  export { EuiFlyoutObject } from './playwright/components/flyout/object';
12
12
  export { EuiAccordionObject } from './playwright/components/accordion/object';
13
+ export { EuiContextMenuObject } from './playwright/components/context_menu/object';
13
14
  export { EuiModalObject } from './playwright/components/modal/object';
14
15
  export { EuiBasicTableObject } from './playwright/components/basic_table/object';
16
+ export { EuiColorPickerObject } from './playwright/components/color_picker/object';
17
+ export { EuiTreeViewObject } from './playwright/components/tree_view/object';
18
+ export { EuiToolTipObject } from './playwright/components/tool_tip/object';
package/lib/cjs/index.js CHANGED
@@ -18,7 +18,13 @@ Object.defineProperty(exports, "EuiAccordionObject", {
18
18
  Object.defineProperty(exports, "EuiBasicTableObject", {
19
19
  enumerable: true,
20
20
  get: function () {
21
- return _object13.EuiBasicTableObject;
21
+ return _object14.EuiBasicTableObject;
22
+ }
23
+ });
24
+ Object.defineProperty(exports, "EuiColorPickerObject", {
25
+ enumerable: true,
26
+ get: function () {
27
+ return _object15.EuiColorPickerObject;
22
28
  }
23
29
  });
24
30
  Object.defineProperty(exports, "EuiComboBoxObject", {
@@ -27,6 +33,12 @@ Object.defineProperty(exports, "EuiComboBoxObject", {
27
33
  return _object.EuiComboBoxObject;
28
34
  }
29
35
  });
36
+ Object.defineProperty(exports, "EuiContextMenuObject", {
37
+ enumerable: true,
38
+ get: function () {
39
+ return _object12.EuiContextMenuObject;
40
+ }
41
+ });
30
42
  Object.defineProperty(exports, "EuiDataGridObject", {
31
43
  enumerable: true,
32
44
  get: function () {
@@ -60,7 +72,7 @@ Object.defineProperty(exports, "EuiGlobalToastListObject", {
60
72
  Object.defineProperty(exports, "EuiModalObject", {
61
73
  enumerable: true,
62
74
  get: function () {
63
- return _object12.EuiModalObject;
75
+ return _object13.EuiModalObject;
64
76
  }
65
77
  });
66
78
  Object.defineProperty(exports, "EuiPopoverObject", {
@@ -87,6 +99,18 @@ Object.defineProperty(exports, "EuiSuperSelectObject", {
87
99
  return _object3.EuiSuperSelectObject;
88
100
  }
89
101
  });
102
+ Object.defineProperty(exports, "EuiToolTipObject", {
103
+ enumerable: true,
104
+ get: function () {
105
+ return _object17.EuiToolTipObject;
106
+ }
107
+ });
108
+ Object.defineProperty(exports, "EuiTreeViewObject", {
109
+ enumerable: true,
110
+ get: function () {
111
+ return _object16.EuiTreeViewObject;
112
+ }
113
+ });
90
114
  var _base_object = require("./playwright/base_object");
91
115
  var _object = require("./playwright/components/combo_box/object");
92
116
  var _object2 = require("./playwright/components/datagrid/object");
@@ -99,5 +123,9 @@ var _object8 = require("./playwright/components/form/range/object");
99
123
  var _object9 = require("./playwright/components/popover/object");
100
124
  var _object10 = require("./playwright/components/flyout/object");
101
125
  var _object11 = require("./playwright/components/accordion/object");
102
- var _object12 = require("./playwright/components/modal/object");
103
- var _object13 = require("./playwright/components/basic_table/object");
126
+ var _object12 = require("./playwright/components/context_menu/object");
127
+ var _object13 = require("./playwright/components/modal/object");
128
+ var _object14 = require("./playwright/components/basic_table/object");
129
+ var _object15 = require("./playwright/components/color_picker/object");
130
+ var _object16 = require("./playwright/components/tree_view/object");
131
+ var _object17 = require("./playwright/components/tool_tip/object");
@@ -6,6 +6,9 @@ export type ObjectScope = Page | Locator | BaseObject;
6
6
  * scope. Subclasses compose: pass another Component Object as `scope` to
7
7
  * nest one inside the other's DOM subtree.
8
8
  *
9
+ * `testSubj` matches one space-separated token of `data-test-subj`, following
10
+ * Kibana's convention (see `@kbn/test-subj-selector`).
11
+ *
9
12
  * Requires `testIdAttribute: 'data-test-subj'` in the Playwright config.
10
13
  */
11
14
  export declare abstract class BaseObject {
@@ -12,12 +12,22 @@ exports.BaseObject = void 0;
12
12
  * Side Public License, v 1.
13
13
  */
14
14
 
15
+ /**
16
+ * Matches one space-separated token in `data-test-subj`, not the whole
17
+ * attribute value. `getByTestId` does an exact match and misses components
18
+ * like `EuiColorPicker` that add their own token to the consumer's subj.
19
+ */
20
+ const testSubjSelector = testSubj => `[data-test-subj~="${testSubj.replace(/\\/g, '\\\\').replace(/"/g, '\\"')}"]`;
21
+
15
22
  /**
16
23
  * Base class for Playwright Component Objects — semantic wrappers around a
17
24
  * single root `Locator` resolved from a `data-test-subj` inside the given
18
25
  * scope. Subclasses compose: pass another Component Object as `scope` to
19
26
  * nest one inside the other's DOM subtree.
20
27
  *
28
+ * `testSubj` matches one space-separated token of `data-test-subj`, following
29
+ * Kibana's convention (see `@kbn/test-subj-selector`).
30
+ *
21
31
  * Requires `testIdAttribute: 'data-test-subj'` in the Playwright config.
22
32
  */
23
33
  class BaseObject {
@@ -41,7 +51,7 @@ class BaseObject {
41
51
  componentVerified = false;
42
52
  constructor(scope, testSubj, componentSelector) {
43
53
  this.scope = scope instanceof BaseObject ? scope.locator : scope;
44
- this.root = this.scope.getByTestId(testSubj);
54
+ this.root = this.scope.locator(testSubjSelector(testSubj));
45
55
  this.testSubj = testSubj;
46
56
  this.componentSelector = componentSelector;
47
57
 
@@ -0,0 +1,20 @@
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/color-picker/ EuiColorPicker}.
6
+ *
7
+ * `testSubj` must be set on `EuiColorPicker` itself. Covers only the default
8
+ * text-input anchor, not a custom `button` prop. See the package README for
9
+ * what this does not cover.
10
+ */
11
+ export declare class EuiColorPickerObject extends BaseObject {
12
+ constructor(scope: ObjectScope, testSubj: string);
13
+ /**
14
+ * The popover panel. Rendered in a portal, so it is found on the page, not
15
+ * under the anchor. Resolves to zero elements while closed.
16
+ */
17
+ get panel(): Locator;
18
+ /** The swatch buttons inside {@link panel}. */
19
+ get swatches(): Locator;
20
+ }
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.EuiColorPickerObject = void 0;
7
+ var _base_object = require("../../base_object");
8
+ var _selectors = require("../../../components/color_picker/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/color-picker/ EuiColorPicker}.
20
+ *
21
+ * `testSubj` must be set on `EuiColorPicker` itself. Covers only the default
22
+ * text-input anchor, not a custom `button` prop. See the package README for
23
+ * what this does not cover.
24
+ */
25
+ class EuiColorPickerObject extends _base_object.BaseObject {
26
+ constructor(scope, testSubj) {
27
+ super(scope, testSubj, _selectors.EuiColorPickerSelectors.ANCHOR_SELECTOR);
28
+ }
29
+
30
+ /**
31
+ * The popover panel. Rendered in a portal, so it is found on the page, not
32
+ * under the anchor. Resolves to zero elements while closed.
33
+ */
34
+ get panel() {
35
+ return this.root.page().locator(_selectors.EuiColorPickerSelectors.PANEL_SELECTOR);
36
+ }
37
+
38
+ /** The swatch buttons inside {@link panel}. */
39
+ get swatches() {
40
+ return this.panel.locator(_selectors.EuiColorPickerSelectors.SWATCH_SELECTOR);
41
+ }
42
+ }
43
+ exports.EuiColorPickerObject = EuiColorPickerObject;
@@ -0,0 +1,19 @@
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/navigation/context-menu/ EuiContextMenu},
6
+ * or a standalone `EuiContextMenuPanel`.
7
+ *
8
+ * `testSubj` must be set on the `<EuiContextMenu>` or `<EuiContextMenuPanel>`
9
+ * itself. See the package README for what this does not cover.
10
+ */
11
+ export declare class EuiContextMenuObject extends BaseObject {
12
+ constructor(scope: ObjectScope, testSubj: string);
13
+ /**
14
+ * The items in the current panel, as a `Locator`. Resolves to the root
15
+ * itself when that is a standalone panel, otherwise to the last panel in
16
+ * the DOM, which is the current one when two exist during a transition.
17
+ */
18
+ get items(): Locator;
19
+ }
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.EuiContextMenuObject = void 0;
7
+ var _base_object = require("../../base_object");
8
+ var _selectors = require("../../../components/context_menu/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/navigation/context-menu/ EuiContextMenu},
20
+ * or a standalone `EuiContextMenuPanel`.
21
+ *
22
+ * `testSubj` must be set on the `<EuiContextMenu>` or `<EuiContextMenuPanel>`
23
+ * itself. See the package README for what this does not cover.
24
+ */
25
+ class EuiContextMenuObject extends _base_object.BaseObject {
26
+ constructor(scope, testSubj) {
27
+ super(scope, testSubj, _selectors.EuiContextMenuSelectors.ROOT_SELECTOR);
28
+ }
29
+
30
+ /**
31
+ * The items in the current panel, as a `Locator`. Resolves to the root
32
+ * itself when that is a standalone panel, otherwise to the last panel in
33
+ * the DOM, which is the current one when two exist during a transition.
34
+ */
35
+ get items() {
36
+ const panel = this.scope.locator(_selectors.EuiContextMenuSelectors.PANEL_SELECTOR);
37
+ return this.root.locator(_selectors.EuiContextMenuSelectors.PANEL_SELECTOR).last().or(this.root.and(panel)).locator(_selectors.EuiContextMenuSelectors.ITEM_SELECTOR);
38
+ }
39
+ }
40
+ exports.EuiContextMenuObject = EuiContextMenuObject;
@@ -0,0 +1,13 @@
1
+ import { BaseObject, type ObjectScope } from '../../base_object';
2
+ /**
3
+ * Playwright Component Object for {@link
4
+ * https://eui.elastic.co/docs/components/display/tooltip/ EuiToolTip}.
5
+ *
6
+ * `testSubj` must be set on `EuiToolTip` itself. EUI forwards it to the
7
+ * tooltip popover, which renders in a portal and only while shown, so
8
+ * `locator` resolves to zero elements until the trigger is hovered or
9
+ * focused. See the package README for what this does not cover.
10
+ */
11
+ export declare class EuiToolTipObject extends BaseObject {
12
+ constructor(scope: ObjectScope, testSubj: string);
13
+ }
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.EuiToolTipObject = void 0;
7
+ var _base_object = require("../../base_object");
8
+ var _selectors = require("../../../components/tool_tip/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/display/tooltip/ EuiToolTip}.
20
+ *
21
+ * `testSubj` must be set on `EuiToolTip` itself. EUI forwards it to the
22
+ * tooltip popover, which renders in a portal and only while shown, so
23
+ * `locator` resolves to zero elements until the trigger is hovered or
24
+ * focused. See the package README for what this does not cover.
25
+ */
26
+ class EuiToolTipObject extends _base_object.BaseObject {
27
+ constructor(scope, testSubj) {
28
+ super(scope, testSubj, _selectors.EuiToolTipSelectors.ROOT_SELECTOR);
29
+ }
30
+ }
31
+ exports.EuiToolTipObject = EuiToolTipObject;
@@ -0,0 +1,17 @@
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/navigation/tree-view/ EuiTreeView}.
6
+ *
7
+ * `testSubj` must be set on `EuiTreeView` itself. See the package README for
8
+ * what this does not cover.
9
+ */
10
+ export declare class EuiTreeViewObject extends BaseObject {
11
+ constructor(scope: ObjectScope, testSubj: string);
12
+ /**
13
+ * The node buttons of this level, in order. A node with children carries
14
+ * `aria-expanded`, a leaf does not.
15
+ */
16
+ get items(): Locator;
17
+ }
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.EuiTreeViewObject = void 0;
7
+ var _base_object = require("../../base_object");
8
+ var _selectors = require("../../../components/tree_view/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/navigation/tree-view/ EuiTreeView}.
20
+ *
21
+ * `testSubj` must be set on `EuiTreeView` itself. See the package README for
22
+ * what this does not cover.
23
+ */
24
+ class EuiTreeViewObject extends _base_object.BaseObject {
25
+ constructor(scope, testSubj) {
26
+ super(scope, testSubj, _selectors.EuiTreeViewSelectors.ROOT_SELECTOR);
27
+ }
28
+
29
+ /**
30
+ * The node buttons of this level, in order. A node with children carries
31
+ * `aria-expanded`, a leaf does not.
32
+ */
33
+ get items() {
34
+ return this.root.locator(_selectors.EuiTreeViewSelectors.ITEM_SELECTOR);
35
+ }
36
+ }
37
+ exports.EuiTreeViewObject = EuiTreeViewObject;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Stable selectors for
3
+ * {@link https://eui.elastic.co/docs/components/forms/color-picker/|EuiColorPicker}.
4
+ * `*_SELECTOR` values are CSS.
5
+ */
6
+ export declare const EuiColorPickerSelectors: {
7
+ /** The default text-input anchor. A custom `button` prop has no class of its own. */
8
+ ANCHOR_SELECTOR: string;
9
+ /** The popover panel, rendered in a portal and only while open. */
10
+ PANEL_SELECTOR: string;
11
+ /** A swatch button inside the panel. */
12
+ SWATCH_SELECTOR: string;
13
+ };
@@ -0,0 +1,21 @@
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/color-picker/|EuiColorPicker}.
11
+ * `*_SELECTOR` values are CSS.
12
+ */
13
+ export const EuiColorPickerSelectors = {
14
+ /** The default text-input anchor. A custom `button` prop has no class of its own. */
15
+ ANCHOR_SELECTOR: '.euiColorPicker__input',
16
+ /** The popover panel, rendered in a portal and only while open. */
17
+ PANEL_SELECTOR: '[data-popover-panel].euiColorPicker__popoverPanel',
18
+ /** A swatch button inside the panel. */
19
+ SWATCH_SELECTOR: '.euiColorPickerSwatch',
20
+ };
21
+ //# sourceMappingURL=selectors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"selectors.js","sourceRoot":"","sources":["../../../../src/components/color_picker/selectors.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,qFAAqF;IACrF,eAAe,EAAE,wBAAwB;IAEzC,mEAAmE;IACnE,cAAc,EAAE,mDAAmD;IAEnE,wCAAwC;IACxC,eAAe,EAAE,uBAAuB;CACzC,CAAC"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Stable selectors for
3
+ * {@link https://eui.elastic.co/docs/components/navigation/context-menu/|EuiContextMenu}.
4
+ * `*_SELECTOR` values are CSS.
5
+ */
6
+ export declare const EuiContextMenuSelectors: {
7
+ /**
8
+ * Root element carrying the consumer's `data-test-subj`: either a multi
9
+ * panel `EuiContextMenu`, or a single `EuiContextMenuPanel` used on its
10
+ * own, which is the more common Kibana pattern.
11
+ */
12
+ ROOT_SELECTOR: string;
13
+ /**
14
+ * Each panel. Two can exist at once during a panel transition (the
15
+ * outgoing one still animating out, plus the incoming one). Both are
16
+ * rendered outgoing-first in markup, so the last match is always the
17
+ * current panel.
18
+ */
19
+ PANEL_SELECTOR: string;
20
+ /** An item inside a panel. */
21
+ ITEM_SELECTOR: string;
22
+ };
@@ -0,0 +1,30 @@
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/navigation/context-menu/|EuiContextMenu}.
11
+ * `*_SELECTOR` values are CSS.
12
+ */
13
+ export const EuiContextMenuSelectors = {
14
+ /**
15
+ * Root element carrying the consumer's `data-test-subj`: either a multi
16
+ * panel `EuiContextMenu`, or a single `EuiContextMenuPanel` used on its
17
+ * own, which is the more common Kibana pattern.
18
+ */
19
+ ROOT_SELECTOR: '.euiContextMenu, .euiContextMenuPanel',
20
+ /**
21
+ * Each panel. Two can exist at once during a panel transition (the
22
+ * outgoing one still animating out, plus the incoming one). Both are
23
+ * rendered outgoing-first in markup, so the last match is always the
24
+ * current panel.
25
+ */
26
+ PANEL_SELECTOR: '.euiContextMenuPanel',
27
+ /** An item inside a panel. */
28
+ ITEM_SELECTOR: '.euiContextMenuItem',
29
+ };
30
+ //# sourceMappingURL=selectors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"selectors.js","sourceRoot":"","sources":["../../../../src/components/context_menu/selectors.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC;;;;OAIG;IACH,aAAa,EAAE,uCAAuC;IAEtD;;;;;OAKG;IACH,cAAc,EAAE,sBAAsB;IAEtC,8BAA8B;IAC9B,aAAa,EAAE,qBAAqB;CACrC,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Stable selectors for
3
+ * {@link https://eui.elastic.co/docs/components/display/tooltip/|EuiToolTip}.
4
+ * `*_SELECTOR` values are CSS.
5
+ */
6
+ export declare const EuiToolTipSelectors: {
7
+ /** The portaled tooltip. Only mounted while shown. */
8
+ ROOT_SELECTOR: string;
9
+ };
@@ -0,0 +1,17 @@
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/display/tooltip/|EuiToolTip}.
11
+ * `*_SELECTOR` values are CSS.
12
+ */
13
+ export const EuiToolTipSelectors = {
14
+ /** The portaled tooltip. Only mounted while shown. */
15
+ ROOT_SELECTOR: '.euiToolTip[role="tooltip"]',
16
+ };
17
+ //# sourceMappingURL=selectors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"selectors.js","sourceRoot":"","sources":["../../../../src/components/tool_tip/selectors.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,sDAAsD;IACtD,aAAa,EAAE,6BAA6B;CAC7C,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Stable selectors for
3
+ * {@link https://eui.elastic.co/docs/components/navigation/tree-view/|EuiTreeView}.
4
+ * `*_SELECTOR` values are CSS.
5
+ */
6
+ export declare const EuiTreeViewSelectors: {
7
+ ROOT_SELECTOR: string;
8
+ /** Node buttons of this level only. A nested tree renders its own `.euiTreeView` inside a node. */
9
+ ITEM_SELECTOR: string;
10
+ };
@@ -0,0 +1,18 @@
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/navigation/tree-view/|EuiTreeView}.
11
+ * `*_SELECTOR` values are CSS.
12
+ */
13
+ export const EuiTreeViewSelectors = {
14
+ ROOT_SELECTOR: '.euiTreeView',
15
+ /** Node buttons of this level only. A nested tree renders its own `.euiTreeView` inside a node. */
16
+ ITEM_SELECTOR: '> li > .euiTreeView__nodeInner',
17
+ };
18
+ //# sourceMappingURL=selectors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"selectors.js","sourceRoot":"","sources":["../../../../src/components/tree_view/selectors.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,aAAa,EAAE,cAAc;IAE7B,mGAAmG;IACnG,aAAa,EAAE,gCAAgC;CAChD,CAAC"}
@@ -10,5 +10,9 @@ export { EuiRangeObject } from './playwright/components/form/range/object';
10
10
  export { EuiPopoverObject } from './playwright/components/popover/object';
11
11
  export { EuiFlyoutObject } from './playwright/components/flyout/object';
12
12
  export { EuiAccordionObject } from './playwright/components/accordion/object';
13
+ export { EuiContextMenuObject } from './playwright/components/context_menu/object';
13
14
  export { EuiModalObject } from './playwright/components/modal/object';
14
15
  export { EuiBasicTableObject } from './playwright/components/basic_table/object';
16
+ export { EuiColorPickerObject } from './playwright/components/color_picker/object';
17
+ export { EuiTreeViewObject } from './playwright/components/tree_view/object';
18
+ export { EuiToolTipObject } from './playwright/components/tool_tip/object';
package/lib/esm/index.js CHANGED
@@ -17,6 +17,10 @@ export { EuiRangeObject } from './playwright/components/form/range/object';
17
17
  export { EuiPopoverObject } from './playwright/components/popover/object';
18
18
  export { EuiFlyoutObject } from './playwright/components/flyout/object';
19
19
  export { EuiAccordionObject } from './playwright/components/accordion/object';
20
+ export { EuiContextMenuObject } from './playwright/components/context_menu/object';
20
21
  export { EuiModalObject } from './playwright/components/modal/object';
21
22
  export { EuiBasicTableObject } from './playwright/components/basic_table/object';
23
+ export { EuiColorPickerObject } from './playwright/components/color_picker/object';
24
+ export { EuiTreeViewObject } from './playwright/components/tree_view/object';
25
+ export { EuiToolTipObject } from './playwright/components/tool_tip/object';
22
26
  //# 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,kBAAkB,EAAE,MAAM,8CAA8C,CAAC;AAClF,OAAO,EAAE,qBAAqB,EAAE,MAAM,8CAA8C,CAAC;AACrF,OAAO,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAC;AAC3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAC1E,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AACxE,OAAO,EAAE,kBAAkB,EAAE,MAAM,0CAA0C,CAAC;AAC9E,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AACtE,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,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAC1E,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AACxE,OAAO,EAAE,kBAAkB,EAAE,MAAM,0CAA0C,CAAC;AAC9E,OAAO,EAAE,oBAAoB,EAAE,MAAM,6CAA6C,CAAC;AACnF,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,4CAA4C,CAAC;AACjF,OAAO,EAAE,oBAAoB,EAAE,MAAM,6CAA6C,CAAC;AACnF,OAAO,EAAE,iBAAiB,EAAE,MAAM,0CAA0C,CAAC;AAC7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC"}
@@ -6,6 +6,9 @@ export type ObjectScope = Page | Locator | BaseObject;
6
6
  * scope. Subclasses compose: pass another Component Object as `scope` to
7
7
  * nest one inside the other's DOM subtree.
8
8
  *
9
+ * `testSubj` matches one space-separated token of `data-test-subj`, following
10
+ * Kibana's convention (see `@kbn/test-subj-selector`).
11
+ *
9
12
  * Requires `testIdAttribute: 'data-test-subj'` in the Playwright config.
10
13
  */
11
14
  export declare abstract class BaseObject {
@@ -5,19 +5,28 @@
5
5
  * in compliance with, at your election, the Elastic License 2.0 or the Server
6
6
  * Side Public License, v 1.
7
7
  */
8
+ /**
9
+ * Matches one space-separated token in `data-test-subj`, not the whole
10
+ * attribute value. `getByTestId` does an exact match and misses components
11
+ * like `EuiColorPicker` that add their own token to the consumer's subj.
12
+ */
13
+ const testSubjSelector = (testSubj) => `[data-test-subj~="${testSubj.replace(/\\/g, '\\\\').replace(/"/g, '\\"')}"]`;
8
14
  /**
9
15
  * Base class for Playwright Component Objects — semantic wrappers around a
10
16
  * single root `Locator` resolved from a `data-test-subj` inside the given
11
17
  * scope. Subclasses compose: pass another Component Object as `scope` to
12
18
  * nest one inside the other's DOM subtree.
13
19
  *
20
+ * `testSubj` matches one space-separated token of `data-test-subj`, following
21
+ * Kibana's convention (see `@kbn/test-subj-selector`).
22
+ *
14
23
  * Requires `testIdAttribute: 'data-test-subj'` in the Playwright config.
15
24
  */
16
25
  export class BaseObject {
17
26
  constructor(scope, testSubj, componentSelector) {
18
27
  this.componentVerified = false;
19
28
  this.scope = scope instanceof BaseObject ? scope.locator : scope;
20
- this.root = this.scope.getByTestId(testSubj);
29
+ this.root = this.scope.locator(testSubjSelector(testSubj));
21
30
  this.testSubj = testSubj;
22
31
  this.componentSelector = componentSelector;
23
32
  // Guard every async public method. A constructor can't be async, so instead
@@ -1 +1 @@
1
- {"version":3,"file":"base_object.js","sourceRoot":"","sources":["../../../src/playwright/base_object.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH;;;;;;;GAOG;AACH,MAAM,OAAgB,UAAU;IAyB9B,YAAY,KAAkB,EAAE,QAAgB,EAAE,iBAA0B;QAFpE,sBAAiB,GAAG,KAAK,CAAC;QAGhC,IAAI,CAAC,KAAK,GAAG,KAAK,YAAY,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC;QACjE,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;QAC7C,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;QAE3C,4EAA4E;QAC5E,6EAA6E;QAC7E,2EAA2E;QAC3E,uEAAuE;QACvE,yEAAyE;QACzE,OAAO,IAAI,KAAK,CAAC,IAAI,EAAE;YACrB,GAAG,CAAC,MAAM,EAAE,IAAI;gBACd,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;gBAChD,MAAM,WAAW,GACf,OAAO,KAAK,KAAK,UAAU;oBAC3B,KAAK,CAAC,WAAW,CAAC,IAAI,KAAK,eAAe;oBAC1C,IAAI,KAAK,iBAAiB;oBAC1B,CAAC,CAAC,IAAI,IAAI,MAAM,CAAC,SAAS,CAAC,CAAC;gBAE9B,IAAI,CAAC,WAAW,EAAE,CAAC;oBACjB,OAAO,KAAK,CAAC;gBACf,CAAC;gBAED,OAAO,KAAK,EAAE,GAAG,IAAe,EAAE,EAAE;oBAClC,MAAM,MAAM,CAAC,eAAe,EAAE,CAAC;oBAC/B,OAAO,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;gBAC5C,CAAC,CAAC;YACJ,CAAC;SACF,CAAC,CAAC;IACL,CAAC;IAED;;;OAGG;IACH,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;IAED;;;;;;OAMG;IACO,KAAK,CAAC,eAAe;QAC7B,IAAI,IAAI,CAAC,iBAAiB,IAAI,CAAC,IAAI,CAAC,iBAAiB,EAAE,CAAC;YACtD,OAAO;QACT,CAAC;QACD,4EAA4E;QAC5E,8EAA8E;QAC9E,yEAAyE;QACzE,IAAI,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC;YACpC,OAAO;QACT,CAAC;QACD,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,IAAI;aAC5B,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;aAC/C,KAAK,EAAE,CAAC;QACX,IAAI,OAAO,KAAK,CAAC,EAAE,CAAC;YAClB,MAAM,IAAI,KAAK,CACb,6CAA6C,IAAI,CAAC,QAAQ,eAAe,IAAI,CAAC,iBAAiB,KAAK;gBAClG,6EAA6E,CAChF,CAAC;QACJ,CAAC;QACD,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC;IAChC,CAAC;CACF"}
1
+ {"version":3,"file":"base_object.js","sourceRoot":"","sources":["../../../src/playwright/base_object.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH;;;;GAIG;AACH,MAAM,gBAAgB,GAAG,CAAC,QAAgB,EAAU,EAAE,CACpD,qBAAqB,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC;AAEhF;;;;;;;;;;GAUG;AACH,MAAM,OAAgB,UAAU;IAyB9B,YAAY,KAAkB,EAAE,QAAgB,EAAE,iBAA0B;QAFpE,sBAAiB,GAAG,KAAK,CAAC;QAGhC,IAAI,CAAC,KAAK,GAAG,KAAK,YAAY,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC;QACjE,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC,CAAC;QAC3D,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;QAE3C,4EAA4E;QAC5E,6EAA6E;QAC7E,2EAA2E;QAC3E,uEAAuE;QACvE,yEAAyE;QACzE,OAAO,IAAI,KAAK,CAAC,IAAI,EAAE;YACrB,GAAG,CAAC,MAAM,EAAE,IAAI;gBACd,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;gBAChD,MAAM,WAAW,GACf,OAAO,KAAK,KAAK,UAAU;oBAC3B,KAAK,CAAC,WAAW,CAAC,IAAI,KAAK,eAAe;oBAC1C,IAAI,KAAK,iBAAiB;oBAC1B,CAAC,CAAC,IAAI,IAAI,MAAM,CAAC,SAAS,CAAC,CAAC;gBAE9B,IAAI,CAAC,WAAW,EAAE,CAAC;oBACjB,OAAO,KAAK,CAAC;gBACf,CAAC;gBAED,OAAO,KAAK,EAAE,GAAG,IAAe,EAAE,EAAE;oBAClC,MAAM,MAAM,CAAC,eAAe,EAAE,CAAC;oBAC/B,OAAO,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;gBAC5C,CAAC,CAAC;YACJ,CAAC;SACF,CAAC,CAAC;IACL,CAAC;IAED;;;OAGG;IACH,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;IAED;;;;;;OAMG;IACO,KAAK,CAAC,eAAe;QAC7B,IAAI,IAAI,CAAC,iBAAiB,IAAI,CAAC,IAAI,CAAC,iBAAiB,EAAE,CAAC;YACtD,OAAO;QACT,CAAC;QACD,4EAA4E;QAC5E,8EAA8E;QAC9E,yEAAyE;QACzE,IAAI,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC;YACpC,OAAO;QACT,CAAC;QACD,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,IAAI;aAC5B,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;aAC/C,KAAK,EAAE,CAAC;QACX,IAAI,OAAO,KAAK,CAAC,EAAE,CAAC;YAClB,MAAM,IAAI,KAAK,CACb,6CAA6C,IAAI,CAAC,QAAQ,eAAe,IAAI,CAAC,iBAAiB,KAAK;gBAClG,6EAA6E,CAChF,CAAC;QACJ,CAAC;QACD,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC;IAChC,CAAC;CACF"}
@@ -0,0 +1,20 @@
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/color-picker/ EuiColorPicker}.
6
+ *
7
+ * `testSubj` must be set on `EuiColorPicker` itself. Covers only the default
8
+ * text-input anchor, not a custom `button` prop. See the package README for
9
+ * what this does not cover.
10
+ */
11
+ export declare class EuiColorPickerObject extends BaseObject {
12
+ constructor(scope: ObjectScope, testSubj: string);
13
+ /**
14
+ * The popover panel. Rendered in a portal, so it is found on the page, not
15
+ * under the anchor. Resolves to zero elements while closed.
16
+ */
17
+ get panel(): Locator;
18
+ /** The swatch buttons inside {@link panel}. */
19
+ get swatches(): Locator;
20
+ }
@@ -0,0 +1,34 @@
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 { EuiColorPickerSelectors } from '../../../components/color_picker/selectors';
10
+ /**
11
+ * Playwright Component Object for {@link
12
+ * https://eui.elastic.co/docs/components/forms/color-picker/ EuiColorPicker}.
13
+ *
14
+ * `testSubj` must be set on `EuiColorPicker` itself. Covers only the default
15
+ * text-input anchor, not a custom `button` prop. See the package README for
16
+ * what this does not cover.
17
+ */
18
+ export class EuiColorPickerObject extends BaseObject {
19
+ constructor(scope, testSubj) {
20
+ super(scope, testSubj, EuiColorPickerSelectors.ANCHOR_SELECTOR);
21
+ }
22
+ /**
23
+ * The popover panel. Rendered in a portal, so it is found on the page, not
24
+ * under the anchor. Resolves to zero elements while closed.
25
+ */
26
+ get panel() {
27
+ return this.root.page().locator(EuiColorPickerSelectors.PANEL_SELECTOR);
28
+ }
29
+ /** The swatch buttons inside {@link panel}. */
30
+ get swatches() {
31
+ return this.panel.locator(EuiColorPickerSelectors.SWATCH_SELECTOR);
32
+ }
33
+ }
34
+ //# sourceMappingURL=object.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"object.js","sourceRoot":"","sources":["../../../../../src/playwright/components/color_picker/object.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,EAAE,UAAU,EAAoB,MAAM,mBAAmB,CAAC;AACjE,OAAO,EAAE,uBAAuB,EAAE,MAAM,4CAA4C,CAAC;AAErF;;;;;;;GAOG;AACH,MAAM,OAAO,oBAAqB,SAAQ,UAAU;IAClD,YAAY,KAAkB,EAAE,QAAgB;QAC9C,KAAK,CAAC,KAAK,EAAE,QAAQ,EAAE,uBAAuB,CAAC,eAAe,CAAC,CAAC;IAClE,CAAC;IAED;;;OAGG;IACH,IAAW,KAAK;QACd,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,uBAAuB,CAAC,cAAc,CAAC,CAAC;IAC1E,CAAC;IAED,+CAA+C;IAC/C,IAAW,QAAQ;QACjB,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,uBAAuB,CAAC,eAAe,CAAC,CAAC;IACrE,CAAC;CACF"}
@@ -0,0 +1,19 @@
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/navigation/context-menu/ EuiContextMenu},
6
+ * or a standalone `EuiContextMenuPanel`.
7
+ *
8
+ * `testSubj` must be set on the `<EuiContextMenu>` or `<EuiContextMenuPanel>`
9
+ * itself. See the package README for what this does not cover.
10
+ */
11
+ export declare class EuiContextMenuObject extends BaseObject {
12
+ constructor(scope: ObjectScope, testSubj: string);
13
+ /**
14
+ * The items in the current panel, as a `Locator`. Resolves to the root
15
+ * itself when that is a standalone panel, otherwise to the last panel in
16
+ * the DOM, which is the current one when two exist during a transition.
17
+ */
18
+ get items(): Locator;
19
+ }
@@ -0,0 +1,36 @@
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 { EuiContextMenuSelectors } from '../../../components/context_menu/selectors';
10
+ /**
11
+ * Playwright Component Object for {@link
12
+ * https://eui.elastic.co/docs/components/navigation/context-menu/ EuiContextMenu},
13
+ * or a standalone `EuiContextMenuPanel`.
14
+ *
15
+ * `testSubj` must be set on the `<EuiContextMenu>` or `<EuiContextMenuPanel>`
16
+ * itself. See the package README for what this does not cover.
17
+ */
18
+ export class EuiContextMenuObject extends BaseObject {
19
+ constructor(scope, testSubj) {
20
+ super(scope, testSubj, EuiContextMenuSelectors.ROOT_SELECTOR);
21
+ }
22
+ /**
23
+ * The items in the current panel, as a `Locator`. Resolves to the root
24
+ * itself when that is a standalone panel, otherwise to the last panel in
25
+ * the DOM, which is the current one when two exist during a transition.
26
+ */
27
+ get items() {
28
+ const panel = this.scope.locator(EuiContextMenuSelectors.PANEL_SELECTOR);
29
+ return this.root
30
+ .locator(EuiContextMenuSelectors.PANEL_SELECTOR)
31
+ .last()
32
+ .or(this.root.and(panel))
33
+ .locator(EuiContextMenuSelectors.ITEM_SELECTOR);
34
+ }
35
+ }
36
+ //# sourceMappingURL=object.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"object.js","sourceRoot":"","sources":["../../../../../src/playwright/components/context_menu/object.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,EAAE,UAAU,EAAoB,MAAM,mBAAmB,CAAC;AACjE,OAAO,EAAE,uBAAuB,EAAE,MAAM,4CAA4C,CAAC;AAErF;;;;;;;GAOG;AACH,MAAM,OAAO,oBAAqB,SAAQ,UAAU;IAClD,YAAY,KAAkB,EAAE,QAAgB;QAC9C,KAAK,CAAC,KAAK,EAAE,QAAQ,EAAE,uBAAuB,CAAC,aAAa,CAAC,CAAC;IAChE,CAAC;IAED;;;;OAIG;IACH,IAAW,KAAK;QACd,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,uBAAuB,CAAC,cAAc,CAAC,CAAC;QACzE,OAAO,IAAI,CAAC,IAAI;aACb,OAAO,CAAC,uBAAuB,CAAC,cAAc,CAAC;aAC/C,IAAI,EAAE;aACN,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;aACxB,OAAO,CAAC,uBAAuB,CAAC,aAAa,CAAC,CAAC;IACpD,CAAC;CACF"}
@@ -0,0 +1,13 @@
1
+ import { BaseObject, type ObjectScope } from '../../base_object';
2
+ /**
3
+ * Playwright Component Object for {@link
4
+ * https://eui.elastic.co/docs/components/display/tooltip/ EuiToolTip}.
5
+ *
6
+ * `testSubj` must be set on `EuiToolTip` itself. EUI forwards it to the
7
+ * tooltip popover, which renders in a portal and only while shown, so
8
+ * `locator` resolves to zero elements until the trigger is hovered or
9
+ * focused. See the package README for what this does not cover.
10
+ */
11
+ export declare class EuiToolTipObject extends BaseObject {
12
+ constructor(scope: ObjectScope, testSubj: string);
13
+ }
@@ -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
+ import { BaseObject } from '../../base_object';
9
+ import { EuiToolTipSelectors } from '../../../components/tool_tip/selectors';
10
+ /**
11
+ * Playwright Component Object for {@link
12
+ * https://eui.elastic.co/docs/components/display/tooltip/ EuiToolTip}.
13
+ *
14
+ * `testSubj` must be set on `EuiToolTip` itself. EUI forwards it to the
15
+ * tooltip popover, which renders in a portal and only while shown, so
16
+ * `locator` resolves to zero elements until the trigger is hovered or
17
+ * focused. See the package README for what this does not cover.
18
+ */
19
+ export class EuiToolTipObject extends BaseObject {
20
+ constructor(scope, testSubj) {
21
+ super(scope, testSubj, EuiToolTipSelectors.ROOT_SELECTOR);
22
+ }
23
+ }
24
+ //# sourceMappingURL=object.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"object.js","sourceRoot":"","sources":["../../../../../src/playwright/components/tool_tip/object.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,UAAU,EAAoB,MAAM,mBAAmB,CAAC;AACjE,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAE7E;;;;;;;;GAQG;AACH,MAAM,OAAO,gBAAiB,SAAQ,UAAU;IAC9C,YAAY,KAAkB,EAAE,QAAgB;QAC9C,KAAK,CAAC,KAAK,EAAE,QAAQ,EAAE,mBAAmB,CAAC,aAAa,CAAC,CAAC;IAC5D,CAAC;CACF"}
@@ -0,0 +1,17 @@
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/navigation/tree-view/ EuiTreeView}.
6
+ *
7
+ * `testSubj` must be set on `EuiTreeView` itself. See the package README for
8
+ * what this does not cover.
9
+ */
10
+ export declare class EuiTreeViewObject extends BaseObject {
11
+ constructor(scope: ObjectScope, testSubj: string);
12
+ /**
13
+ * The node buttons of this level, in order. A node with children carries
14
+ * `aria-expanded`, a leaf does not.
15
+ */
16
+ get items(): Locator;
17
+ }
@@ -0,0 +1,29 @@
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 { EuiTreeViewSelectors } from '../../../components/tree_view/selectors';
10
+ /**
11
+ * Playwright Component Object for {@link
12
+ * https://eui.elastic.co/docs/components/navigation/tree-view/ EuiTreeView}.
13
+ *
14
+ * `testSubj` must be set on `EuiTreeView` itself. See the package README for
15
+ * what this does not cover.
16
+ */
17
+ export class EuiTreeViewObject extends BaseObject {
18
+ constructor(scope, testSubj) {
19
+ super(scope, testSubj, EuiTreeViewSelectors.ROOT_SELECTOR);
20
+ }
21
+ /**
22
+ * The node buttons of this level, in order. A node with children carries
23
+ * `aria-expanded`, a leaf does not.
24
+ */
25
+ get items() {
26
+ return this.root.locator(EuiTreeViewSelectors.ITEM_SELECTOR);
27
+ }
28
+ }
29
+ //# sourceMappingURL=object.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"object.js","sourceRoot":"","sources":["../../../../../src/playwright/components/tree_view/object.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,EAAE,UAAU,EAAoB,MAAM,mBAAmB,CAAC;AACjE,OAAO,EAAE,oBAAoB,EAAE,MAAM,yCAAyC,CAAC;AAE/E;;;;;;GAMG;AACH,MAAM,OAAO,iBAAkB,SAAQ,UAAU;IAC/C,YAAY,KAAkB,EAAE,QAAgB;QAC9C,KAAK,CAAC,KAAK,EAAE,QAAQ,EAAE,oBAAoB,CAAC,aAAa,CAAC,CAAC;IAC7D,CAAC;IAED;;;OAGG;IACH,IAAW,KAAK;QACd,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC,aAAa,CAAC,CAAC;IAC/D,CAAC;CACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elastic/eui-test-helpers",
3
- "version": "1.6.0",
3
+ "version": "1.7.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": {
@@ -0,0 +1,30 @@
1
+ # EuiColorPickerObject
2
+
3
+ Playwright Component Object for [EuiColorPicker](https://eui.elastic.co/docs/components/forms/color-picker/).
4
+
5
+ ## Usage
6
+
7
+ ```ts
8
+ import { EuiColorPickerObject } from '@elastic/eui-test-helpers';
9
+
10
+ const colorPicker = new EuiColorPickerObject(page, 'myColorPicker');
11
+ await colorPicker.locator.click();
12
+ await colorPicker.swatches.first().click();
13
+ ```
14
+
15
+ Set `data-test-subj` on `EuiColorPicker` itself. `EuiColorPicker` renders it on its anchor as `euiColorPickerAnchor <yourSubj>`, a compound value the shared root lookup matches by token. Without that, `getByTestId` on your own subj finds nothing.
16
+
17
+ ## API
18
+
19
+ | Member | Description |
20
+ |---|---|
21
+ | `panel` | `Locator` for the popover panel. Rendered in a portal, so it is found on the page, not under the anchor. Resolves to zero elements while closed, and gets `data-popover-open="true"` once open. |
22
+ | `swatches` | `Locator` for the swatch buttons inside `panel`. |
23
+
24
+ `locator` is the anchor, a plain text input. Click it to open the picker, and use Playwright's own `inputValue()`/`fill()` to read or set the color.
25
+
26
+ ## Deliberately out of scope
27
+
28
+ - **A custom `button` prop**: only the default text-input anchor has a class the component-type guard can rely on. A custom button has none, so it is not supported.
29
+ - **`open()`/`close()` methods**: `EuiPopover` only sets `aria-expanded`/`aria-controls` on button-like toggles, and the default anchor is an input, so the signal `EuiPopoverObject` relies on is missing. Click `locator` and assert on `panel` instead.
30
+ - **Several pickers open at once**: `panel` is found by class on the page, so two open pickers would both match. No consumer has needed this.
@@ -0,0 +1,26 @@
1
+ # EuiContextMenuObject
2
+
3
+ Playwright Component Object for [EuiContextMenu](https://eui.elastic.co/docs/components/navigation/context-menu/), or a standalone `EuiContextMenuPanel`, the more common Kibana pattern (a single panel inside a popover, no multi panel wrapper).
4
+
5
+ ## Usage
6
+
7
+ ```ts
8
+ import { EuiContextMenuObject } from '@elastic/eui-test-helpers';
9
+
10
+ const contextMenu = new EuiContextMenuObject(page, 'myContextMenu');
11
+ await contextMenu.items.filter({ hasText: 'Delete' }).click();
12
+ ```
13
+
14
+ Set `data-test-subj` on the `<EuiContextMenu>` or the `<EuiContextMenuPanel>` itself, which the component-type guard verifies.
15
+
16
+ ## API
17
+
18
+ | Member | Description |
19
+ |---|---|
20
+ | `items` | `Locator` for the items in the current panel. |
21
+
22
+ When the root is a standalone panel, `items` is that panel's items. When it is an `EuiContextMenu`, `items` resolves to the last `.euiContextMenuPanel` in the DOM. During a panel transition (navigating to a nested panel or back) the outgoing panel can briefly still be in the DOM alongside the incoming one, and the incoming one always renders after it, so this avoids matching stale items from a panel that is on its way out.
23
+
24
+ ## Deliberately out of scope
25
+
26
+ - **Clicking an item by label**: every real consumer already gives its own items a stable `data-test-subj`, so click those directly. `items` is for the cases where filtering by content is genuinely needed, e.g. `items.filter({ hasText: label })`.
@@ -0,0 +1,24 @@
1
+ # EuiToolTipObject
2
+
3
+ Playwright Component Object for [EuiToolTip](https://eui.elastic.co/docs/components/display/tooltip/).
4
+
5
+ ## Usage
6
+
7
+ ```ts
8
+ import { EuiToolTipObject } from '@elastic/eui-test-helpers';
9
+
10
+ const toolTip = new EuiToolTipObject(page, 'myToolTip');
11
+ await page.getByRole('button', { name: 'Save' }).hover();
12
+ await expect(toolTip.locator).toHaveText('Saves the dashboard');
13
+ ```
14
+
15
+ Set `data-test-subj` on `EuiToolTip` itself. EUI forwards it to the tooltip popover, not the trigger. The popover renders in a portal and is only mounted while shown, so `locator` resolves to zero elements until the trigger is hovered or focused, and again once it is not. Retrying assertions on `locator` cover both without a wait.
16
+
17
+ ## API
18
+
19
+ This object exposes no members beyond `locator`. Showing and hiding go through the trigger with Playwright's own `hover()`, `focus()` and `blur()`.
20
+
21
+ ## Deliberately out of scope
22
+
23
+ - **The trigger**: it is the consumer's own element, so target it directly. `EuiToolTip` only wraps it in a plain `span`.
24
+ - **Hiding with Escape**: it bubbles to page level handlers such as modals and flyouts. Blur or move the mouse off the trigger instead.
@@ -0,0 +1,28 @@
1
+ # EuiTreeViewObject
2
+
3
+ Playwright Component Object for [EuiTreeView](https://eui.elastic.co/docs/components/navigation/tree-view/).
4
+
5
+ ## Usage
6
+
7
+ ```ts
8
+ import { EuiTreeViewObject } from '@elastic/eui-test-helpers';
9
+
10
+ const treeView = new EuiTreeViewObject(page, 'myTreeView');
11
+ await treeView.items.filter({ hasText: 'Item One' }).click();
12
+ await expect(treeView.items).toHaveCount(2);
13
+ ```
14
+
15
+ Set `data-test-subj` on `EuiTreeView` itself, which the component-type guard verifies.
16
+
17
+ ## API
18
+
19
+ | Member | Description |
20
+ |---|---|
21
+ | `items` | `Locator` for the node buttons of this level, in order. A node with children carries `aria-expanded`, which reflects open state synchronously. A leaf has no `aria-expanded`. |
22
+
23
+ `items` reads direct children of the root only. A nested `EuiTreeView` renders its own `.euiTreeView` inside an expanded node, so a plain descendant search would mix levels.
24
+
25
+ ## Deliberately out of scope
26
+
27
+ - **Nested levels**: `EuiTreeView` gives nested trees no `data-test-subj` of their own, so there is nothing to scope a second object to. Reach nested nodes through a plain locator under the expanded node until a consumer needs more.
28
+ - **Expand and collapse methods**: clicking a node toggles it and `aria-expanded` updates synchronously, so `items.nth(i).click()` plus a retrying assertion is enough.