@o3r/testing 13.0.0-next.6 → 13.0.0-prerelease.2
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/core/angular/angular-materials/autocomplete-material.js +9 -20
- package/core/angular/angular-materials/autocomplete-material.js.map +1 -1
- package/core/angular/angular-materials/index.js +1 -1
- package/core/angular/angular-materials/select-material.js +42 -91
- package/core/angular/angular-materials/select-material.js.map +1 -1
- package/core/angular/angular-materials/slider-material.js +8 -11
- package/core/angular/angular-materials/slider-material.js.map +1 -1
- package/core/angular/component-fixture.js +68 -148
- package/core/angular/component-fixture.js.map +1 -1
- package/core/angular/element.js +44 -50
- package/core/angular/element.js.map +1 -1
- package/core/angular/elements/checkbox-element.js +12 -16
- package/core/angular/elements/checkbox-element.js.map +1 -1
- package/core/angular/elements/index.js +1 -1
- package/core/angular/elements/radio-element.js +12 -16
- package/core/angular/elements/radio-element.js.map +1 -1
- package/core/angular/elements/select-element.js +28 -49
- package/core/angular/elements/select-element.js.map +1 -1
- package/core/angular/elements/slider-element.js +38 -42
- package/core/angular/elements/slider-element.js.map +1 -1
- package/core/angular/group.js +9 -14
- package/core/angular/group.js.map +1 -1
- package/core/angular/groups/index.js +1 -1
- package/core/angular/groups/radio-group.js +25 -62
- package/core/angular/groups/radio-group.js.map +1 -1
- package/core/angular/index.js +1 -1
- package/core/angular/page-fixture.js +8 -11
- package/core/angular/page-fixture.js.map +1 -1
- package/core/angular-materials/autocomplete-material.js +8 -11
- package/core/angular-materials/autocomplete-material.js.map +1 -1
- package/core/angular-materials/index.js +1 -1
- package/core/angular-materials/select-material.js +12 -15
- package/core/angular-materials/select-material.js.map +1 -1
- package/core/angular-materials/slider-material.js +5 -8
- package/core/angular-materials/slider-material.js.map +1 -1
- package/core/component-fixture.js +28 -33
- package/core/component-fixture.js.map +1 -1
- package/core/element.js +24 -26
- package/core/element.js.map +1 -1
- package/core/elements/checkbox-element.js +12 -16
- package/core/elements/checkbox-element.js.map +1 -1
- package/core/elements/index.js +1 -1
- package/core/elements/radio-element.js +12 -16
- package/core/elements/radio-element.js.map +1 -1
- package/core/elements/select-element.js +10 -13
- package/core/elements/select-element.js.map +1 -1
- package/core/elements/slider-element.js +5 -8
- package/core/elements/slider-element.js.map +1 -1
- package/core/group.js +9 -15
- package/core/group.js.map +1 -1
- package/core/groups/index.js +1 -1
- package/core/groups/radio-group.js +8 -11
- package/core/groups/radio-group.js.map +1 -1
- package/core/helpers.js +11 -16
- package/core/helpers.js.map +1 -1
- package/core/index.js +1 -1
- package/core/page-fixture.js +8 -11
- package/core/page-fixture.js.map +1 -1
- package/core/playwright/angular-materials/autocomplete-material.js +26 -56
- package/core/playwright/angular-materials/autocomplete-material.js.map +1 -1
- package/core/playwright/angular-materials/index.js +1 -1
- package/core/playwright/angular-materials/select-material.js +48 -110
- package/core/playwright/angular-materials/select-material.js.map +1 -1
- package/core/playwright/angular-materials/slider-material.js +7 -10
- package/core/playwright/angular-materials/slider-material.js.map +1 -1
- package/core/playwright/component-fixture.js +88 -173
- package/core/playwright/component-fixture.js.map +1 -1
- package/core/playwright/element.js +38 -90
- package/core/playwright/element.js.map +1 -1
- package/core/playwright/elements/checkbox-element.js +49 -94
- package/core/playwright/elements/checkbox-element.js.map +1 -1
- package/core/playwright/elements/index.js +1 -1
- package/core/playwright/elements/radio-element.js +18 -34
- package/core/playwright/elements/radio-element.js.map +1 -1
- package/core/playwright/elements/select-element.js +14 -21
- package/core/playwright/elements/select-element.js.map +1 -1
- package/core/playwright/elements/slider-element.js +78 -157
- package/core/playwright/elements/slider-element.js.map +1 -1
- package/core/playwright/group.js +9 -14
- package/core/playwright/group.js.map +1 -1
- package/core/playwright/groups/index.js +1 -1
- package/core/playwright/groups/radio-group.js +27 -64
- package/core/playwright/groups/radio-group.js.map +1 -1
- package/core/playwright/index.js +1 -1
- package/core/playwright/page-fixture.js +8 -18
- package/core/playwright/page-fixture.js.map +1 -1
- package/errors/fixture-usage-error.js +5 -10
- package/errors/fixture-usage-error.js.map +1 -1
- package/errors/index.js +1 -1
- package/errors/transpilation-purpose-only.js +5 -10
- package/errors/transpilation-purpose-only.js.map +1 -1
- package/kassette/index.js +1 -1
- package/kassette/update-dates-in-mocks.js +66 -85
- package/kassette/update-dates-in-mocks.js.map +1 -1
- package/localization/index.js +1 -1
- package/localization/localization-mock.js +38 -60
- package/localization/localization-mock.js.map +1 -1
- package/mocks/index.js +1 -1
- package/mocks/mock-component-generator.js +54 -53
- package/mocks/mock-component-generator.js.map +1 -1
- package/package.json +60 -59
- package/public_api.js +1 -1
- package/schematics/add-functions-to-fixture/models.d.ts.map +1 -1
- package/schematics/add-functions-to-fixture/models.js.map +1 -1
- package/schematics/ng-add/index.d.ts.map +1 -1
- package/schematics/ng-add/index.js +4 -6
- package/schematics/ng-add/index.js.map +1 -1
- package/schematics/ng-add/playwright/index.d.ts.map +1 -1
- package/schematics/ng-add/playwright/index.js +3 -4
- package/schematics/ng-add/playwright/index.js.map +1 -1
- package/schematics/ng-add/schema.json +2 -1
- package/schematics/playwright/sanity/schema.json +2 -1
- package/schematics/playwright/scenario/schema.json +2 -1
- package/store/index.js +1 -1
- package/store/testable-select.js +13 -13
- package/store/testable-select.js.map +1 -1
- package/tools/index.js +1 -1
- package/tools/path-replacement/index.js +1 -1
- package/tools/path-replacement/path-replacement.js +24 -20
- package/tools/path-replacement/path-replacement.js.map +1 -1
- package/visual-test/index.js +1 -1
- package/visual-test/utils.js +18 -7
- package/visual-test/utils.js.map +1 -1
- package/visual-test/visual-test.d.ts.map +1 -1
- package/visual-test/visual-test.js +30 -35
- package/visual-test/visual-test.js.map +1 -1
- package/visual-testing-reporter/index.d.ts.map +1 -1
- package/visual-testing-reporter/index.js +37 -40
- package/visual-testing-reporter/index.js.map +1 -1
package/core/element.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"element.js","sourceRoot":"","sources":["../../src/core/element.ts"],"names":[],"mappings":";;;AAAA,
|
1
|
+
{"version":3,"file":"element.js","sourceRoot":"","sources":["../../src/core/element.ts"],"names":[],"mappings":";;;AAAA,2CAEyB;AAiEzB;;;GAGG;AACH,MAAa,UAAU;IACrB,YAAY,cAAmB,IAAG,CAAC;IAE5B,YAAY;QACjB,MAAM,IAAI,qCAA6B,CAAC,uCAAuC,CAAC,CAAC;IACnF,CAAC;IAED,kBAAkB;IACX,OAAO;QACZ,MAAM,IAAI,qCAA6B,CAAC,uCAAuC,CAAC,CAAC;IACnF,CAAC;IAED,kBAAkB;IACX,YAAY;QACjB,MAAM,IAAI,qCAA6B,CAAC,uCAAuC,CAAC,CAAC;IACnF,CAAC;IAED,kBAAkB;IACX,KAAK;QACV,MAAM,IAAI,qCAA6B,CAAC,uCAAuC,CAAC,CAAC;IACnF,CAAC;IAED,kBAAkB;IACX,YAAY,CAAC,cAAsB;QACxC,MAAM,IAAI,qCAA6B,CAAC,uCAAuC,CAAC,CAAC;IACnF,CAAC;IAED,kBAAkB;IACX,SAAS;QACd,MAAM,IAAI,qCAA6B,CAAC,uCAAuC,CAAC,CAAC;IACnF,CAAC;IAED,kBAAkB;IACX,QAAQ;QACb,MAAM,IAAI,qCAA6B,CAAC,uCAAuC,CAAC,CAAC;IACnF,CAAC;IAED,kBAAkB;IACX,QAAQ,CAAC,MAAc;QAC5B,MAAM,IAAI,qCAA6B,CAAC,uCAAuC,CAAC,CAAC;IACnF,CAAC;IAED,kBAAkB;IACX,UAAU;QACf,MAAM,IAAI,qCAA6B,CAAC,uCAAuC,CAAC,CAAC;IACnF,CAAC;IAED,kBAAkB;IACX,SAAS;QACd,MAAM,IAAI,qCAA6B,CAAC,uCAAuC,CAAC,CAAC;IACnF,CAAC;CACF;AAnDD,gCAmDC","sourcesContent":["import {\n TranspilationPurposeOnlyError,\n} from '../errors/index';\n\n/**\n * Interface to describe the ElementProfile that are queried inside a fixture.\n * As for ComponentFixture, this abstracts the testing framework that is used by choosing the right\n * implementation at runtime.\n */\nexport interface ElementProfile {\n /**\n * Click on the element. Simple click with left button.\n */\n click(): Promise<void>;\n\n /**\n * Returns a promise that resolves with the value of the attribute given in parameter.\n */\n getAttribute(attributeName: string): Promise<string | undefined>;\n\n /**\n * Returns a promise that resolves with the text of the element or undefined.\n */\n getText(): Promise<string | undefined>;\n\n /**\n * Get the text of an element, remove the multiple whitespaces and linebreaks\n * Returns a promise that resolves with the formatted text or undefined.\n */\n getPlainText(): Promise<string | undefined>;\n\n /**\n * Returns a promise that resolves with the inner html of the element or undefined.\n */\n getInnerHTML(): Promise<string | undefined>;\n\n /**\n * Put the cusrsor on the element.\n */\n mouseOver(): Promise<void>;\n\n /**\n * Returns a promise that resolves with the current value of an input or undefined.\n */\n getValue(): Promise<string | undefined>;\n\n /**\n * Set the value in an input.\n */\n setValue(input: string): Promise<void>;\n\n /**\n * Clears the value in the input\n */\n clearValue(): Promise<void>;\n\n /**\n * Check if an element is visible ( display !none and visibility !hidden)\n */\n isVisible(): Promise<boolean>;\n}\n\n/**\n * Constructor of a O3rElement\n */\nexport type O3rElementConstructor<T extends ElementProfile> = new (sourceElement: any) => T;\n\n/**\n * Mock for ElementProfile class.\n * This class is used for fixture compilation purpose.\n */\nexport class O3rElement implements ElementProfile {\n constructor(_sourceElement: any) {}\n\n public getInnerHTML(): Promise<string | undefined> {\n throw new TranspilationPurposeOnlyError('Should target a proper implementation');\n }\n\n /** @inheritdoc */\n public getText(): Promise<string | undefined> {\n throw new TranspilationPurposeOnlyError('Should target a proper implementation');\n }\n\n /** @inheritdoc */\n public getPlainText(): Promise<string | undefined> {\n throw new TranspilationPurposeOnlyError('Should target a proper implementation');\n }\n\n /** @inheritdoc */\n public click(): Promise<void> {\n throw new TranspilationPurposeOnlyError('Should target a proper implementation');\n }\n\n /** @inheritdoc */\n public getAttribute(_attributeName: string): Promise<string | undefined> {\n throw new TranspilationPurposeOnlyError('Should target a proper implementation');\n }\n\n /** @inheritdoc */\n public mouseOver(): Promise<void> {\n throw new TranspilationPurposeOnlyError('Should target a proper implementation');\n }\n\n /** @inheritdoc */\n public getValue(): Promise<string | undefined> {\n throw new TranspilationPurposeOnlyError('Should target a proper implementation');\n }\n\n /** @inheritdoc */\n public setValue(_input: string): Promise<void> {\n throw new TranspilationPurposeOnlyError('Should target a proper implementation');\n }\n\n /** @inheritdoc */\n public clearValue(): Promise<void> {\n throw new TranspilationPurposeOnlyError('Should target a proper implementation');\n }\n\n /** @inheritdoc */\n public isVisible(): Promise<boolean> {\n throw new TranspilationPurposeOnlyError('Should target a proper implementation');\n }\n}\n"]}
|
@@ -1,32 +1,28 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.O3rCheckboxElement = void 0;
|
4
|
-
|
5
|
-
|
6
|
-
var element_1 = require("../element");
|
4
|
+
const index_1 = require("../../errors/index");
|
5
|
+
const element_1 = require("../element");
|
7
6
|
/**
|
8
7
|
* Mock for ElementProfile class.
|
9
8
|
* This class is used for fixture compilation purpose.
|
10
9
|
*/
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
return _super.call(this, _sourceElement) || this;
|
10
|
+
class O3rCheckboxElement extends element_1.O3rElement {
|
11
|
+
constructor(_sourceElement) {
|
12
|
+
super(_sourceElement);
|
15
13
|
}
|
16
14
|
/** @inheritDoc */
|
17
|
-
|
18
|
-
if (_value === void 0) { _value = true; }
|
15
|
+
check(_value = true, _associatedLabel) {
|
19
16
|
throw new index_1.TranspilationPurposeOnlyError('Should target a proper implementation');
|
20
|
-
}
|
17
|
+
}
|
21
18
|
/** @inheritDoc */
|
22
|
-
|
19
|
+
uncheck() {
|
23
20
|
throw new index_1.TranspilationPurposeOnlyError('Should target a proper implementation');
|
24
|
-
}
|
21
|
+
}
|
25
22
|
/** @inheritDoc */
|
26
|
-
|
23
|
+
isChecked() {
|
27
24
|
throw new index_1.TranspilationPurposeOnlyError('Should target a proper implementation');
|
28
|
-
}
|
29
|
-
|
30
|
-
}(element_1.O3rElement));
|
25
|
+
}
|
26
|
+
}
|
31
27
|
exports.O3rCheckboxElement = O3rCheckboxElement;
|
32
28
|
//# sourceMappingURL=checkbox-element.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"checkbox-element.js","sourceRoot":"","sources":["../../../src/core/elements/checkbox-element.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"checkbox-element.js","sourceRoot":"","sources":["../../../src/core/elements/checkbox-element.ts"],"names":[],"mappings":";;;AAAA,8CAE4B;AAC5B,wCAGoB;AA0BpB;;;GAGG;AACH,MAAa,kBAAmB,SAAQ,oBAAU;IAChD,YAAY,cAAmB;QAC7B,KAAK,CAAC,cAAc,CAAC,CAAC;IACxB,CAAC;IAED,kBAAkB;IACX,KAAK,CAAC,MAAM,GAAG,IAAI,EAAE,gBAA6B;QACvD,MAAM,IAAI,qCAA6B,CAAC,uCAAuC,CAAC,CAAC;IACnF,CAAC;IAED,kBAAkB;IACX,OAAO;QACZ,MAAM,IAAI,qCAA6B,CAAC,uCAAuC,CAAC,CAAC;IACnF,CAAC;IAED,kBAAkB;IACX,SAAS;QACd,MAAM,IAAI,qCAA6B,CAAC,uCAAuC,CAAC,CAAC;IACnF,CAAC;CACF;AAnBD,gDAmBC","sourcesContent":["import {\n TranspilationPurposeOnlyError,\n} from '../../errors/index';\nimport {\n ElementProfile,\n O3rElement,\n} from '../element';\n\n/**\n * Interface to describe the Checkbox elements that are used inside a fixture.\n * As for ComponentFixtureProfile, this abstracts the testing framework that is used by choosing the right\n * implementation at runtime.\n */\nexport interface CheckboxElementProfile extends ElementProfile {\n /**\n * Check the checkbox element\n * @param value If specified, determine the value of the checkbox button\n * @param associatedLabel If specified, specify the label associated to the checkbox\n */\n check(value?: boolean, associatedLabel?: O3rElement): Promise<void>;\n\n /**\n * Uncheck the checkbox element\n */\n uncheck(): Promise<void>;\n\n /**\n * Return true if the checkbox button is checked\n */\n isChecked(): Promise<boolean>;\n}\n\n/**\n * Mock for ElementProfile class.\n * This class is used for fixture compilation purpose.\n */\nexport class O3rCheckboxElement extends O3rElement implements CheckboxElementProfile {\n constructor(_sourceElement: any) {\n super(_sourceElement);\n }\n\n /** @inheritDoc */\n public check(_value = true, _associatedLabel?: O3rElement): Promise<void> {\n throw new TranspilationPurposeOnlyError('Should target a proper implementation');\n }\n\n /** @inheritDoc */\n public uncheck(): Promise<void> {\n throw new TranspilationPurposeOnlyError('Should target a proper implementation');\n }\n\n /** @inheritDoc */\n public isChecked(): Promise<boolean> {\n throw new TranspilationPurposeOnlyError('Should target a proper implementation');\n }\n}\n"]}
|
package/core/elements/index.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
|
3
|
+
const tslib_1 = require("tslib");
|
4
4
|
tslib_1.__exportStar(require("./checkbox-element"), exports);
|
5
5
|
tslib_1.__exportStar(require("./radio-element"), exports);
|
6
6
|
tslib_1.__exportStar(require("./select-element"), exports);
|
@@ -1,32 +1,28 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.O3rRadioElement = void 0;
|
4
|
-
|
5
|
-
|
6
|
-
var element_1 = require("../element");
|
4
|
+
const index_1 = require("../../errors/index");
|
5
|
+
const element_1 = require("../element");
|
7
6
|
/**
|
8
7
|
* Mock for ElementProfile class.
|
9
8
|
* This class is used for fixture compilation purpose.
|
10
9
|
*/
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
return _super.call(this, _sourceElement) || this;
|
10
|
+
class O3rRadioElement extends element_1.O3rElement {
|
11
|
+
constructor(_sourceElement) {
|
12
|
+
super(_sourceElement);
|
15
13
|
}
|
16
14
|
/** @inheritDoc */
|
17
|
-
|
18
|
-
if (_value === void 0) { _value = true; }
|
15
|
+
check(_value = true) {
|
19
16
|
throw new index_1.TranspilationPurposeOnlyError('Should target a proper implementation');
|
20
|
-
}
|
17
|
+
}
|
21
18
|
/** @inheritDoc */
|
22
|
-
|
19
|
+
uncheck() {
|
23
20
|
throw new index_1.TranspilationPurposeOnlyError('Should target a proper implementation');
|
24
|
-
}
|
21
|
+
}
|
25
22
|
/** @inheritDoc */
|
26
|
-
|
23
|
+
isChecked() {
|
27
24
|
throw new index_1.TranspilationPurposeOnlyError('Should target a proper implementation');
|
28
|
-
}
|
29
|
-
|
30
|
-
}(element_1.O3rElement));
|
25
|
+
}
|
26
|
+
}
|
31
27
|
exports.O3rRadioElement = O3rRadioElement;
|
32
28
|
//# sourceMappingURL=radio-element.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"radio-element.js","sourceRoot":"","sources":["../../../src/core/elements/radio-element.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"radio-element.js","sourceRoot":"","sources":["../../../src/core/elements/radio-element.ts"],"names":[],"mappings":";;;AAAA,8CAE4B;AAC5B,wCAGoB;AAyBpB;;;GAGG;AACH,MAAa,eAAgB,SAAQ,oBAAU;IAC7C,YAAY,cAAmB;QAC7B,KAAK,CAAC,cAAc,CAAC,CAAC;IACxB,CAAC;IAED,kBAAkB;IACX,KAAK,CAAC,MAAM,GAAG,IAAI;QACxB,MAAM,IAAI,qCAA6B,CAAC,uCAAuC,CAAC,CAAC;IACnF,CAAC;IAED,kBAAkB;IACX,OAAO;QACZ,MAAM,IAAI,qCAA6B,CAAC,uCAAuC,CAAC,CAAC;IACnF,CAAC;IAED,kBAAkB;IACX,SAAS;QACd,MAAM,IAAI,qCAA6B,CAAC,uCAAuC,CAAC,CAAC;IACnF,CAAC;CACF;AAnBD,0CAmBC","sourcesContent":["import {\n TranspilationPurposeOnlyError,\n} from '../../errors/index';\nimport {\n ElementProfile,\n O3rElement,\n} from '../element';\n\n/**\n * Interface to describe the Radio elements that are used inside a fixture.\n * As for ComponentFixtureProfile, this abstracts the testing framework that is used by choosing the right\n * implementation at runtime.\n */\nexport interface RadioElementProfile extends ElementProfile {\n /**\n * Check the radio element\n * @param value If specified, determine the value of the radio button\n */\n check(value?: boolean): Promise<void>;\n\n /**\n * Uncheck the radio element\n */\n uncheck(): Promise<void>;\n\n /**\n * Return true if the radio button is checked\n */\n isChecked(): Promise<boolean>;\n}\n\n/**\n * Mock for ElementProfile class.\n * This class is used for fixture compilation purpose.\n */\nexport class O3rRadioElement extends O3rElement implements RadioElementProfile {\n constructor(_sourceElement: any) {\n super(_sourceElement);\n }\n\n /** @inheritDoc */\n public check(_value = true): Promise<void> {\n throw new TranspilationPurposeOnlyError('Should target a proper implementation');\n }\n\n /** @inheritDoc */\n public uncheck(): Promise<void> {\n throw new TranspilationPurposeOnlyError('Should target a proper implementation');\n }\n\n /** @inheritDoc */\n public isChecked(): Promise<boolean> {\n throw new TranspilationPurposeOnlyError('Should target a proper implementation');\n }\n}\n"]}
|
@@ -1,35 +1,32 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.O3rSelectElement = void 0;
|
4
|
-
|
5
|
-
|
6
|
-
var element_1 = require("../element");
|
4
|
+
const index_1 = require("../../errors/index");
|
5
|
+
const element_1 = require("../element");
|
7
6
|
/**
|
8
7
|
* Mock for ElementProfile class.
|
9
8
|
* This class is used for fixture compilation purpose.
|
10
9
|
*/
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
return _super.call(this, _sourceElement) || this;
|
10
|
+
class O3rSelectElement extends element_1.O3rElement {
|
11
|
+
constructor(_sourceElement) {
|
12
|
+
super(_sourceElement);
|
15
13
|
}
|
16
14
|
/**
|
17
15
|
* Select an element in a dropdown by index.
|
18
16
|
* @param _index
|
19
17
|
* @param _timeout
|
20
18
|
*/
|
21
|
-
|
19
|
+
selectByIndex(_index, _timeout) {
|
22
20
|
throw new index_1.TranspilationPurposeOnlyError('Should target a proper implementation');
|
23
|
-
}
|
21
|
+
}
|
24
22
|
/**
|
25
23
|
* Select an element in a dropdown by value.
|
26
24
|
* @param _value
|
27
25
|
* @param _timeout
|
28
26
|
*/
|
29
|
-
|
27
|
+
selectByValue(_value, _timeout) {
|
30
28
|
throw new index_1.TranspilationPurposeOnlyError('Should target a proper implementation');
|
31
|
-
}
|
32
|
-
|
33
|
-
}(element_1.O3rElement));
|
29
|
+
}
|
30
|
+
}
|
34
31
|
exports.O3rSelectElement = O3rSelectElement;
|
35
32
|
//# sourceMappingURL=select-element.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"select-element.js","sourceRoot":"","sources":["../../../src/core/elements/select-element.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"select-element.js","sourceRoot":"","sources":["../../../src/core/elements/select-element.ts"],"names":[],"mappings":";;;AAAA,8CAE4B;AAC5B,wCAGoB;AAmBpB;;;GAGG;AACH,MAAa,gBAAiB,SAAQ,oBAAU;IAC9C,YAAY,cAAmB;QAC7B,KAAK,CAAC,cAAc,CAAC,CAAC;IACxB,CAAC;IAED;;;;OAIG;IACI,aAAa,CAAC,MAAc,EAAE,QAAiB;QACpD,MAAM,IAAI,qCAA6B,CAAC,uCAAuC,CAAC,CAAC;IACnF,CAAC;IAED;;;;OAIG;IACI,aAAa,CAAC,MAAc,EAAE,QAAiB;QACpD,MAAM,IAAI,qCAA6B,CAAC,uCAAuC,CAAC,CAAC;IACnF,CAAC;CACF;AAtBD,4CAsBC","sourcesContent":["import {\n TranspilationPurposeOnlyError,\n} from '../../errors/index';\nimport {\n ElementProfile,\n O3rElement,\n} from '../element';\n\n/**\n * Interface to describe the Select elements that are used inside a fixture.\n * As for ComponentFixtureProfile, this abstracts the testing framework that is used by choosing the right\n * implementation at runtime.\n */\nexport interface SelectElementProfile extends ElementProfile {\n /**\n * Select an element in a dropdown by index.\n */\n selectByIndex(index: number, _timeout?: number): Promise<void>;\n\n /**\n * Select an element in a dropdown by value.\n */\n selectByValue(value: string, _timeout?: number): Promise<void>;\n}\n\n/**\n * Mock for ElementProfile class.\n * This class is used for fixture compilation purpose.\n */\nexport class O3rSelectElement extends O3rElement implements SelectElementProfile {\n constructor(_sourceElement: any) {\n super(_sourceElement);\n }\n\n /**\n * Select an element in a dropdown by index.\n * @param _index\n * @param _timeout\n */\n public selectByIndex(_index: number, _timeout?: number): Promise<void> {\n throw new TranspilationPurposeOnlyError('Should target a proper implementation');\n }\n\n /**\n * Select an element in a dropdown by value.\n * @param _value\n * @param _timeout\n */\n public selectByValue(_value: string, _timeout?: number): Promise<void> {\n throw new TranspilationPurposeOnlyError('Should target a proper implementation');\n }\n}\n"]}
|
@@ -1,18 +1,15 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.O3rSliderElement = void 0;
|
4
|
-
|
5
|
-
var element_1 = require("../element");
|
4
|
+
const element_1 = require("../element");
|
6
5
|
/**
|
7
6
|
* Mock for ElementProfile class.
|
8
7
|
* This class is used for fixture compilation purpose.
|
9
8
|
*/
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
return _super.call(this, sourceElement) || this;
|
9
|
+
class O3rSliderElement extends element_1.O3rElement {
|
10
|
+
constructor(sourceElement, _trackSelector, _thumbSelector) {
|
11
|
+
super(sourceElement);
|
14
12
|
}
|
15
|
-
|
16
|
-
}(element_1.O3rElement));
|
13
|
+
}
|
17
14
|
exports.O3rSliderElement = O3rSliderElement;
|
18
15
|
//# sourceMappingURL=slider-element.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"slider-element.js","sourceRoot":"","sources":["../../../src/core/elements/slider-element.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"slider-element.js","sourceRoot":"","sources":["../../../src/core/elements/slider-element.ts"],"names":[],"mappings":";;;AAAA,wCAGoB;AASpB;;;GAGG;AACH,MAAa,gBAAiB,SAAQ,oBAAU;IAC9C,YAAY,aAAkB,EAAE,cAAuB,EAAE,cAAuB;QAC9E,KAAK,CAAC,aAAa,CAAC,CAAC;IACvB,CAAC;CACF;AAJD,4CAIC","sourcesContent":["import {\n ElementProfile,\n O3rElement,\n} from '../element';\n\n/**\n * Interface to describe the Slider elements that are used inside a fixture.\n * As for ComponentFixtureProfile, this abstracts the testing framework that is used by choosing the right\n * implementation at runtime.\n */\nexport interface SliderElementProfile extends ElementProfile {}\n\n/**\n * Mock for ElementProfile class.\n * This class is used for fixture compilation purpose.\n */\nexport class O3rSliderElement extends O3rElement implements SliderElementProfile {\n constructor(sourceElement: any, _trackSelector?: string, _thumbSelector?: string) {\n super(sourceElement);\n }\n}\n"]}
|
package/core/group.js
CHANGED
@@ -1,27 +1,21 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.O3rGroup = void 0;
|
4
|
-
|
4
|
+
const index_1 = require("../errors/index");
|
5
5
|
/**
|
6
6
|
* Mock for GroupProfile class.
|
7
7
|
* This class is used for fixture compilation purpose.
|
8
8
|
*/
|
9
|
-
|
10
|
-
|
9
|
+
class O3rGroup {
|
10
|
+
/** @inheritDoc */
|
11
|
+
get items() {
|
12
|
+
throw new index_1.TranspilationPurposeOnlyError('Should target a proper implementation');
|
11
13
|
}
|
12
|
-
|
13
|
-
/** @inheritDoc */
|
14
|
-
get: function () {
|
15
|
-
throw new index_1.TranspilationPurposeOnlyError('Should target a proper implementation');
|
16
|
-
},
|
17
|
-
enumerable: false,
|
18
|
-
configurable: true
|
19
|
-
});
|
14
|
+
constructor(_sourceElement) { }
|
20
15
|
/** @inheritDoc */
|
21
|
-
|
16
|
+
isValidGroup() {
|
22
17
|
throw new index_1.TranspilationPurposeOnlyError('Should target a proper implementation');
|
23
|
-
}
|
24
|
-
|
25
|
-
}());
|
18
|
+
}
|
19
|
+
}
|
26
20
|
exports.O3rGroup = O3rGroup;
|
27
21
|
//# sourceMappingURL=group.js.map
|
package/core/group.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"group.js","sourceRoot":"","sources":["../../src/core/group.ts"],"names":[],"mappings":";;;AAAA,
|
1
|
+
{"version":3,"file":"group.js","sourceRoot":"","sources":["../../src/core/group.ts"],"names":[],"mappings":";;;AAAA,2CAEyB;AAwBzB;;;GAGG;AACH,MAAa,QAAQ;IACnB,kBAAkB;IAClB,IAAW,KAAK;QACd,MAAM,IAAI,qCAA6B,CAAC,uCAAuC,CAAC,CAAC;IACnF,CAAC;IAED,YAAY,cAAmB,IAAG,CAAC;IAEnC,kBAAkB;IACX,YAAY;QACjB,MAAM,IAAI,qCAA6B,CAAC,uCAAuC,CAAC,CAAC;IACnF,CAAC;CACF;AAZD,4BAYC","sourcesContent":["import {\n TranspilationPurposeOnlyError,\n} from '../errors/index';\nimport {\n ElementProfile,\n O3rElement,\n} from './element';\n\n/**\n * Constructor of a O3rGroup\n */\nexport type O3rGroupConstructor<T extends GroupProfile<V>, V extends ElementProfile> = new (sourceElement: V[]) => T;\n\n/**\n * Interface to describe the GroupProfile that are queried inside a fixture.\n * As for ComponentFixture, this abstracts the testing framework that is used by choosing the right\n * implementation at runtime.\n */\nexport interface GroupProfile<T extends ElementProfile> {\n /** List of items */\n items: T[];\n\n /** Check if the group is valid */\n isValidGroup(): Promise<boolean>;\n}\n\n/**\n * Mock for GroupProfile class.\n * This class is used for fixture compilation purpose.\n */\nexport class O3rGroup<T extends O3rElement> implements GroupProfile<T> {\n /** @inheritDoc */\n public get items(): T[] {\n throw new TranspilationPurposeOnlyError('Should target a proper implementation');\n }\n\n constructor(_sourceElement: T[]) {}\n\n /** @inheritDoc */\n public isValidGroup(): Promise<boolean> {\n throw new TranspilationPurposeOnlyError('Should target a proper implementation');\n }\n}\n"]}
|
package/core/groups/index.js
CHANGED
@@ -1,22 +1,19 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.O3rRadioGroup = void 0;
|
4
|
-
|
5
|
-
|
6
|
-
var group_1 = require("../group");
|
4
|
+
const index_1 = require("../../errors/index");
|
5
|
+
const group_1 = require("../group");
|
7
6
|
/**
|
8
7
|
* Mock for RadioGroupProfile class.
|
9
8
|
* This class is used for fixture compilation purpose.
|
10
9
|
*/
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
return _super.call(this, sourceElement) || this;
|
10
|
+
class O3rRadioGroup extends group_1.O3rGroup {
|
11
|
+
constructor(sourceElement) {
|
12
|
+
super(sourceElement);
|
15
13
|
}
|
16
|
-
|
14
|
+
getSelectedItem() {
|
17
15
|
throw new index_1.TranspilationPurposeOnlyError('Should target a proper implementation');
|
18
|
-
}
|
19
|
-
|
20
|
-
}(group_1.O3rGroup));
|
16
|
+
}
|
17
|
+
}
|
21
18
|
exports.O3rRadioGroup = O3rRadioGroup;
|
22
19
|
//# sourceMappingURL=radio-group.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"radio-group.js","sourceRoot":"","sources":["../../../src/core/groups/radio-group.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"radio-group.js","sourceRoot":"","sources":["../../../src/core/groups/radio-group.ts"],"names":[],"mappings":";;;AAAA,8CAE4B;AAK5B,oCAGkB;AAYlB;;;GAGG;AACH,MAAa,aAAc,SAAQ,gBAAyB;IAC1D,YAAY,aAAgC;QAC1C,KAAK,CAAC,aAAa,CAAC,CAAC;IACvB,CAAC;IAEM,eAAe;QACpB,MAAM,IAAI,qCAA6B,CAAC,uCAAuC,CAAC,CAAC;IACnF,CAAC;CACF;AARD,sCAQC","sourcesContent":["import {\n TranspilationPurposeOnlyError,\n} from '../../errors/index';\nimport {\n O3rRadioElement,\n RadioElementProfile,\n} from '../elements/radio-element';\nimport {\n GroupProfile,\n O3rGroup,\n} from '../group';\n\n/**\n * Interface to describe the Radio Group that are used inside a fixture.\n * As for ComponentFixtureProfile, this abstracts the testing framework that is used by choosing the right\n * implementation at runtime.\n */\nexport interface RadioGroupProfile extends GroupProfile<RadioElementProfile> {\n /** Get of selected items */\n getSelectedItem(): Promise<RadioElementProfile | undefined>;\n}\n\n/**\n * Mock for RadioGroupProfile class.\n * This class is used for fixture compilation purpose.\n */\nexport class O3rRadioGroup extends O3rGroup<O3rRadioElement> implements RadioGroupProfile {\n constructor(sourceElement: O3rRadioElement[]) {\n super(sourceElement);\n }\n\n public getSelectedItem(): Promise<O3rRadioElement | undefined> {\n throw new TranspilationPurposeOnlyError('Should target a proper implementation');\n }\n}\n"]}
|
package/core/helpers.js
CHANGED
@@ -1,36 +1,31 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.withTimeout = exports.TimeoutError = exports.isPromise = void 0;
|
4
|
-
var tslib_1 = require("tslib");
|
5
4
|
/**
|
6
5
|
* Determine if the given item is a promise
|
7
6
|
* @param item Item to check
|
8
7
|
*/
|
9
|
-
|
8
|
+
const isPromise = (item) => !!item && typeof item.then === 'function';
|
10
9
|
exports.isPromise = isPromise;
|
11
10
|
/**
|
12
11
|
* Error raised when promise timeout
|
13
12
|
*/
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
return _super.call(this, message || 'Timeout of the promise') || this;
|
13
|
+
class TimeoutError extends Error {
|
14
|
+
constructor(message) {
|
15
|
+
super(message || 'Timeout of the promise');
|
18
16
|
}
|
19
|
-
|
20
|
-
}(Error));
|
17
|
+
}
|
21
18
|
exports.TimeoutError = TimeoutError;
|
22
19
|
/**
|
23
20
|
* Apply timeout to a given promise
|
24
21
|
* @param promise Promise to timeout
|
25
22
|
* @param timeout timeout of the given promise (in ms)
|
26
23
|
*/
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
});
|
34
|
-
}); };
|
24
|
+
const withTimeout = async (promise, timeout) => {
|
25
|
+
if (!timeout) {
|
26
|
+
return promise;
|
27
|
+
}
|
28
|
+
return Promise.race([promise, new Promise((_, reject) => setTimeout(() => reject(new TimeoutError()), timeout))]);
|
29
|
+
};
|
35
30
|
exports.withTimeout = withTimeout;
|
36
31
|
//# sourceMappingURL=helpers.js.map
|
package/core/helpers.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/core/helpers.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/core/helpers.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACI,MAAM,SAAS,GAAG,CAAI,IAAoB,EAAsB,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,OAAQ,IAAmB,CAAC,IAAI,KAAK,UAAU,CAAC;AAAvH,QAAA,SAAS,aAA8G;AAEpI;;GAEG;AACH,MAAa,YAAa,SAAQ,KAAK;IACrC,YAAY,OAAgB;QAC1B,KAAK,CAAC,OAAO,IAAI,wBAAwB,CAAC,CAAC;IAC7C,CAAC;CACF;AAJD,oCAIC;AAED;;;;GAIG;AACI,MAAM,WAAW,GAAG,KAAK,EAAK,OAAmB,EAAE,OAAgB,EAAc,EAAE;IACxF,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,OAAO,CAAC;IACjB,CAAC;IACD,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,IAAI,OAAO,CAAI,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC,UAAU,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,YAAY,EAAE,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;AACvH,CAAC,CAAC;AALW,QAAA,WAAW,eAKtB","sourcesContent":["/**\n * Determine if the given item is a promise\n * @param item Item to check\n */\nexport const isPromise = <T>(item: T | Promise<T>): item is Promise<T> => !!item && typeof (item as Promise<T>).then === 'function';\n\n/**\n * Error raised when promise timeout\n */\nexport class TimeoutError extends Error {\n constructor(message?: string) {\n super(message || 'Timeout of the promise');\n }\n}\n\n/**\n * Apply timeout to a given promise\n * @param promise Promise to timeout\n * @param timeout timeout of the given promise (in ms)\n */\nexport const withTimeout = async <T>(promise: Promise<T>, timeout?: number): Promise<T> => {\n if (!timeout) {\n return promise;\n }\n return Promise.race([promise, new Promise<T>((_, reject) => setTimeout(() => reject(new TimeoutError()), timeout))]);\n};\n"]}
|
package/core/index.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
|
3
|
+
const tslib_1 = require("tslib");
|
4
4
|
tslib_1.__exportStar(require("./angular-materials"), exports);
|
5
5
|
tslib_1.__exportStar(require("./component-fixture"), exports);
|
6
6
|
tslib_1.__exportStar(require("./element"), exports);
|
package/core/page-fixture.js
CHANGED
@@ -1,27 +1,24 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.O3rPageFixture = void 0;
|
4
|
-
|
5
|
-
|
6
|
-
var component_fixture_1 = require("./component-fixture");
|
4
|
+
const index_1 = require("../errors/index");
|
5
|
+
const component_fixture_1 = require("./component-fixture");
|
7
6
|
/**
|
8
7
|
* Mock for page fixture class.
|
9
8
|
* This class is used for fixture compilation purpose.
|
10
9
|
*/
|
11
|
-
|
12
|
-
tslib_1.__extends(O3rPageFixture, _super);
|
10
|
+
class O3rPageFixture extends component_fixture_1.O3rComponentFixture {
|
13
11
|
/**
|
14
12
|
* Root element of this fixture. Optional in a Protractor.
|
15
13
|
* All further queries will be applied to the element tree if any, otherwise they will be applied to the whole DOM.
|
16
14
|
* @param _rootElement
|
17
15
|
*/
|
18
|
-
|
19
|
-
|
16
|
+
constructor(_rootElement) {
|
17
|
+
super();
|
20
18
|
}
|
21
|
-
|
19
|
+
getTitle() {
|
22
20
|
throw new index_1.TranspilationPurposeOnlyError('Should target Playwright implementation');
|
23
|
-
}
|
24
|
-
|
25
|
-
}(component_fixture_1.O3rComponentFixture));
|
21
|
+
}
|
22
|
+
}
|
26
23
|
exports.O3rPageFixture = O3rPageFixture;
|
27
24
|
//# sourceMappingURL=page-fixture.js.map
|
package/core/page-fixture.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"page-fixture.js","sourceRoot":"","sources":["../../src/core/page-fixture.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"page-fixture.js","sourceRoot":"","sources":["../../src/core/page-fixture.ts"],"names":[],"mappings":";;;AAAA,2CAEyB;AACzB,2DAG6B;AAgB7B;;;GAGG;AACH,MAAa,cAAkD,SAAQ,uCAAsB;IAC3F;;;;OAIG;IACH,YAAY,YAAgB;QAC1B,KAAK,EAAE,CAAC;IACV,CAAC;IAEM,QAAQ;QACb,MAAM,IAAI,qCAA6B,CAAC,yCAAyC,CAAC,CAAC;IACrF,CAAC;CACF;AAbD,wCAaC","sourcesContent":["import {\n TranspilationPurposeOnlyError,\n} from '../errors/index';\nimport {\n ComponentFixtureProfile,\n O3rComponentFixture,\n} from './component-fixture';\nimport {\n ElementProfile,\n O3rElement,\n} from './element';\n\n/**\n * Interface to describe a page fixture.\n */\nexport interface PageFixtureProfile<V extends ElementProfile> extends ComponentFixtureProfile<V> {\n /**\n * Returns the title of the page\n */\n getTitle(): Promise<string>;\n}\n\n/**\n * Mock for page fixture class.\n * This class is used for fixture compilation purpose.\n */\nexport class O3rPageFixture<V extends O3rElement = O3rElement> extends O3rComponentFixture<V> implements PageFixtureProfile<V> {\n /**\n * Root element of this fixture. Optional in a Protractor.\n * All further queries will be applied to the element tree if any, otherwise they will be applied to the whole DOM.\n * @param _rootElement\n */\n constructor(_rootElement?: V) {\n super();\n }\n\n public getTitle(): Promise<string> {\n throw new TranspilationPurposeOnlyError('Should target Playwright implementation');\n }\n}\n"]}
|
@@ -1,66 +1,36 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.MatAutocomplete = void 0;
|
4
|
-
|
5
|
-
var element_1 = require("../element");
|
4
|
+
const element_1 = require("../element");
|
6
5
|
/**
|
7
6
|
* Implementation dedicated to Playwright.
|
8
7
|
*/
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
return _super.call(this, sourceElement) || this;
|
8
|
+
class MatAutocomplete extends element_1.O3rElement {
|
9
|
+
constructor(sourceElement) {
|
10
|
+
super(sourceElement);
|
13
11
|
}
|
14
12
|
/** @inheritdoc */
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
i = 0;
|
38
|
-
_d.label = 5;
|
39
|
-
case 5:
|
40
|
-
if (!(i < matOptionsCount)) return [3 /*break*/, 8];
|
41
|
-
_b = (_a = options).push;
|
42
|
-
_c = element_1.getPlainText;
|
43
|
-
return [4 /*yield*/, matOptions.nth(i).innerText()];
|
44
|
-
case 6:
|
45
|
-
_b.apply(_a, [_c.apply(void 0, [_d.sent()])]);
|
46
|
-
_d.label = 7;
|
47
|
-
case 7:
|
48
|
-
i++;
|
49
|
-
return [3 /*break*/, 5];
|
50
|
-
case 8: throw new Error("MatAutocomplete selectByValue works only for filtered autocomplete. Found multiple values: ".concat(options.join(', ')));
|
51
|
-
case 9:
|
52
|
-
if (!(matOptionsCount === 1)) return [3 /*break*/, 11];
|
53
|
-
selectedOption = { element: matOptions.nth(0), page: this.sourceElement.page };
|
54
|
-
return [4 /*yield*/, new element_1.O3rElement(selectedOption).click()];
|
55
|
-
case 10:
|
56
|
-
_d.sent();
|
57
|
-
return [2 /*return*/, this.sourceElement.element.press('Tab')];
|
58
|
-
case 11: return [2 /*return*/, Promise.reject(new Error('Element with selector .mat-option, mat-option not found.'))];
|
59
|
-
}
|
60
|
-
});
|
61
|
-
});
|
62
|
-
};
|
63
|
-
return MatAutocomplete;
|
64
|
-
}(element_1.O3rElement));
|
13
|
+
async selectByValue(value, timeout = 5000) {
|
14
|
+
await this.setValue(value);
|
15
|
+
await this.click();
|
16
|
+
const element = this.sourceElement.page;
|
17
|
+
const matOptions = element.locator('.mat-option, mat-option');
|
18
|
+
await matOptions.first().waitFor({ state: 'attached', timeout });
|
19
|
+
const matOptionsCount = await matOptions.count();
|
20
|
+
const options = [];
|
21
|
+
if (matOptionsCount > 1) {
|
22
|
+
for (let i = 0; i < matOptionsCount; i++) {
|
23
|
+
options.push((0, element_1.getPlainText)(await matOptions.nth(i).innerText()));
|
24
|
+
}
|
25
|
+
throw new Error(`MatAutocomplete selectByValue works only for filtered autocomplete. Found multiple values: ${options.join(', ')}`);
|
26
|
+
}
|
27
|
+
if (matOptionsCount === 1) {
|
28
|
+
const selectedOption = { element: matOptions.nth(0), page: this.sourceElement.page };
|
29
|
+
await new element_1.O3rElement(selectedOption).click();
|
30
|
+
return this.sourceElement.element.press('Tab');
|
31
|
+
}
|
32
|
+
return Promise.reject(new Error('Element with selector .mat-option, mat-option not found.'));
|
33
|
+
}
|
34
|
+
}
|
65
35
|
exports.MatAutocomplete = MatAutocomplete;
|
66
36
|
//# sourceMappingURL=autocomplete-material.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"autocomplete-material.js","sourceRoot":"","sources":["../../../../src/core/playwright/angular-materials/autocomplete-material.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"autocomplete-material.js","sourceRoot":"","sources":["../../../../src/core/playwright/angular-materials/autocomplete-material.ts"],"names":[],"mappings":";;;AAGA,wCAIoB;AAEpB;;GAEG;AACH,MAAa,eAAgB,SAAQ,oBAAU;IAC7C,YAAY,aAAmD;QAC7D,KAAK,CAAC,aAAa,CAAC,CAAC;IACvB,CAAC;IAED,kBAAkB;IACX,KAAK,CAAC,aAAa,CAAC,KAAa,EAAE,OAAO,GAAG,IAAI;QACtD,MAAM,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QAC3B,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC;QACnB,MAAM,OAAO,GAAG,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC;QACxC,MAAM,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,yBAAyB,CAAC,CAAC;QAC9D,MAAM,UAAU,CAAC,KAAK,EAAE,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,CAAC,CAAC;QACjE,MAAM,eAAe,GAAG,MAAM,UAAU,CAAC,KAAK,EAAE,CAAC;QACjD,MAAM,OAAO,GAA2B,EAAE,CAAC;QAC3C,IAAI,eAAe,GAAG,CAAC,EAAE,CAAC;YACxB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,eAAe,EAAE,CAAC,EAAE,EAAE,CAAC;gBACzC,OAAO,CAAC,IAAI,CAAC,IAAA,sBAAY,EAAC,MAAM,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC;YAClE,CAAC;YACD,MAAM,IAAI,KAAK,CAAC,8FAA8F,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACtI,CAAC;QACD,IAAI,eAAe,KAAK,CAAC,EAAE,CAAC;YAC1B,MAAM,cAAc,GAAG,EAAE,OAAO,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,IAAI,EAA6C,CAAC;YAChI,MAAM,IAAI,oBAAU,CAAC,cAAc,CAAC,CAAC,KAAK,EAAE,CAAC;YAC7C,OAAO,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACjD,CAAC;QAED,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,0DAA0D,CAAC,CAAC,CAAC;IAC/F,CAAC;CACF;AA5BD,0CA4BC","sourcesContent":["import {\n MatAutocompleteProfile,\n} from '../../angular-materials';\nimport {\n getPlainText,\n O3rElement,\n PlaywrightSourceElement,\n} from '../element';\n\n/**\n * Implementation dedicated to Playwright.\n */\nexport class MatAutocomplete extends O3rElement implements MatAutocompleteProfile {\n constructor(sourceElement: PlaywrightSourceElement | O3rElement) {\n super(sourceElement);\n }\n\n /** @inheritdoc */\n public async selectByValue(value: string, timeout = 5000) {\n await this.setValue(value);\n await this.click();\n const element = this.sourceElement.page;\n const matOptions = element.locator('.mat-option, mat-option');\n await matOptions.first().waitFor({ state: 'attached', timeout });\n const matOptionsCount = await matOptions.count();\n const options: (string | undefined)[] = [];\n if (matOptionsCount > 1) {\n for (let i = 0; i < matOptionsCount; i++) {\n options.push(getPlainText(await matOptions.nth(i).innerText()));\n }\n throw new Error(`MatAutocomplete selectByValue works only for filtered autocomplete. Found multiple values: ${options.join(', ')}`);\n }\n if (matOptionsCount === 1) {\n const selectedOption = { element: matOptions.nth(0), page: this.sourceElement.page } as const satisfies PlaywrightSourceElement;\n await new O3rElement(selectedOption).click();\n return this.sourceElement.element.press('Tab');\n }\n\n return Promise.reject(new Error('Element with selector .mat-option, mat-option not found.'));\n }\n}\n"]}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
|
3
|
+
const tslib_1 = require("tslib");
|
4
4
|
tslib_1.__exportStar(require("./autocomplete-material"), exports);
|
5
5
|
tslib_1.__exportStar(require("./select-material"), exports);
|
6
6
|
tslib_1.__exportStar(require("./slider-material"), exports);
|