@elastic/eui-test-helpers 2.2.0 → 2.3.0-snapshot.1794281274327

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 (45) hide show
  1. package/README.md +3 -0
  2. package/lib/cjs/components/card/selectors.d.ts +15 -0
  3. package/lib/cjs/components/card/selectors.js +29 -0
  4. package/lib/cjs/components/markdown_editor/selectors.d.ts +17 -0
  5. package/lib/cjs/components/markdown_editor/selectors.js +31 -0
  6. package/lib/cjs/components/tabs/selectors.d.ts +17 -0
  7. package/lib/cjs/components/tabs/selectors.js +31 -0
  8. package/lib/cjs/index.d.ts +3 -0
  9. package/lib/cjs/index.js +33 -12
  10. package/lib/cjs/playwright/components/card/object.d.ts +23 -0
  11. package/lib/cjs/playwright/components/card/object.js +69 -0
  12. package/lib/cjs/playwright/components/markdown_editor/object.d.ts +24 -0
  13. package/lib/cjs/playwright/components/markdown_editor/object.js +70 -0
  14. package/lib/cjs/playwright/components/tabs/object.d.ts +31 -0
  15. package/lib/cjs/playwright/components/tabs/object.js +76 -0
  16. package/lib/cjs/selectors.d.ts +20 -0
  17. package/lib/cjs/selectors.js +46 -40
  18. package/lib/esm/components/card/selectors.d.ts +15 -0
  19. package/lib/esm/components/card/selectors.js +23 -0
  20. package/lib/esm/components/card/selectors.js.map +1 -0
  21. package/lib/esm/components/markdown_editor/selectors.d.ts +17 -0
  22. package/lib/esm/components/markdown_editor/selectors.js +25 -0
  23. package/lib/esm/components/markdown_editor/selectors.js.map +1 -0
  24. package/lib/esm/components/tabs/selectors.d.ts +17 -0
  25. package/lib/esm/components/tabs/selectors.js +25 -0
  26. package/lib/esm/components/tabs/selectors.js.map +1 -0
  27. package/lib/esm/index.d.ts +3 -0
  28. package/lib/esm/index.js +3 -0
  29. package/lib/esm/index.js.map +1 -1
  30. package/lib/esm/playwright/components/card/object.d.ts +23 -0
  31. package/lib/esm/playwright/components/card/object.js +54 -0
  32. package/lib/esm/playwright/components/card/object.js.map +1 -0
  33. package/lib/esm/playwright/components/markdown_editor/object.d.ts +24 -0
  34. package/lib/esm/playwright/components/markdown_editor/object.js +57 -0
  35. package/lib/esm/playwright/components/markdown_editor/object.js.map +1 -0
  36. package/lib/esm/playwright/components/tabs/object.d.ts +31 -0
  37. package/lib/esm/playwright/components/tabs/object.js +70 -0
  38. package/lib/esm/playwright/components/tabs/object.js.map +1 -0
  39. package/lib/esm/selectors.d.ts +20 -0
  40. package/lib/esm/selectors.js +6 -0
  41. package/lib/esm/selectors.js.map +1 -1
  42. package/package.json +3 -2
  43. package/src/components/card/README.md +30 -0
  44. package/src/components/markdown_editor/README.md +30 -0
  45. package/src/components/tabs/README.md +29 -0
package/README.md CHANGED
@@ -63,9 +63,12 @@ their own version at runtime.
63
63
  | `EuiContextMenuObject` | [src/components/context_menu/README.md](src/components/context_menu/README.md) |
64
64
  | `EuiModalObject` | [src/components/modal/README.md](src/components/modal/README.md) |
65
65
  | `EuiTableObject` | [src/components/table/README.md](src/components/table/README.md) |
66
+ | `EuiTabsObject` | [src/components/tabs/README.md](src/components/tabs/README.md) |
67
+ | `EuiMarkdownEditorObject` | [src/components/markdown_editor/README.md](src/components/markdown_editor/README.md) |
66
68
  | `EuiPaginationObject` | [src/components/pagination/README.md](src/components/pagination/README.md) |
67
69
  | `EuiBasicTableObject` | [src/components/basic_table/README.md](src/components/basic_table/README.md) |
68
70
  | `EuiCallOutObject` | [src/components/call_out/README.md](src/components/call_out/README.md) |
