@elastic/eui-test-helpers 1.5.0 → 1.6.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.
- package/README.md +4 -0
- package/lib/cjs/components/accordion/selectors.d.ts +15 -0
- package/lib/cjs/components/accordion/selectors.js +29 -0
- package/lib/cjs/components/flyout/selectors.d.ts +10 -0
- package/lib/cjs/components/flyout/selectors.js +24 -0
- package/lib/cjs/components/modal/selectors.d.ts +11 -0
- package/lib/cjs/components/modal/selectors.js +25 -0
- package/lib/cjs/components/popover/selectors.d.ts +11 -0
- package/lib/cjs/components/popover/selectors.js +25 -0
- package/lib/cjs/index.d.ts +4 -0
- package/lib/cjs/index.js +30 -2
- package/lib/cjs/playwright/components/accordion/object.d.ts +16 -0
- package/lib/cjs/playwright/components/accordion/object.js +39 -0
- package/lib/cjs/playwright/components/combo_box/object.d.ts +9 -2
- package/lib/cjs/playwright/components/combo_box/object.js +23 -3
- package/lib/cjs/playwright/components/flyout/object.d.ts +17 -0
- package/lib/cjs/playwright/components/flyout/object.js +37 -0
- package/lib/cjs/playwright/components/modal/object.d.ts +15 -0
- package/lib/cjs/playwright/components/modal/object.js +35 -0
- package/lib/cjs/playwright/components/popover/object.d.ts +26 -0
- package/lib/cjs/playwright/components/popover/object.js +72 -0
- package/lib/cjs/storybook.d.ts +1 -1
- package/lib/cjs/storybook.js +1 -1
- package/lib/esm/components/accordion/selectors.d.ts +15 -0
- package/lib/esm/components/accordion/selectors.js +23 -0
- package/lib/esm/components/accordion/selectors.js.map +1 -0
- package/lib/esm/components/flyout/selectors.d.ts +10 -0
- package/lib/esm/components/flyout/selectors.js +18 -0
- package/lib/esm/components/flyout/selectors.js.map +1 -0
- package/lib/esm/components/modal/selectors.d.ts +11 -0
- package/lib/esm/components/modal/selectors.js +19 -0
- package/lib/esm/components/modal/selectors.js.map +1 -0
- package/lib/esm/components/popover/selectors.d.ts +11 -0
- package/lib/esm/components/popover/selectors.js +19 -0
- package/lib/esm/components/popover/selectors.js.map +1 -0
- package/lib/esm/index.d.ts +4 -0
- package/lib/esm/index.js +4 -0
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/playwright/components/accordion/object.d.ts +16 -0
- package/lib/esm/playwright/components/accordion/object.js +30 -0
- package/lib/esm/playwright/components/accordion/object.js.map +1 -0
- package/lib/esm/playwright/components/combo_box/object.d.ts +9 -2
- package/lib/esm/playwright/components/combo_box/object.js +23 -3
- package/lib/esm/playwright/components/combo_box/object.js.map +1 -1
- package/lib/esm/playwright/components/flyout/object.d.ts +17 -0
- package/lib/esm/playwright/components/flyout/object.js +29 -0
- package/lib/esm/playwright/components/flyout/object.js.map +1 -0
- package/lib/esm/playwright/components/modal/object.d.ts +15 -0
- package/lib/esm/playwright/components/modal/object.js +27 -0
- package/lib/esm/playwright/components/modal/object.js.map +1 -0
- package/lib/esm/playwright/components/popover/object.d.ts +26 -0
- package/lib/esm/playwright/components/popover/object.js +58 -0
- package/lib/esm/playwright/components/popover/object.js.map +1 -0
- package/lib/esm/storybook.d.ts +1 -1
- package/lib/esm/storybook.js +1 -1
- package/package.json +1 -1
- package/src/components/accordion/README.md +28 -0
- package/src/components/flyout/README.md +26 -0
- package/src/components/modal/README.md +27 -0
- package/src/components/popover/README.md +29 -0
package/README.md
CHANGED
|
@@ -54,6 +54,10 @@ their own version at runtime.
|
|
|
54
54
|
| `EuiDraggableObject` | [src/components/drag_and_drop/README.md](src/components/drag_and_drop/README.md) |
|
|
55
55
|
| `EuiFilterButtonObject` | [src/components/filter_button/README.md](src/components/filter_button/README.md) |
|
|
56
56
|
| `EuiRangeObject` | [src/components/form/range/README.md](src/components/form/range/README.md) |
|
|
57
|
+
| `EuiPopoverObject` | [src/components/popover/README.md](src/components/popover/README.md) |
|
|
58
|
+
| `EuiFlyoutObject` | [src/components/flyout/README.md](src/components/flyout/README.md) |
|
|
59
|
+
| `EuiAccordionObject` | [src/components/accordion/README.md](src/components/accordion/README.md) |
|
|
60
|
+
| `EuiModalObject` | [src/components/modal/README.md](src/components/modal/README.md) |
|
|
57
61
|
| `EuiBasicTableObject` | [src/components/basic_table/README.md](src/components/basic_table/README.md) |
|
|
58
62
|
|
|
59
63
|
## Contributing
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stable selectors for
|
|
3
|
+
* {@link https://eui.elastic.co/docs/components/containers/accordion/|EuiAccordion}.
|
|
4
|
+
* `*_SELECTOR` values are CSS, scoped to direct children (`>`) so a nested
|
|
5
|
+
* accordion inside `content` never matches these instead of this instance's
|
|
6
|
+
* own elements.
|
|
7
|
+
*/
|
|
8
|
+
export declare const EuiAccordionSelectors: {
|
|
9
|
+
/** Root element carrying the consumer's `data-test-subj`. */
|
|
10
|
+
ROOT_SELECTOR: string;
|
|
11
|
+
/** The trigger button. `aria-expanded` on it reflects open state synchronously. */
|
|
12
|
+
TRIGGER_SELECTOR: string;
|
|
13
|
+
/** The children wrapper. `height: 0` and `opacity: 0` while closed, so Playwright treats its contents as not visible. */
|
|
14
|
+
CONTENT_SELECTOR: string;
|
|
15
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.EuiAccordionSelectors = 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/containers/accordion/|EuiAccordion}.
|
|
18
|
+
* `*_SELECTOR` values are CSS, scoped to direct children (`>`) so a nested
|
|
19
|
+
* accordion inside `content` never matches these instead of this instance's
|
|
20
|
+
* own elements.
|
|
21
|
+
*/
|
|
22
|
+
const EuiAccordionSelectors = exports.EuiAccordionSelectors = {
|
|
23
|
+
/** Root element carrying the consumer's `data-test-subj`. */
|
|
24
|
+
ROOT_SELECTOR: '.euiAccordion',
|
|
25
|
+
/** The trigger button. `aria-expanded` on it reflects open state synchronously. */
|
|
26
|
+
TRIGGER_SELECTOR: '> .euiAccordion__triggerWrapper > .euiAccordion__button',
|
|
27
|
+
/** The children wrapper. `height: 0` and `opacity: 0` while closed, so Playwright treats its contents as not visible. */
|
|
28
|
+
CONTENT_SELECTOR: '> .euiAccordion__childWrapper'
|
|
29
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stable selectors for
|
|
3
|
+
* {@link https://eui.elastic.co/docs/components/containers/flyout/|EuiFlyout}.
|
|
4
|
+
*/
|
|
5
|
+
export declare const EuiFlyoutSelectors: {
|
|
6
|
+
/** Root element carrying the consumer's `data-test-subj`. CSS. */
|
|
7
|
+
ROOT_SELECTOR: string;
|
|
8
|
+
/** `data-test-subj` EUI sets on its own close button. Absent with `hideCloseButton` or a rendered flyout menu. */
|
|
9
|
+
CLOSE_BUTTON_TEST_SUBJ: string;
|
|
10
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.EuiFlyoutSelectors = 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/containers/flyout/|EuiFlyout}.
|
|
18
|
+
*/
|
|
19
|
+
const EuiFlyoutSelectors = exports.EuiFlyoutSelectors = {
|
|
20
|
+
/** Root element carrying the consumer's `data-test-subj`. CSS. */
|
|
21
|
+
ROOT_SELECTOR: '.euiFlyout',
|
|
22
|
+
/** `data-test-subj` EUI sets on its own close button. Absent with `hideCloseButton` or a rendered flyout menu. */
|
|
23
|
+
CLOSE_BUTTON_TEST_SUBJ: 'euiFlyoutCloseButton'
|
|
24
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stable selectors for
|
|
3
|
+
* {@link https://eui.elastic.co/docs/components/containers/modal/|EuiModal}
|
|
4
|
+
* and `EuiConfirmModal`. `*_SELECTOR` values are CSS.
|
|
5
|
+
*/
|
|
6
|
+
export declare const EuiModalSelectors: {
|
|
7
|
+
/** Root element carrying the consumer's `data-test-subj`. Matches `EuiConfirmModal` too, which renders `EuiModal` underneath. */
|
|
8
|
+
ROOT_SELECTOR: string;
|
|
9
|
+
/** The close button. No `data-test-subj`, only an i18n `aria-label`, so read by this stable class instead. */
|
|
10
|
+
CLOSE_BUTTON_SELECTOR: string;
|
|
11
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.EuiModalSelectors = 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/containers/modal/|EuiModal}
|
|
18
|
+
* and `EuiConfirmModal`. `*_SELECTOR` values are CSS.
|
|
19
|
+
*/
|
|
20
|
+
const EuiModalSelectors = exports.EuiModalSelectors = {
|
|
21
|
+
/** Root element carrying the consumer's `data-test-subj`. Matches `EuiConfirmModal` too, which renders `EuiModal` underneath. */
|
|
22
|
+
ROOT_SELECTOR: '.euiModal',
|
|
23
|
+
/** The close button. No `data-test-subj`, only an i18n `aria-label`, so read by this stable class instead. */
|
|
24
|
+
CLOSE_BUTTON_SELECTOR: '.euiModal__closeIcon'
|
|
25
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stable selectors for
|
|
3
|
+
* {@link https://eui.elastic.co/docs/components/containers/popover/|EuiPopover}.
|
|
4
|
+
* `*_SELECTOR` values are CSS.
|
|
5
|
+
*/
|
|
6
|
+
export declare const EuiPopoverSelectors: {
|
|
7
|
+
/** `EuiPopover` sets this on a button-like toggle from mount, regardless of open state. */
|
|
8
|
+
TOGGLE_SELECTOR: string;
|
|
9
|
+
/** The portal panel, matched by the id the toggle's `aria-controls` points at. Present while open or closing. */
|
|
10
|
+
panelFor: (id: string) => string;
|
|
11
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.EuiPopoverSelectors = 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/containers/popover/|EuiPopover}.
|
|
18
|
+
* `*_SELECTOR` values are CSS.
|
|
19
|
+
*/
|
|
20
|
+
const EuiPopoverSelectors = exports.EuiPopoverSelectors = {
|
|
21
|
+
/** `EuiPopover` sets this on a button-like toggle from mount, regardless of open state. */
|
|
22
|
+
TOGGLE_SELECTOR: '[aria-expanded]',
|
|
23
|
+
/** The portal panel, matched by the id the toggle's `aria-controls` points at. Present while open or closing. */
|
|
24
|
+
panelFor: id => `[data-popover-panel][id="${id}"]`
|
|
25
|
+
};
|
package/lib/cjs/index.d.ts
CHANGED
|
@@ -7,4 +7,8 @@ export { EuiSelectableObject } from './playwright/components/selectable/object';
|
|
|
7
7
|
export { EuiDraggableObject } from './playwright/components/drag_and_drop/object';
|
|
8
8
|
export { EuiFilterButtonObject } from './playwright/components/filter_button/object';
|
|
9
9
|
export { EuiRangeObject } from './playwright/components/form/range/object';
|
|
10
|
+
export { EuiPopoverObject } from './playwright/components/popover/object';
|
|
11
|
+
export { EuiFlyoutObject } from './playwright/components/flyout/object';
|
|
12
|
+
export { EuiAccordionObject } from './playwright/components/accordion/object';
|
|
13
|
+
export { EuiModalObject } from './playwright/components/modal/object';
|
|
10
14
|
export { EuiBasicTableObject } from './playwright/components/basic_table/object';
|
package/lib/cjs/index.js
CHANGED
|
@@ -9,10 +9,16 @@ Object.defineProperty(exports, "BaseObject", {
|
|
|
9
9
|
return _base_object.BaseObject;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
+
Object.defineProperty(exports, "EuiAccordionObject", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _object11.EuiAccordionObject;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
12
18
|
Object.defineProperty(exports, "EuiBasicTableObject", {
|
|
13
19
|
enumerable: true,
|
|
14
20
|
get: function () {
|
|
15
|
-
return
|
|
21
|
+
return _object13.EuiBasicTableObject;
|
|
16
22
|
}
|
|
17
23
|
});
|
|
18
24
|
Object.defineProperty(exports, "EuiComboBoxObject", {
|
|
@@ -39,12 +45,30 @@ Object.defineProperty(exports, "EuiFilterButtonObject", {
|
|
|
39
45
|
return _object7.EuiFilterButtonObject;
|
|
40
46
|
}
|
|
41
47
|
});
|
|
48
|
+
Object.defineProperty(exports, "EuiFlyoutObject", {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
get: function () {
|
|
51
|
+
return _object10.EuiFlyoutObject;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
42
54
|
Object.defineProperty(exports, "EuiGlobalToastListObject", {
|
|
43
55
|
enumerable: true,
|
|
44
56
|
get: function () {
|
|
45
57
|
return _object4.EuiGlobalToastListObject;
|
|
46
58
|
}
|
|
47
59
|
});
|
|
60
|
+
Object.defineProperty(exports, "EuiModalObject", {
|
|
61
|
+
enumerable: true,
|
|
62
|
+
get: function () {
|
|
63
|
+
return _object12.EuiModalObject;
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
Object.defineProperty(exports, "EuiPopoverObject", {
|
|
67
|
+
enumerable: true,
|
|
68
|
+
get: function () {
|
|
69
|
+
return _object9.EuiPopoverObject;
|
|
70
|
+
}
|
|
71
|
+
});
|
|
48
72
|
Object.defineProperty(exports, "EuiRangeObject", {
|
|
49
73
|
enumerable: true,
|
|
50
74
|
get: function () {
|
|
@@ -72,4 +96,8 @@ var _object5 = require("./playwright/components/selectable/object");
|
|
|
72
96
|
var _object6 = require("./playwright/components/drag_and_drop/object");
|
|
73
97
|
var _object7 = require("./playwright/components/filter_button/object");
|
|
74
98
|
var _object8 = require("./playwright/components/form/range/object");
|
|
75
|
-
var _object9 = require("./playwright/components/
|
|
99
|
+
var _object9 = require("./playwright/components/popover/object");
|
|
100
|
+
var _object10 = require("./playwright/components/flyout/object");
|
|
101
|
+
var _object11 = require("./playwright/components/accordion/object");
|
|
102
|
+
var _object12 = require("./playwright/components/modal/object");
|
|
103
|
+
var _object13 = require("./playwright/components/basic_table/object");
|
|
@@ -0,0 +1,16 @@
|
|
|
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/containers/accordion/ EuiAccordion}.
|
|
6
|
+
*
|
|
7
|
+
* `testSubj` must be set on the `<EuiAccordion>` itself. See the package
|
|
8
|
+
* README for what this does not cover.
|
|
9
|
+
*/
|
|
10
|
+
export declare class EuiAccordionObject extends BaseObject {
|
|
11
|
+
constructor(scope: ObjectScope, testSubj: string);
|
|
12
|
+
/** The trigger button. Assert `aria-expanded` on it for open state, e.g. `toHaveAttribute('aria-expanded', 'true')`. */
|
|
13
|
+
get trigger(): Locator;
|
|
14
|
+
/** The children wrapper, scoped to this instance. */
|
|
15
|
+
get content(): Locator;
|
|
16
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.EuiAccordionObject = void 0;
|
|
7
|
+
var _base_object = require("../../base_object");
|
|
8
|
+
var _selectors = require("../../../components/accordion/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/containers/accordion/ EuiAccordion}.
|
|
20
|
+
*
|
|
21
|
+
* `testSubj` must be set on the `<EuiAccordion>` itself. See the package
|
|
22
|
+
* README for what this does not cover.
|
|
23
|
+
*/
|
|
24
|
+
class EuiAccordionObject extends _base_object.BaseObject {
|
|
25
|
+
constructor(scope, testSubj) {
|
|
26
|
+
super(scope, testSubj, _selectors.EuiAccordionSelectors.ROOT_SELECTOR);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** The trigger button. Assert `aria-expanded` on it for open state, e.g. `toHaveAttribute('aria-expanded', 'true')`. */
|
|
30
|
+
get trigger() {
|
|
31
|
+
return this.root.locator(_selectors.EuiAccordionSelectors.TRIGGER_SELECTOR);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** The children wrapper, scoped to this instance. */
|
|
35
|
+
get content() {
|
|
36
|
+
return this.root.locator(_selectors.EuiAccordionSelectors.CONTENT_SELECTOR);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.EuiAccordionObject = EuiAccordionObject;
|
|
@@ -43,7 +43,8 @@ export declare class EuiComboBoxObject extends BaseObject {
|
|
|
43
43
|
* Clear all selected options. No-op if nothing is selected.
|
|
44
44
|
*
|
|
45
45
|
* Auto-detects the combo box configuration and uses the appropriate strategy:
|
|
46
|
-
* - Pills
|
|
46
|
+
* - Pills with a close button → {@link clickPillClearButtons}
|
|
47
|
+
* - Pills without a close button (`singleSelection`) → {@link clearPillWithoutCloseButton}
|
|
47
48
|
* - `asPlainText` with a confirmed input selection → {@link deleteSearchInput}
|
|
48
49
|
* - Otherwise → {@link deselectAllFromDropdown}
|
|
49
50
|
*
|
|
@@ -62,12 +63,18 @@ export declare class EuiComboBoxObject extends BaseObject {
|
|
|
62
63
|
*/
|
|
63
64
|
getSelectedOptions(): Promise<string[]>;
|
|
64
65
|
private hasPills;
|
|
66
|
+
private hasPillCloseButtons;
|
|
65
67
|
/**
|
|
66
68
|
* Clicks the `×` button on each selected pill individually.
|
|
67
|
-
* Works regardless of `isClearable` — pill close buttons are always present.
|
|
68
69
|
* No-op if no pills are rendered.
|
|
69
70
|
*/
|
|
70
71
|
private clickPillClearButtons;
|
|
72
|
+
/**
|
|
73
|
+
* `singleSelection` pills render without a close button, whatever
|
|
74
|
+
* `isClearable` is. Backspace on an empty search input removes the
|
|
75
|
+
* selection instead.
|
|
76
|
+
*/
|
|
77
|
+
private clearPillWithoutCloseButton;
|
|
71
78
|
/**
|
|
72
79
|
* Opens the dropdown and clicks each `aria-selected="true"` option to
|
|
73
80
|
* deselect it. Works for all `isClearable` and `singleSelection`
|
|
@@ -125,7 +125,8 @@ class EuiComboBoxObject extends _base_object.BaseObject {
|
|
|
125
125
|
* Clear all selected options. No-op if nothing is selected.
|
|
126
126
|
*
|
|
127
127
|
* Auto-detects the combo box configuration and uses the appropriate strategy:
|
|
128
|
-
* - Pills
|
|
128
|
+
* - Pills with a close button → {@link clickPillClearButtons}
|
|
129
|
+
* - Pills without a close button (`singleSelection`) → {@link clearPillWithoutCloseButton}
|
|
129
130
|
* - `asPlainText` with a confirmed input selection → {@link deleteSearchInput}
|
|
130
131
|
* - Otherwise → {@link deselectAllFromDropdown}
|
|
131
132
|
*
|
|
@@ -138,7 +139,11 @@ class EuiComboBoxObject extends _base_object.BaseObject {
|
|
|
138
139
|
return;
|
|
139
140
|
}
|
|
140
141
|
if (await this.hasPills()) {
|
|
141
|
-
await this.
|
|
142
|
+
if (await this.hasPillCloseButtons()) {
|
|
143
|
+
await this.clickPillClearButtons();
|
|
144
|
+
} else {
|
|
145
|
+
await this.clearPillWithoutCloseButton();
|
|
146
|
+
}
|
|
142
147
|
return;
|
|
143
148
|
}
|
|
144
149
|
if (await this.hasConfirmedInputSelection()) {
|
|
@@ -168,10 +173,12 @@ class EuiComboBoxObject extends _base_object.BaseObject {
|
|
|
168
173
|
async hasPills() {
|
|
169
174
|
return (await this.pills.count()) > 0;
|
|
170
175
|
}
|
|
176
|
+
async hasPillCloseButtons() {
|
|
177
|
+
return (await this.pills.first().locator('button').count()) > 0;
|
|
178
|
+
}
|
|
171
179
|
|
|
172
180
|
/**
|
|
173
181
|
* Clicks the `×` button on each selected pill individually.
|
|
174
|
-
* Works regardless of `isClearable` — pill close buttons are always present.
|
|
175
182
|
* No-op if no pills are rendered.
|
|
176
183
|
*/
|
|
177
184
|
async clickPillClearButtons() {
|
|
@@ -182,6 +189,19 @@ class EuiComboBoxObject extends _base_object.BaseObject {
|
|
|
182
189
|
}
|
|
183
190
|
}
|
|
184
191
|
|
|
192
|
+
/**
|
|
193
|
+
* `singleSelection` pills render without a close button, whatever
|
|
194
|
+
* `isClearable` is. Backspace on an empty search input removes the
|
|
195
|
+
* selection instead.
|
|
196
|
+
*/
|
|
197
|
+
async clearPillWithoutCloseButton() {
|
|
198
|
+
while (await this.hasPills()) {
|
|
199
|
+
const countBefore = await this.pills.count();
|
|
200
|
+
await this.searchInput.press('Backspace');
|
|
201
|
+
await (0, _test.expect)(this.pills).not.toHaveCount(countBefore);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
185
205
|
/**
|
|
186
206
|
* Opens the dropdown and clicks each `aria-selected="true"` option to
|
|
187
207
|
* deselect it. Works for all `isClearable` and `singleSelection`
|
|
@@ -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/containers/flyout/ EuiFlyout}.
|
|
6
|
+
*
|
|
7
|
+
* `testSubj` must be set on the `<EuiFlyout>` itself. See the package README
|
|
8
|
+
* for what this does not cover.
|
|
9
|
+
*/
|
|
10
|
+
export declare class EuiFlyoutObject extends BaseObject {
|
|
11
|
+
constructor(scope: ObjectScope, testSubj: string);
|
|
12
|
+
/**
|
|
13
|
+
* This flyout's own close button, scoped to this instance. Absent with
|
|
14
|
+
* `hideCloseButton` or a rendered flyout menu.
|
|
15
|
+
*/
|
|
16
|
+
get closeButton(): Locator;
|
|
17
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.EuiFlyoutObject = void 0;
|
|
7
|
+
var _base_object = require("../../base_object");
|
|
8
|
+
var _selectors = require("../../../components/flyout/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/containers/flyout/ EuiFlyout}.
|
|
20
|
+
*
|
|
21
|
+
* `testSubj` must be set on the `<EuiFlyout>` itself. See the package README
|
|
22
|
+
* for what this does not cover.
|
|
23
|
+
*/
|
|
24
|
+
class EuiFlyoutObject extends _base_object.BaseObject {
|
|
25
|
+
constructor(scope, testSubj) {
|
|
26
|
+
super(scope, testSubj, _selectors.EuiFlyoutSelectors.ROOT_SELECTOR);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* This flyout's own close button, scoped to this instance. Absent with
|
|
31
|
+
* `hideCloseButton` or a rendered flyout menu.
|
|
32
|
+
*/
|
|
33
|
+
get closeButton() {
|
|
34
|
+
return this.root.getByTestId(_selectors.EuiFlyoutSelectors.CLOSE_BUTTON_TEST_SUBJ);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.EuiFlyoutObject = EuiFlyoutObject;
|
|
@@ -0,0 +1,15 @@
|
|
|
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/containers/modal/ EuiModal} and
|
|
6
|
+
* `EuiConfirmModal`, which renders `EuiModal` underneath.
|
|
7
|
+
*
|
|
8
|
+
* `testSubj` must be set on the `<EuiModal>`/`<EuiConfirmModal>` itself. See
|
|
9
|
+
* the package README for what this does not cover.
|
|
10
|
+
*/
|
|
11
|
+
export declare class EuiModalObject extends BaseObject {
|
|
12
|
+
constructor(scope: ObjectScope, testSubj: string);
|
|
13
|
+
/** This modal's own close button, scoped to this instance. */
|
|
14
|
+
get closeButton(): Locator;
|
|
15
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.EuiModalObject = void 0;
|
|
7
|
+
var _base_object = require("../../base_object");
|
|
8
|
+
var _selectors = require("../../../components/modal/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/containers/modal/ EuiModal} and
|
|
20
|
+
* `EuiConfirmModal`, which renders `EuiModal` underneath.
|
|
21
|
+
*
|
|
22
|
+
* `testSubj` must be set on the `<EuiModal>`/`<EuiConfirmModal>` itself. See
|
|
23
|
+
* the package README for what this does not cover.
|
|
24
|
+
*/
|
|
25
|
+
class EuiModalObject extends _base_object.BaseObject {
|
|
26
|
+
constructor(scope, testSubj) {
|
|
27
|
+
super(scope, testSubj, _selectors.EuiModalSelectors.ROOT_SELECTOR);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** This modal's own close button, scoped to this instance. */
|
|
31
|
+
get closeButton() {
|
|
32
|
+
return this.root.locator(_selectors.EuiModalSelectors.CLOSE_BUTTON_SELECTOR);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
exports.EuiModalObject = EuiModalObject;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { BaseObject, type ObjectScope } from '../../base_object';
|
|
2
|
+
/**
|
|
3
|
+
* Playwright Component Object for {@link
|
|
4
|
+
* https://eui.elastic.co/docs/components/containers/popover/ EuiPopover}.
|
|
5
|
+
*
|
|
6
|
+
* `testSubj` must be set on the toggle button, not the panel. See the
|
|
7
|
+
* package README for the component-type guard and what this does not cover.
|
|
8
|
+
*/
|
|
9
|
+
export declare class EuiPopoverObject extends BaseObject {
|
|
10
|
+
constructor(scope: ObjectScope, testSubj: string);
|
|
11
|
+
/**
|
|
12
|
+
* Opens the popover and waits for the panel to be open. A no-op if it is
|
|
13
|
+
* already open.
|
|
14
|
+
*/
|
|
15
|
+
open(): Promise<void>;
|
|
16
|
+
/**
|
|
17
|
+
* Closes the popover and waits for the panel to be removed. A no-op if it
|
|
18
|
+
* is already closed.
|
|
19
|
+
*/
|
|
20
|
+
close(): Promise<void>;
|
|
21
|
+
/**
|
|
22
|
+
* The panel the toggle's `aria-controls` points at. EUI sets that attribute
|
|
23
|
+
* synchronously with the open state, before the panel's own transition.
|
|
24
|
+
*/
|
|
25
|
+
private panel;
|
|
26
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.EuiPopoverObject = void 0;
|
|
7
|
+
var _test = require("@playwright/test");
|
|
8
|
+
var _base_object = require("../../base_object");
|
|
9
|
+
var _selectors = require("../../../components/popover/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/containers/popover/ EuiPopover}.
|
|
21
|
+
*
|
|
22
|
+
* `testSubj` must be set on the toggle button, not the panel. See the
|
|
23
|
+
* package README for the component-type guard and what this does not cover.
|
|
24
|
+
*/
|
|
25
|
+
class EuiPopoverObject extends _base_object.BaseObject {
|
|
26
|
+
constructor(scope, testSubj) {
|
|
27
|
+
super(scope, testSubj, _selectors.EuiPopoverSelectors.TOGGLE_SELECTOR);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Opens the popover and waits for the panel to be open. A no-op if it is
|
|
32
|
+
* already open.
|
|
33
|
+
*/
|
|
34
|
+
async open() {
|
|
35
|
+
if ((await this.root.getAttribute('aria-expanded')) === 'true') {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
await this.root.click();
|
|
39
|
+
const panel = await this.panel();
|
|
40
|
+
await panel.waitFor({
|
|
41
|
+
state: 'visible'
|
|
42
|
+
});
|
|
43
|
+
await (0, _test.expect)(panel).toHaveAttribute('data-popover-open', 'true');
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Closes the popover and waits for the panel to be removed. A no-op if it
|
|
48
|
+
* is already closed.
|
|
49
|
+
*/
|
|
50
|
+
async close() {
|
|
51
|
+
if ((await this.root.getAttribute('aria-expanded')) !== 'true') {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
// `aria-controls` is removed on close, so resolve the panel first.
|
|
55
|
+
const panel = await this.panel();
|
|
56
|
+
await this.root.click();
|
|
57
|
+
await panel.waitFor({
|
|
58
|
+
state: 'detached'
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* The panel the toggle's `aria-controls` points at. EUI sets that attribute
|
|
64
|
+
* synchronously with the open state, before the panel's own transition.
|
|
65
|
+
*/
|
|
66
|
+
async panel() {
|
|
67
|
+
await (0, _test.expect)(this.root).toHaveAttribute('aria-controls', /.+/);
|
|
68
|
+
const id = await this.root.getAttribute('aria-controls');
|
|
69
|
+
return this.root.page().locator(_selectors.EuiPopoverSelectors.panelFor(id));
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
exports.EuiPopoverObject = EuiPopoverObject;
|
package/lib/cjs/storybook.d.ts
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
* Returns the Storybook iframe URL for a given story ID and optional args.
|
|
3
3
|
*
|
|
4
4
|
* @param id - The Storybook story ID (e.g. `'forms-euicombobox--playground'`)
|
|
5
|
-
* @param args - Optional semicolon-separated Storybook args string (e.g. `'data-test-subj:myCombo;singleSelection
|
|
5
|
+
* @param args - Optional semicolon-separated Storybook args string (e.g. `'data-test-subj:myCombo;singleSelection:!true'`)
|
|
6
6
|
*/
|
|
7
7
|
export declare const storyUrl: (id: string, args?: string) => string;
|
package/lib/cjs/storybook.js
CHANGED
|
@@ -16,7 +16,7 @@ exports.storyUrl = void 0;
|
|
|
16
16
|
* Returns the Storybook iframe URL for a given story ID and optional args.
|
|
17
17
|
*
|
|
18
18
|
* @param id - The Storybook story ID (e.g. `'forms-euicombobox--playground'`)
|
|
19
|
-
* @param args - Optional semicolon-separated Storybook args string (e.g. `'data-test-subj:myCombo;singleSelection
|
|
19
|
+
* @param args - Optional semicolon-separated Storybook args string (e.g. `'data-test-subj:myCombo;singleSelection:!true'`)
|
|
20
20
|
*/
|
|
21
21
|
const storyUrl = (id, args) => `/iframe.html?id=${id}&viewMode=story${args ? `&args=${args}` : ''}`;
|
|
22
22
|
exports.storyUrl = storyUrl;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stable selectors for
|
|
3
|
+
* {@link https://eui.elastic.co/docs/components/containers/accordion/|EuiAccordion}.
|
|
4
|
+
* `*_SELECTOR` values are CSS, scoped to direct children (`>`) so a nested
|
|
5
|
+
* accordion inside `content` never matches these instead of this instance's
|
|
6
|
+
* own elements.
|
|
7
|
+
*/
|
|
8
|
+
export declare const EuiAccordionSelectors: {
|
|
9
|
+
/** Root element carrying the consumer's `data-test-subj`. */
|
|
10
|
+
ROOT_SELECTOR: string;
|
|
11
|
+
/** The trigger button. `aria-expanded` on it reflects open state synchronously. */
|
|
12
|
+
TRIGGER_SELECTOR: string;
|
|
13
|
+
/** The children wrapper. `height: 0` and `opacity: 0` while closed, so Playwright treats its contents as not visible. */
|
|
14
|
+
CONTENT_SELECTOR: string;
|
|
15
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
3
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
4
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
5
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
6
|
+
* Side Public License, v 1.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Stable selectors for
|
|
10
|
+
* {@link https://eui.elastic.co/docs/components/containers/accordion/|EuiAccordion}.
|
|
11
|
+
* `*_SELECTOR` values are CSS, scoped to direct children (`>`) so a nested
|
|
12
|
+
* accordion inside `content` never matches these instead of this instance's
|
|
13
|
+
* own elements.
|
|
14
|
+
*/
|
|
15
|
+
export const EuiAccordionSelectors = {
|
|
16
|
+
/** Root element carrying the consumer's `data-test-subj`. */
|
|
17
|
+
ROOT_SELECTOR: '.euiAccordion',
|
|
18
|
+
/** The trigger button. `aria-expanded` on it reflects open state synchronously. */
|
|
19
|
+
TRIGGER_SELECTOR: '> .euiAccordion__triggerWrapper > .euiAccordion__button',
|
|
20
|
+
/** The children wrapper. `height: 0` and `opacity: 0` while closed, so Playwright treats its contents as not visible. */
|
|
21
|
+
CONTENT_SELECTOR: '> .euiAccordion__childWrapper',
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=selectors.js.map
|