@o3r/testing 13.0.0-next.6 → 13.0.0-prerelease.1

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.
Files changed (129) hide show
  1. package/core/angular/angular-materials/autocomplete-material.js +9 -20
  2. package/core/angular/angular-materials/autocomplete-material.js.map +1 -1
  3. package/core/angular/angular-materials/index.js +1 -1
  4. package/core/angular/angular-materials/select-material.js +42 -91
  5. package/core/angular/angular-materials/select-material.js.map +1 -1
  6. package/core/angular/angular-materials/slider-material.js +8 -11
  7. package/core/angular/angular-materials/slider-material.js.map +1 -1
  8. package/core/angular/component-fixture.js +68 -148
  9. package/core/angular/component-fixture.js.map +1 -1
  10. package/core/angular/element.js +44 -50
  11. package/core/angular/element.js.map +1 -1
  12. package/core/angular/elements/checkbox-element.js +12 -16
  13. package/core/angular/elements/checkbox-element.js.map +1 -1
  14. package/core/angular/elements/index.js +1 -1
  15. package/core/angular/elements/radio-element.js +12 -16
  16. package/core/angular/elements/radio-element.js.map +1 -1
  17. package/core/angular/elements/select-element.js +28 -49
  18. package/core/angular/elements/select-element.js.map +1 -1
  19. package/core/angular/elements/slider-element.js +38 -42
  20. package/core/angular/elements/slider-element.js.map +1 -1
  21. package/core/angular/group.js +9 -14
  22. package/core/angular/group.js.map +1 -1
  23. package/core/angular/groups/index.js +1 -1
  24. package/core/angular/groups/radio-group.js +25 -62
  25. package/core/angular/groups/radio-group.js.map +1 -1
  26. package/core/angular/index.js +1 -1
  27. package/core/angular/page-fixture.js +8 -11
  28. package/core/angular/page-fixture.js.map +1 -1
  29. package/core/angular-materials/autocomplete-material.js +8 -11
  30. package/core/angular-materials/autocomplete-material.js.map +1 -1
  31. package/core/angular-materials/index.js +1 -1
  32. package/core/angular-materials/select-material.js +12 -15
  33. package/core/angular-materials/select-material.js.map +1 -1
  34. package/core/angular-materials/slider-material.js +5 -8
  35. package/core/angular-materials/slider-material.js.map +1 -1
  36. package/core/component-fixture.js +28 -33
  37. package/core/component-fixture.js.map +1 -1
  38. package/core/element.js +24 -26
  39. package/core/element.js.map +1 -1
  40. package/core/elements/checkbox-element.js +12 -16
  41. package/core/elements/checkbox-element.js.map +1 -1
  42. package/core/elements/index.js +1 -1
  43. package/core/elements/radio-element.js +12 -16
  44. package/core/elements/radio-element.js.map +1 -1
  45. package/core/elements/select-element.js +10 -13
  46. package/core/elements/select-element.js.map +1 -1
  47. package/core/elements/slider-element.js +5 -8
  48. package/core/elements/slider-element.js.map +1 -1
  49. package/core/group.js +9 -15
  50. package/core/group.js.map +1 -1
  51. package/core/groups/index.js +1 -1
  52. package/core/groups/radio-group.js +8 -11
  53. package/core/groups/radio-group.js.map +1 -1
  54. package/core/helpers.js +11 -16
  55. package/core/helpers.js.map +1 -1
  56. package/core/index.js +1 -1
  57. package/core/page-fixture.js +8 -11
  58. package/core/page-fixture.js.map +1 -1
  59. package/core/playwright/angular-materials/autocomplete-material.js +26 -56
  60. package/core/playwright/angular-materials/autocomplete-material.js.map +1 -1
  61. package/core/playwright/angular-materials/index.js +1 -1
  62. package/core/playwright/angular-materials/select-material.js +48 -110
  63. package/core/playwright/angular-materials/select-material.js.map +1 -1
  64. package/core/playwright/angular-materials/slider-material.js +7 -10
  65. package/core/playwright/angular-materials/slider-material.js.map +1 -1
  66. package/core/playwright/component-fixture.js +88 -173
  67. package/core/playwright/component-fixture.js.map +1 -1
  68. package/core/playwright/element.js +38 -90
  69. package/core/playwright/element.js.map +1 -1
  70. package/core/playwright/elements/checkbox-element.js +49 -94
  71. package/core/playwright/elements/checkbox-element.js.map +1 -1
  72. package/core/playwright/elements/index.js +1 -1
  73. package/core/playwright/elements/radio-element.js +18 -34
  74. package/core/playwright/elements/radio-element.js.map +1 -1
  75. package/core/playwright/elements/select-element.js +14 -21
  76. package/core/playwright/elements/select-element.js.map +1 -1
  77. package/core/playwright/elements/slider-element.js +78 -157
  78. package/core/playwright/elements/slider-element.js.map +1 -1
  79. package/core/playwright/group.js +9 -14
  80. package/core/playwright/group.js.map +1 -1
  81. package/core/playwright/groups/index.js +1 -1
  82. package/core/playwright/groups/radio-group.js +27 -64
  83. package/core/playwright/groups/radio-group.js.map +1 -1
  84. package/core/playwright/index.js +1 -1
  85. package/core/playwright/page-fixture.js +8 -18
  86. package/core/playwright/page-fixture.js.map +1 -1
  87. package/errors/fixture-usage-error.js +5 -10
  88. package/errors/fixture-usage-error.js.map +1 -1
  89. package/errors/index.js +1 -1
  90. package/errors/transpilation-purpose-only.js +5 -10
  91. package/errors/transpilation-purpose-only.js.map +1 -1
  92. package/kassette/index.js +1 -1
  93. package/kassette/update-dates-in-mocks.js +66 -85
  94. package/kassette/update-dates-in-mocks.js.map +1 -1
  95. package/localization/index.js +1 -1
  96. package/localization/localization-mock.js +38 -60
  97. package/localization/localization-mock.js.map +1 -1
  98. package/mocks/index.js +1 -1
  99. package/mocks/mock-component-generator.js +54 -53
  100. package/mocks/mock-component-generator.js.map +1 -1
  101. package/package.json +59 -58
  102. package/public_api.js +1 -1
  103. package/schematics/add-functions-to-fixture/models.d.ts.map +1 -1
  104. package/schematics/add-functions-to-fixture/models.js.map +1 -1
  105. package/schematics/ng-add/index.d.ts.map +1 -1
  106. package/schematics/ng-add/index.js +4 -6
  107. package/schematics/ng-add/index.js.map +1 -1
  108. package/schematics/ng-add/playwright/index.d.ts.map +1 -1
  109. package/schematics/ng-add/playwright/index.js +3 -4
  110. package/schematics/ng-add/playwright/index.js.map +1 -1
  111. package/schematics/ng-add/schema.json +2 -1
  112. package/schematics/playwright/sanity/schema.json +2 -1
  113. package/schematics/playwright/scenario/schema.json +2 -1
  114. package/store/index.js +1 -1
  115. package/store/testable-select.js +13 -13
  116. package/store/testable-select.js.map +1 -1
  117. package/tools/index.js +1 -1
  118. package/tools/path-replacement/index.js +1 -1
  119. package/tools/path-replacement/path-replacement.js +24 -20
  120. package/tools/path-replacement/path-replacement.js.map +1 -1
  121. package/visual-test/index.js +1 -1
  122. package/visual-test/utils.js +18 -7
  123. package/visual-test/utils.js.map +1 -1
  124. package/visual-test/visual-test.d.ts.map +1 -1
  125. package/visual-test/visual-test.js +30 -35
  126. package/visual-test/visual-test.js.map +1 -1
  127. package/visual-testing-reporter/index.d.ts.map +1 -1
  128. package/visual-testing-reporter/index.js +37 -40
  129. package/visual-testing-reporter/index.js.map +1 -1