71
+ | `EuiCardObject` | [src/components/card/README.md](src/components/card/README.md) |
69
72
  | `EuiColorPickerObject` | [src/components/color_picker/README.md](src/components/color_picker/README.md) |
70
73
  | `EuiTreeViewObject` | [src/components/tree_view/README.md](src/components/tree_view/README.md) |
71
74
  | `EuiToolTipObject` | [src/components/tool_tip/README.md](src/components/tool_tip/README.md) |
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Stable selectors for
3
+ * {@link https://eui.elastic.co/docs/components/display/card/|EuiCard}.
4
+ * `*_SELECTOR` values are CSS, `*_TEST_SUBJ` values are `data-test-subj` names EUI sets itself.
5
+ */
6
+ export declare const EuiCardSelectors: {
7
+ /** The panel carrying the consumer's `data-test-subj`. */
8
+ ROOT_SELECTOR: string;
9
+ /** The title element, wrapping a link or button when the card is clickable. */
10
+ TITLE_SELECTOR: string;
11
+ /** The description text, rendered only when `description` is set. */
12
+ DESCRIPTION_SELECTOR: string;
13
+ /** The `selectable` toggle button, a `role="switch"` with `aria-checked`, direct child of the panel. */
14
+ SELECT_BUTTON_SELECTOR: string;
15
+ };
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.EuiCardSelectors = 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/card/|EuiCard}.
18
+ * `*_SELECTOR` values are CSS, `*_TEST_SUBJ` values are `data-test-subj` names EUI sets itself.
19
+ */
20
+ const EuiCardSelectors = exports.EuiCardSelectors = {
21
+ /** The panel carrying the consumer's `data-test-subj`. */
22
+ ROOT_SELECTOR: '.euiCard',
23
+ /** The title element, wrapping a link or button when the card is clickable. */
24
+ TITLE_SELECTOR: '.euiCard__title',
25
+ /** The description text, rendered only when `description` is set. */
26
+ DESCRIPTION_SELECTOR: '.euiCard__content > .euiText',
27
+ /** The `selectable` toggle button, a `role="switch"` with `aria-checked`, direct child of the panel. */
28
+ SELECT_BUTTON_SELECTOR: 'button[role="switch"]'
29
+ };
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Stable selectors for
3
+ * {@link https://eui.elastic.co/docs/components/editors-and-syntax/markdown-editor/|EuiMarkdownEditor}.
4
+ * `*_SELECTOR` values are CSS, `*_TEST_SUBJ` values are `data-test-subj` names EUI sets itself.
5
+ */
6
+ export declare const EuiMarkdownEditorSelectors: {
7
+ /** The wrapper carrying the consumer's `data-test-subj`. */
8
+ ROOT_SELECTOR: string;
9
+ /** The `<textarea>` holding the markdown source. */
10
+ TEXT_AREA_SELECTOR: string;
11
+ /** The rendered markdown, only in the DOM while previewing. */
12
+ PREVIEW_SELECTOR: string;
13
+ /** The toolbar button that switches to preview. */
14
+ PREVIEW_BUTTON_TEST_SUBJ: string;
15
+ /** The toolbar button that switches back to editing. */
16
+ EDIT_BUTTON_TEST_SUBJ: string;
17
+ };
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.EuiMarkdownEditorSelectors = 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/editors-and-syntax/markdown-editor/|EuiMarkdownEditor}.
18
+ * `*_SELECTOR` values are CSS, `*_TEST_SUBJ` values are `data-test-subj` names EUI sets itself.
19
+ */
20
+ const EuiMarkdownEditorSelectors = exports.EuiMarkdownEditorSelectors = {
21
+ /** The wrapper carrying the consumer's `data-test-subj`. */
22
+ ROOT_SELECTOR: '.euiMarkdownEditor',
23
+ /** The `<textarea>` holding the markdown source. */
24
+ TEXT_AREA_SELECTOR: '.euiMarkdownEditorTextArea',
25
+ /** The rendered markdown, only in the DOM while previewing. */
26
+ PREVIEW_SELECTOR: '.euiMarkdownEditorPreview',
27
+ /** The toolbar button that switches to preview. */
28
+ PREVIEW_BUTTON_TEST_SUBJ: 'markdown_editor_edit_button',
29
+ /** The toolbar button that switches back to editing. */
30
+ EDIT_BUTTON_TEST_SUBJ: 'markdown_editor_preview_button'
31
+ };
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Stable selectors for
3
+ * {@link https://eui.elastic.co/docs/components/navigation/tabs/|EuiTabs}.
4
+ * `*_SELECTOR` values are CSS.
5
+ */
6
+ export declare const EuiTabsSelectors: {
7
+ /** The tab list. `EuiTabbedContent` puts the consumer's subj on a wrapper whose first child is the list. */
8
+ ROOT_SELECTOR: string;
9
+ /** The tab list element itself. */
10
+ LIST_SELECTOR: string;
11
+ /** A tab, an `<a>` or `<button>` with `role="tab"`. */
12
+ TAB_SELECTOR: string;
13
+ /** The selected tab. */
14
+ SELECTED_TAB_SELECTOR: string;
15
+ /** The label span inside a tab, without `prepend` or `append` content. */
16
+ TAB_CONTENT_SELECTOR: string;
17
+ };
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.EuiTabsSelectors = 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/tabs/|EuiTabs}.
18
+ * `*_SELECTOR` values are CSS.
19
+ */
20
+ const EuiTabsSelectors = exports.EuiTabsSelectors = {
21
+ /** The tab list. `EuiTabbedContent` puts the consumer's subj on a wrapper whose first child is the list. */
22
+ ROOT_SELECTOR: '.euiTabs, :has(> .euiTabs)',
23
+ /** The tab list element itself. */
24
+ LIST_SELECTOR: '.euiTabs',
25
+ /** A tab, an `<a>` or `<button>` with `role="tab"`. */
26
+ TAB_SELECTOR: '.euiTab',
27
+ /** The selected tab. */
28
+ SELECTED_TAB_SELECTOR: '.euiTab-isSelected',
29
+ /** The label span inside a tab, without `prepend` or `append` content. */
30
+ TAB_CONTENT_SELECTOR: '.euiTab__content'
31
+ };
@@ -16,9 +16,12 @@ export { EuiAccordionObject } from './playwright/components/accordion/object';
16
16
  export { EuiContextMenuObject } from './playwright/components/context_menu/object';
