@axinom/mosaic-e2e-ui-selectors 0.1.0-rc.3
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 +55 -0
- package/dist/component-model.d.ts +58 -0
- package/dist/component-model.d.ts.map +1 -0
- package/dist/component-model.js +89 -0
- package/dist/component-model.js.map +1 -0
- package/dist/component-models/accordion.d.ts +44 -0
- package/dist/component-models/accordion.d.ts.map +1 -0
- package/dist/component-models/accordion.js +89 -0
- package/dist/component-models/accordion.js.map +1 -0
- package/dist/component-models/actions.d.ts +20 -0
- package/dist/component-models/actions.d.ts.map +1 -0
- package/dist/component-models/actions.js +29 -0
- package/dist/component-models/actions.js.map +1 -0
- package/dist/component-models/breadcrumbs.d.ts +35 -0
- package/dist/component-models/breadcrumbs.d.ts.map +1 -0
- package/dist/component-models/breadcrumbs.js +59 -0
- package/dist/component-models/breadcrumbs.js.map +1 -0
- package/dist/component-models/dynamic-data-list.d.ts +80 -0
- package/dist/component-models/dynamic-data-list.d.ts.map +1 -0
- package/dist/component-models/dynamic-data-list.js +131 -0
- package/dist/component-models/dynamic-data-list.js.map +1 -0
- package/dist/component-models/filters/date-filter.d.ts +17 -0
- package/dist/component-models/filters/date-filter.d.ts.map +1 -0
- package/dist/component-models/filters/date-filter.js +32 -0
- package/dist/component-models/filters/date-filter.js.map +1 -0
- package/dist/component-models/filters/date-time-filter.d.ts +9 -0
- package/dist/component-models/filters/date-time-filter.d.ts.map +1 -0
- package/dist/component-models/filters/date-time-filter.js +15 -0
- package/dist/component-models/filters/date-time-filter.js.map +1 -0
- package/dist/component-models/filters/filter.d.ts +35 -0
- package/dist/component-models/filters/filter.d.ts.map +1 -0
- package/dist/component-models/filters/filter.js +56 -0
- package/dist/component-models/filters/filter.js.map +1 -0
- package/dist/component-models/filters/filters.d.ts +34 -0
- package/dist/component-models/filters/filters.d.ts.map +1 -0
- package/dist/component-models/filters/filters.js +45 -0
- package/dist/component-models/filters/filters.js.map +1 -0
- package/dist/component-models/filters/free-text-filter.d.ts +17 -0
- package/dist/component-models/filters/free-text-filter.d.ts.map +1 -0
- package/dist/component-models/filters/free-text-filter.js +32 -0
- package/dist/component-models/filters/free-text-filter.js.map +1 -0
- package/dist/component-models/filters/index.d.ts +9 -0
- package/dist/component-models/filters/index.d.ts.map +1 -0
- package/dist/component-models/filters/index.js +21 -0
- package/dist/component-models/filters/index.js.map +1 -0
- package/dist/component-models/filters/numeric-filter.d.ts +17 -0
- package/dist/component-models/filters/numeric-filter.d.ts.map +1 -0
- package/dist/component-models/filters/numeric-filter.js +32 -0
- package/dist/component-models/filters/numeric-filter.js.map +1 -0
- package/dist/component-models/filters/options-filter.d.ts +23 -0
- package/dist/component-models/filters/options-filter.d.ts.map +1 -0
- package/dist/component-models/filters/options-filter.js +43 -0
- package/dist/component-models/filters/options-filter.js.map +1 -0
- package/dist/component-models/filters/untyped-filter.d.ts +29 -0
- package/dist/component-models/filters/untyped-filter.d.ts.map +1 -0
- package/dist/component-models/filters/untyped-filter.js +31 -0
- package/dist/component-models/filters/untyped-filter.js.map +1 -0
- package/dist/component-models/form/checkbox.d.ts +15 -0
- package/dist/component-models/form/checkbox.d.ts.map +1 -0
- package/dist/component-models/form/checkbox.js +29 -0
- package/dist/component-models/form/checkbox.js.map +1 -0
- package/dist/component-models/form/custom-tags-field.d.ts +23 -0
- package/dist/component-models/form/custom-tags-field.d.ts.map +1 -0
- package/dist/component-models/form/custom-tags-field.js +49 -0
- package/dist/component-models/form/custom-tags-field.js.map +1 -0
- package/dist/component-models/form/dynamic-data-list-field.d.ts +12 -0
- package/dist/component-models/form/dynamic-data-list-field.d.ts.map +1 -0
- package/dist/component-models/form/dynamic-data-list-field.js +22 -0
- package/dist/component-models/form/dynamic-data-list-field.js.map +1 -0
- package/dist/component-models/form/file-upload-field.d.ts +13 -0
- package/dist/component-models/form/file-upload-field.d.ts.map +1 -0
- package/dist/component-models/form/file-upload-field.js +26 -0
- package/dist/component-models/form/file-upload-field.js.map +1 -0
- package/dist/component-models/form/form-field.d.ts +31 -0
- package/dist/component-models/form/form-field.d.ts.map +1 -0
- package/dist/component-models/form/form-field.js +44 -0
- package/dist/component-models/form/form-field.js.map +1 -0
- package/dist/component-models/form/form.d.ts +42 -0
- package/dist/component-models/form/form.d.ts.map +1 -0
- package/dist/component-models/form/form.js +60 -0
- package/dist/component-models/form/form.js.map +1 -0
- package/dist/component-models/form/generic-field.d.ts +11 -0
- package/dist/component-models/form/generic-field.d.ts.map +1 -0
- package/dist/component-models/form/generic-field.js +23 -0
- package/dist/component-models/form/generic-field.js.map +1 -0
- package/dist/component-models/form/index.d.ts +14 -0
- package/dist/component-models/form/index.d.ts.map +1 -0
- package/dist/component-models/form/index.js +26 -0
- package/dist/component-models/form/index.js.map +1 -0
- package/dist/component-models/form/radio-field.d.ts +17 -0
- package/dist/component-models/form/radio-field.d.ts.map +1 -0
- package/dist/component-models/form/radio-field.js +45 -0
- package/dist/component-models/form/radio-field.js.map +1 -0
- package/dist/component-models/form/read-only-field.d.ts +13 -0
- package/dist/component-models/form/read-only-field.d.ts.map +1 -0
- package/dist/component-models/form/read-only-field.js +27 -0
- package/dist/component-models/form/read-only-field.js.map +1 -0
- package/dist/component-models/form/read-only-text-field.d.ts +11 -0
- package/dist/component-models/form/read-only-text-field.d.ts.map +1 -0
- package/dist/component-models/form/read-only-text-field.js +23 -0
- package/dist/component-models/form/read-only-text-field.js.map +1 -0
- package/dist/component-models/form/select-field.d.ts +20 -0
- package/dist/component-models/form/select-field.d.ts.map +1 -0
- package/dist/component-models/form/select-field.js +42 -0
- package/dist/component-models/form/select-field.js.map +1 -0
- package/dist/component-models/form/single-line-text-field.d.ts +15 -0
- package/dist/component-models/form/single-line-text-field.d.ts.map +1 -0
- package/dist/component-models/form/single-line-text-field.js +33 -0
- package/dist/component-models/form/single-line-text-field.js.map +1 -0
- package/dist/component-models/form/untyped-form-field.d.ts +46 -0
- package/dist/component-models/form/untyped-form-field.d.ts.map +1 -0
- package/dist/component-models/form/untyped-form-field.js +50 -0
- package/dist/component-models/form/untyped-form-field.js.map +1 -0
- package/dist/component-models/hub-tiles.d.ts +47 -0
- package/dist/component-models/hub-tiles.d.ts.map +1 -0
- package/dist/component-models/hub-tiles.js +76 -0
- package/dist/component-models/hub-tiles.js.map +1 -0
- package/dist/component-models/index.d.ts +19 -0
- package/dist/component-models/index.d.ts.map +1 -0
- package/dist/component-models/index.js +31 -0
- package/dist/component-models/index.js.map +1 -0
- package/dist/component-models/info-panel.d.ts +55 -0
- package/dist/component-models/info-panel.d.ts.map +1 -0
- package/dist/component-models/info-panel.js +85 -0
- package/dist/component-models/info-panel.js.map +1 -0
- package/dist/component-models/inline-menu.d.ts +19 -0
- package/dist/component-models/inline-menu.d.ts.map +1 -0
- package/dist/component-models/inline-menu.js +27 -0
- package/dist/component-models/inline-menu.js.map +1 -0
- package/dist/component-models/landing-page-header.d.ts +18 -0
- package/dist/component-models/landing-page-header.d.ts.map +1 -0
- package/dist/component-models/landing-page-header.js +25 -0
- package/dist/component-models/landing-page-header.js.map +1 -0
- package/dist/component-models/landing-page-tiles.d.ts +31 -0
- package/dist/component-models/landing-page-tiles.d.ts.map +1 -0
- package/dist/component-models/landing-page-tiles.js +50 -0
- package/dist/component-models/landing-page-tiles.js.map +1 -0
- package/dist/component-models/list-row.d.ts +37 -0
- package/dist/component-models/list-row.d.ts.map +1 -0
- package/dist/component-models/list-row.js +61 -0
- package/dist/component-models/list-row.js.map +1 -0
- package/dist/component-models/list.d.ts +43 -0
- package/dist/component-models/list.d.ts.map +1 -0
- package/dist/component-models/list.js +70 -0
- package/dist/component-models/list.js.map +1 -0
- package/dist/component-models/loader.d.ts +17 -0
- package/dist/component-models/loader.d.ts.map +1 -0
- package/dist/component-models/loader.js +33 -0
- package/dist/component-models/loader.js.map +1 -0
- package/dist/component-models/message-bar.d.ts +22 -0
- package/dist/component-models/message-bar.d.ts.map +1 -0
- package/dist/component-models/message-bar.js +38 -0
- package/dist/component-models/message-bar.js.map +1 -0
- package/dist/component-models/modal/index.d.ts +4 -0
- package/dist/component-models/modal/index.d.ts.map +1 -0
- package/dist/component-models/modal/index.js +16 -0
- package/dist/component-models/modal/index.js.map +1 -0
- package/dist/component-models/modal/modal-content.d.ts +14 -0
- package/dist/component-models/modal/modal-content.d.ts.map +1 -0
- package/dist/component-models/modal/modal-content.js +19 -0
- package/dist/component-models/modal/modal-content.js.map +1 -0
- package/dist/component-models/modal/modal.d.ts +24 -0
- package/dist/component-models/modal/modal.d.ts.map +1 -0
- package/dist/component-models/modal/modal.js +28 -0
- package/dist/component-models/modal/modal.js.map +1 -0
- package/dist/component-models/modal/selection-explorer.d.ts +19 -0
- package/dist/component-models/modal/selection-explorer.d.ts.map +1 -0
- package/dist/component-models/modal/selection-explorer.js +26 -0
- package/dist/component-models/modal/selection-explorer.js.map +1 -0
- package/dist/component-models/page-header.d.ts +21 -0
- package/dist/component-models/page-header.d.ts.map +1 -0
- package/dist/component-models/page-header.js +26 -0
- package/dist/component-models/page-header.js.map +1 -0
- package/dist/component-models/toggle-button.d.ts +22 -0
- package/dist/component-models/toggle-button.d.ts.map +1 -0
- package/dist/component-models/toggle-button.js +32 -0
- package/dist/component-models/toggle-button.js.map +1 -0
- package/dist/constants/action-label.d.ts +9 -0
- package/dist/constants/action-label.d.ts.map +1 -0
- package/dist/constants/action-label.js +13 -0
- package/dist/constants/action-label.js.map +1 -0
- package/dist/constants/index.d.ts +2 -0
- package/dist/constants/index.d.ts.map +1 -0
- package/dist/constants/index.js +14 -0
- package/dist/constants/index.js.map +1 -0
- package/dist/helpers/index.d.ts +4 -0
- package/dist/helpers/index.d.ts.map +1 -0
- package/dist/helpers/index.js +16 -0
- package/dist/helpers/index.js.map +1 -0
- package/dist/helpers/wait-for-data-to-load.d.ts +5 -0
- package/dist/helpers/wait-for-data-to-load.d.ts.map +1 -0
- package/dist/helpers/wait-for-data-to-load.js +10 -0
- package/dist/helpers/wait-for-data-to-load.js.map +1 -0
- package/dist/helpers/wait-for-or-timeout.d.ts +13 -0
- package/dist/helpers/wait-for-or-timeout.d.ts.map +1 -0
- package/dist/helpers/wait-for-or-timeout.js +23 -0
- package/dist/helpers/wait-for-or-timeout.js.map +1 -0
- package/dist/helpers/wait-for-page-transition.d.ts +4 -0
- package/dist/helpers/wait-for-page-transition.d.ts.map +1 -0
- package/dist/helpers/wait-for-page-transition.js +18 -0
- package/dist/helpers/wait-for-page-transition.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -0
- package/dist/ui-workflows-model.d.ts +29 -0
- package/dist/ui-workflows-model.d.ts.map +1 -0
- package/dist/ui-workflows-model.js +32 -0
- package/dist/ui-workflows-model.js.map +1 -0
- package/package.json +34 -0
package/README.md
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# @axinom/mosaic-e2e-ui-selectors
|
|
2
|
+
|
|
3
|
+
## About the Package
|
|
4
|
+
|
|
5
|
+
This package is part of the Axinom Mosaic development platform. More information
|
|
6
|
+
can be found at https://portal.axinom.com/mosaic.
|
|
7
|
+
|
|
8
|
+
This library models components in the Mosaic UI library, `@axinom/mosaic-ui` for
|
|
9
|
+
use in Playwright tests. Exported class `UiWorkflowsModel` provides a model to
|
|
10
|
+
navigate the DOM tree and to perform operations and assertions with Playwright.
|
|
11
|
+
|
|
12
|
+
This library should be used to model customized services. It should be used in
|
|
13
|
+
concert with `@axinom/mosaic-page-models` which models the Mosaic management
|
|
14
|
+
system including the shell UI and managed services.
|
|
15
|
+
|
|
16
|
+
## License
|
|
17
|
+
|
|
18
|
+
This package can be licensed under the
|
|
19
|
+
[Axinom Products Licensing Agreement](https://portal.axinom.com/mosaic/contracts/products-licensing-agreement)
|
|
20
|
+
or evaluated under the
|
|
21
|
+
[Axinom Products Evaluation Agreement](https://portal.axinom.com/mosaic/contracts/products-evaluation-agreement).
|
|
22
|
+
No part of Axinom's software may be copied, modified, propagated, or distributed
|
|
23
|
+
except in accordance with the terms contained in the Axinom Products Licensing
|
|
24
|
+
Agreement and Axinom Products Evaluation Agreement.
|
|
25
|
+
|
|
26
|
+
## Library Conventions
|
|
27
|
+
|
|
28
|
+
Many conventions should be obvious from reading the code. Still, for clarity
|
|
29
|
+
there are some, maybe less obvious, conventions described here. The library is
|
|
30
|
+
designed to leverage the capabilities of intellisense to guide a test author and
|
|
31
|
+
to minimise the need to refer to documentation and source. Conventions are
|
|
32
|
+
designed to foster intuition in the user, and to improve readability of tests.
|
|
33
|
+
|
|
34
|
+
- All models are extended from the `ComponentModel` class.
|
|
35
|
+
- If the desired functionality of an element can be achieved with a `Locator`
|
|
36
|
+
then return a `Locator` rather than modelling behavior through additional
|
|
37
|
+
methods and properties.
|
|
38
|
+
|
|
39
|
+
Exposing `Locators` empowers the test author, e.g. by enabling expressive
|
|
40
|
+
`expect` statements which wait gracefully. There are exceptions to the rule,
|
|
41
|
+
e.g. where an element is a generic container that could contain any other UI
|
|
42
|
+
components, a `ComponentModel` can be more flexible as it has the `getChild`
|
|
43
|
+
method.
|
|
44
|
+
|
|
45
|
+
- Classes extending `ComponentModel` should mirror components defined in the UI
|
|
46
|
+
library where possible. The naming and structure should be aligned.
|
|
47
|
+
- Method parameters should be simple. Preferably just strings and numbers with
|
|
48
|
+
sufficient doc comments to guide the user.
|
|
49
|
+
|
|
50
|
+
Enums and typed objects as parameters are good for enforcing type safety but
|
|
51
|
+
they require an additional level of introspection when authoring tests. If a
|
|
52
|
+
test fails due to a string typo its easy to fix. If there is a limited set of
|
|
53
|
+
options which can be codified, consider a method for each so that intellisense
|
|
54
|
+
will list them alongside other methods and properties (e.g. see
|
|
55
|
+
`UntypedFormField`).
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { FrameLocator, Locator, Page } from 'playwright-core';
|
|
2
|
+
/** Interface for a ComponentModel constructor. */
|
|
3
|
+
interface ComponentModelType<TModel extends ComponentModel> {
|
|
4
|
+
new (parent: Page | FrameLocator | ComponentModel, xpath?: string, nth?: number): TModel;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Base class for UI component models. A component model is an abstraction of
|
|
8
|
+
* a playwright locator. Specific UI components can be modelled by extending
|
|
9
|
+
* this class and a UI structure can be represented through composition.
|
|
10
|
+
*
|
|
11
|
+
* A component model is initiated with a parent object and an xpath. The DOM
|
|
12
|
+
* element which is represented by the model is found by applying the xpath
|
|
13
|
+
* relative to the parent.
|
|
14
|
+
*
|
|
15
|
+
* The `getLocator` method exposes a playwright locator. This method can be
|
|
16
|
+
* used with 0 arguments to get a locator directly to the DOM element the model
|
|
17
|
+
* represents, or it can be used with an xpath argument to get a relative
|
|
18
|
+
* element.
|
|
19
|
+
*
|
|
20
|
+
* Only XPATH selectors can be used. This is because xpaths are combined
|
|
21
|
+
* through string concatenation so that the selector for a component model is
|
|
22
|
+
* always absolute. An absolute xpath is convenient when debugging failed
|
|
23
|
+
* matches as it can be copied and analyzed with browser dev tools. This
|
|
24
|
+
* approach was preferred over using Playwright relative locators because
|
|
25
|
+
* relative locators are logged in test output as a series of selectors,
|
|
26
|
+
* possibly using mixed technologies.
|
|
27
|
+
*/
|
|
28
|
+
export declare class ComponentModel {
|
|
29
|
+
/**
|
|
30
|
+
* A model which represents a DOM element.
|
|
31
|
+
* @param parent The playwright page object, frame or component model to be used as the parent of this component.
|
|
32
|
+
* @param xpath A relative xpath to this component from the parent.
|
|
33
|
+
* @param nth Optional position of this component among xpath matches. Position is 1 indexed. Negative numbers count from the end.
|
|
34
|
+
*/
|
|
35
|
+
constructor(parent: Page | FrameLocator | ComponentModel, xpath: string, nth?: number);
|
|
36
|
+
/** The root playwright entity from which to resolve this component model's xpath. */
|
|
37
|
+
protected root: Page | FrameLocator;
|
|
38
|
+
/** An absolute xpath to the DOM element that this component model represents. */
|
|
39
|
+
readonly xpath: string;
|
|
40
|
+
/** This method gets a locator to the DOM element represented by this component model. */
|
|
41
|
+
getLocator(): Locator;
|
|
42
|
+
/**
|
|
43
|
+
* This method gets a locator to a DOM element relative to the element represented by this component model.
|
|
44
|
+
* @param xpath An xpath relative to this component.
|
|
45
|
+
* @param nth Optional position among matches. Position is 1 indexed. Negative numbers count from the end.
|
|
46
|
+
*/
|
|
47
|
+
getLocator(xpath: string, nth?: number): Locator;
|
|
48
|
+
/**
|
|
49
|
+
* This method gets a child component model with a provided type. This is useful
|
|
50
|
+
* for modelling a page where the UI is composed in a custom manner.
|
|
51
|
+
* @param model A ComponentModel type. e.g. `ToggleButton` / `Modal`
|
|
52
|
+
* @param xpath An optional xpath relative to this component. If not provided, the model's default xpath will be used.
|
|
53
|
+
* @param nth Optional position among matches. Position is 1 indexed. Negative numbers count from the end.
|
|
54
|
+
*/
|
|
55
|
+
getChildOfType<TModel extends ComponentModel>(model: ComponentModelType<TModel>, xpath?: string, nth?: number): TModel;
|
|
56
|
+
}
|
|
57
|
+
export {};
|
|
58
|
+
//# sourceMappingURL=component-model.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component-model.d.ts","sourceRoot":"","sources":["../src/component-model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAE9D,kDAAkD;AAClD,UAAU,kBAAkB,CAAC,MAAM,SAAS,cAAc;IACxD,KACE,MAAM,EAAE,IAAI,GAAG,YAAY,GAAG,cAAc,EAC5C,KAAK,CAAC,EAAE,MAAM,EACd,GAAG,CAAC,EAAE,MAAM,GACX,MAAM,CAAC;CACX;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,qBAAa,cAAc;IACzB;;;;;OAKG;gBAED,MAAM,EAAE,IAAI,GAAG,YAAY,GAAG,cAAc,EAC5C,KAAK,EAAE,MAAM,EACb,GAAG,CAAC,EAAE,MAAM;IAgBd,qFAAqF;IACrF,SAAS,CAAC,IAAI,EAAE,IAAI,GAAG,YAAY,CAAC;IAEpC,iFAAiF;IACjF,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAEvB,yFAAyF;IACzF,UAAU,IAAI,OAAO;IACrB;;;;OAIG;IACH,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO;IAWhD;;;;;;OAMG;IACH,cAAc,CAAC,MAAM,SAAS,cAAc,EAC1C,KAAK,EAAE,kBAAkB,CAAC,MAAM,CAAC,EACjC,KAAK,CAAC,EAAE,MAAM,EACd,GAAG,CAAC,EAAE,MAAM,GACX,MAAM;CAGV"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ComponentModel = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Base class for UI component models. A component model is an abstraction of
|
|
6
|
+
* a playwright locator. Specific UI components can be modelled by extending
|
|
7
|
+
* this class and a UI structure can be represented through composition.
|
|
8
|
+
*
|
|
9
|
+
* A component model is initiated with a parent object and an xpath. The DOM
|
|
10
|
+
* element which is represented by the model is found by applying the xpath
|
|
11
|
+
* relative to the parent.
|
|
12
|
+
*
|
|
13
|
+
* The `getLocator` method exposes a playwright locator. This method can be
|
|
14
|
+
* used with 0 arguments to get a locator directly to the DOM element the model
|
|
15
|
+
* represents, or it can be used with an xpath argument to get a relative
|
|
16
|
+
* element.
|
|
17
|
+
*
|
|
18
|
+
* Only XPATH selectors can be used. This is because xpaths are combined
|
|
19
|
+
* through string concatenation so that the selector for a component model is
|
|
20
|
+
* always absolute. An absolute xpath is convenient when debugging failed
|
|
21
|
+
* matches as it can be copied and analyzed with browser dev tools. This
|
|
22
|
+
* approach was preferred over using Playwright relative locators because
|
|
23
|
+
* relative locators are logged in test output as a series of selectors,
|
|
24
|
+
* possibly using mixed technologies.
|
|
25
|
+
*/
|
|
26
|
+
class ComponentModel {
|
|
27
|
+
/**
|
|
28
|
+
* A model which represents a DOM element.
|
|
29
|
+
* @param parent The playwright page object, frame or component model to be used as the parent of this component.
|
|
30
|
+
* @param xpath A relative xpath to this component from the parent.
|
|
31
|
+
* @param nth Optional position of this component among xpath matches. Position is 1 indexed. Negative numbers count from the end.
|
|
32
|
+
*/
|
|
33
|
+
constructor(parent, xpath, nth) {
|
|
34
|
+
// If the parent is a ComponentModel, copy it's root and combine the xpaths
|
|
35
|
+
if (parent instanceof ComponentModel) {
|
|
36
|
+
this.root = parent.root;
|
|
37
|
+
xpath = parent.xpath + xpath;
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
this.root = parent;
|
|
41
|
+
}
|
|
42
|
+
// Apply position argument
|
|
43
|
+
if (nth !== undefined) {
|
|
44
|
+
xpath = applyPositionToXpath(xpath, nth);
|
|
45
|
+
}
|
|
46
|
+
this.xpath = xpath;
|
|
47
|
+
}
|
|
48
|
+
getLocator(xpath = '', nth) {
|
|
49
|
+
// Combine xpaths
|
|
50
|
+
xpath = this.xpath + xpath;
|
|
51
|
+
// Apply position argument
|
|
52
|
+
if (nth !== undefined) {
|
|
53
|
+
xpath = applyPositionToXpath(xpath, nth);
|
|
54
|
+
}
|
|
55
|
+
return this.root.locator(xpath);
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* This method gets a child component model with a provided type. This is useful
|
|
59
|
+
* for modelling a page where the UI is composed in a custom manner.
|
|
60
|
+
* @param model A ComponentModel type. e.g. `ToggleButton` / `Modal`
|
|
61
|
+
* @param xpath An optional xpath relative to this component. If not provided, the model's default xpath will be used.
|
|
62
|
+
* @param nth Optional position among matches. Position is 1 indexed. Negative numbers count from the end.
|
|
63
|
+
*/
|
|
64
|
+
getChildOfType(model, xpath, nth) {
|
|
65
|
+
return new model(this, xpath, nth);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
exports.ComponentModel = ComponentModel;
|
|
69
|
+
/**
|
|
70
|
+
* This method applies a position to an xpath to match single DOM element.
|
|
71
|
+
* Position is 1 indexed. Negative numbers count from the end (1 is the first match, -1 is the last).
|
|
72
|
+
*/
|
|
73
|
+
function applyPositionToXpath(xpath, position) {
|
|
74
|
+
if (position === 0) {
|
|
75
|
+
throw new Error('Unexpected value 0 for 1-indexed position argument.');
|
|
76
|
+
}
|
|
77
|
+
if (position !== Math.floor(position)) {
|
|
78
|
+
throw new Error('Unexpected non-integer value for position argument.');
|
|
79
|
+
}
|
|
80
|
+
if (position === -1) {
|
|
81
|
+
return `(${xpath})[last()]`;
|
|
82
|
+
}
|
|
83
|
+
if (position < -1) {
|
|
84
|
+
// The negative symbol on the number becomes an operator:
|
|
85
|
+
return `(${xpath})[position() = (last()${position + 1})]`;
|
|
86
|
+
}
|
|
87
|
+
return `(${xpath})[${position}]`;
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=component-model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component-model.js","sourceRoot":"","sources":["../src/component-model.ts"],"names":[],"mappings":";;;AAWA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAa,cAAc;IACzB;;;;;OAKG;IACH,YACE,MAA4C,EAC5C,KAAa,EACb,GAAY;QAEZ,2EAA2E;QAC3E,IAAI,MAAM,YAAY,cAAc,EAAE;YACpC,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;YACxB,KAAK,GAAG,MAAM,CAAC,KAAK,GAAG,KAAK,CAAC;SAC9B;aAAM;YACL,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC;SACpB;QACD,0BAA0B;QAC1B,IAAI,GAAG,KAAK,SAAS,EAAE;YACrB,KAAK,GAAG,oBAAoB,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;SAC1C;QACD,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAgBD,UAAU,CAAC,KAAK,GAAG,EAAE,EAAE,GAAY;QACjC,iBAAiB;QACjB,KAAK,GAAG,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QAC3B,0BAA0B;QAC1B,IAAI,GAAG,KAAK,SAAS,EAAE;YACrB,KAAK,GAAG,oBAAoB,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;SAC1C;QACD,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAClC,CAAC;IAED;;;;;;OAMG;IACH,cAAc,CACZ,KAAiC,EACjC,KAAc,EACd,GAAY;QAEZ,OAAO,IAAI,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;IACrC,CAAC;CACF;AAhED,wCAgEC;AAED;;;GAGG;AACH,SAAS,oBAAoB,CAAC,KAAa,EAAE,QAAgB;IAC3D,IAAI,QAAQ,KAAK,CAAC,EAAE;QAClB,MAAM,IAAI,KAAK,CAAC,qDAAqD,CAAC,CAAC;KACxE;IACD,IAAI,QAAQ,KAAK,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE;QACrC,MAAM,IAAI,KAAK,CAAC,qDAAqD,CAAC,CAAC;KACxE;IACD,IAAI,QAAQ,KAAK,CAAC,CAAC,EAAE;QACnB,OAAO,IAAI,KAAK,WAAW,CAAC;KAC7B;IACD,IAAI,QAAQ,GAAG,CAAC,CAAC,EAAE;QACjB,yDAAyD;QACzD,OAAO,IAAI,KAAK,yBAAyB,QAAQ,GAAG,CAAC,IAAI,CAAC;KAC3D;IACD,OAAO,IAAI,KAAK,KAAK,QAAQ,GAAG,CAAC;AACnC,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { FrameLocator, Page } from 'playwright-core';
|
|
2
|
+
import { ComponentModel } from '../component-model';
|
|
3
|
+
/**
|
|
4
|
+
* A model for an AccordionItem component.
|
|
5
|
+
*/
|
|
6
|
+
export declare class AccordionItem extends ComponentModel {
|
|
7
|
+
/** A locator to the row for this accordion item that is always displayed. */
|
|
8
|
+
readonly row: import("playwright-core").Locator;
|
|
9
|
+
/** A locator to the content for this accordion item that is only shown when expanded. */
|
|
10
|
+
readonly content: import("playwright-core").Locator;
|
|
11
|
+
/**
|
|
12
|
+
* This method expands the accordion item.
|
|
13
|
+
* If it is already expanded an error will be raised.
|
|
14
|
+
*/
|
|
15
|
+
expand(): Promise<void>;
|
|
16
|
+
/**
|
|
17
|
+
* This method contracts the accordion item.
|
|
18
|
+
* If it is not expanded an error will be raised
|
|
19
|
+
*/
|
|
20
|
+
contract(): Promise<void>;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* A model for an Accordion component with methods to get models for the
|
|
24
|
+
* header and individual items.
|
|
25
|
+
*/
|
|
26
|
+
export declare class Accordion extends ComponentModel {
|
|
27
|
+
/**
|
|
28
|
+
* A model for an accordion component.
|
|
29
|
+
* @param parent The parent playwright page, frame or component model.
|
|
30
|
+
* @param xpath A relative xpath selector to this element from the parent.
|
|
31
|
+
*/
|
|
32
|
+
constructor(parent: Page | FrameLocator | ComponentModel, xpath?: string);
|
|
33
|
+
/** A locator to the header row. */
|
|
34
|
+
readonly header: import("playwright-core").Locator;
|
|
35
|
+
/** This method gets a visible accordion item by position. Position is 1 indexed. Negative numbers count from the end. */
|
|
36
|
+
getItem(position: number): AccordionItem;
|
|
37
|
+
/**
|
|
38
|
+
* This method gets a visible accordion item by matching text in the accordion
|
|
39
|
+
* row. If multiple items match the text, the 'nth' parameter can be used to
|
|
40
|
+
* select which is returned (the first by default).
|
|
41
|
+
*/
|
|
42
|
+
getItemContainingText(text: string, nth?: number): AccordionItem;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=accordion.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accordion.d.ts","sourceRoot":"","sources":["../../src/component-models/accordion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD;;GAEG;AACH,qBAAa,aAAc,SAAQ,cAAc;IAC/C,6EAA6E;IAC7E,QAAQ,CAAC,GAAG,oCAGV;IAEF,yFAAyF;IACzF,QAAQ,CAAC,OAAO,oCAGd;IAEF;;;OAGG;IACG,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAU7B;;;OAGG;IACG,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;CAShC;AAED;;;GAGG;AACH,qBAAa,SAAU,SAAQ,cAAc;IAC3C;;;;OAIG;gBAED,MAAM,EAAE,IAAI,GAAG,YAAY,GAAG,cAAc,EAE5C,KAAK,SAAiD;IAKxD,mCAAmC;IACnC,QAAQ,CAAC,MAAM,oCAGb;IAEF,yHAAyH;IACzH,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,aAAa;IASxC;;;;OAIG;IACH,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,SAAI,GAAG,aAAa;CAU5D"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Accordion = exports.AccordionItem = void 0;
|
|
4
|
+
const component_model_1 = require("../component-model");
|
|
5
|
+
/**
|
|
6
|
+
* A model for an AccordionItem component.
|
|
7
|
+
*/
|
|
8
|
+
class AccordionItem extends component_model_1.ComponentModel {
|
|
9
|
+
constructor() {
|
|
10
|
+
super(...arguments);
|
|
11
|
+
/** A locator to the row for this accordion item that is always displayed. */
|
|
12
|
+
this.row = this.getLocator(
|
|
13
|
+
//TODO: improve selector
|
|
14
|
+
'//*[contains(@class, "AccordionItem_row")]');
|
|
15
|
+
/** A locator to the content for this accordion item that is only shown when expanded. */
|
|
16
|
+
this.content = this.getLocator(
|
|
17
|
+
//TODO: improve selector. only selects expanded content
|
|
18
|
+
'//*[contains(@class, "AccordionItem_expanded")]//*[contains(@class, "AccordionItem_content")]');
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* This method expands the accordion item.
|
|
22
|
+
* If it is already expanded an error will be raised.
|
|
23
|
+
*/
|
|
24
|
+
async expand() {
|
|
25
|
+
try {
|
|
26
|
+
this.content.waitFor({ state: 'hidden' });
|
|
27
|
+
}
|
|
28
|
+
catch (_a) {
|
|
29
|
+
throw new Error('Accordion entry is already expanded.');
|
|
30
|
+
}
|
|
31
|
+
await this.row.click();
|
|
32
|
+
await this.content.waitFor({ state: 'visible' });
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* This method contracts the accordion item.
|
|
36
|
+
* If it is not expanded an error will be raised
|
|
37
|
+
*/
|
|
38
|
+
async contract() {
|
|
39
|
+
try {
|
|
40
|
+
this.content.waitFor({ state: 'visible' });
|
|
41
|
+
}
|
|
42
|
+
catch (_a) {
|
|
43
|
+
throw new Error('Accordion entry is not expanded');
|
|
44
|
+
}
|
|
45
|
+
await this.row.click();
|
|
46
|
+
await this.content.waitFor({ state: 'hidden' });
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
exports.AccordionItem = AccordionItem;
|
|
50
|
+
/**
|
|
51
|
+
* A model for an Accordion component with methods to get models for the
|
|
52
|
+
* header and individual items.
|
|
53
|
+
*/
|
|
54
|
+
class Accordion extends component_model_1.ComponentModel {
|
|
55
|
+
/**
|
|
56
|
+
* A model for an accordion component.
|
|
57
|
+
* @param parent The parent playwright page, frame or component model.
|
|
58
|
+
* @param xpath A relative xpath selector to this element from the parent.
|
|
59
|
+
*/
|
|
60
|
+
constructor(parent,
|
|
61
|
+
//TODO: improve selector
|
|
62
|
+
xpath = '//*[contains(@class, "Accordion_container")]') {
|
|
63
|
+
super(parent, xpath);
|
|
64
|
+
/** A locator to the header row. */
|
|
65
|
+
this.header = this.getLocator(
|
|
66
|
+
//TODO: improve selector
|
|
67
|
+
'//*[contains(@class, "Accordion_header")]');
|
|
68
|
+
}
|
|
69
|
+
/** This method gets a visible accordion item by position. Position is 1 indexed. Negative numbers count from the end. */
|
|
70
|
+
getItem(position) {
|
|
71
|
+
return new AccordionItem(this,
|
|
72
|
+
//TODO: improve selector
|
|
73
|
+
'/div/div[not(@class)', position);
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* This method gets a visible accordion item by matching text in the accordion
|
|
77
|
+
* row. If multiple items match the text, the 'nth' parameter can be used to
|
|
78
|
+
* select which is returned (the first by default).
|
|
79
|
+
*/
|
|
80
|
+
getItemContainingText(text, nth = 1) {
|
|
81
|
+
//TODO: improve selector
|
|
82
|
+
const rowFilter = `//*[contains(@class, "AccordionItem_row") and .//*[contains(text(), "${text}")]]`;
|
|
83
|
+
return new AccordionItem(this,
|
|
84
|
+
//TODO: improve selector
|
|
85
|
+
`/div/div[not(@class) and .${rowFilter}]`, nth);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
exports.Accordion = Accordion;
|
|
89
|
+
//# sourceMappingURL=accordion.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accordion.js","sourceRoot":"","sources":["../../src/component-models/accordion.ts"],"names":[],"mappings":";;;AACA,wDAAoD;AAEpD;;GAEG;AACH,MAAa,aAAc,SAAQ,gCAAc;IAAjD;;QACE,6EAA6E;QACpE,QAAG,GAAG,IAAI,CAAC,UAAU;QAC5B,wBAAwB;QACxB,4CAA4C,CAC7C,CAAC;QAEF,yFAAyF;QAChF,YAAO,GAAG,IAAI,CAAC,UAAU;QAChC,uDAAuD;QACvD,+FAA+F,CAChG,CAAC;IA6BJ,CAAC;IA3BC;;;OAGG;IACH,KAAK,CAAC,MAAM;QACV,IAAI;YACF,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC;SAC3C;QAAC,WAAM;YACN,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAC;SACzD;QACD,MAAM,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC;QACvB,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;IACnD,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,QAAQ;QACZ,IAAI;YACF,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;SAC5C;QAAC,WAAM;YACN,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;SACpD;QACD,MAAM,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC;QACvB,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC;IAClD,CAAC;CACF;AAxCD,sCAwCC;AAED;;;GAGG;AACH,MAAa,SAAU,SAAQ,gCAAc;IAC3C;;;;OAIG;IACH,YACE,MAA4C;IAC5C,wBAAwB;IACxB,KAAK,GAAG,8CAA8C;QAEtD,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;QAGvB,mCAAmC;QAC1B,WAAM,GAAG,IAAI,CAAC,UAAU;QAC/B,wBAAwB;QACxB,2CAA2C,CAC5C,CAAC;IANF,CAAC;IAQD,yHAAyH;IACzH,OAAO,CAAC,QAAgB;QACtB,OAAO,IAAI,aAAa,CACtB,IAAI;QACJ,wBAAwB;QACxB,sBAAsB,EACtB,QAAQ,CACT,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACH,qBAAqB,CAAC,IAAY,EAAE,GAAG,GAAG,CAAC;QACzC,wBAAwB;QACxB,MAAM,SAAS,GAAG,wEAAwE,IAAI,MAAM,CAAC;QACrG,OAAO,IAAI,aAAa,CACtB,IAAI;QACJ,wBAAwB;QACxB,6BAA6B,SAAS,GAAG,EACzC,GAAG,CACJ,CAAC;IACJ,CAAC;CACF;AA7CD,8BA6CC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { FrameLocator, Locator, Page } from 'playwright-core';
|
|
2
|
+
import { ComponentModel } from '../component-model';
|
|
3
|
+
/**
|
|
4
|
+
* An model for an Actions component with methods to retrieve individual actions.
|
|
5
|
+
*/
|
|
6
|
+
export declare class Actions extends ComponentModel {
|
|
7
|
+
/**
|
|
8
|
+
* An model for an Actions component with methods to retrieve individual actions.
|
|
9
|
+
* @param parent The parent playwright page, frame or component model.
|
|
10
|
+
* @param xpath A relative xpath selector to this element from the parent.
|
|
11
|
+
*/
|
|
12
|
+
constructor(parent: Page | FrameLocator | ComponentModel, xpath?: string);
|
|
13
|
+
/** A locator to the confirm button which may show after clicking an action. */
|
|
14
|
+
readonly confirmButton: Locator;
|
|
15
|
+
/** This method finds an action button by position. Position is 1 indexed. Negative numbers count from the end. */
|
|
16
|
+
getAction(position: number): Locator;
|
|
17
|
+
/** This method finds an action button by label. the label must match exactly. */
|
|
18
|
+
getActionByLabel(label: string): Locator;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=actions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../src/component-models/actions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD;;GAEG;AACH,qBAAa,OAAQ,SAAQ,cAAc;IACzC;;;;OAIG;gBAED,MAAM,EAAE,IAAI,GAAG,YAAY,GAAG,cAAc,EAC5C,KAAK,SAAiC;IAKxC,+EAA+E;IAC/E,QAAQ,CAAC,aAAa,UAEpB;IAEF,kHAAkH;IAClH,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAIpC,iFAAiF;IACjF,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;CAKzC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Actions = void 0;
|
|
4
|
+
const component_model_1 = require("../component-model");
|
|
5
|
+
/**
|
|
6
|
+
* An model for an Actions component with methods to retrieve individual actions.
|
|
7
|
+
*/
|
|
8
|
+
class Actions extends component_model_1.ComponentModel {
|
|
9
|
+
/**
|
|
10
|
+
* An model for an Actions component with methods to retrieve individual actions.
|
|
11
|
+
* @param parent The parent playwright page, frame or component model.
|
|
12
|
+
* @param xpath A relative xpath selector to this element from the parent.
|
|
13
|
+
*/
|
|
14
|
+
constructor(parent, xpath = '//*[@data-test-id="actions"]') {
|
|
15
|
+
super(parent, xpath);
|
|
16
|
+
/** A locator to the confirm button which may show after clicking an action. */
|
|
17
|
+
this.confirmButton = this.getLocator(`//*[@data-test-id="action"]//*[@data-test-id="confirm"]`);
|
|
18
|
+
}
|
|
19
|
+
/** This method finds an action button by position. Position is 1 indexed. Negative numbers count from the end. */
|
|
20
|
+
getAction(position) {
|
|
21
|
+
return this.getLocator('//*[@data-test-id="action"]', position);
|
|
22
|
+
}
|
|
23
|
+
/** This method finds an action button by label. the label must match exactly. */
|
|
24
|
+
getActionByLabel(label) {
|
|
25
|
+
return this.getLocator(`//*[@data-test-id="action" and .//*[@data-test-id="label" and text()="${label}"]]`);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
exports.Actions = Actions;
|
|
29
|
+
//# sourceMappingURL=actions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actions.js","sourceRoot":"","sources":["../../src/component-models/actions.ts"],"names":[],"mappings":";;;AACA,wDAAoD;AAEpD;;GAEG;AACH,MAAa,OAAQ,SAAQ,gCAAc;IACzC;;;;OAIG;IACH,YACE,MAA4C,EAC5C,KAAK,GAAG,8BAA8B;QAEtC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;QAGvB,+EAA+E;QACtE,kBAAa,GAAG,IAAI,CAAC,UAAU,CACtC,yDAAyD,CAC1D,CAAC;IALF,CAAC;IAOD,kHAAkH;IAClH,SAAS,CAAC,QAAgB;QACxB,OAAO,IAAI,CAAC,UAAU,CAAC,6BAA6B,EAAE,QAAQ,CAAC,CAAC;IAClE,CAAC;IAED,iFAAiF;IACjF,gBAAgB,CAAC,KAAa;QAC5B,OAAO,IAAI,CAAC,UAAU,CACpB,yEAAyE,KAAK,KAAK,CACpF,CAAC;IACJ,CAAC;CACF;AA7BD,0BA6BC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { FrameLocator, Page } from 'playwright-core';
|
|
2
|
+
import { ComponentModel } from '../component-model';
|
|
3
|
+
/**
|
|
4
|
+
* A model for an individual breadcrumb.
|
|
5
|
+
*/
|
|
6
|
+
export declare class Breadcrumb extends ComponentModel {
|
|
7
|
+
/** A locator to the element containing the label text. */
|
|
8
|
+
readonly label: import("playwright-core").Locator;
|
|
9
|
+
/** A locator to the breadcrumb anchor (\<a href=".."\>). */
|
|
10
|
+
readonly anchor: import("playwright-core").Locator;
|
|
11
|
+
/** This method clicks the breadcrumb and waits for navigation to complete. */
|
|
12
|
+
navigate(): Promise<void>;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* A model for a Breadcrumbs bar with methods to retrieve individual breadcrumbs.
|
|
16
|
+
*/
|
|
17
|
+
export declare class Breadcrumbs extends ComponentModel {
|
|
18
|
+
/**
|
|
19
|
+
* A model for a breadcrumbs bar with methods to retrieve individual breadcrumbs.
|
|
20
|
+
* @param parent The playwright page or frame.
|
|
21
|
+
* @param xpath An absolute XPath selector to this element. Default: //*[@data-test-id="breadcrumbs"]
|
|
22
|
+
*/
|
|
23
|
+
constructor(parent: Page | FrameLocator, xpath?: string);
|
|
24
|
+
/** This method expands the drop-down menu if it is visible enabling hidden breadcrumbs to be selected. */
|
|
25
|
+
expand(): Promise<void>;
|
|
26
|
+
/**
|
|
27
|
+
* This method finds a breadcrumb by position. Position is 1 indexed. Negative numbers count from the end.
|
|
28
|
+
*/
|
|
29
|
+
getBreadcrumb(position: number): Breadcrumb;
|
|
30
|
+
/** The method finds a breadcrumb by label. The label must match exactly. */
|
|
31
|
+
getBreadcrumbByLabel(label: string): Breadcrumb;
|
|
32
|
+
/** The method finds a breadcrumb by URL. The URL must match exactly. */
|
|
33
|
+
getBreadcrumbByURL(url: string): Breadcrumb;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=breadcrumbs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"breadcrumbs.d.ts","sourceRoot":"","sources":["../../src/component-models/breadcrumbs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGpD;;GAEG;AACH,qBAAa,UAAW,SAAQ,cAAc;IAC5C,0DAA0D;IAC1D,QAAQ,CAAC,KAAK,oCAA4D;IAE1E,4DAA4D;IAC5D,QAAQ,CAAC,MAAM,oCAAqB;IAEpC,8EAA8E;IACxE,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;CAIhC;AAED;;GAEG;AACH,qBAAa,WAAY,SAAQ,cAAc;IAC7C;;;;OAIG;gBAED,MAAM,EAAE,IAAI,GAAG,YAAY,EAC3B,KAAK,SAAqC;IAK5C,0GAA0G;IACpG,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAS7B;;OAEG;IACH,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,UAAU;IAI3C,4EAA4E;IAC5E,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU;IAO/C,wEAAwE;IACxE,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU;CAG5C"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Breadcrumbs = exports.Breadcrumb = void 0;
|
|
4
|
+
const component_model_1 = require("../component-model");
|
|
5
|
+
const helpers_1 = require("../helpers");
|
|
6
|
+
/**
|
|
7
|
+
* A model for an individual breadcrumb.
|
|
8
|
+
*/
|
|
9
|
+
class Breadcrumb extends component_model_1.ComponentModel {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(...arguments);
|
|
12
|
+
/** A locator to the element containing the label text. */
|
|
13
|
+
this.label = this.getLocator('//*[@data-test-id="breadcrumb-label"]');
|
|
14
|
+
/** A locator to the breadcrumb anchor (\<a href=".."\>). */
|
|
15
|
+
this.anchor = this.getLocator();
|
|
16
|
+
}
|
|
17
|
+
/** This method clicks the breadcrumb and waits for navigation to complete. */
|
|
18
|
+
async navigate() {
|
|
19
|
+
this.getLocator().click();
|
|
20
|
+
await (0, helpers_1.waitForPageTransition)(this.root);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.Breadcrumb = Breadcrumb;
|
|
24
|
+
/**
|
|
25
|
+
* A model for a Breadcrumbs bar with methods to retrieve individual breadcrumbs.
|
|
26
|
+
*/
|
|
27
|
+
class Breadcrumbs extends component_model_1.ComponentModel {
|
|
28
|
+
/**
|
|
29
|
+
* A model for a breadcrumbs bar with methods to retrieve individual breadcrumbs.
|
|
30
|
+
* @param parent The playwright page or frame.
|
|
31
|
+
* @param xpath An absolute XPath selector to this element. Default: //*[@data-test-id="breadcrumbs"]
|
|
32
|
+
*/
|
|
33
|
+
constructor(parent, xpath = '//*[@data-test-id="breadcrumbs"]') {
|
|
34
|
+
super(parent, xpath);
|
|
35
|
+
}
|
|
36
|
+
/** This method expands the drop-down menu if it is visible enabling hidden breadcrumbs to be selected. */
|
|
37
|
+
async expand() {
|
|
38
|
+
const dropdown = this.getLocator('//*[@data-test-id="breadcrumbs-dropdown"]');
|
|
39
|
+
if (await dropdown.isVisible()) {
|
|
40
|
+
await dropdown.hover();
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* This method finds a breadcrumb by position. Position is 1 indexed. Negative numbers count from the end.
|
|
45
|
+
*/
|
|
46
|
+
getBreadcrumb(position) {
|
|
47
|
+
return new Breadcrumb(this, '//a', position);
|
|
48
|
+
}
|
|
49
|
+
/** The method finds a breadcrumb by label. The label must match exactly. */
|
|
50
|
+
getBreadcrumbByLabel(label) {
|
|
51
|
+
return new Breadcrumb(this, `//a[.//*[@data-test-id="breadcrumb-label" and text()="${label}"]]`);
|
|
52
|
+
}
|
|
53
|
+
/** The method finds a breadcrumb by URL. The URL must match exactly. */
|
|
54
|
+
getBreadcrumbByURL(url) {
|
|
55
|
+
return new Breadcrumb(this, `//a[@href="${url}"]`);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
exports.Breadcrumbs = Breadcrumbs;
|
|
59
|
+
//# sourceMappingURL=breadcrumbs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"breadcrumbs.js","sourceRoot":"","sources":["../../src/component-models/breadcrumbs.ts"],"names":[],"mappings":";;;AACA,wDAAoD;AACpD,wCAAmD;AAEnD;;GAEG;AACH,MAAa,UAAW,SAAQ,gCAAc;IAA9C;;QACE,0DAA0D;QACjD,UAAK,GAAG,IAAI,CAAC,UAAU,CAAC,uCAAuC,CAAC,CAAC;QAE1E,4DAA4D;QACnD,WAAM,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;IAOtC,CAAC;IALC,8EAA8E;IAC9E,KAAK,CAAC,QAAQ;QACZ,IAAI,CAAC,UAAU,EAAE,CAAC,KAAK,EAAE,CAAC;QAC1B,MAAM,IAAA,+BAAqB,EAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACzC,CAAC;CACF;AAZD,gCAYC;AAED;;GAEG;AACH,MAAa,WAAY,SAAQ,gCAAc;IAC7C;;;;OAIG;IACH,YACE,MAA2B,EAC3B,KAAK,GAAG,kCAAkC;QAE1C,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IACvB,CAAC;IAED,0GAA0G;IAC1G,KAAK,CAAC,MAAM;QACV,MAAM,QAAQ,GAAG,IAAI,CAAC,UAAU,CAC9B,2CAA2C,CAC5C,CAAC;QACF,IAAI,MAAM,QAAQ,CAAC,SAAS,EAAE,EAAE;YAC9B,MAAM,QAAQ,CAAC,KAAK,EAAE,CAAC;SACxB;IACH,CAAC;IAED;;OAEG;IACH,aAAa,CAAC,QAAgB;QAC5B,OAAO,IAAI,UAAU,CAAC,IAAI,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;IAC/C,CAAC;IAED,4EAA4E;IAC5E,oBAAoB,CAAC,KAAa;QAChC,OAAO,IAAI,UAAU,CACnB,IAAI,EACJ,yDAAyD,KAAK,KAAK,CACpE,CAAC;IACJ,CAAC;IAED,wEAAwE;IACxE,kBAAkB,CAAC,GAAW;QAC5B,OAAO,IAAI,UAAU,CAAC,IAAI,EAAE,cAAc,GAAG,IAAI,CAAC,CAAC;IACrD,CAAC;CACF;AA1CD,kCA0CC"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { FrameLocator, Locator, Page } from 'playwright-core';
|
|
2
|
+
import { ComponentModel } from '../component-model';
|
|
3
|
+
import { InlineMenu } from './inline-menu';
|
|
4
|
+
/**
|
|
5
|
+
* A model for a data entry cell.
|
|
6
|
+
*/
|
|
7
|
+
export declare class DynamicDataEntryCell extends ComponentModel {
|
|
8
|
+
/** A locator to an input element (text entry). */
|
|
9
|
+
readonly input: Locator;
|
|
10
|
+
/** A locator to a select element (dropdown). */
|
|
11
|
+
readonly select: Locator;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* A model for a list row cell.
|
|
15
|
+
*/
|
|
16
|
+
export declare class DynamicListCell extends ComponentModel {
|
|
17
|
+
/** A locator to the element containing the value. */
|
|
18
|
+
readonly content: Locator;
|
|
19
|
+
/** This method verifies that the cell is visible and gets the cell value. */
|
|
20
|
+
getValue(): Promise<string>;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* A model for a dynamic data list header.
|
|
24
|
+
*/
|
|
25
|
+
export declare class DynamicListHeader extends ComponentModel {
|
|
26
|
+
getLabel(position: number): Locator;
|
|
27
|
+
getLabelByPropertyName(name: string): Locator;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* A model for a data entry row which is used to enter new data.
|
|
31
|
+
*/
|
|
32
|
+
export declare class DynamicListDataEntry extends ComponentModel {
|
|
33
|
+
/**
|
|
34
|
+
* A locator to the add button ('+'). Depending on the configuration of the
|
|
35
|
+
* data list this may add a row directly or open a mod*a*l. Use the mod*a*l
|
|
36
|
+
* property on the form component mod*e*l for a mod*a*l opened in this way.
|
|
37
|
+
*/
|
|
38
|
+
readonly addButton: Locator;
|
|
39
|
+
getCell(position: number): DynamicDataEntryCell;
|
|
40
|
+
getCellByPropertyName(name: string): DynamicDataEntryCell;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* A model for a dynamic data list row.
|
|
44
|
+
*/
|
|
45
|
+
export declare class DynamicListRow extends ComponentModel {
|
|
46
|
+
/** A locator to the remove button for this row ('X'). */
|
|
47
|
+
readonly removeButton: Locator;
|
|
48
|
+
/** A model for the the inline menu for this row (e.g. '...'). */
|
|
49
|
+
readonly inlineMenu: InlineMenu;
|
|
50
|
+
getCell(position: number): DynamicListCell;
|
|
51
|
+
getCellByPropertyName(name: string): DynamicListCell;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* A model for a DynamicDataList component.
|
|
55
|
+
*/
|
|
56
|
+
export declare class DynamicDataList extends ComponentModel {
|
|
57
|
+
/**
|
|
58
|
+
* A model representing a dynamic data list component.
|
|
59
|
+
* @param parent The parent playwright page, frame or component model.
|
|
60
|
+
* @param xpath A relative xpath selector to this element from the parent.
|
|
61
|
+
*/
|
|
62
|
+
constructor(parent: Page | FrameLocator | ComponentModel, xpath?: string);
|
|
63
|
+
/** A model representing the dynamic data list header row. */
|
|
64
|
+
readonly header: DynamicListHeader;
|
|
65
|
+
/** A model representing the data entry row. */
|
|
66
|
+
readonly dataEntryRow: DynamicListDataEntry;
|
|
67
|
+
/** A locator to all visible rows. Useful for getting a count. */
|
|
68
|
+
readonly allVisibleRows: Locator;
|
|
69
|
+
/** This method gets a visible row by position. Position is 1 indexed. Negative numbers count from the end. */
|
|
70
|
+
getRow(position: number): DynamicListRow;
|
|
71
|
+
/**
|
|
72
|
+
* This method gets a row by matching the value of a property. If multiple
|
|
73
|
+
* rows share the same property value, the 'nth' parameter can be used to
|
|
74
|
+
* select which is returned (the first by default).
|
|
75
|
+
*/
|
|
76
|
+
getRowByPropertyValue(propertyName: string, propertyValue: string, nth?: number): DynamicListRow;
|
|
77
|
+
/** This method waits for transitions of new or removed rows of data to be completed. */
|
|
78
|
+
waitForData(): Promise<void>;
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=dynamic-data-list.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dynamic-data-list.d.ts","sourceRoot":"","sources":["../../src/component-models/dynamic-data-list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C;;GAEG;AACH,qBAAa,oBAAqB,SAAQ,cAAc;IACtD,kDAAkD;IAClD,QAAQ,CAAC,KAAK,UAA8B;IAE5C,gDAAgD;IAChD,QAAQ,CAAC,MAAM,UAA+B;CAC/C;AAED;;GAEG;AACH,qBAAa,eAAgB,SAAQ,cAAc;IACjD,qDAAqD;IACrD,QAAQ,CAAC,OAAO,UAAqB;IAErC,6EAA6E;IACvE,QAAQ,IAAI,OAAO,CAAC,MAAM,CAAC;CAIlC;AAED;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,cAAc;IAEnD,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAQnC,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;CAK9C;AAED;;GAEG;AACH,qBAAa,oBAAqB,SAAQ,cAAc;IACtD;;;;OAIG;IACH,QAAQ,CAAC,SAAS,UAEhB;IAGF,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,oBAAoB;IAS/C,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,oBAAoB;CAM1D;AAED;;GAEG;AACH,qBAAa,cAAe,SAAQ,cAAc;IAChD,yDAAyD;IACzD,QAAQ,CAAC,YAAY,UAEnB;IAEF,iEAAiE;IACjE,QAAQ,CAAC,UAAU,aAAwB;IAG3C,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,eAAe;IAS1C,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe;CAMrD;AAED;;GAEG;AACH,qBAAa,eAAgB,SAAQ,cAAc;IACjD;;;;OAIG;gBAED,MAAM,EAAE,IAAI,GAAG,YAAY,GAAG,cAAc,EAC5C,KAAK,SAA2C;IAKlD,6DAA6D;IAC7D,QAAQ,CAAC,MAAM,oBAGb;IAEF,+CAA+C;IAC/C,QAAQ,CAAC,YAAY,uBAGnB;IAEF,iEAAiE;IACjE,QAAQ,CAAC,cAAc,UAErB;IAEF,8GAA8G;IAC9G,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,cAAc;IAQxC;;;;OAIG;IACH,qBAAqB,CACnB,YAAY,EAAE,MAAM,EACpB,aAAa,EAAE,MAAM,EACrB,GAAG,CAAC,EAAE,MAAM,GACX,cAAc;IASjB,wFAAwF;IAClF,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;CAKnC"}
|