@@ -1,124 +1,62 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MatSelect = void 0;
4
- var tslib_1 = require("tslib");
5
- var element_1 = require("../element");
4
+ const element_1 = require("../element");
6
5
  /**
7
6
  * Implementation dedicated to Playwright.
8
7
  */
9
- var MatSelect = /** @class */ (function (_super) {
10
- tslib_1.__extends(MatSelect, _super);
11
- function MatSelect(sourceElement) {
12
- return _super.call(this, sourceElement) || this;
8
+ class MatSelect extends element_1.O3rElement {
9
+ constructor(sourceElement) {
10
+ super(sourceElement);
13
11
  }
14
12
  /** @inheritdoc */
15
- MatSelect.prototype.selectByIndex = function (index_1) {
16
- return tslib_1.__awaiter(this, arguments, void 0, function (index, timeout) {
17
- var options, selectedOption, option;
18
- if (timeout === void 0) { timeout = 5000; }
19
- return tslib_1.__generator(this, function (_a) {
20
- switch (_a.label) {
21
- case 0: return [4 /*yield*/, this.click()];
22
- case 1:
23
- _a.sent();
24
- options = this.sourceElement.page.locator('mat-option');
25
- return [4 /*yield*/, options.first().waitFor({ state: 'attached', timeout: timeout })];
26
- case 2:
27
- _a.sent();
28
- return [4 /*yield*/, options.count()];
29
- case 3:
30
- if ((_a.sent()) >= index + 1) {
31
- selectedOption = { element: options.nth(index), page: this.sourceElement.page };
32
- option = new element_1.O3rElement(selectedOption);
33
- return [2 /*return*/, option.click()];
34
- }
35
- else {
36
- return [2 /*return*/, Promise.reject(new Error("Option with index ".concat(index, " not found in select element.")))];
37
- }
38
- return [2 /*return*/];
39
- }
40
- });
41
- });
42
- };
13
+ async selectByIndex(index, timeout = 5000) {
14
+ await this.click();
15
+ const options = this.sourceElement.page.locator('mat-option');
16
+ await options.first().waitFor({ state: 'attached', timeout });
17
+ if ((await options.count()) >= index + 1) {
18
+ const selectedOption = { element: options.nth(index), page: this.sourceElement.page };
19
+ const option = new element_1.O3rElement(selectedOption);
20
+ return option.click();
21
+ }
22
+ else {
23
+ return Promise.reject(new Error(`Option with index ${index} not found in select element.`));
24
+ }
25
+ }
43
26
  /** @inheritdoc */
44
- MatSelect.prototype.selectByValue = function (value_1) {
45
- return tslib_1.__awaiter(this, arguments, void 0, function (value, timeout) {
46
- var options, optionsCount, i, selectedOption, option;
47
- if (timeout === void 0) { timeout = 5000; }
48
- return tslib_1.__generator(this, function (_a) {
49
- switch (_a.label) {
50
- case 0: return [4 /*yield*/, this.click()];
51
- case 1:
52
- _a.sent();
53
- options = this.sourceElement.page.locator('mat-option');
54
- return [4 /*yield*/, options.first().waitFor({ state: 'attached', timeout: timeout })];
55
- case 2:
56
- _a.sent();
57
- return [4 /*yield*/, options.count()];
58
- case 3:
59
- optionsCount = _a.sent();
60
- i = 0;
61
- _a.label = 4;
62
- case 4:
63
- if (!(i < optionsCount)) return [3 /*break*/, 7];
64
- selectedOption = { element: options.nth(i), page: this.sourceElement.page };
65
- option = new element_1.O3rElement(selectedOption);
66
- return [4 /*yield*/, option.getAttribute('ng-reflect-value')];
67
- case 5:
68
- if ((_a.sent()) === value) {
69
- return [2 /*return*/, option.click()];
70
- }
71
- _a.label = 6;
72
- case 6:
73
- i++;
74
- return [3 /*break*/, 4];
75
- case 7: return [2 /*return*/, Promise.reject(new Error("Option with value ".concat(value, " not found in select element.")))];
76
- }
77
- });
78
- });
79
- };
27
+ async selectByValue(value, timeout = 5000) {
28
+ await this.click();
29
+ const options = this.sourceElement.page.locator('mat-option');
30
+ await options.first().waitFor({ state: 'attached', timeout });
31
+ const optionsCount = await options.count();
32
+ for (let i = 0; i < optionsCount; i++) {
33
+ const selectedOption = { element: options.nth(i), page: this.sourceElement.page };
34
+ const option = new element_1.O3rElement(selectedOption);
35
+ if (await option.getAttribute('ng-reflect-value') === value) {
36
+ return option.click();
37
+ }
38
+ }
39
+ return Promise.reject(new Error(`Option with value ${value} not found in select element.`));
40
+ }
80
41
  /** @inheritdoc */
81
- MatSelect.prototype.selectByLabel = function (label_1) {
82
- return tslib_1.__awaiter(this, arguments, void 0, function (label, timeout) {
83
- var options, optionsCount, i, selectedOption, option;
84
- if (timeout === void 0) { timeout = 5000; }
85
- return tslib_1.__generator(this, function (_a) {
86
- switch (_a.label) {
87
- case 0: return [4 /*yield*/, this.click()];
88
- case 1:
89
- _a.sent();
90
- options = this.sourceElement.page.locator('mat-option');
91
- return [4 /*yield*/, options.first().waitFor({ state: 'attached', timeout: timeout })];
92
- case 2:
93
- _a.sent();
94
- return [4 /*yield*/, options.count()];
95
- case 3:
96
- optionsCount = _a.sent();
97
- i = 0;
98
- _a.label = 4;
99
- case 4:
100
- if (!(i < optionsCount)) return [3 /*break*/, 7];
101
- selectedOption = { element: options.nth(i), page: this.sourceElement.page };
102
- option = new element_1.O3rElement(selectedOption);
103
- return [4 /*yield*/, option.getText()];
104
- case 5:
105
- if ((_a.sent()) === label) {
106
- return [2 /*return*/, option.click()];
107
- }
108
- _a.label = 6;
109
- case 6:
110
- i++;
111
- return [3 /*break*/, 4];
112
- case 7: return [2 /*return*/, Promise.reject(new Error("Option with label ".concat(label, " not found in select element.")))];
113
- }
114
- });
115
- });
116
- };
42
+ async selectByLabel(label, timeout = 5000) {
43
+ await this.click();
44
+ const options = this.sourceElement.page.locator('mat-option');
45
+ await options.first().waitFor({ state: 'attached', timeout });
46
+ const optionsCount = await options.count();
47
+ for (let i = 0; i < optionsCount; i++) {
48
+ const selectedOption = { element: options.nth(i), page: this.sourceElement.page };
49
+ const option = new element_1.O3rElement(selectedOption);
50
+ if (await option.getText() === label) {
51
+ return option.click();
52
+ }
53
+ }
54
+ return Promise.reject(new Error(`Option with label ${label} not found in select element.`));
55
+ }
117
56
  /** @inheritDoc */
118
- MatSelect.prototype.getValue = function () {
57
+ getValue() {
119
58
  throw new Error('Cannot use "getValue" function on a Material Select element. Use "getPlainText()" instead.');
120
- };
121
- return MatSelect;
122
- }(element_1.O3rElement));
59
+ }
60
+ }
123
61
  exports.MatSelect = MatSelect;
124
62
  //# sourceMappingURL=select-material.js.map
@@ -1 +1 @@
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,GAAG,EAAE,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,IAAI,EAA6C,CAAC;4BAC3H,MAAM,GAAG,IAAI,oBAAU,CAAC,cAAc,CAAC,CAAC;4BAC9C,sBAAO,MAAM,CAAC,KAAK,EAAE,EAAC;wBACxB,CAAC;6BAAM,CAAC;4BACN,sBAAO,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,4BAAqB,KAAK,kCAA+B,CAAC,CAAC,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AC,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;wBACzC,qBAAM,OAAO,CAAC,KAAK,EAAE,EAAA;;wBAApC,YAAY,GAAG,SAAqB;wBACjC,CAAC,GAAG,CAAC;;;6BAAE,CAAA,CAAC,GAAG,YAAY,CAAA;wBACxB,cAAc,GAAG,EAAE,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,IAAI,EAA6C,CAAC;wBACvH,MAAM,GAAG,IAAI,oBAAU,CAAC,cAAc,CAAC,CAAC;wBAC1C,qBAAM,MAAM,CAAC,OAAO,EAAE,EAAA;;wBAA1B,IAAI,CAAA,SAAsB,MAAK,KAAK,EAAE,CAAC;4BACrC,sBAAO,MAAM,CAAC,KAAK,EAAE,EAAC;wBACxB,CAAC;;;wBAL+B,CAAC,EAAE,CAAA;;4BAQrC,sBAAO,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,4BAAqB,KAAK,kCAA+B,CAAC,CAAC,EAAC;;;;KAC7F;IAED,kBAAkB;IACX,4BAAQ,GAAf;QACE,MAAM,IAAI,KAAK,CAAC,4FAA4F,CAAC,CAAC;IAChH,CAAC;IACH,gBAAC;AAAD,CAAC,AAxDD,CAA+B,oBAAU,GAwDxC;AAxDY,8BAAS","sourcesContent":["import {\n MatSelectProfile,\n} from '../../angular-materials';\nimport {\n O3rElement,\n PlaywrightSourceElement,\n} from '../element';\n\n/**\n * 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 = { element: options.nth(index), page: this.sourceElement.page } as const satisfies PlaywrightSourceElement;\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 = { element: options.nth(i), page: this.sourceElement.page } as const satisfies PlaywrightSourceElement;\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 = { element: options.nth(i), page: this.sourceElement.page } as const satisfies PlaywrightSourceElement;\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
+ {"version":3,"file":"select-material.js","sourceRoot":"","sources":["../../../../src/core/playwright/angular-materials/select-material.ts"],"names":[],"mappings":";;;AAGA,wCAGoB;AAEpB;;GAEG;AACH,MAAa,SAAU,SAAQ,oBAAU;IACvC,YAAY,aAAmD;QAC7D,KAAK,CAAC,aAAa,CAAC,CAAC;IACvB,CAAC;IAED,kBAAkB;IACX,KAAK,CAAC,aAAa,CAAC,KAAa,E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CAAC;QAED,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,qBAAqB,KAAK,+BAA+B,CAAC,CAAC,CAAC;IAC9F,CAAC;IAED,kBAAkB;IACX,QAAQ;QACb,MAAM,IAAI,KAAK,CAAC,4FAA4F,CAAC,CAAC;IAChH,CAAC;CACF;AAxDD,8BAwDC","sourcesContent":["import {\n MatSelectProfile,\n} from '../../angular-materials';\nimport {\n O3rElement,\n PlaywrightSourceElement,\n} from '../element';\n\n/**\n * 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 = { element: options.nth(index), page: this.sourceElement.page } as const satisfies PlaywrightSourceElement;\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 = { element: options.nth(i), page: this.sourceElement.page } as const satisfies PlaywrightSourceElement;\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 = { element: options.nth(i), page: this.sourceElement.page } as const satisfies PlaywrightSourceElement;\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,19 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MatSlider = void 0;
4
- var tslib_1 = require("tslib");
5
- var elements_1 = require("../elements");
6
- var TRACK_CLASS = 'mdc-slider__track';
7
- var THUMB_CLASS = 'mdc-slider__thumb';
4
+ const elements_1 = require("../elements");
5
+ const TRACK_CLASS = 'mdc-slider__track';
6
+ const THUMB_CLASS = 'mdc-slider__thumb';
8
7
  /**
9
8
  * Implementation dedicated to Playwright.
10
9
  */
11
- var MatSlider = /** @class */ (function (_super) {
12
- tslib_1.__extends(MatSlider, _super);
13
- function MatSlider(sourceElement) {
14
- return _super.call(this, sourceElement, ".".concat(TRACK_CLASS), ".".concat(THUMB_CLASS)) || this;
10
+ class MatSlider extends elements_1.O3rSliderElement {
11
+ constructor(sourceElement) {
12
+ super(sourceElement, `.${TRACK_CLASS}`, `.${THUMB_CLASS}`);
15
13
  }
16
- return MatSlider;
17
- }(elements_1.O3rSliderElement));
14
+ }
18
15
  exports.MatSlider = MatSlider;
19
16
  //# sourceMappingURL=slider-material.js.map
@@ -1 +1 @@
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
+ {"version":3,"file":"slider-material.js","sourceRoot":"","sources":["../../../../src/core/playwright/angular-materials/slider-material.ts"],"names":[],"mappings":";;;AAUA,0CAEqB;AAErB,MAAM,WAAW,GAA4B,mBAAmB,CAAC;AACjE,MAAM,WAAW,GAA4B,mBAAmB,CAAC;AAEjE;;GAEG;AACH,MAAa,SAAU,SAAQ,2BAAgB;IAC7C,YAAY,aAAmD;QAC7D,KAAK,CAAC,aAAa,EAAE,IAAI,WAAW,EAAE,EAAE,IAAI,WAAW,EAAE,CAAC,CAAC;IAC7D,CAAC;CACF;AAJD,8BAIC","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,20 +1,19 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.O3rComponentFixture = void 0;
4
- var tslib_1 = require("tslib");
5
- var index_1 = require("../../errors/index");
6
- var helpers_1 = require("../helpers");
7
- var element_1 = require("./element");
4
+ const index_1 = require("../../errors/index");
5
+ const helpers_1 = require("../helpers");
6
+ const element_1 = require("./element");
8
7
  /**
9
8
  * Implementation of the fixture dedicated to Playwright, hence using the webdriver to interact with the dom.
10
9
  */
11
- var O3rComponentFixture = /** @class */ (function () {
10
+ class O3rComponentFixture {
12
11
  /**
13
12
  * Root element of this fixture.
14
13
  * All further queries will be applied to the element tree if any, otherwise they will be applied to the whole DOM.
15
14
  * @param rootElement
16
15
  */
17
- function O3rComponentFixture(rootElement) {
16
+ constructor(rootElement) {
18
17
  this.rootElement = rootElement;
19
18
  }
20
19
  /**
@@ -23,45 +22,26 @@ var O3rComponentFixture = /** @class */ (function () {
23
22
  * @param element ElementProfile to test
24
23
  * @param timeout specific timeout that will throw when reach
25
24
  */
26
- O3rComponentFixture.prototype.throwOnUndefinedElement = function (element, timeout) {
27
- return tslib_1.__awaiter(this, void 0, void 0, function () {
28
- return tslib_1.__generator(this, function (_a) {
29
- switch (_a.label) {
30
- case 0:
31
- if (!element) {
32
- throw new Error('Element not found in ' + this.constructor.name);
33
- }
34
- return [4 /*yield*/, element.sourceElement.element.first().waitFor({ state: 'attached', timeout: timeout })];
35
- case 1:
36
- _a.sent();
37
- return [2 /*return*/, element];
38
- }
39
- });
40
- });
41
- };
25
+ async throwOnUndefinedElement(element, timeout) {
26
+ if (!element) {
27
+ throw new Error('Element not found in ' + this.constructor.name);
28
+ }
29
+ await element.sourceElement.element.first().waitFor({ state: 'attached', timeout });
30
+ return element;
31
+ }
42
32
  /**
43
33
  * Throws an exception if the element is undefined.
44
34
  * Otherwise returns the element.
45
35
  * @param element ElementProfile to test
46
36
  * @param timeout specific timeout that will throw when reach
47
37
  */
48
- O3rComponentFixture.prototype.throwOnUndefined = function (element, timeout) {
49
- var _this = this;
50
- return (0, helpers_1.withTimeout)((function () { return tslib_1.__awaiter(_this, void 0, void 0, function () {
51
- var el;
52
- return tslib_1.__generator(this, function (_a) {
53
- switch (_a.label) {
54
- case 0: return [4 /*yield*/, element];
55
- case 1:
56
- el = _a.sent();
57
- return [4 /*yield*/, el.sourceElement.element.first().waitFor({ state: 'attached' })];
58
- case 2:
59
- _a.sent();
60
- return [2 /*return*/, el];
61
- }
62
- });
63
- }); })(), timeout);
64
- };
38
+ throwOnUndefined(element, timeout) {
39
+ return (0, helpers_1.withTimeout)((async () => {
40
+ const el = await element;
41
+ await el.sourceElement.element.first().waitFor({ state: 'attached' });
42
+ return el;
43
+ })(), timeout);
44
+ }
65
45
  /**
66
46
  * Get the element associated to the selector if present
67
47
  * @param selector Selector to access the element
@@ -71,23 +51,13 @@ var O3rComponentFixture = /** @class */ (function () {
71
51
  * @param options.shouldThrowIfNotPresent If set to true the function will throw if the element is not present
72
52
  * @param options.timeout Duration to wait for the element to be present before it throws
73
53
  */
74
- O3rComponentFixture.prototype.queryWithOptions = function (selector_1, elementConstructor_1) {
75
- return tslib_1.__awaiter(this, arguments, void 0, function (selector, elementConstructor, options) {
76
- var element;
77
- if (options === void 0) { options = {}; }
78
- return tslib_1.__generator(this, function (_a) {
79
- switch (_a.label) {
80
- case 0: return [4 /*yield*/, (options.index === undefined ? this.query(selector, elementConstructor) : this.queryNth(selector, options.index, elementConstructor))];
81
- case 1:
82
- element = _a.sent();
83
- if (options.shouldThrowIfNotPresent) {
84
- return [2 /*return*/, this.throwOnUndefinedElement(element, options.timeout)];
85
- }
86
- return [2 /*return*/, element];
87
- }
88
- });
89
- });
90
- };
54
+ async queryWithOptions(selector, elementConstructor, options = {}) {
55
+ const element = await (options.index === undefined ? this.query(selector, elementConstructor) : this.queryNth(selector, options.index, elementConstructor));
56
+ if (options.shouldThrowIfNotPresent) {
57
+ return this.throwOnUndefinedElement(element, options.timeout);
58
+ }
59
+ return element;
60
+ }
91
61
  /**
92
62
  * Get text from the element associated to the given selector, or undefined if the element is not found or not visible
93
63
  * @param selector Selector to access the element
@@ -97,26 +67,13 @@ var O3rComponentFixture = /** @class */ (function () {
97
67
  * @param options.shouldThrowIfNotPresent If set to true the function will throw if the element is not present
98
68
  * @param options.timeout Duration to wait for the element to be present before it throws
99
69
  */
100
- O3rComponentFixture.prototype.getText = function (selector_1) {
101
- return tslib_1.__awaiter(this, arguments, void 0, function (selector, options) {
102
- var element;
103
- if (options === void 0) { options = {}; }
104
- return tslib_1.__generator(this, function (_a) {
105
- switch (_a.label) {
106
- case 0: return [4 /*yield*/, this.queryWithOptions(selector, options.elementConstructor, options)];
107
- case 1:
108
- element = _a.sent();
109
- return [4 /*yield*/, element.isVisible()];
110
- case 2:
111
- if (!(_a.sent())) {
112
- return [2 /*return*/];
113
- }
114
- return [4 /*yield*/, element.getText()];
115
- case 3: return [2 /*return*/, _a.sent()];
116
- }
117
- });
118
- });
119
- };
70
+ async getText(selector, options = {}) {
71
+ const element = await this.queryWithOptions(selector, options.elementConstructor, options);
72
+ if (!await element.isVisible()) {
73
+ return;
74
+ }
75
+ return await element.getText();
76
+ }
120
77
  /**
121
78
  * Check if the element associated to the given selector is visible
122
79
  * @param selector Selector to access the element
@@ -126,21 +83,10 @@ var O3rComponentFixture = /** @class */ (function () {
126
83
  * @param options.shouldThrowIfNotPresent If set to true the function will throw if the element is not present
127
84
  * @param options.timeout Duration to wait for the element to be present before it throws
128
85
  */
129
- O3rComponentFixture.prototype.isVisible = function (selector_1) {
130
- return tslib_1.__awaiter(this, arguments, void 0, function (selector, options) {
131
- var element;
132
- if (options === void 0) { options = {}; }
133
- return tslib_1.__generator(this, function (_a) {
134
- switch (_a.label) {
135
- case 0: return [4 /*yield*/, this.queryWithOptions(selector, options.elementConstructor, options)];
136
- case 1:
137
- element = _a.sent();
138
- return [4 /*yield*/, element.isVisible()];
139
- case 2: return [2 /*return*/, _a.sent()];
140
- }
141
- });
142
- });
143
- };
86
+ async isVisible(selector, options = {}) {
87
+ const element = await this.queryWithOptions(selector, options.elementConstructor, options);
88
+ return await element.isVisible();
89
+ }
144
90
  /**
145
91
  * Click on the element associated to the given selector if it exists and is visible
146
92
  * @param selector Selector to access the element
@@ -150,96 +96,65 @@ var O3rComponentFixture = /** @class */ (function () {
150
96
  * @param options.shouldThrowIfNotPresent If set to true the function will throw if the element is not present
151
97
  * @param options.timeout Duration to wait for the element to be present before it throws
152
98
  */
153
- O3rComponentFixture.prototype.click = function (selector_1) {
154
- return tslib_1.__awaiter(this, arguments, void 0, function (selector, options) {
155
- var element;
156
- if (options === void 0) { options = {}; }
157
- return tslib_1.__generator(this, function (_a) {
158
- switch (_a.label) {
159
- case 0: return [4 /*yield*/, this.queryWithOptions(selector, options.elementConstructor, options)];
160
- case 1:
161
- element = _a.sent();
162
- return [4 /*yield*/, element.isVisible()];
163
- case 2:
164
- if (!_a.sent()) return [3 /*break*/, 4];
165
- return [4 /*yield*/, element.click()];
166
- case 3:
167
- _a.sent();
168
- _a.label = 4;
169
- case 4: return [2 /*return*/];
170
- }
171
- });
172
- });
173
- };
174
- O3rComponentFixture.prototype.query = function (selector, returnType) {
175
- var elements = this.rootElement.sourceElement.element.locator(selector);
176
- var element = elements.first();
177
- var selectedElement = { element: element, page: this.rootElement.sourceElement.page };
99
+ async click(selector, options = {}) {
100
+ const element = await this.queryWithOptions(selector, options.elementConstructor, options);
101
+ if (await element.isVisible()) {
102
+ await element.click();
103
+ }
104
+ }
105
+ query(selector, returnType) {
106
+ const elements = this.rootElement.sourceElement.element.locator(selector);
107
+ const element = elements.first();
108
+ const selectedElement = { element: element, page: this.rootElement.sourceElement.page };
178
109
  return Promise.resolve(new (returnType || element_1.O3rElement)(selectedElement));
179
- };
180
- O3rComponentFixture.prototype.queryNth = function (selector, index, returnType) {
181
- var elements = this.rootElement.sourceElement.element.locator(selector);
182
- var element = elements.nth(index);
183
- var selectedElement = { element: element, page: this.rootElement.sourceElement.page };
110
+ }
111
+ queryNth(selector, index, returnType) {
112
+ const elements = this.rootElement.sourceElement.element.locator(selector);
113
+ const element = elements.nth(index);
114
+ const selectedElement = { element: element, page: this.rootElement.sourceElement.page };
184
115
  return Promise.resolve(new (returnType || element_1.O3rElement)(selectedElement));
185
- };
186
- O3rComponentFixture.prototype.queryAll = function (selector_1, returnType_1, groupType_1) {
187
- return tslib_1.__awaiter(this, arguments, void 0, function (selector, returnType, groupType, timeout) {
188
- var sourceElement, pElements, pElementsCount, elements, i, selectedElement, group, isValid, err_1;
189
- if (timeout === void 0) { timeout = 5000; }
190
- return tslib_1.__generator(this, function (_a) {
191
- switch (_a.label) {
192
- case 0:
193
- _a.trys.push([0, 5, , 6]);
194
- sourceElement = this.rootElement.sourceElement.element;
195
- pElements = sourceElement.locator(selector);
196
- // Mandatory because count is not reliable if we don't wait for the list to be attached
197
- return [4 /*yield*/, pElements.first().waitFor({ state: 'attached', timeout: timeout })];
198
- case 1:
199
- // Mandatory because count is not reliable if we don't wait for the list to be attached
200
- _a.sent();
201
- return [4 /*yield*/, pElements.count()];
202
- case 2:
203
- pElementsCount = _a.sent();
204
- elements = [];
205
- for (i = 0; i < pElementsCount; i++) {
206
- selectedElement = { element: pElements.nth(i), page: this.rootElement.sourceElement.page };
207
- elements.push(returnType ? new returnType(selectedElement) : new element_1.O3rElement(selectedElement));
208
- }
209
- if (!groupType) return [3 /*break*/, 4];
210
- group = new groupType(elements);
211
- return [4 /*yield*/, group.isValidGroup()];
212
- case 3:
213
- isValid = _a.sent();
214
- if (!isValid) {
215
- throw new index_1.FixtureUsageError('invalid group of items');
216
- }
217
- return [2 /*return*/, group];
218
- case 4: return [2 /*return*/, elements];
219
- case 5:
220
- err_1 = _a.sent();
221
- // eslint-disable-next-line no-console -- no other logger available
222
- console.warn("Failed to query all ".concat(selector), err_1);
223
- return [2 /*return*/, Promise.resolve([])];
224
- case 6: return [2 /*return*/];
116
+ }
117
+ async queryAll(selector, returnType, groupType, timeout = 5000) {
118
+ try {
119
+ const sourceElement = this.rootElement.sourceElement.element;
120
+ const pElements = sourceElement.locator(selector);
121
+ // Mandatory because count is not reliable if we don't wait for the list to be attached
122
+ await pElements.first().waitFor({ state: 'attached', timeout });
123
+ const pElementsCount = await pElements.count();
124
+ const elements = [];
125
+ for (let i = 0; i < pElementsCount; i++) {
126
+ const selectedElement = { element: pElements.nth(i), page: this.rootElement.sourceElement.page };
127
+ elements.push(returnType ? new returnType(selectedElement) : new element_1.O3rElement(selectedElement));
128
+ }
129
+ if (groupType) {
130
+ const group = new groupType(elements);
131
+ const isValid = await group.isValidGroup();
132
+ if (!isValid) {
133
+ throw new index_1.FixtureUsageError('invalid group of items');
225
134
  }
226
- });
227
- });
228
- };
135
+ return group;
136
+ }
137
+ return elements;
138
+ }
139
+ catch (err) {
140
+ // eslint-disable-next-line no-console -- no other logger available
141
+ console.warn(`Failed to query all ${selector}`, err);
142
+ return Promise.resolve([]);
143
+ }
144
+ }
229
145
  /** @inheritdoc */
230
- O3rComponentFixture.prototype.getElement = function () {
146
+ getElement() {
231
147
  return this.rootElement;
232
- };
148
+ }
233
149
  /** @inheritdoc */
234
- O3rComponentFixture.prototype.getSubComponents = function () {
150
+ getSubComponents() {
235
151
  return Promise.resolve({ block: [this] });
236
- };
152
+ }
237
153
  /** @inheritDoc */
238
- O3rComponentFixture.prototype.queryNotPresent = function (selector) {
239
- var element = this.rootElement.sourceElement.element.locator(selector).first();
154
+ queryNotPresent(selector) {
155
+ const element = this.rootElement.sourceElement.element.locator(selector).first();
240
156
  return element.isHidden();
241
- };
242
- return O3rComponentFixture;
243
- }());
157
+ }
158
+ }
244
159
  exports.O3rComponentFixture = O3rComponentFixture;
245
160
  //# sourceMappingURL=component-fixture.js.map