17
17
  export { EuiModalObject } from './playwright/components/modal/object';
18
18
  export { EuiTableObject } from './playwright/components/table/object';
19
+ export { EuiTabsObject } from './playwright/components/tabs/object';
20
+ export { EuiMarkdownEditorObject } from './playwright/components/markdown_editor/object';
19
21
  export { EuiPaginationObject } from './playwright/components/pagination/object';
20
22
  export { EuiBasicTableObject } from './playwright/components/basic_table/object';
21
23
  export { EuiCallOutObject } from './playwright/components/call_out/object';
24
+ export { EuiCardObject } from './playwright/components/card/object';
22
25
  export { EuiColorPickerObject } from './playwright/components/color_picker/object';
23
26
  export { EuiTreeViewObject } from './playwright/components/tree_view/object';
24
27
  export { EuiToolTipObject } from './playwright/components/tool_tip/object';
package/lib/cjs/index.js CHANGED
@@ -18,19 +18,25 @@ Object.defineProperty(exports, "EuiAccordionObject", {
18
18
  Object.defineProperty(exports, "EuiBasicTableObject", {
19
19
  enumerable: true,
20
20
  get: function () {
21
- return _object19.EuiBasicTableObject;
21
+ return _object21.EuiBasicTableObject;
22
22
  }
23
23
  });
24
24
  Object.defineProperty(exports, "EuiCallOutObject", {
25
25
  enumerable: true,
26
26
  get: function () {
27
- return _object20.EuiCallOutObject;
27
+ return _object22.EuiCallOutObject;
28
+ }
29
+ });
30
+ Object.defineProperty(exports, "EuiCardObject", {
31
+ enumerable: true,
32
+ get: function () {
33
+ return _object23.EuiCardObject;
28
34
  }
29
35
  });
30
36
  Object.defineProperty(exports, "EuiColorPickerObject", {
31
37
  enumerable: true,
32
38
  get: function () {
33
- return _object21.EuiColorPickerObject;
39
+ return _object24.EuiColorPickerObject;
34
40
  }
35
41
  });
36
42
  Object.defineProperty(exports, "EuiComboBoxObject", {
@@ -81,6 +87,12 @@ Object.defineProperty(exports, "EuiGlobalToastListObject", {
81
87
  return _object4.EuiGlobalToastListObject;
82
88
  }
83
89
  });
90
+ Object.defineProperty(exports, "EuiMarkdownEditorObject", {
91
+ enumerable: true,
92
+ get: function () {
93
+ return _object19.EuiMarkdownEditorObject;
94
+ }
95
+ });
84
96
  Object.defineProperty(exports, "EuiModalObject", {
85
97
  enumerable: true,
86
98
  get: function () {
@@ -90,7 +102,7 @@ Object.defineProperty(exports, "EuiModalObject", {
90
102
  Object.defineProperty(exports, "EuiPaginationObject", {
91
103
  enumerable: true,
92
104
  get: function () {
93
- return _object18.EuiPaginationObject;
105
+ return _object20.EuiPaginationObject;
94
106
  }
95
107
  });
96
108
  Object.defineProperty(exports, "EuiPopoverObject", {
@@ -135,16 +147,22 @@ Object.defineProperty(exports, "EuiTableObject", {
135
147
  return _object17.EuiTableObject;
136
148
  }
137
149
  });
150
+ Object.defineProperty(exports, "EuiTabsObject", {
151
+ enumerable: true,
152
+ get: function () {
153
+ return _object18.EuiTabsObject;
154
+ }
155
+ });
138
156
  Object.defineProperty(exports, "EuiToolTipObject", {
139
157
  enumerable: true,
140
158
  get: function () {
141
- return _object23.EuiToolTipObject;
159
+ return _object26.EuiToolTipObject;
142
160
  }
143
161
  });
144
162
  Object.defineProperty(exports, "EuiTreeViewObject", {
145
163
  enumerable: true,
146
164
  get: function () {
147
- return _object22.EuiTreeViewObject;
165
+ return _object25.EuiTreeViewObject;
148
166
  }
149
167
  });
150
168
  Object.defineProperty(exports, "selectors", {
@@ -171,10 +189,13 @@ var _object14 = require("./playwright/components/accordion/object");
171
189
  var _object15 = require("./playwright/components/context_menu/object");
172
190
  var _object16 = require("./playwright/components/modal/object");
173
191
  var _object17 = require("./playwright/components/table/object");
174
- var _object18 = require("./playwright/components/pagination/object");
175
- var _object19 = require("./playwright/components/basic_table/object");
176
- var _object20 = require("./playwright/components/call_out/object");
177
- var _object21 = require("./playwright/components/color_picker/object");
178
- var _object22 = require("./playwright/components/tree_view/object");
179
- var _object23 = require("./playwright/components/tool_tip/object");
192
+ var _object18 = require("./playwright/components/tabs/object");
193
+ var _object19 = require("./playwright/components/markdown_editor/object");
194
+ var _object20 = require("./playwright/components/pagination/object");
195
+ var _object21 = require("./playwright/components/basic_table/object");
196
+ var _object22 = require("./playwright/components/call_out/object");
197
+ var _object23 = require("./playwright/components/card/object");
198
+ var _object24 = require("./playwright/components/color_picker/object");
199
+ var _object25 = require("./playwright/components/tree_view/object");
200
+ var _object26 = require("./playwright/components/tool_tip/object");
180
201
  var _selectors = require("./selectors");
@@ -0,0 +1,23 @@
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/display/card/ EuiCard}.
6
+ *
7
+ * `testSubj` must be set on `EuiCard` itself, EUI spreads it onto the panel.
8
+ */
9
+ export declare class EuiCardObject extends BaseObject {
10
+ constructor(scope: ObjectScope, testSubj: string, componentSelector?: string);
11
+ /** The `selectable` toggle button, absent on plain cards. */
12
+ get selectButton(): Locator;
13
+ /** The title text. */
14
+ getTitle(): Promise<string>;
15
+ /** The description text, or `null` when the card has none. */
16
+ getDescription(): Promise<string | null>;
17
+ /** Click the card, which follows `href` or fires `onClick`. */
18
+ click(): Promise<void>;
19
+ /** Whether the `selectable` toggle is checked. */
20
+ isSelected(): Promise<boolean>;
21
+ /** Click the `selectable` toggle and wait for it to flip. */
22
+ toggleSelected(): Promise<void>;
23
+ }
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.EuiCardObject = void 0;
7
+ var _test = require("@playwright/test");
8
+ var _base_object = require("../../base_object");
9
+ var _selectors = require("../../../components/card/selectors");
10
+ /*
11
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
12
+ * or more contributor license agreements. Licensed under the Elastic License
13
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
14
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
15
+ * Side Public License, v 1.
16
+ */
17
+
18
+ /**
19
+ * Playwright Component Object for {@link
20
+ * https://eui.elastic.co/docs/components/display/card/ EuiCard}.
21
+ *
22
+ * `testSubj` must be set on `EuiCard` itself, EUI spreads it onto the panel.
23
+ */
24
+ class EuiCardObject extends _base_object.BaseObject {
25
+ constructor(scope, testSubj, componentSelector = _selectors.EuiCardSelectors.ROOT_SELECTOR) {
26
+ super(scope, testSubj, componentSelector);
27
+ }
28
+
29
+ /** The `selectable` toggle button, absent on plain cards. */
30
+ get selectButton() {
31
+ // A direct child, so switches in `children` or `footer` do not match.
32
+ return this.root.locator(`> ${_selectors.EuiCardSelectors.SELECT_BUTTON_SELECTOR}`);
33
+ }
34
+
35
+ /** The title text. */
36
+ async getTitle() {
37
+ return (await this.root.locator(_selectors.EuiCardSelectors.TITLE_SELECTOR).innerText()).trim();
38
+ }
39
+
40
+ /** The description text, or `null` when the card has none. */
41
+ async getDescription() {
42
+ await this.root.waitFor({
43
+ state: 'attached'
44
+ });
45
+ const description = this.root.locator(_selectors.EuiCardSelectors.DESCRIPTION_SELECTOR);
46
+ if ((await description.count()) === 0) {
47
+ return null;
48
+ }
49
+ return (await description.innerText()).trim();
50
+ }
51
+
52
+ /** Click the card, which follows `href` or fires `onClick`. */
53
+ async click() {
54
+ await this.root.click();
55
+ }
56
+
57
+ /** Whether the `selectable` toggle is checked. */
58
+ async isSelected() {
59
+ return (await this.selectButton.getAttribute('aria-checked')) === 'true';
60
+ }
61
+
62
+ /** Click the `selectable` toggle and wait for it to flip. */
63
+ async toggleSelected() {
64
+ const selected = await this.isSelected();
65
+ await this.selectButton.click();
66
+ await (0, _test.expect)(this.selectButton).toHaveAttribute('aria-checked', String(!selected));
67
+ }
68
+ }
69
+ exports.EuiCardObject = EuiCardObject;
@@ -0,0 +1,24 @@
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/editors-and-syntax/markdown-editor/ EuiMarkdownEditor}.
6
+ *
7
+ * `testSubj` must be set on `EuiMarkdownEditor` itself, EUI spreads it onto
8
+ * the wrapper.
9
+ */
10
+ export declare class EuiMarkdownEditorObject extends BaseObject {
11
+ constructor(scope: ObjectScope, testSubj: string, componentSelector?: string);
12
+ /** The `<textarea>` holding the markdown source. */
13
+ get textArea(): Locator;
14
+ /** The rendered markdown, only in the DOM while previewing. */
15
+ get preview(): Locator;
16
+ /** Replace the markdown source. Switches back to editing first if needed. */
17
+ setValue(text: string): Promise<void>;
18
+ /** The current markdown source. */
19
+ getValue(): Promise<string>;
20
+ /** Whether the rendered preview is shown instead of the textarea. */
21
+ isPreviewing(): Promise<boolean>;
22
+ /** Switch between the textarea and the rendered preview. */
23
+ togglePreview(): Promise<void>;
24
+ }
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.EuiMarkdownEditorObject = void 0;
7
+ var _test = require("@playwright/test");
8
+ var _base_object = require("../../base_object");
9
+ var _selectors = require("../../../components/markdown_editor/selectors");
10
+ /*
11
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
12
+ * or more contributor license agreements. Licensed under the Elastic License
13
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
14
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
15
+ * Side Public License, v 1.
16
+ */
17
+
18
+ /**
19
+ * Playwright Component Object for {@link
20
+ * https://eui.elastic.co/docs/components/editors-and-syntax/markdown-editor/ EuiMarkdownEditor}.
21
+ *
22
+ * `testSubj` must be set on `EuiMarkdownEditor` itself, EUI spreads it onto
23
+ * the wrapper.
24
+ */
25
+ class EuiMarkdownEditorObject extends _base_object.BaseObject {
26
+ constructor(scope, testSubj, componentSelector = _selectors.EuiMarkdownEditorSelectors.ROOT_SELECTOR) {
27
+ super(scope, testSubj, componentSelector);
28
+ }
29
+
30
+ /** The `<textarea>` holding the markdown source. */
31
+ get textArea() {
32
+ return this.root.locator(_selectors.EuiMarkdownEditorSelectors.TEXT_AREA_SELECTOR);
33
+ }
34
+
35
+ /** The rendered markdown, only in the DOM while previewing. */
36
+ get preview() {
37
+ return this.root.locator(_selectors.EuiMarkdownEditorSelectors.PREVIEW_SELECTOR);
38
+ }
39
+
40
+ /** Replace the markdown source. Switches back to editing first if needed. */
41
+ async setValue(text) {
42
+ if (await this.isPreviewing()) {
43
+ await this.togglePreview();
44
+ }
45
+ await this.textArea.fill(text);
46
+ await (0, _test.expect)(this.textArea).toHaveValue(text);
47
+ }
48
+
49
+ /** The current markdown source. */
50
+ async getValue() {
51
+ return this.textArea.inputValue();
52
+ }
53
+
54
+ /** Whether the rendered preview is shown instead of the textarea. */
55
+ async isPreviewing() {
56
+ await this.root.waitFor({
57
+ state: 'attached'
58
+ });
59
+ return (await this.preview.count()) > 0;
60
+ }
61
+
62
+ /** Switch between the textarea and the rendered preview. */
63
+ async togglePreview() {
64
+ const previewing = await this.isPreviewing();
65
+ const button = previewing ? _selectors.EuiMarkdownEditorSelectors.EDIT_BUTTON_TEST_SUBJ : _selectors.EuiMarkdownEditorSelectors.PREVIEW_BUTTON_TEST_SUBJ;
66
+ await this.root.getByTestId(button).click();
67
+ await (0, _test.expect)(this.preview).toHaveCount(previewing ? 0 : 1);
68
+ }
69
+ }
70
+ exports.EuiMarkdownEditorObject = EuiMarkdownEditorObject;
@@ -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/navigation/tabs/ EuiTabs}, and for
6
+ * `EuiTabbedContent`, which renders an `EuiTabs` as the first child of the
7
+ * element carrying the consumer's `data-test-subj`. Tabs are addressed by
8
+ * their exact label.
9
+ */
10
+ export declare class EuiTabsObject extends BaseObject {
11
+ constructor(scope: ObjectScope, testSubj: string);
12
+ /** All tabs, in order. */
13
+ get tabs(): Locator;
14
+ /** The labels of all tabs, in order. */
15
+ getTabs(): Promise<string[]>;
16
+ /**
17
+ * The tab with exactly this label. Matches the label span, so `prepend`
18
+ * and `append` content does not interfere, then climbs to the tab.
19
+ */
20
+ tab(label: string): Locator;
21
+ /** Click the tab with this label and wait for it to become selected. */
22
+ select(label: string): Promise<void>;
23
+ /** The label of the selected tab, or null when none is selected. */
24
+ getSelected(): Promise<string | null>;
25
+ /**
26
+ * The owning tab list: the root itself for `EuiTabs`, or the wrapper's
27
+ * direct `.euiTabs` child for `EuiTabbedContent`. Queries never reach into
28
+ * the tabbed content panel, which may hold its own tabs.
29
+ */
30
+ private get list();
31
+ }
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.EuiTabsObject = void 0;
7
+ var _test = require("@playwright/test");
8
+ var _base_object = require("../../base_object");
9
+ var _selectors = require("../../../components/tabs/selectors");
10
+ /*
11
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
12
+ * or more contributor license agreements. Licensed under the Elastic License
13
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
14
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
15
+ * Side Public License, v 1.
16
+ */
17
+
18
+ /**
19
+ * Playwright Component Object for {@link
20
+ * https://eui.elastic.co/docs/components/navigation/tabs/ EuiTabs}, and for
21
+ * `EuiTabbedContent`, which renders an `EuiTabs` as the first child of the
22
+ * element carrying the consumer's `data-test-subj`. Tabs are addressed by
23
+ * their exact label.
24
+ */
25
+ class EuiTabsObject extends _base_object.BaseObject {
26
+ constructor(scope, testSubj) {
27
+ super(scope, testSubj, _selectors.EuiTabsSelectors.ROOT_SELECTOR);
28
+ }
29
+
30
+ /** All tabs, in order. */
31
+ get tabs() {
32
+ return this.list.locator(_selectors.EuiTabsSelectors.TAB_SELECTOR);
33
+ }
34
+
35
+ /** The labels of all tabs, in order. */
36
+ async getTabs() {
37
+ return this.list.locator(_selectors.EuiTabsSelectors.TAB_CONTENT_SELECTOR).allInnerTexts();
38
+ }
39
+
40
+ /**
41
+ * The tab with exactly this label. Matches the label span, so `prepend`
42
+ * and `append` content does not interfere, then climbs to the tab.
43
+ */
44
+ tab(label) {
45
+ return this.list.locator(_selectors.EuiTabsSelectors.TAB_CONTENT_SELECTOR).filter({
46
+ hasText: new RegExp(`^${escapeRegExp(label)}$`)
47
+ }).locator('..');
48
+ }
49
+
50
+ /** Click the tab with this label and wait for it to become selected. */
51
+ async select(label) {
52
+ const tab = this.tab(label);
53
+ await tab.click();
54
+ await (0, _test.expect)(tab).toHaveAttribute('aria-selected', 'true');
55
+ }
56
+
57
+ /** The label of the selected tab, or null when none is selected. */
58
+ async getSelected() {
59
+ const selected = this.list.locator(_selectors.EuiTabsSelectors.SELECTED_TAB_SELECTOR).locator(_selectors.EuiTabsSelectors.TAB_CONTENT_SELECTOR);
60
+ if ((await selected.count()) === 0) {
61
+ return null;
62
+ }
63
+ return selected.first().innerText();
64
+ }
65
+
66
+ /**
67
+ * The owning tab list: the root itself for `EuiTabs`, or the wrapper's
68
+ * direct `.euiTabs` child for `EuiTabbedContent`. Queries never reach into
69
+ * the tabbed content panel, which may hold its own tabs.
70
+ */
71
+ get list() {
72
+ return this.root.and(this.scope.locator(_selectors.EuiTabsSelectors.LIST_SELECTOR)).or(this.root.locator(`> ${_selectors.EuiTabsSelectors.LIST_SELECTOR}`));
73
+ }
74
+ }
75
+ exports.EuiTabsObject = EuiTabsObject;
76
+ const escapeRegExp = text => text.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
@@ -23,6 +23,12 @@ export declare const selectors: {
23
23
  DISMISS_BUTTON_TEST_SUBJ: string;
24
24
  DISMISS_BUTTON_SELECTOR: string;
25
25
  };
26
+ readonly card: {
27
+ ROOT_SELECTOR: string;
28
+ TITLE_SELECTOR: string;
29
+ DESCRIPTION_SELECTOR: string;
30
+ SELECT_BUTTON_SELECTOR: string;
31
+ };
26
32
  readonly colorPicker: {
27
33
  ANCHOR_TEST_SUBJ: string;
28
34
  ANCHOR_SELECTOR: string;
@@ -79,6 +85,13 @@ export declare const selectors: {
79
85
  ROOT_SELECTOR: string;
80
86
  CLOSE_BUTTON_TEST_SUBJ: string;
81
87
  };
88
+ readonly markdownEditor: {
89
+ ROOT_SELECTOR: string;
90
+ TEXT_AREA_SELECTOR: string;
91
+ PREVIEW_SELECTOR: string;
92
+ PREVIEW_BUTTON_TEST_SUBJ: string;
93
+ EDIT_BUTTON_TEST_SUBJ: string;
94
+ };
82
95
  readonly modal: {
83
96
  ROOT_SELECTOR: string;
84
97
  CLOSE_BUTTON_SELECTOR: string;
@@ -132,6 +145,13 @@ export declare const selectors: {
132
145
  ROW_CELL_SELECTOR: string;
133
146
  HEADER_CELL_SELECTOR: string;
134
147
  };
148
+ readonly tabs: {
149
+ ROOT_SELECTOR: string;
150
+ LIST_SELECTOR: string;
151
+ TAB_SELECTOR: string;
152
+ SELECTED_TAB_SELECTOR: string;
153
+ TAB_CONTENT_SELECTOR: string;
154
+ };
135
155
  readonly globalToastList: {
136
156
  ROOT_SELECTOR: string;
137
157
  TOAST_SELECTOR: string;