@o3r/testing 11.6.0-prerelease.7 → 11.6.0-prerelease.9
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.d.ts +0 -1
- package/core/angular/angular-materials/autocomplete-material.d.ts.map +1 -1
- package/core/angular/angular-materials/autocomplete-material.js.map +1 -1
- package/core/angular/angular-materials/select-material.d.ts +0 -1
- package/core/angular/angular-materials/select-material.d.ts.map +1 -1
- package/core/angular/angular-materials/select-material.js +4 -3
- package/core/angular/angular-materials/select-material.js.map +1 -1
- package/core/angular/angular-materials/slider-material.d.ts.map +1 -1
- package/core/angular/angular-materials/slider-material.js.map +1 -1
- package/core/angular/component-fixture.d.ts.map +1 -1
- package/core/angular/component-fixture.js +3 -10
- package/core/angular/component-fixture.js.map +1 -1
- package/core/angular/element.d.ts.map +1 -1
- package/core/angular/element.js +2 -2
- package/core/angular/element.js.map +1 -1
- package/core/angular/elements/checkbox-element.d.ts.map +1 -1
- package/core/angular/elements/checkbox-element.js.map +1 -1
- package/core/angular/elements/radio-element.d.ts.map +1 -1
- package/core/angular/elements/radio-element.js.map +1 -1
- package/core/angular/elements/select-element.d.ts +0 -1
- package/core/angular/elements/select-element.d.ts.map +1 -1
- package/core/angular/elements/select-element.js +2 -2
- package/core/angular/elements/select-element.js.map +1 -1
- package/core/angular/elements/slider-element.d.ts +2 -1
- package/core/angular/elements/slider-element.d.ts.map +1 -1
- package/core/angular/elements/slider-element.js +2 -1
- package/core/angular/elements/slider-element.js.map +1 -1
- package/core/angular/group.d.ts.map +1 -1
- package/core/angular/group.js.map +1 -1
- package/core/angular/groups/radio-group.d.ts.map +1 -1
- package/core/angular/groups/radio-group.js.map +1 -1
- package/core/angular/index.d.ts +3 -2
- package/core/angular/index.d.ts.map +1 -1
- package/core/angular/index.js +2 -2
- package/core/angular/index.js.map +1 -1
- package/core/angular/page-fixture.d.ts.map +1 -1
- package/core/angular/page-fixture.js.map +1 -1
- package/core/angular-materials/autocomplete-material.d.ts.map +1 -1
- package/core/angular-materials/autocomplete-material.js.map +1 -1
- package/core/angular-materials/select-material.d.ts.map +1 -1
- package/core/angular-materials/select-material.js.map +1 -1
- package/core/angular-materials/slider-material.d.ts.map +1 -1
- package/core/angular-materials/slider-material.js.map +1 -1
- package/core/component-fixture.d.ts +18 -36
- package/core/component-fixture.d.ts.map +1 -1
- package/core/component-fixture.js +18 -36
- package/core/component-fixture.js.map +1 -1
- package/core/element.d.ts.map +1 -1
- package/core/element.js.map +1 -1
- package/core/elements/checkbox-element.d.ts.map +1 -1
- package/core/elements/checkbox-element.js.map +1 -1
- package/core/elements/radio-element.d.ts.map +1 -1
- package/core/elements/radio-element.js.map +1 -1
- package/core/elements/select-element.d.ts.map +1 -1
- package/core/elements/select-element.js.map +1 -1
- package/core/elements/slider-element.d.ts.map +1 -1
- package/core/elements/slider-element.js.map +1 -1
- package/core/group.d.ts.map +1 -1
- package/core/group.js.map +1 -1
- package/core/groups/radio-group.d.ts.map +1 -1
- package/core/groups/radio-group.js.map +1 -1
- package/core/helpers.d.ts +1 -1
- package/core/helpers.d.ts.map +1 -1
- package/core/helpers.js.map +1 -1
- package/core/index.d.ts +2 -2
- package/core/index.d.ts.map +1 -1
- package/core/index.js +2 -2
- package/core/index.js.map +1 -1
- package/core/page-fixture.d.ts.map +1 -1
- package/core/page-fixture.js.map +1 -1
- package/core/playwright/angular-materials/autocomplete-material.d.ts +0 -1
- package/core/playwright/angular-materials/autocomplete-material.d.ts.map +1 -1
- package/core/playwright/angular-materials/autocomplete-material.js +1 -1
- package/core/playwright/angular-materials/autocomplete-material.js.map +1 -1
- package/core/playwright/angular-materials/select-material.d.ts +0 -1
- package/core/playwright/angular-materials/select-material.d.ts.map +1 -1
- package/core/playwright/angular-materials/select-material.js +3 -3
- package/core/playwright/angular-materials/select-material.js.map +1 -1
- package/core/playwright/angular-materials/slider-material.d.ts.map +1 -1
- package/core/playwright/angular-materials/slider-material.js.map +1 -1
- package/core/playwright/component-fixture.d.ts.map +1 -1
- package/core/playwright/component-fixture.js +2 -10
- package/core/playwright/component-fixture.js.map +1 -1
- package/core/playwright/element.d.ts.map +1 -1
- package/core/playwright/element.js +11 -10
- package/core/playwright/element.js.map +1 -1
- package/core/playwright/elements/checkbox-element.d.ts +2 -1
- package/core/playwright/elements/checkbox-element.d.ts.map +1 -1
- package/core/playwright/elements/checkbox-element.js +4 -1
- package/core/playwright/elements/checkbox-element.js.map +1 -1
- package/core/playwright/elements/index.d.ts +2 -2
- package/core/playwright/elements/index.d.ts.map +1 -1
- package/core/playwright/elements/index.js +2 -2
- package/core/playwright/elements/index.js.map +1 -1
- package/core/playwright/elements/radio-element.d.ts.map +1 -1
- package/core/playwright/elements/radio-element.js +1 -0
- package/core/playwright/elements/radio-element.js.map +1 -1
- package/core/playwright/elements/select-element.d.ts.map +1 -1
- package/core/playwright/elements/select-element.js.map +1 -1
- package/core/playwright/elements/slider-element.d.ts.map +1 -1
- package/core/playwright/elements/slider-element.js.map +1 -1
- package/core/playwright/group.d.ts.map +1 -1
- package/core/playwright/group.js.map +1 -1
- package/core/playwright/groups/radio-group.d.ts.map +1 -1
- package/core/playwright/groups/radio-group.js.map +1 -1
- package/core/playwright/index.d.ts +3 -2
- package/core/playwright/index.d.ts.map +1 -1
- package/core/playwright/index.js +2 -2
- package/core/playwright/index.js.map +1 -1
- package/core/playwright/page-fixture.d.ts.map +1 -1
- package/core/playwright/page-fixture.js.map +1 -1
- package/core/protractor/angular-materials/autocomplete-material.d.ts +0 -1
- package/core/protractor/angular-materials/autocomplete-material.d.ts.map +1 -1
- package/core/protractor/angular-materials/autocomplete-material.js.map +1 -1
- package/core/protractor/angular-materials/select-material.d.ts +0 -1
- package/core/protractor/angular-materials/select-material.d.ts.map +1 -1
- package/core/protractor/angular-materials/select-material.js +7 -6
- package/core/protractor/angular-materials/select-material.js.map +1 -1
- package/core/protractor/component-fixture.d.ts.map +1 -1
- package/core/protractor/component-fixture.js +6 -11
- package/core/protractor/component-fixture.js.map +1 -1
- package/core/protractor/element.d.ts.map +1 -1
- package/core/protractor/element.js +6 -4
- package/core/protractor/element.js.map +1 -1
- package/core/protractor/elements/checkbox-element.d.ts.map +1 -1
- package/core/protractor/elements/checkbox-element.js.map +1 -1
- package/core/protractor/elements/index.d.ts +1 -1
- package/core/protractor/elements/index.d.ts.map +1 -1
- package/core/protractor/elements/index.js +1 -1
- package/core/protractor/elements/index.js.map +1 -1
- package/core/protractor/elements/radio-element.d.ts.map +1 -1
- package/core/protractor/elements/radio-element.js +1 -0
- package/core/protractor/elements/radio-element.js.map +1 -1
- package/core/protractor/elements/select-element.d.ts +0 -1
- package/core/protractor/elements/select-element.d.ts.map +1 -1
- package/core/protractor/elements/select-element.js.map +1 -1
- package/core/protractor/group.d.ts.map +1 -1
- package/core/protractor/group.js.map +1 -1
- package/core/protractor/groups/radio-group.d.ts.map +1 -1
- package/core/protractor/groups/radio-group.js +1 -0
- package/core/protractor/groups/radio-group.js.map +1 -1
- package/core/protractor/index.d.ts +3 -2
- package/core/protractor/index.d.ts.map +1 -1
- package/core/protractor/index.js +2 -2
- package/core/protractor/index.js.map +1 -1
- package/core/protractor/page-fixture.d.ts.map +1 -1
- package/core/protractor/page-fixture.js.map +1 -1
- package/core/protractor/utils.d.ts.map +1 -1
- package/core/protractor/utils.js.map +1 -1
- package/esm/visual-test/utils.d.ts +2 -2
- package/esm/visual-test/utils.js +3 -3
- package/esm/visual-test/utils.js.map +1 -1
- package/kassette/update-dates-in-mocks.d.ts.map +1 -1
- package/kassette/update-dates-in-mocks.js +3 -3
- package/kassette/update-dates-in-mocks.js.map +1 -1
- package/localization/localization-mock.d.ts.map +1 -1
- package/localization/localization-mock.js.map +1 -1
- package/mocks/mock-component-generator.d.ts +1 -1
- package/mocks/mock-component-generator.d.ts.map +1 -1
- package/mocks/mock-component-generator.js +15 -14
- package/mocks/mock-component-generator.js.map +1 -1
- package/package.json +23 -18
- package/schematics/add-functions-to-fixture/helpers.d.ts +0 -2
- package/schematics/add-functions-to-fixture/helpers.d.ts.map +1 -1
- package/schematics/add-functions-to-fixture/helpers.js +2 -4
- package/schematics/add-functions-to-fixture/helpers.js.map +1 -1
- package/schematics/add-functions-to-fixture/index.d.ts.map +1 -1
- package/schematics/add-functions-to-fixture/index.js +6 -6
- package/schematics/add-functions-to-fixture/index.js.map +1 -1
- package/schematics/add-functions-to-fixture/schema.d.ts.map +1 -1
- package/schematics/fixture-to-component/index.d.ts.map +1 -1
- package/schematics/fixture-to-component/index.js +1 -1
- package/schematics/fixture-to-component/index.js.map +1 -1
- package/schematics/fixture-to-component/schema.d.ts.map +1 -1
- package/schematics/ng-add/fixture/index.d.ts.map +1 -1
- package/schematics/ng-add/fixture/index.js +4 -5
- package/schematics/ng-add/fixture/index.js.map +1 -1
- package/schematics/ng-add/index.d.ts.map +1 -1
- package/schematics/ng-add/index.js +16 -23
- 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 +5 -5
- package/schematics/ng-add/playwright/index.js.map +1 -1
- package/schematics/ng-add/schema.d.ts.map +1 -1
- package/schematics/ng-update/v9-0/index.d.ts.map +1 -1
- package/schematics/ng-update/v9-0/index.js +1 -1
- package/schematics/ng-update/v9-0/index.js.map +1 -1
- package/schematics/ng-update/v9-0/localization-imports/localization-imports-map.d.ts.map +1 -1
- package/schematics/ng-update/v9-0/localization-imports/localization-imports-map.js.map +1 -1
- package/schematics/ng-update/v9-0/localization-imports/localization-imports.d.ts.map +1 -1
- package/schematics/ng-update/v9-0/localization-imports/localization-imports.js +1 -2
- package/schematics/ng-update/v9-0/localization-imports/localization-imports.js.map +1 -1
- package/schematics/ng-update/v9-0/throw-on-undefined/throw-on-undefined.d.ts.map +1 -1
- package/schematics/ng-update/v9-0/throw-on-undefined/throw-on-undefined.js +13 -13
- package/schematics/ng-update/v9-0/throw-on-undefined/throw-on-undefined.js.map +1 -1
- package/schematics/playwright/sanity/index.d.ts.map +1 -1
- package/schematics/playwright/sanity/index.js.map +1 -1
- package/schematics/playwright/sanity/schema.d.ts.map +1 -1
- package/schematics/playwright/scenario/index.d.ts.map +1 -1
- package/schematics/playwright/scenario/index.js.map +1 -1
- package/schematics/playwright/scenario/schema.d.ts.map +1 -1
- package/store/testable-select.d.ts +1 -1
- package/store/testable-select.d.ts.map +1 -1
- package/store/testable-select.js +3 -2
- package/store/testable-select.js.map +1 -1
- package/store/typings.d.ts.map +1 -1
- package/store/typings.js.map +1 -1
- package/tools/index.d.ts +1 -1
- package/tools/index.d.ts.map +1 -1
- package/tools/index.js +1 -1
- package/tools/index.js.map +1 -1
- package/tools/path-replacement/path-replacement.d.ts.map +1 -1
- package/tools/path-replacement/path-replacement.js +6 -7
- package/tools/path-replacement/path-replacement.js.map +1 -1
- package/tools/protractor/fetch-manager/utils.d.ts.map +1 -1
- package/tools/protractor/fetch-manager/utils.js.map +1 -1
- package/tools/protractor/post-message-interceptor/post-message-interceptor.d.ts.map +1 -1
- package/tools/protractor/post-message-interceptor/post-message-interceptor.js.map +1 -1
- package/visual-test/utils.d.ts +2 -2
- package/visual-test/utils.js +3 -3
- package/visual-test/utils.js.map +1 -1
- package/visual-test/visual-test.d.ts +1 -1
- package/visual-test/visual-test.d.ts.map +1 -1
- package/visual-test/visual-test.js +6 -6
- package/visual-test/visual-test.js.map +1 -1
|
@@ -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,sCAIoB;AAEpB;;GAEG;AACH;IAAqC,2CAAU;IAC7C,yBAAY,aAAmD;QAC7D,OAAA,MAAK,YAAC,aAAa,CAAC,SAAC;IACvB,CAAC;IAED,kBAAkB;IACL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AAM,IAAI,oBAAU,CAAC,cAAc,CAAC,CAAC,KAAK,EAAE,EAAA;;wBAA5C,SAA4C,CAAC;wBAC7C,sBAAO,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,EAAC;6BAGjD,sBAAO,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,0DAA0D,CAAC,CAAC,EAAC;;;;KAC9F;IACH,sBAAC;AAAD,CAAC,AA5BD,CAAqC,oBAAU,GA4B9C;AA5BY,0CAAe","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: PlaywrightSourceElement = { element: matOptions.nth(0), page: this.sourceElement.page };\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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select-material.d.ts","sourceRoot":"","sources":["../../../../src/core/playwright/angular-materials/select-material.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"select-material.d.ts","sourceRoot":"","sources":["../../../../src/core/playwright/angular-materials/select-material.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EACjB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,UAAU,EACV,uBAAuB,EACxB,MAAM,YAAY,CAAC;AAEpB;;GAEG;AACH,qBAAa,SAAU,SAAQ,UAAW,YAAW,gBAAgB;gBACvD,aAAa,EAAE,uBAAuB,GAAG,UAAU;IAI/D,kBAAkB;IACL,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,SAAO;IAaxD,kBAAkB;IACL,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,SAAO;IAexD,kBAAkB;IACL,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,SAAO;IAgBxD,kBAAkB;IACX,QAAQ,IAAI,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;CAG/C"}
|
|
@@ -33,7 +33,7 @@ var MatSelect = /** @class */ (function (_super) {
|
|
|
33
33
|
return [2 /*return*/, option.click()];
|
|
34
34
|
}
|
|
35
35
|
else {
|
|
36
|
-
return [2 /*return*/, Promise.reject("Option with index ".concat(index, " not found in select element."))];
|
|
36
|
+
return [2 /*return*/, Promise.reject(new Error("Option with index ".concat(index, " not found in select element.")))];
|
|
37
37
|
}
|
|
38
38
|
return [2 /*return*/];
|
|
39
39
|
}
|
|
@@ -72,7 +72,7 @@ var MatSelect = /** @class */ (function (_super) {
|
|
|
72
72
|
case 6:
|
|
73
73
|
i++;
|
|
74
74
|
return [3 /*break*/, 4];
|
|
75
|
-
case 7: return [2 /*return*/, Promise.reject("Option with value ".concat(value, " not found in select element."))];
|
|
75
|
+
case 7: return [2 /*return*/, Promise.reject(new Error("Option with value ".concat(value, " not found in select element.")))];
|
|
76
76
|
}
|
|
77
77
|
});
|
|
78
78
|
});
|
|
@@ -109,7 +109,7 @@ var MatSelect = /** @class */ (function (_super) {
|
|
|
109
109
|
case 6:
|
|
110
110
|
i++;
|
|
111
111
|
return [3 /*break*/, 4];
|
|
112
|
-
case 7: return [2 /*return*/, Promise.reject("Option with label ".concat(label, " not found in select element."))];
|
|
112
|
+
case 7: return [2 /*return*/, Promise.reject(new Error("Option with label ".concat(label, " not found in select element.")))];
|
|
113
113
|
}
|
|
114
114
|
});
|
|
115
115
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select-material.js","sourceRoot":"","sources":["../../../../src/core/playwright/angular-materials/select-material.ts"],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"select-material.js","sourceRoot":"","sources":["../../../../src/core/playwright/angular-materials/select-material.ts"],"names":[],"mappings":";;;;AAGA,sCAGoB;AAEpB;;GAEG;AACH;IAA+B,qCAAU;IACvC,mBAAY,aAAmD;QAC7D,OAAA,MAAK,YAAC,aAAa,CAAC,SAAC;IACvB,CAAC;IAED,kBAAkB;IACL,iCAAa,GAA1B;oEAA2B,KAAa,EAAE,OAAc;;YAAd,wBAAA,EAAA,cAAc;;;4BACtD,qBAAM,IAAI,CAAC,KAAK,EAAE,EAAA;;wBAAlB,SAAkB,CAAC;wBACb,OAAO,GAAG,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;wBAC9D,qBAAM,OAAO,CAAC,KAAK,EAAE,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,SAAA,EAAE,CAAC,EAAA;;wBAA7D,SAA6D,CAAC;wBACzD,qBAAM,OAAO,CAAC,KAAK,EAAE,EAAA;;wBAA1B,IAAI,CAAC,SAAqB,CAAC,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC;4BACnC,cAAc,GAA4B,EAAE,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC;4BACzG,MAAM,GAAG,IAAI,oBAAU,CAAC,cAAc,CAAC,CAAC;4BAC9C,s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Implementation dedicated to Playwright.\n */\nexport class MatSelect extends O3rElement implements MatSelectProfile {\n constructor(sourceElement: PlaywrightSourceElement | O3rElement) {\n super(sourceElement);\n }\n\n /** @inheritdoc */\n public async selectByIndex(index: number, timeout = 5000) {\n await this.click();\n const options = this.sourceElement.page.locator('mat-option');\n await options.first().waitFor({ state: 'attached', timeout });\n if ((await options.count()) >= index + 1) {\n const selectedOption: PlaywrightSourceElement = { element: options.nth(index), page: this.sourceElement.page };\n const option = new O3rElement(selectedOption);\n return option.click();\n } else {\n return Promise.reject(new Error(`Option with index ${index} not found in select element.`));\n }\n }\n\n /** @inheritdoc */\n public async selectByValue(value: string, timeout = 5000) {\n await this.click();\n const options = this.sourceElement.page.locator('mat-option');\n await options.first().waitFor({ state: 'attached', timeout });\n const optionsCount = await options.count();\n for (let i = 0; i < optionsCount; i++) {\n const selectedOption: PlaywrightSourceElement = { element: options.nth(i), page: this.sourceElement.page };\n const option = new O3rElement(selectedOption);\n if (await option.getAttribute('ng-reflect-value') === value) {\n return option.click();\n }\n }\n return Promise.reject(new Error(`Option with value ${value} not found in select element.`));\n }\n\n /** @inheritdoc */\n public async selectByLabel(label: string, timeout = 5000) {\n await this.click();\n const options = this.sourceElement.page.locator('mat-option');\n await options.first().waitFor({ state: 'attached', timeout });\n const optionsCount = await options.count();\n for (let i = 0; i < optionsCount; i++) {\n const selectedOption: PlaywrightSourceElement = { element: options.nth(i), page: this.sourceElement.page };\n const option = new O3rElement(selectedOption);\n if (await option.getText() === label) {\n return option.click();\n }\n }\n\n return Promise.reject(new Error(`Option with label ${label} not found in select element.`));\n }\n\n /** @inheritDoc */\n public getValue(): Promise<string | undefined> {\n throw new Error('Cannot use \"getValue\" function on a Material Select element. Use \"getPlainText()\" instead.');\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slider-material.d.ts","sourceRoot":"","sources":["../../../../src/core/playwright/angular-materials/slider-material.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"slider-material.d.ts","sourceRoot":"","sources":["../../../../src/core/playwright/angular-materials/slider-material.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,gBAAgB,EACjB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,UAAU,EACV,KAAK,uBAAuB,EAC7B,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,gBAAgB,EACjB,MAAM,aAAa,CAAC;AAKrB;;GAEG;AACH,qBAAa,SAAU,SAAQ,gBAAiB,YAAW,gBAAgB;gBAC7D,aAAa,EAAE,uBAAuB,GAAG,UAAU;CAGhE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slider-material.js","sourceRoot":"","sources":["../../../../src/core/playwright/angular-materials/slider-material.ts"],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"slider-material.js","sourceRoot":"","sources":["../../../../src/core/playwright/angular-materials/slider-material.ts"],"names":[],"mappings":";;;;AAUA,wCAEqB;AAErB,IAAM,WAAW,GAA4B,mBAAmB,CAAC;AACjE,IAAM,WAAW,GAA4B,mBAAmB,CAAC;AAEjE;;GAEG;AACH;IAA+B,qCAAgB;IAC7C,mBAAY,aAAmD;QAC7D,OAAA,MAAK,YAAC,aAAa,EAAE,WAAI,WAAW,CAAE,EAAE,WAAI,WAAW,CAAE,CAAC,SAAC;IAC7D,CAAC;IACH,gBAAC;AAAD,CAAC,AAJD,CAA+B,2BAAgB,GAI9C;AAJY,8BAAS","sourcesContent":["import type {\n cssClasses,\n} from '@material/slider';\nimport type {\n MatSliderProfile,\n} from '../../angular-materials';\nimport {\n O3rElement,\n type PlaywrightSourceElement,\n} from '../element';\nimport {\n O3rSliderElement,\n} from '../elements';\n\nconst TRACK_CLASS: typeof cssClasses.TRACK = 'mdc-slider__track';\nconst THUMB_CLASS: typeof cssClasses.THUMB = 'mdc-slider__thumb';\n\n/**\n * Implementation dedicated to Playwright.\n */\nexport class MatSlider extends O3rSliderElement implements MatSliderProfile {\n constructor(sourceElement: PlaywrightSourceElement | O3rElement) {\n super(sourceElement, `.${TRACK_CLASS}`, `.${THUMB_CLASS}`);\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component-fixture.d.ts","sourceRoot":"","sources":["../../../src/core/playwright/component-fixture.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"component-fixture.d.ts","sourceRoot":"","sources":["../../../src/core/playwright/component-fixture.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,uBAAuB,EACxB,MAAM,sBAAsB,CAAC;AAI9B,OAAO,EACL,UAAU,EACV,qBAAqB,EAEtB,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,QAAQ,EACR,mBAAmB,EACpB,MAAM,SAAS,CAAC;AAEjB,YAAY,EAAE,uBAAuB,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEtG;;GAEG;AACH,qBAAa,mBAAmB,CAAC,CAAC,SAAS,UAAU,GAAG,UAAU,CAAE,YAAW,uBAAuB,CAAC,CAAC,CAAC;IACvG;;OAEG;IACH,SAAS,CAAC,WAAW,EAAE,CAAC,CAAC;IAEzB;;;;OAIG;gBACS,WAAW,EAAE,CAAC;IAI1B;;;;;OAKG;cACa,uBAAuB,CAAC,CAAC,SAAS,UAAU,EAAE,OAAO,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC;IAQxG;;;;;OAKG;IACH,SAAS,CAAC,gBAAgB,CAAC,CAAC,SAAS,UAAU,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC;IAUnG;;;;;;;;OAQG;cACa,gBAAgB,CAC9B,QAAQ,EAAE,MAAM,EAChB,kBAAkB,CAAC,EAAE,qBAAqB,CAAC,UAAU,CAAC,EACtD,OAAO,GAAE;QACP,KAAK,CAAC,EAA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AG,OAAO,CAAC,OAAO,CAAC;CAI3D"}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.O3rComponentFixture = void 0;
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
|
-
/* eslint-disable new-cap */
|
|
6
5
|
var index_1 = require("../../errors/index");
|
|
7
6
|
var helpers_1 = require("../helpers");
|
|
8
7
|
var element_1 = require("./element");
|
|
@@ -78,17 +77,9 @@ var O3rComponentFixture = /** @class */ (function () {
|
|
|
78
77
|
if (options === void 0) { options = {}; }
|
|
79
78
|
return tslib_1.__generator(this, function (_a) {
|
|
80
79
|
switch (_a.label) {
|
|
81
|
-
case 0:
|
|
82
|
-
if (!(options.index !== undefined)) return [3 /*break*/, 2];
|
|
83
|
-
return [4 /*yield*/, this.queryNth(selector, options.index, elementConstructor)];
|
|
80
|
+
case 0: return [4 /*yield*/, (options.index === undefined ? this.query(selector, elementConstructor) : this.queryNth(selector, options.index, elementConstructor))];
|
|
84
81
|
case 1:
|
|
85
82
|
element = _a.sent();
|
|
86
|
-
return [3 /*break*/, 4];
|
|
87
|
-
case 2: return [4 /*yield*/, this.query(selector, elementConstructor)];
|
|
88
|
-
case 3:
|
|
89
|
-
element = _a.sent();
|
|
90
|
-
_a.label = 4;
|
|
91
|
-
case 4:
|
|
92
83
|
if (options.shouldThrowIfNotPresent) {
|
|
93
84
|
return [2 /*return*/, this.throwOnUndefinedElement(element, options.timeout)];
|
|
94
85
|
}
|
|
@@ -227,6 +218,7 @@ var O3rComponentFixture = /** @class */ (function () {
|
|
|
227
218
|
case 4: return [2 /*return*/, elements];
|
|
228
219
|
case 5:
|
|
229
220
|
err_1 = _a.sent();
|
|
221
|
+
// eslint-disable-next-line no-console -- no other logger available
|
|
230
222
|
console.warn("Failed to query all ".concat(selector), err_1);
|
|
231
223
|
return [2 /*return*/, Promise.resolve([])];
|
|
232
224
|
case 6: return [2 /*return*/];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component-fixture.js","sourceRoot":"","sources":["../../../src/core/playwright/component-fixture.ts"],"names":[],"mappings":";;;;AAAA,4BAA4B;AAC5B,4CAAuD;AAEvD,sCAAyC;AACzC,qCAAuF;AAKvF;;GAEG;AACH;IAOE;;;;OAIG;IACH,6BAAY,WAAc;QACxB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACjC,CAAC;IAED;;;;;OAKG;IACa,qDAAuB,GAAvC,UAA8D,OAAW,EAAE,OAAgB;;;;;wBACzF,IAAI,CAAC,OAAO,EAAE,CAAC;4BACb,MAAM,IAAI,KAAK,CAAC,uBAAuB,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;wBACnE,CAAC;wBACD,qBAAM,OAAO,CAAC,aAAa,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC,OAAO,CAAC,EAAC,KAAK,EAAE,UAAU,EAAE,OAAO,SAAA,EAAC,CAAC,EAAA;;wBAAjF,SAAiF,CAAC;wBAClF,sBAAO,OAAO,EAAC;;;;KAChB;IAED;;;;;OAKG;IACO,8CAAgB,GAA1B,UAAiD,OAAmB,EAAE,OAAgB;QAAtF,iBAQC;QAPC,OAAO,IAAA,qBAAW,EAChB,CAAC;;;;4BACY,qBAAM,OAAO,EAAA;;wBAAlB,EAAE,GAAG,SAAa;wBACxB,qBAAM,EAAE,CAAC,aAAa,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC,OAAO,CAAC,EAAC,KAAK,EAAE,UAAU,EAAC,CAAC,EAAA;;wBAAnE,SAAmE,CAAC;wBACpE,sBAAO,EAAE,EAAC;;;aACX,CAAC,EAAE,EACJ,OAAO,CAAC,CAAC;IACb,CAAC;IAED;;;;;;;;OAQG;IACa,8CAAgB,GAAhC;oEACE,QAAgB,EAChB,kBAAsD,EACtD,OAIM;;YAJN,wBAAA,EAAA,YAIM;;;;6BAGF,CAAA,OAAO,CAAC,KAAK,KAAK,SAAS,CAAA,EAA3B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AO,CAAC,IAAI,CAAC,8BAAuB,QAAQ,CAAE,EAAE,KAAG,CAAC,CAAC;wBACrD,sBAAO,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,EAAC;;;;;KAE9B;IAED,kBAAkB;IACX,wCAAU,GAAjB;QACE,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IAED,kBAAkB;IACX,8CAAgB,GAAvB;QACE,OAAO,OAAO,CAAC,OAAO,CAAC,EAAC,KAAK,EAAE,CAAC,IAAI,CAAC,EAAC,CAAC,CAAC;IAC1C,CAAC;IAED,kBAAkB;IACX,6CAAe,GAAtB,UAAuB,QAAgB;QACrC,IAAM,OAAO,GAAG,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,CAAC;QACjF,OAAO,OAAO,CAAC,QAAQ,EAAE,CAAC;IAC5B,CAAC;IACH,0BAAC;AAAD,CAAC,AAnND,IAmNC;AAnNY,kDAAmB","sourcesContent":["/* eslint-disable new-cap */\nimport { FixtureUsageError } from '../../errors/index';\nimport type { ComponentFixtureProfile } from '../component-fixture';\nimport { withTimeout } from '../helpers';\nimport { O3rElement, O3rElementConstructor, PlaywrightSourceElement } from './element';\nimport { O3rGroup, O3rGroupConstructor } from './group';\n\nexport type { ComponentFixtureProfile, Constructable, FixtureWithCustom } from '../component-fixture';\n\n/**\n * Implementation of the fixture dedicated to Playwright, hence using the webdriver to interact with the dom.\n */\nexport class O3rComponentFixture<V extends O3rElement = O3rElement> implements ComponentFixtureProfile<V> {\n\n /**\n * DOM element linked to the fixture.\n */\n protected rootElement: V;\n\n /**\n * Root element of this fixture.\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 this.rootElement = rootElement;\n }\n\n /**\n * Throws an exception if the element is undefined.\n * Otherwise returns the element.\n * @param element ElementProfile to test\n * @param timeout specific timeout that will throw when reach\n */\n protected async throwOnUndefinedElement<T extends O3rElement>(element?: T, timeout?: number): Promise<T> {\n if (!element) {\n throw new Error('Element not found in ' + this.constructor.name);\n }\n await element.sourceElement.element.first().waitFor({state: 'attached', timeout});\n return element;\n }\n\n /**\n * Throws an exception if the element is undefined.\n * Otherwise returns the element.\n * @param element ElementProfile to test\n * @param timeout specific timeout that will throw when reach\n */\n protected throwOnUndefined<T extends O3rElement>(element: Promise<T>, timeout?: number): Promise<T> {\n return withTimeout(\n (async () => {\n const el = await element;\n await el.sourceElement.element.first().waitFor({state: 'attached'});\n return el;\n })(),\n timeout);\n }\n\n /**\n * Get the element associated to the selector if present\n * @param selector Selector to access the element\n * @param elementConstructor Constructor that will be used to create the Element, defaults to O3rElement\n * @param options Options supported\n * @param options.index index Select the element associated to the index\n * @param options.shouldThrowIfNotPresent If set to true the function will throw if the element is not present\n * @param options.timeout Duration to wait for the element to be present before it throws\n */\n protected async queryWithOptions(\n selector: string,\n elementConstructor?: O3rElementConstructor<O3rElement>,\n options: {\n index?: number;\n shouldThrowIfNotPresent?: boolean;\n timeout?: number;\n } = {}\n ): Promise<O3rElement> {\n let element: O3rElement;\n if (options.index !== undefined) {\n element = await this.queryNth(selector, options.index, elementConstructor as any);\n } else {\n element = await this.query(selector, elementConstructor as any);\n }\n if (options.shouldThrowIfNotPresent) {\n return this.throwOnUndefinedElement<O3rElement>(element, options.timeout);\n }\n return element;\n }\n\n /**\n * Get text from the element associated to the given selector, or undefined if the element is not found or not visible\n * @param selector Selector to access the element\n * @param options Options supported\n * @param options.elementConstructor Constructor that will be used to create the Element, defaults to O3rElement\n * @param options.index index Select the element associated to the index\n * @param options.shouldThrowIfNotPresent If set to true the function will throw if the element is not present\n * @param options.timeout Duration to wait for the element to be present before it throws\n */\n protected async getText<T extends O3rElement>(selector: string, options: {\n elementConstructor?: O3rElementConstructor<T>;\n index?: number;\n shouldThrowIfNotPresent?: boolean;\n timeout?: number;\n } = {}): Promise<string | undefined> {\n const element = await this.queryWithOptions(selector, options.elementConstructor, options);\n if (!await element.isVisible()) {\n return;\n }\n return await element.getText();\n }\n\n /**\n * Check if the element associated to the given selector is visible\n * @param selector Selector to access the element\n * @param options Options supported\n * @param options.elementConstructor Constructor that will be used to create the Element, defaults to O3rElement\n * @param options.index index Select the element associated to the index\n * @param options.shouldThrowIfNotPresent If set to true the function will throw if the element is not present\n * @param options.timeout Duration to wait for the element to be present before it throws\n */\n protected async isVisible<T extends O3rElement>(selector: string, options: {\n elementConstructor?: O3rElementConstructor<T> | undefined;\n index?: number;\n shouldThrowIfNotPresent?: boolean;\n timeout?: number;\n } = {}): Promise<boolean> {\n const element = await this.queryWithOptions(selector, options.elementConstructor, options);\n return await element.isVisible();\n }\n\n /**\n * Click on the element associated to the given selector if it exists and is visible\n * @param selector Selector to access the element\n * @param options Options supported\n * @param options.elementConstructor Constructor that will be used to create the Element, defaults to O3rElement\n * @param options.index index Select the element associated to the index\n * @param options.shouldThrowIfNotPresent If set to true the function will throw if the element is not present\n * @param options.timeout Duration to wait for the element to be present before it throws\n */\n protected async click<T extends O3rElement>(selector: string, options: {\n elementConstructor?: O3rElementConstructor<T> | undefined;\n index?: number;\n shouldThrowIfNotPresent?: boolean;\n timeout?: number;\n } = {}): Promise<void> {\n const element = await this.queryWithOptions(selector, options.elementConstructor, options);\n if (await element.isVisible()) {\n await element.click();\n }\n }\n\n /** @inheritdoc */\n public query(selector: string, returnType?: undefined): Promise<O3rElement>;\n public query<T extends O3rElement>(selector: string, returnType: O3rElementConstructor<T>): Promise<T>;\n public query<T extends O3rElement>(selector: string, returnType: O3rElementConstructor<T> | undefined): Promise<T | O3rElement> {\n const elements = this.rootElement.sourceElement.element.locator(selector);\n const element = elements.first();\n const selectedElement: PlaywrightSourceElement = {element: element, page: this.rootElement.sourceElement.page};\n return Promise.resolve(new (returnType || O3rElement)(selectedElement));\n }\n\n /** @inheritdoc */\n public queryNth(selector: string, index: number, returnType?: undefined): Promise<O3rElement>;\n public queryNth<T extends O3rElement>(selector: string, index: number, returnType: O3rElementConstructor<T>): Promise<T>;\n public queryNth<T extends O3rElement>(selector: string, index: number, returnType: O3rElementConstructor<T> | undefined): Promise<T | O3rElement> {\n const elements = this.rootElement.sourceElement.element.locator(selector);\n const element = elements.nth(index);\n const selectedElement: PlaywrightSourceElement = {element: element, page: this.rootElement.sourceElement.page};\n return Promise.resolve(new (returnType || O3rElement)(selectedElement));\n }\n\n /** @inheritdoc */\n public async queryAll(_selector: string, _returnType?: undefined, groupType?: undefined, timeout?: number): Promise<O3rElement[]>;\n public async queryAll<T extends O3rElement>(selector: string, returnType: O3rElementConstructor<T>, groupType?: undefined, timeout?: number): Promise<T[]>;\n public async queryAll<T extends O3rElement, K extends O3rGroup<T>>(selector: string, returnType: O3rElementConstructor<T>, groupType: O3rGroupConstructor<K, T>, timeout?: number): Promise<K>;\n public async queryAll<T extends O3rElement, K extends O3rGroup<T>>(\n selector: string,\n returnType: O3rElementConstructor<T> | undefined,\n groupType: O3rGroupConstructor<K, T> | undefined,\n timeout = 5000\n ): Promise<(T | O3rElement)[] | K> {\n try {\n const sourceElement = this.rootElement.sourceElement.element;\n const pElements = sourceElement.locator(selector);\n // Mandatory because count is not reliable if we don't wait for the list to be attached\n await pElements.first().waitFor({state: 'attached', timeout});\n const pElementsCount = await pElements.count();\n const elements = [];\n for (let i = 0; i < pElementsCount; i++) {\n const selectedElement: PlaywrightSourceElement = {element: pElements.nth(i), page: this.rootElement.sourceElement.page};\n elements.push(returnType ? new returnType(selectedElement) : new O3rElement(selectedElement));\n }\n if (groupType) {\n const group = new groupType(elements as T[]);\n const isValid = await group.isValidGroup();\n\n if (!isValid) {\n throw new FixtureUsageError('invalid group of items');\n }\n return group;\n }\n\n return elements;\n } catch (err) {\n console.warn(`Failed to query all ${selector}`, err);\n return Promise.resolve([]);\n }\n }\n\n /** @inheritdoc */\n public getElement() {\n return this.rootElement;\n }\n\n /** @inheritdoc */\n public getSubComponents(): Promise<{[componentName: string]: ComponentFixtureProfile[]}> {\n return Promise.resolve({block: [this]});\n }\n\n /** @inheritDoc */\n public queryNotPresent(selector: string): Promise<boolean> {\n const element = this.rootElement.sourceElement.element.locator(selector).first();\n return element.isHidden();\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"component-fixture.js","sourceRoot":"","sources":["../../../src/core/playwright/component-fixture.ts"],"names":[],"mappings":";;;;AAAA,4CAE4B;AAI5B,sCAEoB;AACpB,qCAImB;AAQnB;;GAEG;AACH;IAME;;;;OAIG;IACH,6BAAY,WAAc;QACxB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACjC,CAAC;IAED;;;;;OAKG;IACa,qDAAuB,GAAvC,UAA8D,OAAW,EAAE,OAAgB;;;;;wBACzF,IAAI,CAAC,OAAO,EAAE,CAAC;4BACb,MAAM,IAAI,KAAK,CAAC,uBAAuB,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;wBACnE,CAAC;wBACD,qBAAM,OAAO,CAAC,aAAa,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,SAAA,EAAE,CAAC,EAAA;;wBAAnF,SAAmF,CAAC;wBACpF,sBAAO,OAAO,EAAC;;;;KAChB;IAED;;;;;OAKG;IACO,8CAAgB,GAA1B,UAAiD,OAAmB,EAAE,OAAgB;QAAtF,iBAQC;QAPC,OAAO,IAAA,qBAAW,EAChB,CAAC;;;;4BACY,qBAAM,OAAO,EAAA;;wBAAlB,EAAE,GAAG,SAAa;wBACxB,qBAAM,EAAE,CAAC,aAAa,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,EAAA;;wBAArE,SAAqE,CAAC;wBACtE,sBAAO,EAAE,EAAC;;;aACX,CAAC,EAAE,EACJ,OAAO,CAAC,CAAC;IACb,CAAC;IAED;;;;;;;;OAQG;IACa,8CAAgB,GAAhC;oEACE,QAAgB,EAChB,kBAAs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,EAAC;4BAGf,sBAAO,QAAQ,EAAC;;;wBAEhB,mEAAmE;wBACnE,OAAO,CAAC,IAAI,CAAC,8BAAuB,QAAQ,CAAE,EAAE,KAAG,CAAC,CAAC;wBACrD,sBAAO,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,EAAC;;;;;KAE9B;IAED,kBAAkB;IACX,wCAAU,GAAjB;QACE,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IAED,kBAAkB;IACX,8CAAgB,GAAvB;QACE,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC5C,CAAC;IAED,kBAAkB;IACX,6CAAe,GAAtB,UAAuB,QAAgB;QACrC,IAAM,OAAO,GAAG,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,CAAC;QACjF,OAAO,OAAO,CAAC,QAAQ,EAAE,CAAC;IAC5B,CAAC;IACH,0BAAC;AAAD,CAAC,AA9MD,IA8MC;AA9MY,kDAAmB","sourcesContent":["import {\n FixtureUsageError,\n} from '../../errors/index';\nimport type {\n ComponentFixtureProfile,\n} from '../component-fixture';\nimport {\n withTimeout,\n} from '../helpers';\nimport {\n O3rElement,\n O3rElementConstructor,\n PlaywrightSourceElement,\n} from './element';\nimport {\n O3rGroup,\n O3rGroupConstructor,\n} from './group';\n\nexport type { ComponentFixtureProfile, Constructable, FixtureWithCustom } from '../component-fixture';\n\n/**\n * Implementation of the fixture dedicated to Playwright, hence using the webdriver to interact with the dom.\n */\nexport class O3rComponentFixture<V extends O3rElement = O3rElement> implements ComponentFixtureProfile<V> {\n /**\n * DOM element linked to the fixture.\n */\n protected rootElement: V;\n\n /**\n * Root element of this fixture.\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 this.rootElement = rootElement;\n }\n\n /**\n * Throws an exception if the element is undefined.\n * Otherwise returns the element.\n * @param element ElementProfile to test\n * @param timeout specific timeout that will throw when reach\n */\n protected async throwOnUndefinedElement<T extends O3rElement>(element?: T, timeout?: number): Promise<T> {\n if (!element) {\n throw new Error('Element not found in ' + this.constructor.name);\n }\n await element.sourceElement.element.first().waitFor({ state: 'attached', timeout });\n return element;\n }\n\n /**\n * Throws an exception if the element is undefined.\n * Otherwise returns the element.\n * @param element ElementProfile to test\n * @param timeout specific timeout that will throw when reach\n */\n protected throwOnUndefined<T extends O3rElement>(element: Promise<T>, timeout?: number): Promise<T> {\n return withTimeout(\n (async () => {\n const el = await element;\n await el.sourceElement.element.first().waitFor({ state: 'attached' });\n return el;\n })(),\n timeout);\n }\n\n /**\n * Get the element associated to the selector if present\n * @param selector Selector to access the element\n * @param elementConstructor Constructor that will be used to create the Element, defaults to O3rElement\n * @param options Options supported\n * @param options.index index Select the element associated to the index\n * @param options.shouldThrowIfNotPresent If set to true the function will throw if the element is not present\n * @param options.timeout Duration to wait for the element to be present before it throws\n */\n protected async queryWithOptions(\n selector: string,\n elementConstructor?: O3rElementConstructor<O3rElement>,\n options: {\n index?: number;\n shouldThrowIfNotPresent?: boolean;\n timeout?: number;\n } = {}\n ): Promise<O3rElement> {\n const element: O3rElement = await (options.index === undefined ? this.query(selector, elementConstructor as any) : this.queryNth(selector, options.index, elementConstructor as any));\n if (options.shouldThrowIfNotPresent) {\n return this.throwOnUndefinedElement<O3rElement>(element, options.timeout);\n }\n return element;\n }\n\n /**\n * Get text from the element associated to the given selector, or undefined if the element is not found or not visible\n * @param selector Selector to access the element\n * @param options Options supported\n * @param options.elementConstructor Constructor that will be used to create the Element, defaults to O3rElement\n * @param options.index index Select the element associated to the index\n * @param options.shouldThrowIfNotPresent If set to true the function will throw if the element is not present\n * @param options.timeout Duration to wait for the element to be present before it throws\n */\n protected async getText<T extends O3rElement>(selector: string, options: {\n elementConstructor?: O3rElementConstructor<T>;\n index?: number;\n shouldThrowIfNotPresent?: boolean;\n timeout?: number;\n } = {}): Promise<string | undefined> {\n const element = await this.queryWithOptions(selector, options.elementConstructor, options);\n if (!await element.isVisible()) {\n return;\n }\n return await element.getText();\n }\n\n /**\n * Check if the element associated to the given selector is visible\n * @param selector Selector to access the element\n * @param options Options supported\n * @param options.elementConstructor Constructor that will be used to create the Element, defaults to O3rElement\n * @param options.index index Select the element associated to the index\n * @param options.shouldThrowIfNotPresent If set to true the function will throw if the element is not present\n * @param options.timeout Duration to wait for the element to be present before it throws\n */\n protected async isVisible<T extends O3rElement>(selector: string, options: {\n elementConstructor?: O3rElementConstructor<T> | undefined;\n index?: number;\n shouldThrowIfNotPresent?: boolean;\n timeout?: number;\n } = {}): Promise<boolean> {\n const element = await this.queryWithOptions(selector, options.elementConstructor, options);\n return await element.isVisible();\n }\n\n /**\n * Click on the element associated to the given selector if it exists and is visible\n * @param selector Selector to access the element\n * @param options Options supported\n * @param options.elementConstructor Constructor that will be used to create the Element, defaults to O3rElement\n * @param options.index index Select the element associated to the index\n * @param options.shouldThrowIfNotPresent If set to true the function will throw if the element is not present\n * @param options.timeout Duration to wait for the element to be present before it throws\n */\n protected async click<T extends O3rElement>(selector: string, options: {\n elementConstructor?: O3rElementConstructor<T> | undefined;\n index?: number;\n shouldThrowIfNotPresent?: boolean;\n timeout?: number;\n } = {}): Promise<void> {\n const element = await this.queryWithOptions(selector, options.elementConstructor, options);\n if (await element.isVisible()) {\n await element.click();\n }\n }\n\n /** @inheritdoc */\n public query(selector: string, returnType?: undefined): Promise<O3rElement>;\n public query<T extends O3rElement>(selector: string, returnType: O3rElementConstructor<T>): Promise<T>;\n public query<T extends O3rElement>(selector: string, returnType: O3rElementConstructor<T> | undefined): Promise<T | O3rElement> {\n const elements = this.rootElement.sourceElement.element.locator(selector);\n const element = elements.first();\n const selectedElement: PlaywrightSourceElement = { element: element, page: this.rootElement.sourceElement.page };\n return Promise.resolve(new (returnType || O3rElement)(selectedElement));\n }\n\n /** @inheritdoc */\n public queryNth(selector: string, index: number, returnType?: undefined): Promise<O3rElement>;\n public queryNth<T extends O3rElement>(selector: string, index: number, returnType: O3rElementConstructor<T>): Promise<T>;\n public queryNth<T extends O3rElement>(selector: string, index: number, returnType: O3rElementConstructor<T> | undefined): Promise<T | O3rElement> {\n const elements = this.rootElement.sourceElement.element.locator(selector);\n const element = elements.nth(index);\n const selectedElement: PlaywrightSourceElement = { element: element, page: this.rootElement.sourceElement.page };\n return Promise.resolve(new (returnType || O3rElement)(selectedElement));\n }\n\n /** @inheritdoc */\n public async queryAll(_selector: string, _returnType?: undefined, groupType?: undefined, timeout?: number): Promise<O3rElement[]>;\n public async queryAll<T extends O3rElement>(selector: string, returnType: O3rElementConstructor<T>, groupType?: undefined, timeout?: number): Promise<T[]>;\n public async queryAll<T extends O3rElement, K extends O3rGroup<T>>(selector: string, returnType: O3rElementConstructor<T>, groupType: O3rGroupConstructor<K, T>, timeout?: number): Promise<K>;\n public async queryAll<T extends O3rElement, K extends O3rGroup<T>>(\n selector: string,\n returnType: O3rElementConstructor<T> | undefined,\n groupType: O3rGroupConstructor<K, T> | undefined,\n timeout = 5000\n ): Promise<(T | O3rElement)[] | K> {\n try {\n const sourceElement = this.rootElement.sourceElement.element;\n const pElements = sourceElement.locator(selector);\n // Mandatory because count is not reliable if we don't wait for the list to be attached\n await pElements.first().waitFor({ state: 'attached', timeout });\n const pElementsCount = await pElements.count();\n const elements = [];\n for (let i = 0; i < pElementsCount; i++) {\n const selectedElement: PlaywrightSourceElement = { element: pElements.nth(i), page: this.rootElement.sourceElement.page };\n elements.push(returnType ? new returnType(selectedElement) : new O3rElement(selectedElement));\n }\n if (groupType) {\n const group = new groupType(elements as T[]);\n const isValid = await group.isValidGroup();\n\n if (!isValid) {\n throw new FixtureUsageError('invalid group of items');\n }\n return group;\n }\n\n return elements;\n } catch (err) {\n // eslint-disable-next-line no-console -- no other logger available\n console.warn(`Failed to query all ${selector}`, err);\n return Promise.resolve([]);\n }\n }\n\n /** @inheritdoc */\n public getElement() {\n return this.rootElement;\n }\n\n /** @inheritdoc */\n public getSubComponents(): Promise<{ [componentName: string]: ComponentFixtureProfile[] }> {\n return Promise.resolve({ block: [this] });\n }\n\n /** @inheritDoc */\n public queryNotPresent(selector: string): Promise<boolean> {\n const element = this.rootElement.sourceElement.element.locator(selector).first();\n return element.isHidden();\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"element.d.ts","sourceRoot":"","sources":["../../../src/core/playwright/element.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"element.d.ts","sourceRoot":"","sources":["../../../src/core/playwright/element.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EACP,IAAI,EACL,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,cAAc,EACf,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C;;;;GAIG;AAEH,MAAM,MAAM,uBAAuB,GAAG;IACpC,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,IAAI,CAAC;CACZ,CAAC;AAEF;;;GAGG;AACH,wBAAgB,YAAY,CAAC,SAAS,EAAE,MAAM,sBAE7C;AAED;;GAEG;AACH,qBAAa,UAAW,YAAW,cAAc;IAC/C,+BAA+B;IACxB,aAAa,EAAE,uBAAuB,CAAC;gBAElC,aAAa,EAAE,uBAAuB,GAAG,UAAU;IAM/D,kBAAkB;IACX,OAAO;IAId,kBAAkB;IACL,YAAY;IAIzB,kBAAkB;IACX,YAAY,IAAI,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAIlD,kBAAkB;IACX,SAAS;IAIhB,kBAAkB;IACL,QAAQ;IAWrB,kBAAkB;IACL,QAAQ,CAAC,KAAK,EAAE,MAAM;IAMnC,kBAAkB;IACL,UAAU;IAIvB,kBAAkB;IACX,KAAK;IAIZ,kBAAkB;IACX,SAAS;IAIhB,kBAAkB;IACL,YAAY,CAAC,aAAa,EAAE,MAAM;CAIhD;AAED;;GAEG;AACH,MAAM,MAAM,qBAAqB,CAAC,CAAC,SAAS,cAAc,IAAI,KAAK,aAAa,EAAE,uBAAuB,GAAG,UAAU,KAAK,CAAC,CAAC"}
|
|
@@ -8,7 +8,7 @@ var tslib_1 = require("tslib");
|
|
|
8
8
|
* @param innerText
|
|
9
9
|
*/
|
|
10
10
|
function getPlainText(innerText) {
|
|
11
|
-
return innerText ? innerText.replace(
|
|
11
|
+
return innerText ? innerText.replace(/\r\n|\r|\n/g, ' ').replace(/\s\s+/g, ' ').trim() : undefined;
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
14
14
|
* Implementation dedicated to Playwright.
|
|
@@ -48,20 +48,21 @@ var O3rElement = /** @class */ (function () {
|
|
|
48
48
|
/** @inheritdoc */
|
|
49
49
|
O3rElement.prototype.getValue = function () {
|
|
50
50
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
51
|
-
var
|
|
52
|
-
return tslib_1.__generator(this, function (
|
|
53
|
-
switch (
|
|
51
|
+
var _a, valueByAttribute;
|
|
52
|
+
return tslib_1.__generator(this, function (_b) {
|
|
53
|
+
switch (_b.label) {
|
|
54
54
|
case 0:
|
|
55
|
-
|
|
55
|
+
_b.trys.push([0, 2, , 4]);
|
|
56
56
|
return [4 /*yield*/, this.sourceElement.element.inputValue()];
|
|
57
|
-
case 1: return [2 /*return*/,
|
|
57
|
+
case 1: return [2 /*return*/, _b.sent()];
|
|
58
58
|
case 2:
|
|
59
|
-
|
|
59
|
+
_a = _b.sent();
|
|
60
|
+
// eslint-disable-next-line no-console -- no other logger available
|
|
60
61
|
console.warn('Failed to retrieve input value');
|
|
61
62
|
return [4 /*yield*/, this.sourceElement.element.getAttribute('value')];
|
|
62
63
|
case 3:
|
|
63
|
-
valueByAttribute =
|
|
64
|
-
return [2 /*return*/, valueByAttribute
|
|
64
|
+
valueByAttribute = _b.sent();
|
|
65
|
+
return [2 /*return*/, valueByAttribute === null ? undefined : valueByAttribute];
|
|
65
66
|
case 4: return [2 /*return*/];
|
|
66
67
|
}
|
|
67
68
|
});
|
|
@@ -113,7 +114,7 @@ var O3rElement = /** @class */ (function () {
|
|
|
113
114
|
case 0: return [4 /*yield*/, this.sourceElement.element.getAttribute(attributeName)];
|
|
114
115
|
case 1:
|
|
115
116
|
attribute = _a.sent();
|
|
116
|
-
return [2 /*return*/, attribute
|
|
117
|
+
return [2 /*return*/, attribute === null ? undefined : attribute];
|
|
117
118
|
}
|
|
118
119
|
});
|
|
119
120
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"element.js","sourceRoot":"","sources":["../../../src/core/playwright/element.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"element.js","sourceRoot":"","sources":["../../../src/core/playwright/element.ts"],"names":[],"mappings":";;;AAyBA,oCAEC;;AAND;;;GAGG;AACH,SAAgB,YAAY,CAAC,SAAiB;IAC5C,OAAO,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,aAAa,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;AACrG,CAAC;AAED;;GAEG;AACH;IAIE,oBAAY,aAAmD;QAC7D,IAAI,CAAC,aAAa,GAAG,aAAa,YAAY,UAAU;YACtD,CAAC,CAAC,EAAE,OAAO,EAAE,aAAa,CAAC,aAAa,CAAC,OAAO,EAAE,IAAI,EAAE,aAAa,CAAC,aAAa,CAAC,IAAI,EAAE;YAC1F,CAAC,CAAC,aAAa,CAAC;IACpB,CAAC;IAED,kBAAkB;IACX,4BAAO,GAAd;QACE,OAAO,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC;IAChD,CAAC;IAED,kBAAkB;IACL,iCAAY,GAAzB;;;;;;wBACS,KAAA,YAAY,CAAA;wBAAC,qBAAM,IAAI,CAAC,OAAO,EAAE,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IAED,kBAAkB;IACX,8BAAS,GAAhB;QACE,OAAO,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC;IAChD,CAAC;IAED,kBAAkB;IACL,iCAAY,GAAzB,UAA0B,aAAqB;;;;;4BAC3B,qBAAM,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,YAAY,CAAC,aAAa,CAAC,EAAA;;wBAAxE,SAAS,GAAG,SAA4D;wBAC9E,sBAAO,SAAS,KAAK,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,EAAC;;;;KACnD;IACH,iBAAC;AAAD,CAAC,AArED,IAqEC;AArEY,gCAAU","sourcesContent":["import type {\n Locator,\n Page,\n} from '@playwright/test';\nimport {\n ElementProfile,\n} from '../element';\n\nexport { ElementProfile } from '../element';\n\n/**\n * Playwright type for source element\n * @param element is the DOM element\n * @param page is the tab in the browser where the test is run\n */\n\nexport type PlaywrightSourceElement = {\n element: Locator;\n page: Page;\n};\n\n/**\n * Remove text formatting (endline etc.) and return the content.\n * @param innerText\n */\nexport function getPlainText(innerText: string) {\n return innerText ? innerText.replace(/\\r\\n|\\r|\\n/g, ' ').replace(/\\s\\s+/g, ' ').trim() : undefined;\n}\n\n/**\n * Implementation dedicated to Playwright.\n */\nexport class O3rElement implements ElementProfile {\n /** Playwright sourceElement */\n public sourceElement: PlaywrightSourceElement;\n\n constructor(sourceElement: PlaywrightSourceElement | O3rElement) {\n this.sourceElement = sourceElement instanceof O3rElement\n ? { element: sourceElement.sourceElement.element, page: sourceElement.sourceElement.page }\n : sourceElement;\n }\n\n /** @inheritdoc */\n public getText() {\n return this.sourceElement.element.innerText();\n }\n\n /** @inheritdoc */\n public async getPlainText() {\n return getPlainText(await this.getText());\n }\n\n /** @inheritdoc */\n public getInnerHTML(): Promise<string | undefined> {\n return this.sourceElement.element.innerHTML();\n }\n\n /** @inheritdoc */\n public mouseOver() {\n return this.sourceElement.element.hover();\n }\n\n /** @inheritdoc */\n public async getValue() {\n try {\n return await this.sourceElement.element.inputValue();\n } catch {\n // eslint-disable-next-line no-console -- no other logger available\n console.warn('Failed to retrieve input value');\n const valueByAttribute = await this.sourceElement.element.getAttribute('value');\n return valueByAttribute === null ? undefined : valueByAttribute;\n }\n }\n\n /** @inheritdoc */\n public async setValue(input: string) {\n await this.sourceElement.element.fill(input);\n\n await this.sourceElement.element.press('Tab');\n }\n\n /** @inheritdoc */\n public async clearValue() {\n await this.sourceElement.element.fill('');\n }\n\n /** @inheritdoc */\n public click() {\n return this.sourceElement.element.click();\n }\n\n /** @inheritdoc */\n public isVisible() {\n return this.sourceElement.element.isVisible();\n }\n\n /** @inheritdoc */\n public async getAttribute(attributeName: string) {\n const attribute = await this.sourceElement.element.getAttribute(attributeName);\n return attribute === null ? undefined : attribute;\n }\n}\n\n/**\n * Constructor of a O3rElement\n */\nexport type O3rElementConstructor<T extends ElementProfile> = new (sourceElement: PlaywrightSourceElement | O3rElement) => T;\n"]}
|
|
@@ -8,7 +8,8 @@ export declare class O3rCheckboxElement extends O3rElement implements CheckboxEl
|
|
|
8
8
|
private getInputElement;
|
|
9
9
|
private getLabelElement;
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
11
|
+
* Check the checkbox element
|
|
12
|
+
* @param value If specified, determine the value of the checkbox button
|
|
12
13
|
* If the element contains a label, the label will be used to (un)check the checkbox.
|
|
13
14
|
*/
|
|
14
15
|
check(value?: boolean): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkbox-element.d.ts","sourceRoot":"","sources":["../../../../src/core/playwright/elements/checkbox-element.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"checkbox-element.d.ts","sourceRoot":"","sources":["../../../../src/core/playwright/elements/checkbox-element.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACvB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,UAAU,EACV,uBAAuB,EACxB,MAAM,YAAY,CAAC;AAEpB;;GAEG;AACH,qBAAa,kBAAmB,SAAQ,UAAW,YAAW,sBAAsB;gBACtE,aAAa,EAAE,uBAAuB,GAAG,UAAU;YAIjD,eAAe;YAYf,eAAe;IAa7B;;;;OAIG;IACU,KAAK,CAAC,KAAK,UAAO;IAc/B,kBAAkB;IACX,OAAO;IAId,kBAAkB;IACL,SAAS,IAAI,OAAO,CAAC,OAAO,CAAC;CAI3C"}
|
|
@@ -49,6 +49,7 @@ var O3rCheckboxElement = /** @class */ (function (_super) {
|
|
|
49
49
|
return [3 /*break*/, 3];
|
|
50
50
|
case 2:
|
|
51
51
|
err_1 = _a.sent();
|
|
52
|
+
// eslint-disable-next-line no-console -- no other logger available
|
|
52
53
|
console.warn('Failed to retrieve label of O3rCheckboxElement', err_1);
|
|
53
54
|
return [2 /*return*/];
|
|
54
55
|
case 3: return [2 /*return*/];
|
|
@@ -57,7 +58,8 @@ var O3rCheckboxElement = /** @class */ (function (_super) {
|
|
|
57
58
|
});
|
|
58
59
|
};
|
|
59
60
|
/**
|
|
60
|
-
*
|
|
61
|
+
* Check the checkbox element
|
|
62
|
+
* @param value If specified, determine the value of the checkbox button
|
|
61
63
|
* If the element contains a label, the label will be used to (un)check the checkbox.
|
|
62
64
|
*/
|
|
63
65
|
O3rCheckboxElement.prototype.check = function () {
|
|
@@ -74,6 +76,7 @@ var O3rCheckboxElement = /** @class */ (function (_super) {
|
|
|
74
76
|
case 2:
|
|
75
77
|
currentValue = _a.sent();
|
|
76
78
|
if (currentValue === value) {
|
|
79
|
+
// eslint-disable-next-line no-console -- no other logger available
|
|
77
80
|
console.warn("Checkbox is already ".concat(currentValue ? 'checked' : 'unchecked'));
|
|
78
81
|
return [2 /*return*/, Promise.resolve()];
|
|
79
82
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkbox-element.js","sourceRoot":"","sources":["../../../../src/core/playwright/elements/checkbox-element.ts"],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,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C,8BAAuB,YAAY,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,CAAE,CAAC,CAAC;4BAC9E,sBAAO,OAAO,CAAC,OAAO,EAAE,EAAC;wBAC3B,CAAC;wBACD,sBAAO,YAAY,CAAC,KAAK,EAAE,EAAC;4BAEtB,qBAAM,IAAI,CAAC,eAAe,EAAE,EAAA;4BAApC,sBAAO,CAAC,SAA4B,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,EAAC;;;;KACzD;IAED,kBAAkB;IACX,oCAAO,GAAd;QACE,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC3B,CAAC;IAED,kBAAkB;IACL,sCAAS,GAAtB;;;;;4BACuB,qBAAM,IAAI,CAAC,eAAe,EAAE,EAAA;;wBAA3C,YAAY,GAAG,SAA4B;wBACjD,sBAAO,YAAY,CAAC,SAAS,EAAE,EAAC;;;;KACjC;IACH,yBAAC;AAAD,CAAC,AA3DD,CAAwC,oBAAU,GA2DjD;AA3DY,gDAAkB","sourcesContent":["import {\n CheckboxElementProfile,\n} from '../../elements';\nimport {\n O3rElement,\n PlaywrightSourceElement,\n} from '../element';\n\n/**\n * Implementation dedicated to Playwright.\n */\nexport class O3rCheckboxElement extends O3rElement implements CheckboxElementProfile {\n constructor(sourceElement: PlaywrightSourceElement | O3rElement) {\n super(sourceElement);\n }\n\n private async getInputElement() {\n try {\n const subInputElement = this.sourceElement.element.locator('input[type=\"checkbox\"]');\n if (await subInputElement.count()) {\n return subInputElement;\n }\n return this.sourceElement.element;\n } catch {\n return this.sourceElement.element;\n }\n }\n\n private async getLabelElement() {\n try {\n const element = this.sourceElement.element.locator('label');\n if (await element.count()) {\n return element;\n }\n } catch (err) {\n // eslint-disable-next-line no-console -- no other logger available\n console.warn('Failed to retrieve label of O3rCheckboxElement', err);\n return;\n }\n }\n\n /**\n * Check the checkbox element\n * @param value If specified, determine the value of the checkbox button\n * If the element contains a label, the label will be used to (un)check the checkbox.\n */\n public async check(value = true) {\n const labelElement = await this.getLabelElement();\n if (labelElement) {\n const currentValue = await this.isChecked();\n if (currentValue === value) {\n // eslint-disable-next-line no-console -- no other logger available\n console.warn(`Checkbox is already ${currentValue ? 'checked' : 'unchecked'}`);\n return Promise.resolve();\n }\n return labelElement.click();\n }\n return (await this.getInputElement()).setChecked(value);\n }\n\n /** @inheritDoc */\n public uncheck() {\n return this.check(false);\n }\n\n /** @inheritDoc */\n public async isChecked(): Promise<boolean> {\n const inputElement = await this.getInputElement();\n return inputElement.isChecked();\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/playwright/elements/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/playwright/elements/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
var tslib_1 = require("tslib");
|
|
4
|
-
tslib_1.__exportStar(require("./select-element"), exports);
|
|
5
|
-
tslib_1.__exportStar(require("./radio-element"), exports);
|
|
6
4
|
tslib_1.__exportStar(require("./checkbox-element"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./radio-element"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./select-element"), exports);
|
|
7
7
|
tslib_1.__exportStar(require("./slider-element"), exports);
|
|
8
8
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/core/playwright/elements/index.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/core/playwright/elements/index.ts"],"names":[],"mappings":";;;AAAA,6DAAmC;AACnC,0DAAgC;AAChC,2DAAiC;AACjC,2DAAiC","sourcesContent":["export * from './checkbox-element';\nexport * from './radio-element';\nexport * from './select-element';\nexport * from './slider-element';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"radio-element.d.ts","sourceRoot":"","sources":["../../../../src/core/playwright/elements/radio-element.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"radio-element.d.ts","sourceRoot":"","sources":["../../../../src/core/playwright/elements/radio-element.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACpB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,UAAU,EACV,uBAAuB,EACxB,MAAM,YAAY,CAAC;AAEpB;;GAEG;AACH,qBAAa,eAAgB,SAAQ,UAAW,YAAW,mBAAmB;gBAChE,aAAa,EAAE,uBAAuB,GAAG,UAAU;IAI/D,kBAAkB;IACL,KAAK,CAAC,KAAK,UAAO;IAS/B,kBAAkB;IACL,OAAO;IAIpB,kBAAkB;IACX,SAAS,IAAI,OAAO,CAAC,OAAO,CAAC;CAGrC"}
|
|
@@ -20,6 +20,7 @@ var O3rRadioElement = /** @class */ (function (_super) {
|
|
|
20
20
|
case 0: return [4 /*yield*/, this.isChecked()];
|
|
21
21
|
case 1:
|
|
22
22
|
if ((_a.sent()) === value) {
|
|
23
|
+
// eslint-disable-next-line no-console -- no other logger available
|
|
23
24
|
console.warn("O3rRadioELement is already ".concat(value ? 'checked' : 'unchecked'));
|
|
24
25
|
return [2 /*return*/];
|
|
25
26
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"radio-element.js","sourceRoot":"","sources":["../../../../src/core/playwright/elements/radio-element.ts"],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"radio-element.js","sourceRoot":"","sources":["../../../../src/core/playwright/elements/radio-element.ts"],"names":[],"mappings":";;;;AAGA,sCAGoB;AAEpB;;GAEG;AACH;IAAqC,2CAAU;IAC7C,yBAAY,aAAmD;QAC7D,OAAA,MAAK,YAAC,aAAa,CAAC,SAAC;IACvB,CAAC;IAED,kBAAkB;IACL,+BAAK,GAAlB;oEAAmB,KAAY;YAAZ,sBAAA,EAAA,YAAY;;;4BACxB,qBAAM,IAAI,CAAC,SAAS,EAAE,EAAA;;wBAA3B,IAAI,CAAC,SAAsB,CAAC,KAAK,KAAK,EAAE,CAAC;4BACvC,mEAAmE;4BACnE,OAAO,CAAC,IAAI,CAAC,qCAA8B,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,CAAE,CAAC,CAAC;4BAC9E,sBAAO;wBACT,CAAC;wBACD,sBAAO,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,EAAC;;;;KACrD;IAED,kBAAkB;IACL,iCAAO,GAApB;;;gBACE,sBAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,EAAC;;;KAC1B;IAED,kBAAkB;IACX,mCAAS,GAAhB;QACE,OAAO,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC;IAChD,CAAC;IACH,sBAAC;AAAD,CAAC,AAxBD,CAAqC,oBAAU,GAwB9C;AAxBY,0CAAe","sourcesContent":["import {\n RadioElementProfile,\n} from '../../elements';\nimport {\n O3rElement,\n PlaywrightSourceElement,\n} from '../element';\n\n/**\n * Implementation dedicated to Playwright.\n */\nexport class O3rRadioElement extends O3rElement implements RadioElementProfile {\n constructor(sourceElement: PlaywrightSourceElement | O3rElement) {\n super(sourceElement);\n }\n\n /** @inheritDoc */\n public async check(value = true) {\n if ((await this.isChecked()) === value) {\n // eslint-disable-next-line no-console -- no other logger available\n console.warn(`O3rRadioELement is already ${value ? 'checked' : 'unchecked'}`);\n return;\n }\n return this.sourceElement.element.setChecked(value);\n }\n\n /** @inheritDoc */\n public async uncheck() {\n return this.check(false);\n }\n\n /** @inheritDoc */\n public isChecked(): Promise<boolean> {\n return this.sourceElement.element.isChecked();\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select-element.d.ts","sourceRoot":"","sources":["../../../../src/core/playwright/elements/select-element.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"select-element.d.ts","sourceRoot":"","sources":["../../../../src/core/playwright/elements/select-element.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,uBAAuB,EACxB,MAAM,YAAY,CAAC;AAEpB;;GAEG;AACH,qBAAa,gBAAiB,SAAQ,UAAU;gBAClC,aAAa,EAAE,uBAAuB,GAAG,UAAU;IAI/D,kBAAkB;IACX,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM;IAIrD,kBAAkB;IACX,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM;IAIrD,kBAAkB;IACL,QAAQ;CAGtB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select-element.js","sourceRoot":"","sources":["../../../../src/core/playwright/elements/select-element.ts"],"names":[],"mappings":";;;;AAAA,
|
|
1
|
+
{"version":3,"file":"select-element.js","sourceRoot":"","sources":["../../../../src/core/playwright/elements/select-element.ts"],"names":[],"mappings":";;;;AAAA,sCAGoB;AAEpB;;GAEG;AACH;IAAsC,4CAAU;IAC9C,0BAAY,aAAmD;QAC7D,OAAA,MAAK,YAAC,aAAa,CAAC,SAAC;IACvB,CAAC;IAED,kBAAkB;IACX,wCAAa,GAApB,UAAqB,KAAa,EAAE,QAAiB;QACnD,OAAO,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,KAAK,OAAA,EAAE,CAAC,CAAC;IAC5D,CAAC;IAED,kBAAkB;IACX,wCAAa,GAApB,UAAqB,KAAa,EAAE,QAAiB;QACnD,OAAO,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,KAAK,OAAA,EAAE,CAAC,CAAC;IAC5D,CAAC;IAED,kBAAkB;IACL,mCAAQ,GAArB;;;gBACE,sBAAO,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC,UAAU,EAAE,EAAC;;;KAC1E;IACH,uBAAC;AAAD,CAAC,AAnBD,CAAsC,oBAAU,GAmB/C;AAnBY,4CAAgB","sourcesContent":["import {\n O3rElement,\n PlaywrightSourceElement,\n} from '../element';\n\n/**\n * Implementation dedicated to Playwright.\n */\nexport class O3rSelectElement extends O3rElement {\n constructor(sourceElement: PlaywrightSourceElement | O3rElement) {\n super(sourceElement);\n }\n\n /** @inheritdoc */\n public selectByIndex(index: number, _timeout?: number) {\n return this.sourceElement.element.selectOption({ index });\n }\n\n /** @inheritdoc */\n public selectByValue(value: string, _timeout?: number) {\n return this.sourceElement.element.selectOption({ value });\n }\n\n /** @inheritDoc */\n public async getValue() {\n return this.sourceElement.element.locator('option:checked').inputValue();\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slider-element.d.ts","sourceRoot":"","sources":["../../../../src/core/playwright/elements/slider-element.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"slider-element.d.ts","sourceRoot":"","sources":["../../../../src/core/playwright/elements/slider-element.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EACrB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,UAAU,EACV,KAAK,uBAAuB,EAC7B,MAAM,YAAY,CAAC;AAEpB;;GAEG;AACH,qBAAa,gBAAiB,SAAQ,UAAW,YAAW,oBAAoB;IAG5E,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC;IAC/B,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC;gBAF/B,aAAa,EAAE,uBAAuB,GAAG,UAAU,EAClC,aAAa,CAAC,EAAE,MAAM,YAAA,EACtB,aAAa,CAAC,EAAE,MAAM,YAAA;YAK3B,eAAe;YAYf,eAAe;YAef,eAAe;IAe7B,kBAAkB;IACL,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IA4BnD,kBAAkB;IACL,QAAQ;CAMtB"}
|
|
@@ -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,sCAGoB;AAEpB;;GAEG;AACH;IAAsC,4CAAU;IAC9C,0BACE,aAAmD,EAClC,aAAsB,EACtB,aAAsB;QAEvC,YAAA,MAAK,YAAC,aAAa,CAAC,SAAC;QAHJ,mBAAa,GAAb,aAAa,CAAS;QACtB,mBAAa,GAAb,aAAa,CAAS;;IAGzC,CAAC;IAEa,0CAAe,GAA7B;;;;;;;wBAEU,UAAU,GAAG,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,OAAO,CAAC,qBAAqB,CAAC,CAAC;wBACzE,qBAAM,UAAU,CAAC,KAAK,EAAE,EAAA;;wBAA5B,IAAI,SAAwB,EAAE,CAAC;4BAC7B,sBAAO,UAAU,CAAC,KAAK,EAAE,EAAC;wBAC5B,CAAC;wBACD,sBAAO,IAAI,CAAC,aAAa,CAAC,OAAO,EAAC;;;wBAElC,sBAAO,IAAI,CAAC,aAAa,CAAC,OAAO,EAAC;;;;;KAErC;IAEa,0CAAe,GAA7B;;;;;;wBACE,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC;4BACxB,sBAAO,IAAI,CAAC,aAAa,CAAC,OAAO,EAAC;wBACpC,CAAC;;;;wBAEO,UAAU,GAAG,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,aAAa,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CACjD,EAAA;;wBAHD,SAGC,CAAC;wBACF,qBAAM,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,EAAE,EAAA;;wBAAxC,SAAwC,CAAC;;;;;KAC1C;IAED,kBAAkB;IACL,mCAAQ,GAArB;;;;;;;6BACc,oBAAU;;wBACX,qBAAM,IAAI,CAAC,eAAe,EAAE,EAAA;4BADvC,sBAAO,CAAC,cAAI,oBAAU,YACpB,UAAO,GAAE,SAA4B;gCACrC,OAAI,GAAE,IAAI,CAAC,aAAa,CAAC,IAAI;wCAC7B,CAAC,CAAC,QAAQ,EAAE,EAAC;;;;KAChB;IACH,uBAAC;AAAD,CAAC,AAvFD,CAAsC,oBAAU,GAuF/C;AAvFY,4CAAgB","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"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"group.d.ts","sourceRoot":"","sources":["../../../src/core/playwright/group.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"group.d.ts","sourceRoot":"","sources":["../../../src/core/playwright/group.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACb,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,cAAc,EACd,UAAU,EACX,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC;;GAEG;AACH,MAAM,MAAM,mBAAmB,CAAC,CAAC,SAAS,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC,SAAS,cAAc,IAAI,KAAK,aAAa,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC;AAErH;;GAEG;AACH,qBAAa,QAAQ,CAAC,CAAC,SAAS,UAAU,CAAE,YAAW,YAAY,CAAC,CAAC,CAAC;IAMxD,SAAS,CAAC,aAAa,EAAE,CAAC,EAAE;IALxC,kBAAkB;IAClB,IAAW,KAAK,IAAI,CAAC,EAAE,CAEtB;gBAEqB,aAAa,EAAE,CAAC,EAAE;IAExC,kBAAkB;IACX,YAAY;CAGpB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"group.js","sourceRoot":"","sources":["../../../src/core/playwright/group.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"group.js","sourceRoot":"","sources":["../../../src/core/playwright/group.ts"],"names":[],"mappings":";;;AAeA;;GAEG;AACH;IAME,kBAAsB,aAAkB;QAAlB,kBAAa,GAAb,aAAa,CAAK;IAAG,CAAC;IAJ5C,sBAAW,2BAAK;QADhB,kBAAkB;aAClB;YACE,OAAO,IAAI,CAAC,aAAa,CAAC;QAC5B,CAAC;;;OAAA;IAID,kBAAkB;IACX,+BAAY,GAAnB;QACE,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC;IACH,eAAC;AAAD,CAAC,AAZD,IAYC;AAZY,4BAAQ","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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"radio-group.d.ts","sourceRoot":"","sources":["../../../../src/core/playwright/groups/radio-group.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"radio-group.d.ts","sourceRoot":"","sources":["../../../../src/core/playwright/groups/radio-group.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EAClB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,eAAe,EAChB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,QAAQ,EACT,MAAM,UAAU,CAAC;AAElB;;GAEG;AACH,qBAAa,aAAc,SAAQ,QAAQ,CAAC,eAAe,CAAE,YAAW,iBAAiB;gBAC3E,aAAa,EAAE,eAAe,EAAE;IAI5C,kBAAkB;IACL,YAAY;IAgBzB;;OAEG;IACU,eAAe;CAU7B"}
|
|
@@ -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,kCAEkB;AAElB;;GAEG;AACH;IAAmC,yCAAyB;IAC1D,uBAAY,aAAgC;QAC1C,OAAA,MAAK,YAAC,aAAa,CAAC,SAAC;IACvB,CAAC;IAED,kBAAkB;IACL,oCAAY,GAAzB;;;;;;wBACM,IAAI,GAAG,EAAE,CAAC;8BAEe,EAAV,KAAA,IAAI,CAAC,KAAK;;;6BAAV,CAAA,cAAU,CAAA;wBAAlB,IAAI;wBACI,qBAAM,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,EAAA;;wBAA1C,QAAQ,GAAG,SAA+B;wBAChD,IAAI,IAAI,KAAK,EAAE,IAAI,IAAI,KAAK,QAAQ,EAAE,CAAC;4BACrC,sBAAO,KAAK,EAAC;wBACf,CAAC;wBACD,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;4BAC3B,IAAI,GAAG,QAAQ,CAAC;wBAClB,CAAC;;;wBAPgB,IAAU,CAAA;;4BAU7B,sBAAO,IAAI,EAAC;;;;KACb;IAED;;OAEG;IACU,uCAAe,GAA5B;;;;;;8BAC+B,EAAV,KAAA,IAAI,CAAC,KAAK;;;6BAAV,CAAA,cAAU,CAAA;wBAAlB,IAAI;wBACM,qBAAM,IAAI,CAAC,SAAS,EAAE,EAAA;;wBAAnC,UAAU,GAAG,SAAsB;wBACzC,IAAI,UAAU,EAAE,CAAC;4BACf,sBAAO,IAAI,EAAC;wBACd,CAAC;;;wBAJgB,IAAU,CAAA;;4BAO7B,sBAAO,SAAS,EAAC;;;;KAClB;IACH,oBAAC;AAAD,CAAC,AAnCD,CAAmC,gBAAQ,GAmC1C;AAnCY,sCAAa","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"]}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
export * from './angular-materials';
|
|
1
2
|
export * from './component-fixture';
|
|
2
|
-
export * from './elements';
|
|
3
3
|
export * from './element';
|
|
4
|
+
export * from './elements';
|
|
4
5
|
export * from './group';
|
|
5
6
|
export * from './groups';
|
|
6
7
|
export * from './page-fixture';
|
|
7
|
-
export
|
|
8
|
+
export { SelectElementProfile } from '../elements';
|
|
8
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/playwright/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/playwright/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC"}
|
package/core/playwright/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
var tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./angular-materials"), exports);
|
|
4
5
|
tslib_1.__exportStar(require("./component-fixture"), exports);
|
|
5
|
-
tslib_1.__exportStar(require("./elements"), exports);
|
|
6
6
|
tslib_1.__exportStar(require("./element"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./elements"), exports);
|
|
7
8
|
tslib_1.__exportStar(require("./group"), exports);
|
|
8
9
|
tslib_1.__exportStar(require("./groups"), exports);
|
|
9
10
|
tslib_1.__exportStar(require("./page-fixture"), exports);
|
|
10
|
-
tslib_1.__exportStar(require("./angular-materials"), exports);
|
|
11
11
|
//# sourceMappingURL=index.js.map
|