@o3r/testing 13.0.0-next.26 → 13.0.0-next.28
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 +16 -15
- package/public_api.js +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/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.js +29 -34
- 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
@@ -1,168 +1,89 @@
|
|
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
|
* Implementation dedicated to Playwright.
|
8
7
|
*/
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
8
|
+
class O3rSliderElement extends element_1.O3rElement {
|
9
|
+
constructor(sourceElement, trackSelector, thumbSelector) {
|
10
|
+
super(sourceElement);
|
11
|
+
this.trackSelector = trackSelector;
|
12
|
+
this.thumbSelector = thumbSelector;
|
13
|
+
}
|
14
|
+
async getInputElement() {
|
15
|
+
try {
|
16
|
+
const subElement = this.sourceElement.element.locator('input[type="range"]');
|
17
|
+
if (await subElement.count()) {
|
18
|
+
return subElement.first();
|
19
|
+
}
|
20
|
+
return this.sourceElement.element;
|
21
|
+
}
|
22
|
+
catch {
|
23
|
+
return this.sourceElement.element;
|
24
|
+
}
|
25
|
+
}
|
26
|
+
async getTrackElement() {
|
27
|
+
if (!this.trackSelector) {
|
28
|
+
return this.sourceElement.element;
|
29
|
+
}
|
30
|
+
try {
|
31
|
+
const subElement = this.sourceElement.element.locator(this.trackSelector);
|
32
|
+
if (await subElement.count()) {
|
33
|
+
return subElement.first();
|
34
|
+
}
|
35
|
+
return this.sourceElement.element;
|
36
|
+
}
|
37
|
+
catch {
|
38
|
+
return this.sourceElement.element;
|
39
|
+
}
|
40
|
+
}
|
41
|
+
async getThumbElement() {
|
42
|
+
if (!this.thumbSelector) {
|
43
|
+
return this.sourceElement.element;
|
44
|
+
}
|
45
|
+
try {
|
46
|
+
const subElement = this.sourceElement.element.locator(this.thumbSelector);
|
47
|
+
if (await subElement.count()) {
|
48
|
+
return subElement.first();
|
49
|
+
}
|
50
|
+
return this.sourceElement.element;
|
51
|
+
}
|
52
|
+
catch {
|
53
|
+
return this.sourceElement.element;
|
54
|
+
}
|
16
55
|
}
|
17
|
-
O3rSliderElement.prototype.getInputElement = function () {
|
18
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
19
|
-
var subElement, _a;
|
20
|
-
return tslib_1.__generator(this, function (_b) {
|
21
|
-
switch (_b.label) {
|
22
|
-
case 0:
|
23
|
-
_b.trys.push([0, 2, , 3]);
|
24
|
-
subElement = this.sourceElement.element.locator('input[type="range"]');
|
25
|
-
return [4 /*yield*/, subElement.count()];
|
26
|
-
case 1:
|
27
|
-
if (_b.sent()) {
|
28
|
-
return [2 /*return*/, subElement.first()];
|
29
|
-
}
|
30
|
-
return [2 /*return*/, this.sourceElement.element];
|
31
|
-
case 2:
|
32
|
-
_a = _b.sent();
|
33
|
-
return [2 /*return*/, this.sourceElement.element];
|
34
|
-
case 3: return [2 /*return*/];
|
35
|
-
}
|
36
|
-
});
|
37
|
-
});
|
38
|
-
};
|
39
|
-
O3rSliderElement.prototype.getTrackElement = function () {
|
40
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
41
|
-
var subElement, _a;
|
42
|
-
return tslib_1.__generator(this, function (_b) {
|
43
|
-
switch (_b.label) {
|
44
|
-
case 0:
|
45
|
-
if (!this.trackSelector) {
|
46
|
-
return [2 /*return*/, this.sourceElement.element];
|
47
|
-
}
|
48
|
-
_b.label = 1;
|
49
|
-
case 1:
|
50
|
-
_b.trys.push([1, 3, , 4]);
|
51
|
-
subElement = this.sourceElement.element.locator(this.trackSelector);
|
52
|
-
return [4 /*yield*/, subElement.count()];
|
53
|
-
case 2:
|
54
|
-
if (_b.sent()) {
|
55
|
-
return [2 /*return*/, subElement.first()];
|
56
|
-
}
|
57
|
-
return [2 /*return*/, this.sourceElement.element];
|
58
|
-
case 3:
|
59
|
-
_a = _b.sent();
|
60
|
-
return [2 /*return*/, this.sourceElement.element];
|
61
|
-
case 4: return [2 /*return*/];
|
62
|
-
}
|
63
|
-
});
|
64
|
-
});
|
65
|
-
};
|
66
|
-
O3rSliderElement.prototype.getThumbElement = function () {
|
67
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
68
|
-
var subElement, _a;
|
69
|
-
return tslib_1.__generator(this, function (_b) {
|
70
|
-
switch (_b.label) {
|
71
|
-
case 0:
|
72
|
-
if (!this.thumbSelector) {
|
73
|
-
return [2 /*return*/, this.sourceElement.element];
|
74
|
-
}
|
75
|
-
_b.label = 1;
|
76
|
-
case 1:
|
77
|
-
_b.trys.push([1, 3, , 4]);
|
78
|
-
subElement = this.sourceElement.element.locator(this.thumbSelector);
|
79
|
-
return [4 /*yield*/, subElement.count()];
|
80
|
-
case 2:
|
81
|
-
if (_b.sent()) {
|
82
|
-
return [2 /*return*/, subElement.first()];
|
83
|
-
}
|
84
|
-
return [2 /*return*/, this.sourceElement.element];
|
85
|
-
case 3:
|
86
|
-
_a = _b.sent();
|
87
|
-
return [2 /*return*/, this.sourceElement.element];
|
88
|
-
case 4: return [2 /*return*/];
|
89
|
-
}
|
90
|
-
});
|
91
|
-
});
|
92
|
-
};
|
93
56
|
/** @inheritdoc */
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
startPosition = {
|
118
|
-
x: thumbBoundingBox.x + thumbBoundingBox.width / 2,
|
119
|
-
y: thumbBoundingBox.y + thumbBoundingBox.height / 2
|
120
|
-
};
|
121
|
-
return [4 /*yield*/, this.sourceElement.page.mouse.move(startPosition.x, startPosition.y)];
|
122
|
-
case 6:
|
123
|
-
_a.sent();
|
124
|
-
return [4 /*yield*/, this.sourceElement.page.mouse.down()];
|
125
|
-
case 7:
|
126
|
-
_a.sent();
|
127
|
-
return [4 /*yield*/, inputElement.getAttribute('max')];
|
128
|
-
case 8:
|
129
|
-
maxAttribute = _a.sent();
|
130
|
-
max = maxAttribute ? +maxAttribute : 100;
|
131
|
-
return [4 /*yield*/, inputElement.getAttribute('min')];
|
132
|
-
case 9:
|
133
|
-
minAttribute = _a.sent();
|
134
|
-
min = minAttribute ? +minAttribute : 0;
|
135
|
-
percent = (Math.max(min, Math.min(+value, max)) - min) / (max - min);
|
136
|
-
return [4 /*yield*/, this.sourceElement.page.mouse.move(trackBoundingBox.x + Math.round(trackBoundingBox.width * percent), trackBoundingBox.y + trackBoundingBox.height / 2)];
|
137
|
-
case 10:
|
138
|
-
_a.sent();
|
139
|
-
return [4 /*yield*/, this.sourceElement.page.mouse.up()];
|
140
|
-
case 11:
|
141
|
-
_a.sent();
|
142
|
-
return [2 /*return*/];
|
143
|
-
}
|
144
|
-
});
|
145
|
-
});
|
146
|
-
};
|
57
|
+
async setValue(value) {
|
58
|
+
const trackElement = await this.getTrackElement();
|
59
|
+
const trackBoundingBox = await trackElement.boundingBox();
|
60
|
+
const thumbElement = await this.getThumbElement();
|
61
|
+
const inputElement = await this.getInputElement();
|
62
|
+
const thumbBoundingBox = await thumbElement.boundingBox();
|
63
|
+
if (!trackBoundingBox || !thumbBoundingBox) {
|
64
|
+
return;
|
65
|
+
}
|
66
|
+
const startPosition = {
|
67
|
+
x: thumbBoundingBox.x + thumbBoundingBox.width / 2,
|
68
|
+
y: thumbBoundingBox.y + thumbBoundingBox.height / 2
|
69
|
+
};
|
70
|
+
await this.sourceElement.page.mouse.move(startPosition.x, startPosition.y);
|
71
|
+
await this.sourceElement.page.mouse.down();
|
72
|
+
const maxAttribute = await inputElement.getAttribute('max');
|
73
|
+
const max = maxAttribute ? +maxAttribute : 100;
|
74
|
+
const minAttribute = await inputElement.getAttribute('min');
|
75
|
+
const min = minAttribute ? +minAttribute : 0;
|
76
|
+
const percent = (Math.max(min, Math.min(+value, max)) - min) / (max - min);
|
77
|
+
await this.sourceElement.page.mouse.move(trackBoundingBox.x + Math.round(trackBoundingBox.width * percent), trackBoundingBox.y + trackBoundingBox.height / 2);
|
78
|
+
await this.sourceElement.page.mouse.up();
|
79
|
+
}
|
147
80
|
/** @inheritdoc */
|
148
|
-
|
149
|
-
return
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
_a = element_1.O3rElement.bind;
|
156
|
-
_b = {};
|
157
|
-
return [4 /*yield*/, this.getInputElement()];
|
158
|
-
case 1: return [2 /*return*/, (new (_a.apply(element_1.O3rElement, [void 0, (_b.element = _c.sent(),
|
159
|
-
_b.page = this.sourceElement.page,
|
160
|
-
_b)]))()).getValue()];
|
161
|
-
}
|
162
|
-
});
|
163
|
-
});
|
164
|
-
};
|
165
|
-
return O3rSliderElement;
|
166
|
-
}(element_1.O3rElement));
|
81
|
+
async getValue() {
|
82
|
+
return (new element_1.O3rElement({
|
83
|
+
element: await this.getInputElement(),
|
84
|
+
page: this.sourceElement.page
|
85
|
+
})).getValue();
|
86
|
+
}
|
87
|
+
}
|
167
88
|
exports.O3rSliderElement = O3rSliderElement;
|
168
89
|
//# sourceMappingURL=slider-element.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"slider-element.js","sourceRoot":"","sources":["../../../../src/core/playwright/elements/slider-element.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"slider-element.js","sourceRoot":"","sources":["../../../../src/core/playwright/elements/slider-element.ts"],"names":[],"mappings":";;;AAGA,wCAGoB;AAEpB;;GAEG;AACH,MAAa,gBAAiB,SAAQ,oBAAU;IAC9C,YACE,aAAmD,EAClC,aAAsB,EACtB,aAAsB;QAEvC,KAAK,CAAC,aAAa,CAAC,CAAC;QAHJ,kBAAa,GAAb,aAAa,CAAS;QACtB,kBAAa,GAAb,aAAa,CAAS;IAGzC,CAAC;IAEO,KAAK,CAAC,eAAe;QAC3B,IAAI,CAAC;YACH,MAAM,UAAU,GAAG,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,OAAO,CAAC,qBAAqB,CAAC,CAAC;YAC7E,IAAI,MAAM,UAAU,CAAC,KAAK,EAAE,EAAE,CAAC;gBAC7B,OAAO,UAAU,CAAC,KAAK,EAAE,CAAC;YAC5B,CAAC;YACD,OAAO,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC;QACpC,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC;QACpC,CAAC;IACH,CAAC;IAEO,KAAK,CAAC,eAAe;QAC3B,IAAI,CAAC,IA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C,KAAK,GAAG,OAAO,CAAC,EACjE,gBAAgB,CAAC,CAAC,GAAG,gBAAgB,CAAC,MAAM,GAAG,CAAC,CACjD,CAAC;QACF,MAAM,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC;IAC3C,CAAC;IAED,kBAAkB;IACX,KAAK,CAAC,QAAQ;QACnB,OAAO,CAAC,IAAI,oBAAU,CAAC;YACrB,OAAO,EAAE,MAAM,IAAI,CAAC,eAAe,EAAE;YACrC,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,IAAI;SAC9B,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;IACjB,CAAC;CACF;AAvFD,4CAuFC","sourcesContent":["import type {\n SliderElementProfile,\n} from '../../elements';\nimport {\n O3rElement,\n type PlaywrightSourceElement,\n} from '../element';\n\n/**\n * Implementation dedicated to Playwright.\n */\nexport class O3rSliderElement extends O3rElement implements SliderElementProfile {\n constructor(\n sourceElement: PlaywrightSourceElement | O3rElement,\n private readonly trackSelector?: string,\n private readonly thumbSelector?: string\n ) {\n super(sourceElement);\n }\n\n private async getInputElement() {\n try {\n const subElement = this.sourceElement.element.locator('input[type=\"range\"]');\n if (await subElement.count()) {\n return subElement.first();\n }\n return this.sourceElement.element;\n } catch {\n return this.sourceElement.element;\n }\n }\n\n private async getTrackElement() {\n if (!this.trackSelector) {\n return this.sourceElement.element;\n }\n try {\n const subElement = this.sourceElement.element.locator(this.trackSelector);\n if (await subElement.count()) {\n return subElement.first();\n }\n return this.sourceElement.element;\n } catch {\n return this.sourceElement.element;\n }\n }\n\n private async getThumbElement() {\n if (!this.thumbSelector) {\n return this.sourceElement.element;\n }\n try {\n const subElement = this.sourceElement.element.locator(this.thumbSelector);\n if (await subElement.count()) {\n return subElement.first();\n }\n return this.sourceElement.element;\n } catch {\n return this.sourceElement.element;\n }\n }\n\n /** @inheritdoc */\n public async setValue(value: string): Promise<void> {\n const trackElement = await this.getTrackElement();\n const trackBoundingBox = await trackElement.boundingBox();\n const thumbElement = await this.getThumbElement();\n const inputElement = await this.getInputElement();\n const thumbBoundingBox = await thumbElement.boundingBox();\n if (!trackBoundingBox || !thumbBoundingBox) {\n return;\n }\n const startPosition = {\n x: thumbBoundingBox.x + thumbBoundingBox.width / 2,\n y: thumbBoundingBox.y + thumbBoundingBox.height / 2\n };\n await this.sourceElement.page.mouse.move(startPosition.x, startPosition.y);\n await this.sourceElement.page.mouse.down();\n\n const maxAttribute = await inputElement.getAttribute('max');\n const max = maxAttribute ? +maxAttribute : 100;\n const minAttribute = await inputElement.getAttribute('min');\n const min = minAttribute ? +minAttribute : 0;\n const percent = (Math.max(min, Math.min(+value, max)) - min) / (max - min);\n await this.sourceElement.page.mouse.move(\n trackBoundingBox.x + Math.round(trackBoundingBox.width * percent),\n trackBoundingBox.y + trackBoundingBox.height / 2\n );\n await this.sourceElement.page.mouse.up();\n }\n\n /** @inheritdoc */\n public async getValue() {\n return (new O3rElement({\n element: await this.getInputElement(),\n page: this.sourceElement.page\n })).getValue();\n }\n}\n"]}
|
package/core/playwright/group.js
CHANGED
@@ -4,23 +4,18 @@ exports.O3rGroup = void 0;
|
|
4
4
|
/**
|
5
5
|
* Implementation dedicated to Playwright.
|
6
6
|
*/
|
7
|
-
|
8
|
-
|
7
|
+
class O3rGroup {
|
8
|
+
/** @inheritDoc */
|
9
|
+
get items() {
|
10
|
+
return this.sourceElement;
|
11
|
+
}
|
12
|
+
constructor(sourceElement) {
|
9
13
|
this.sourceElement = sourceElement;
|
10
14
|
}
|
11
|
-
Object.defineProperty(O3rGroup.prototype, "items", {
|
12
|
-
/** @inheritDoc */
|
13
|
-
get: function () {
|
14
|
-
return this.sourceElement;
|
15
|
-
},
|
16
|
-
enumerable: false,
|
17
|
-
configurable: true
|
18
|
-
});
|
19
15
|
/** @inheritDoc */
|
20
|
-
|
16
|
+
isValidGroup() {
|
21
17
|
return Promise.resolve(true);
|
22
|
-
}
|
23
|
-
|
24
|
-
}());
|
18
|
+
}
|
19
|
+
}
|
25
20
|
exports.O3rGroup = O3rGroup;
|
26
21
|
//# sourceMappingURL=group.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"group.js","sourceRoot":"","sources":["../../../src/core/playwright/group.ts"],"names":[],"mappings":";;;AAeA;;GAEG;AACH;
|
1
|
+
{"version":3,"file":"group.js","sourceRoot":"","sources":["../../../src/core/playwright/group.ts"],"names":[],"mappings":";;;AAeA;;GAEG;AACH,MAAa,QAAQ;IACnB,kBAAkB;IAClB,IAAW,KAAK;QACd,OAAO,IAAI,CAAC,aAAa,CAAC;IAC5B,CAAC;IAED,YAAsB,aAAkB;QAAlB,kBAAa,GAAb,aAAa,CAAK;IAAG,CAAC;IAE5C,kBAAkB;IACX,YAAY;QACjB,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC;CACF;AAZD,4BAYC","sourcesContent":["import {\n GroupProfile,\n} from '../group';\nimport {\n ElementProfile,\n O3rElement,\n} from './element';\n\nexport { GroupProfile } from '../group';\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 * Implementation dedicated to Playwright.\n */\nexport class O3rGroup<T extends O3rElement> implements GroupProfile<T> {\n /** @inheritDoc */\n public get items(): T[] {\n return this.sourceElement;\n }\n\n constructor(protected sourceElement: T[]) {}\n\n /** @inheritDoc */\n public isValidGroup() {\n return Promise.resolve(true);\n }\n}\n"]}
|
@@ -1,77 +1,40 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.O3rRadioGroup = void 0;
|
4
|
-
|
5
|
-
var group_1 = require("../group");
|
4
|
+
const group_1 = require("../group");
|
6
5
|
/**
|
7
6
|
* Group element to manage a radio group
|
8
7
|
*/
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
return _super.call(this, sourceElement) || this;
|
8
|
+
class O3rRadioGroup extends group_1.O3rGroup {
|
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
|
-
case 2:
|
29
|
-
itemName = _b.sent();
|
30
|
-
if (name !== '' && name !== itemName) {
|
31
|
-
return [2 /*return*/, false];
|
32
|
-
}
|
33
|
-
if (itemName !== undefined) {
|
34
|
-
name = itemName;
|
35
|
-
}
|
36
|
-
_b.label = 3;
|
37
|
-
case 3:
|
38
|
-
_i++;
|
39
|
-
return [3 /*break*/, 1];
|
40
|
-
case 4: return [2 /*return*/, true];
|
41
|
-
}
|
42
|
-
});
|
43
|
-
});
|
44
|
-
};
|
13
|
+
async isValidGroup() {
|
14
|
+
let name = '';
|
15
|
+
for (const item of this.items) {
|
16
|
+
const itemName = await item.getAttribute('name');
|
17
|
+
if (name !== '' && name !== itemName) {
|
18
|
+
return false;
|
19
|
+
}
|
20
|
+
if (itemName !== undefined) {
|
21
|
+
name = itemName;
|
22
|
+
}
|
23
|
+
}
|
24
|
+
return true;
|
25
|
+
}
|
45
26
|
/**
|
46
27
|
* Get the selected radio
|
47
28
|
*/
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
item = _a[_i];
|
59
|
-
return [4 /*yield*/, item.isChecked()];
|
60
|
-
case 2:
|
61
|
-
isSelected = _b.sent();
|
62
|
-
if (isSelected) {
|
63
|
-
return [2 /*return*/, item];
|
64
|
-
}
|
65
|
-
_b.label = 3;
|
66
|
-
case 3:
|
67
|
-
_i++;
|
68
|
-
return [3 /*break*/, 1];
|
69
|
-
case 4: return [2 /*return*/, undefined];
|
70
|
-
}
|
71
|
-
});
|
72
|
-
});
|
73
|
-
};
|
74
|
-
return O3rRadioGroup;
|
75
|
-
}(group_1.O3rGroup));
|
29
|
+
async getSelectedItem() {
|
30
|
+
for (const item of this.items) {
|
31
|
+
const isSelected = await item.isChecked();
|
32
|
+
if (isSelected) {
|
33
|
+
return item;
|
34
|
+
}
|
35
|
+
}
|
36
|
+
return undefined;
|
37
|
+
}
|
38
|
+
}
|
76
39
|
exports.O3rRadioGroup = O3rRadioGroup;
|
77
40
|
//# sourceMappingURL=radio-group.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"radio-group.js","sourceRoot":"","sources":["../../../../src/core/playwright/groups/radio-group.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"radio-group.js","sourceRoot":"","sources":["../../../../src/core/playwright/groups/radio-group.ts"],"names":[],"mappings":";;;AAMA,oCAEkB;AAElB;;GAEG;AACH,MAAa,aAAc,SAAQ,gBAAyB;IAC1D,YAAY,aAAgC;QAC1C,KAAK,CAAC,aAAa,CAAC,CAAC;IACvB,CAAC;IAED,kBAAkB;IACX,KAAK,CAAC,YAAY;QACvB,IAAI,IAAI,GAAG,EAAE,CAAC;QAEd,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YAC9B,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;YACjD,IAAI,IAAI,KAAK,EAAE,IAAI,IAAI,KAAK,QAAQ,EAAE,CAAC;gBACrC,OAAO,KAAK,CAAC;YACf,CAAC;YACD,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;gBAC3B,IAAI,GAAG,QAAQ,CAAC;YAClB,CAAC;QACH,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,eAAe;QAC1B,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YAC9B,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,SAAS,EAAE,CAAC;YAC1C,IAAI,UAAU,EAAE,CAAC;gBACf,OAAO,IAAI,CAAC;YACd,CAAC;QACH,CAAC;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;CACF;AAnCD,sCAmCC","sourcesContent":["import {\n RadioGroupProfile,\n} from '../../groups/radio-group';\nimport {\n O3rRadioElement,\n} from '../elements/radio-element';\nimport {\n O3rGroup,\n} from '../group';\n\n/**\n * Group element to manage a radio group\n */\nexport class O3rRadioGroup extends O3rGroup<O3rRadioElement> implements RadioGroupProfile {\n constructor(sourceElement: O3rRadioElement[]) {\n super(sourceElement);\n }\n\n /** @inheritDoc */\n public async isValidGroup() {\n let name = '';\n\n for (const item of this.items) {\n const itemName = await item.getAttribute('name');\n if (name !== '' && name !== itemName) {\n return false;\n }\n if (itemName !== undefined) {\n name = itemName;\n }\n }\n\n return true;\n }\n\n /**\n * Get the selected radio\n */\n public async getSelectedItem() {\n for (const item of this.items) {\n const isSelected = await item.isChecked();\n if (isSelected) {\n return item;\n }\n }\n\n return undefined;\n }\n}\n"]}
|
package/core/playwright/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);
|
@@ -1,27 +1,17 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.O3rPageFixture = void 0;
|
4
|
-
|
5
|
-
var component_fixture_1 = require("./component-fixture");
|
4
|
+
const component_fixture_1 = require("./component-fixture");
|
6
5
|
/**
|
7
6
|
* Implementation of the page fixture dedicated to Playwright.
|
8
7
|
*/
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
return _super.call(this, rootElement) || this;
|
8
|
+
class O3rPageFixture extends component_fixture_1.O3rComponentFixture {
|
9
|
+
constructor(rootElement) {
|
10
|
+
super(rootElement);
|
13
11
|
}
|
14
|
-
|
15
|
-
return
|
16
|
-
|
17
|
-
|
18
|
-
case 0: return [4 /*yield*/, this.rootElement.sourceElement.page.title()];
|
19
|
-
case 1: return [2 /*return*/, _a.sent()];
|
20
|
-
}
|
21
|
-
});
|
22
|
-
});
|
23
|
-
};
|
24
|
-
return O3rPageFixture;
|
25
|
-
}(component_fixture_1.O3rComponentFixture));
|
12
|
+
async getTitle() {
|
13
|
+
return await this.rootElement.sourceElement.page.title();
|
14
|
+
}
|
15
|
+
}
|
26
16
|
exports.O3rPageFixture = O3rPageFixture;
|
27
17
|
//# sourceMappingURL=page-fixture.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"page-fixture.js","sourceRoot":"","sources":["../../../src/core/playwright/page-fixture.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"page-fixture.js","sourceRoot":"","sources":["../../../src/core/playwright/page-fixture.ts"],"names":[],"mappings":";;;AAGA,2DAE6B;AAO7B;;GAEG;AACH,MAAa,cAAkD,SAAQ,uCAAsB;IAC3F,YAAY,WAAc;QACxB,KAAK,CAAC,WAAW,CAAC,CAAC;IACrB,CAAC;IAEM,KAAK,CAAC,QAAQ;QACnB,OAAO,MAAM,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;IAC3D,CAAC;CACF;AARD,wCAQC","sourcesContent":["import {\n PageFixtureProfile,\n} from '../page-fixture';\nimport {\n O3rComponentFixture,\n} from './component-fixture';\nimport {\n O3rElement,\n} from './element';\n\nexport { PageFixtureProfile } from '../page-fixture';\n\n/**\n * Implementation of the page fixture dedicated to Playwright.\n */\nexport class O3rPageFixture<V extends O3rElement = O3rElement> extends O3rComponentFixture<V> implements PageFixtureProfile<V> {\n constructor(rootElement: V) {\n super(rootElement);\n }\n\n public async getTitle() {\n return await this.rootElement.sourceElement.page.title();\n }\n}\n"]}
|
@@ -1,19 +1,14 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.FixtureUsageError = void 0;
|
4
|
-
var tslib_1 = require("tslib");
|
5
4
|
/**
|
6
5
|
* Exception to indicate that a fixture is being used with invalid parameters.
|
7
6
|
*/
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
var _this = _super.call(this, message) || this;
|
13
|
-
_this.name = 'FixtureUsageError';
|
14
|
-
return _this;
|
7
|
+
class FixtureUsageError extends Error {
|
8
|
+
constructor(message = 'Fixture usage error') {
|
9
|
+
super(message);
|
10
|
+
this.name = 'FixtureUsageError';
|
15
11
|
}
|
16
|
-
|
17
|
-
}(Error));
|
12
|
+
}
|
18
13
|
exports.FixtureUsageError = FixtureUsageError;
|
19
14
|
//# sourceMappingURL=fixture-usage-error.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"fixture-usage-error.js","sourceRoot":"","sources":["../../src/errors/fixture-usage-error.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"fixture-usage-error.js","sourceRoot":"","sources":["../../src/errors/fixture-usage-error.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,MAAa,iBAAkB,SAAQ,KAAK;IAC1C,YAAY,OAAO,GAAG,qBAAqB;QACzC,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAC;IAClC,CAAC;CACF;AALD,8CAKC","sourcesContent":["/**\n * Exception to indicate that a fixture is being used with invalid parameters.\n */\nexport class FixtureUsageError extends Error {\n constructor(message = 'Fixture usage error') {\n super(message);\n this.name = 'FixtureUsageError';\n }\n}\n"]}
|
package/errors/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("./fixture-usage-error"), exports);
|
5
5
|
tslib_1.__exportStar(require("./transpilation-purpose-only"), exports);
|
6
6
|
//# sourceMappingURL=index.js.map
|
@@ -1,20 +1,15 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.TranspilationPurposeOnlyError = void 0;
|
4
|
-
var tslib_1 = require("tslib");
|
5
4
|
/**
|
6
5
|
* Exception to indicate that the code run is for transpilation purpose only.
|
7
6
|
* It should not be used during runtime process
|
8
7
|
*/
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
var _this = _super.call(this, message) || this;
|
14
|
-
_this.name = 'TranspilationPurposeOnly';
|
15
|
-
return _this;
|
8
|
+
class TranspilationPurposeOnlyError extends Error {
|
9
|
+
constructor(message = 'Transpilation purpose only') {
|
10
|
+
super(message);
|
11
|
+
this.name = 'TranspilationPurposeOnly';
|
16
12
|
}
|
17
|
-
|
18
|
-
}(Error));
|
13
|
+
}
|
19
14
|
exports.TranspilationPurposeOnlyError = TranspilationPurposeOnlyError;
|
20
15
|
//# sourceMappingURL=transpilation-purpose-only.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"transpilation-purpose-only.js","sourceRoot":"","sources":["../../src/errors/transpilation-purpose-only.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"transpilation-purpose-only.js","sourceRoot":"","sources":["../../src/errors/transpilation-purpose-only.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,MAAa,6BAA8B,SAAQ,KAAK;IACtD,YAAY,OAAO,GAAG,4BAA4B;QAChD,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,0BAA0B,CAAC;IACzC,CAAC;CACF;AALD,sEAKC","sourcesContent":["/**\n * Exception to indicate that the code run is for transpilation purpose only.\n * It should not be used during runtime process\n */\nexport class TranspilationPurposeOnlyError extends Error {\n constructor(message = 'Transpilation purpose only') {\n super(message);\n this.name = 'TranspilationPurposeOnly';\n }\n}\n"]}
|
package/kassette/index.js
CHANGED