@axinom/mosaic-e2e-ui-selectors 0.14.0-rc.11 → 0.14.0-rc.13
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/dist/component-models/form/form-field.d.ts +5 -3
- package/dist/component-models/form/form-field.d.ts.map +1 -1
- package/dist/component-models/form/form-field.js +4 -0
- package/dist/component-models/form/form-field.js.map +1 -1
- package/dist/component-models/form/select-field.d.ts +6 -1
- package/dist/component-models/form/select-field.d.ts.map +1 -1
- package/dist/component-models/form/select-field.js +17 -4
- package/dist/component-models/form/select-field.js.map +1 -1
- package/package.json +2 -2
- package/src/component-models/form/form-field.ts +6 -1
- package/src/component-models/form/select-field.ts +23 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FrameLocator, Page } from 'playwright-core';
|
|
1
|
+
import { FrameLocator, Locator, Page } from 'playwright-core';
|
|
2
2
|
import { ComponentModel } from '../../component-model';
|
|
3
3
|
/**
|
|
4
4
|
* Abstract base class for all FormField component models.
|
|
@@ -12,9 +12,9 @@ export declare abstract class FormField extends ComponentModel {
|
|
|
12
12
|
*/
|
|
13
13
|
constructor(parent: Page | FrameLocator | ComponentModel, xpath?: string, nth?: number);
|
|
14
14
|
/** A locator to the field label. */
|
|
15
|
-
readonly label:
|
|
15
|
+
readonly label: Locator;
|
|
16
16
|
/** A locator to the field error message. */
|
|
17
|
-
readonly error:
|
|
17
|
+
readonly error: Locator;
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
20
20
|
* Abstract base class for FormField component models of a specific type.
|
|
@@ -22,6 +22,8 @@ export declare abstract class FormField extends ComponentModel {
|
|
|
22
22
|
export declare abstract class TypedFormField extends FormField {
|
|
23
23
|
/** A selector which will match the field if the element type is correct. */
|
|
24
24
|
protected abstract get fieldTypeValidator(): string;
|
|
25
|
+
/** A helper method to create global locators - This helps with locating globally across the entire DOM, rather than being scoped to the form */
|
|
26
|
+
protected getGlobalLocator(selector: string): Locator;
|
|
25
27
|
/**
|
|
26
28
|
* This method verifies that the field is visible, and that the actual
|
|
27
29
|
* element matches the model being used.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-field.d.ts","sourceRoot":"","sources":["../../../src/component-models/form/form-field.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"form-field.d.ts","sourceRoot":"","sources":["../../../src/component-models/form/form-field.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD;;GAEG;AACH,8BAAsB,SAAU,SAAQ,cAAc;IACpD;;;;;OAKG;gBAED,MAAM,EAAE,IAAI,GAAG,YAAY,GAAG,cAAc,EAC5C,KAAK,SAAoC,EACzC,GAAG,SAAI;IAKT,oCAAoC;IACpC,QAAQ,CAAC,KAAK,UAA4D;IAE1E,4CAA4C;IAC5C,QAAQ,CAAC,KAAK,UAA4D;CAC3E;AAED;;GAEG;AACH,8BAAsB,cAAe,SAAQ,SAAS;IACpD,4EAA4E;IAC5E,SAAS,CAAC,QAAQ,KAAK,kBAAkB,IAAI,MAAM,CAAC;IAEpD,gJAAgJ;IAChJ,SAAS,CAAC,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAIrD;;;OAGG;IACG,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC;CAWvC"}
|
|
@@ -25,6 +25,10 @@ exports.FormField = FormField;
|
|
|
25
25
|
* Abstract base class for FormField component models of a specific type.
|
|
26
26
|
*/
|
|
27
27
|
class TypedFormField extends FormField {
|
|
28
|
+
/** A helper method to create global locators - This helps with locating globally across the entire DOM, rather than being scoped to the form */
|
|
29
|
+
getGlobalLocator(selector) {
|
|
30
|
+
return this.root.locator(selector);
|
|
31
|
+
}
|
|
28
32
|
/**
|
|
29
33
|
* This method verifies that the field is visible, and that the actual
|
|
30
34
|
* element matches the model being used.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-field.js","sourceRoot":"","sources":["../../../src/component-models/form/form-field.ts"],"names":[],"mappings":";;;AACA,2DAAuD;AAEvD;;GAEG;AACH,MAAsB,SAAU,SAAQ,gCAAc;IACpD;;;;;OAKG;IACH,YACE,MAA4C,EAC5C,KAAK,GAAG,iCAAiC,EACzC,GAAG,GAAG,CAAC;QAEP,KAAK,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;QAG5B,oCAAoC;QAC3B,UAAK,GAAG,IAAI,CAAC,UAAU,CAAC,uCAAuC,CAAC,CAAC;QAE1E,4CAA4C;QACnC,UAAK,GAAG,IAAI,CAAC,UAAU,CAAC,uCAAuC,CAAC,CAAC;IAN1E,CAAC;CAOF;AApBD,8BAoBC;AAED;;GAEG;AACH,MAAsB,cAAe,SAAQ,SAAS;IAIpD;;;OAGG;IACH,KAAK,CAAC,eAAe;QACnB,IAAI;YACF,MAAM,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC,OAAO,CAAC;gBACrD,KAAK,EAAE,SAAS;aACjB,CAAC,CAAC;SACJ;QAAC,WAAM;YACN,MAAM,IAAI,KAAK,CACb,2DAA2D,CAC5D,CAAC;SACH;IACH,CAAC;CACF;
|
|
1
|
+
{"version":3,"file":"form-field.js","sourceRoot":"","sources":["../../../src/component-models/form/form-field.ts"],"names":[],"mappings":";;;AACA,2DAAuD;AAEvD;;GAEG;AACH,MAAsB,SAAU,SAAQ,gCAAc;IACpD;;;;;OAKG;IACH,YACE,MAA4C,EAC5C,KAAK,GAAG,iCAAiC,EACzC,GAAG,GAAG,CAAC;QAEP,KAAK,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;QAG5B,oCAAoC;QAC3B,UAAK,GAAG,IAAI,CAAC,UAAU,CAAC,uCAAuC,CAAC,CAAC;QAE1E,4CAA4C;QACnC,UAAK,GAAG,IAAI,CAAC,UAAU,CAAC,uCAAuC,CAAC,CAAC;IAN1E,CAAC;CAOF;AApBD,8BAoBC;AAED;;GAEG;AACH,MAAsB,cAAe,SAAQ,SAAS;IAIpD,gJAAgJ;IACtI,gBAAgB,CAAC,QAAgB;QACzC,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACrC,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,eAAe;QACnB,IAAI;YACF,MAAM,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC,OAAO,CAAC;gBACrD,KAAK,EAAE,SAAS;aACjB,CAAC,CAAC;SACJ;QAAC,WAAM;YACN,MAAM,IAAI,KAAK,CACb,2DAA2D,CAC5D,CAAC;SACH;IACH,CAAC;CACF;AAxBD,wCAwBC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Locator } from 'playwright-core';
|
|
1
2
|
import { TypedFormField } from './form-field';
|
|
2
3
|
/**
|
|
3
4
|
* A model for a SelectField (dropdown) component.
|
|
@@ -5,8 +6,12 @@ import { TypedFormField } from './form-field';
|
|
|
5
6
|
export declare class SelectField extends TypedFormField {
|
|
6
7
|
/** @inheritdoc */
|
|
7
8
|
protected get fieldTypeValidator(): string;
|
|
9
|
+
protected readonly input: Locator;
|
|
10
|
+
protected readonly listbox: Locator;
|
|
8
11
|
/** A locator to the select element (<select>..). */
|
|
9
|
-
protected readonly select:
|
|
12
|
+
protected readonly select: Locator;
|
|
13
|
+
/** A locator to the select an option from the combobox. */
|
|
14
|
+
protected readonly option: (value: string) => Locator;
|
|
10
15
|
/** This method verifies the field type and sets the selected value. */
|
|
11
16
|
setValue(value: string): Promise<void>;
|
|
12
17
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select-field.d.ts","sourceRoot":"","sources":["../../../src/component-models/form/select-field.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C;;GAEG;AACH,qBAAa,WAAY,SAAQ,cAAc;IAC7C,kBAAkB;IAClB,cAAuB,kBAAkB,IAAI,MAAM,CAElD;IAED,oDAAoD;IACpD,SAAS,CAAC,QAAQ,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"select-field.d.ts","sourceRoot":"","sources":["../../../src/component-models/form/select-field.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C;;GAEG;AACH,qBAAa,WAAY,SAAQ,cAAc;IAC7C,kBAAkB;IAClB,cAAuB,kBAAkB,IAAI,MAAM,CAElD;IAED,SAAS,CAAC,QAAQ,CAAC,KAAK,UAAgD;IACxE,SAAS,CAAC,QAAQ,CAAC,OAAO,UAAkD;IAE5E,oDAAoD;IACpD,SAAS,CAAC,QAAQ,CAAC,MAAM,UAA+B;IAExD,2DAA2D;IAC3D,SAAS,CAAC,QAAQ,CAAC,MAAM,UAAW,MAAM,KAAG,OAAO,CAGhD;IAEJ,uEAAuE;IACjE,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAW5C;;;OAGG;IACG,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAWnD,0EAA0E;IACpE,QAAQ,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;CAKzC"}
|
|
@@ -8,8 +8,12 @@ const form_field_1 = require("./form-field");
|
|
|
8
8
|
class SelectField extends form_field_1.TypedFormField {
|
|
9
9
|
constructor() {
|
|
10
10
|
super(...arguments);
|
|
11
|
+
this.input = this.getLocator('//input[@role="combobox"]');
|
|
12
|
+
this.listbox = this.getGlobalLocator('//ul[@role="listbox"]');
|
|
11
13
|
/** A locator to the select element (<select>..). */
|
|
12
14
|
this.select = this.getLocator('//select');
|
|
15
|
+
/** A locator to the select an option from the combobox. */
|
|
16
|
+
this.option = (value) => this.getGlobalLocator(`//li[@role="option" and normalize-space(text())="${value}"]`);
|
|
13
17
|
}
|
|
14
18
|
/** @inheritdoc */
|
|
15
19
|
get fieldTypeValidator() {
|
|
@@ -19,7 +23,12 @@ class SelectField extends form_field_1.TypedFormField {
|
|
|
19
23
|
async setValue(value) {
|
|
20
24
|
// sanity check
|
|
21
25
|
await this.verifyFieldType();
|
|
22
|
-
await this.
|
|
26
|
+
await this.input.click();
|
|
27
|
+
await this.input.type(value);
|
|
28
|
+
await this.listbox.waitFor({ state: 'visible' });
|
|
29
|
+
const optionElement = this.option(value);
|
|
30
|
+
await optionElement.waitFor({ state: 'visible' });
|
|
31
|
+
await optionElement.click();
|
|
23
32
|
}
|
|
24
33
|
/**
|
|
25
34
|
* This method verifies the field type and sets the selected value by label.
|
|
@@ -28,14 +37,18 @@ class SelectField extends form_field_1.TypedFormField {
|
|
|
28
37
|
async setValueByLabel(label) {
|
|
29
38
|
// sanity check
|
|
30
39
|
await this.verifyFieldType();
|
|
31
|
-
await this.
|
|
40
|
+
await this.input.click();
|
|
41
|
+
await this.input.type(label);
|
|
42
|
+
await this.listbox.waitFor({ state: 'visible' });
|
|
43
|
+
const optionElement = this.option(label);
|
|
44
|
+
await optionElement.waitFor({ state: 'visible' });
|
|
45
|
+
await optionElement.click();
|
|
32
46
|
}
|
|
33
47
|
/** This method verifies the field type and returns the selected value. */
|
|
34
48
|
async getValue() {
|
|
35
|
-
var _a;
|
|
36
49
|
// sanity check
|
|
37
50
|
await this.verifyFieldType();
|
|
38
|
-
return
|
|
51
|
+
return await this.input.inputValue();
|
|
39
52
|
}
|
|
40
53
|
}
|
|
41
54
|
exports.SelectField = SelectField;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select-field.js","sourceRoot":"","sources":["../../../src/component-models/form/select-field.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"select-field.js","sourceRoot":"","sources":["../../../src/component-models/form/select-field.ts"],"names":[],"mappings":";;;AACA,6CAA8C;AAE9C;;GAEG;AACH,MAAa,WAAY,SAAQ,2BAAc;IAA/C;;QAMqB,UAAK,GAAG,IAAI,CAAC,UAAU,CAAC,2BAA2B,CAAC,CAAC;QACrD,YAAO,GAAG,IAAI,CAAC,gBAAgB,CAAC,uBAAuB,CAAC,CAAC;QAE5E,oDAAoD;QACjC,WAAM,GAAG,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;QAExD,2DAA2D;QACxC,WAAM,GAAG,CAAC,KAAa,EAAW,EAAE,CACrD,IAAI,CAAC,gBAAgB,CACnB,oDAAoD,KAAK,IAAI,CAC9D,CAAC;IAmCN,CAAC;IAlDC,kBAAkB;IAClB,IAAuB,kBAAkB;QACvC,OAAO,4BAA4B,CAAC;IACtC,CAAC;IAcD,uEAAuE;IACvE,KAAK,CAAC,QAAQ,CAAC,KAAa;QAC1B,eAAe;QACf,MAAM,IAAI,CAAC,eAAe,EAAE,CAAC;QAC7B,MAAM,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;QACzB,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC7B,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;QACjD,MAAM,aAAa,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACzC,MAAM,aAAa,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;QAClD,MAAM,aAAa,CAAC,KAAK,EAAE,CAAC;IAC9B,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,eAAe,CAAC,KAAa;QACjC,eAAe;QACf,MAAM,IAAI,CAAC,eAAe,EAAE,CAAC;QAC7B,MAAM,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;QACzB,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC7B,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;QACjD,MAAM,aAAa,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACzC,MAAM,aAAa,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;QAClD,MAAM,aAAa,CAAC,KAAK,EAAE,CAAC;IAC9B,CAAC;IAED,0EAA0E;IAC1E,KAAK,CAAC,QAAQ;QACZ,eAAe;QACf,MAAM,IAAI,CAAC,eAAe,EAAE,CAAC;QAC7B,OAAO,MAAM,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,CAAC;IACvC,CAAC;CACF;AAnDD,kCAmDC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@axinom/mosaic-e2e-ui-selectors",
|
|
3
|
-
"version": "0.14.0-rc.
|
|
3
|
+
"version": "0.14.0-rc.13",
|
|
4
4
|
"description": "Component models for testing Axinom Mosaic applications with Playwright.",
|
|
5
5
|
"author": "Axinom",
|
|
6
6
|
"license": "PROPRIETARY",
|
|
@@ -32,5 +32,5 @@
|
|
|
32
32
|
"publishConfig": {
|
|
33
33
|
"access": "public"
|
|
34
34
|
},
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "f53dafedbd92684becb0b4aba9b2aea25da2f6c4"
|
|
36
36
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FrameLocator, Page } from 'playwright-core';
|
|
1
|
+
import { FrameLocator, Locator, Page } from 'playwright-core';
|
|
2
2
|
import { ComponentModel } from '../../component-model';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -33,6 +33,11 @@ export abstract class TypedFormField extends FormField {
|
|
|
33
33
|
/** A selector which will match the field if the element type is correct. */
|
|
34
34
|
protected abstract get fieldTypeValidator(): string;
|
|
35
35
|
|
|
36
|
+
/** A helper method to create global locators - This helps with locating globally across the entire DOM, rather than being scoped to the form */
|
|
37
|
+
protected getGlobalLocator(selector: string): Locator {
|
|
38
|
+
return this.root.locator(selector);
|
|
39
|
+
}
|
|
40
|
+
|
|
36
41
|
/**
|
|
37
42
|
* This method verifies that the field is visible, and that the actual
|
|
38
43
|
* element matches the model being used.
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Locator } from 'playwright-core';
|
|
1
2
|
import { TypedFormField } from './form-field';
|
|
2
3
|
|
|
3
4
|
/**
|
|
@@ -9,14 +10,28 @@ export class SelectField extends TypedFormField {
|
|
|
9
10
|
return '[@data-test-type="Select"]';
|
|
10
11
|
}
|
|
11
12
|
|
|
13
|
+
protected readonly input = this.getLocator('//input[@role="combobox"]');
|
|
14
|
+
protected readonly listbox = this.getGlobalLocator('//ul[@role="listbox"]');
|
|
15
|
+
|
|
12
16
|
/** A locator to the select element (<select>..). */
|
|
13
17
|
protected readonly select = this.getLocator('//select');
|
|
14
18
|
|
|
19
|
+
/** A locator to the select an option from the combobox. */
|
|
20
|
+
protected readonly option = (value: string): Locator =>
|
|
21
|
+
this.getGlobalLocator(
|
|
22
|
+
`//li[@role="option" and normalize-space(text())="${value}"]`,
|
|
23
|
+
);
|
|
24
|
+
|
|
15
25
|
/** This method verifies the field type and sets the selected value. */
|
|
16
26
|
async setValue(value: string): Promise<void> {
|
|
17
27
|
// sanity check
|
|
18
28
|
await this.verifyFieldType();
|
|
19
|
-
await this.
|
|
29
|
+
await this.input.click();
|
|
30
|
+
await this.input.type(value);
|
|
31
|
+
await this.listbox.waitFor({ state: 'visible' });
|
|
32
|
+
const optionElement = this.option(value);
|
|
33
|
+
await optionElement.waitFor({ state: 'visible' });
|
|
34
|
+
await optionElement.click();
|
|
20
35
|
}
|
|
21
36
|
|
|
22
37
|
/**
|
|
@@ -26,13 +41,18 @@ export class SelectField extends TypedFormField {
|
|
|
26
41
|
async setValueByLabel(label: string): Promise<void> {
|
|
27
42
|
// sanity check
|
|
28
43
|
await this.verifyFieldType();
|
|
29
|
-
await this.
|
|
44
|
+
await this.input.click();
|
|
45
|
+
await this.input.type(label);
|
|
46
|
+
await this.listbox.waitFor({ state: 'visible' });
|
|
47
|
+
const optionElement = this.option(label);
|
|
48
|
+
await optionElement.waitFor({ state: 'visible' });
|
|
49
|
+
await optionElement.click();
|
|
30
50
|
}
|
|
31
51
|
|
|
32
52
|
/** This method verifies the field type and returns the selected value. */
|
|
33
53
|
async getValue(): Promise<string | null> {
|
|
34
54
|
// sanity check
|
|
35
55
|
await this.verifyFieldType();
|
|
36
|
-
return
|
|
56
|
+
return await this.input.inputValue();
|
|
37
57
|
}
|
|
38
58
|
}
|