@o3r/testing 11.3.0-prerelease.8 → 11.3.0-rc.0
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/page-fixture.js +1 -1
- package/core/page-fixture.js.map +1 -1
- package/core/protractor/angular-materials/autocomplete-material.d.ts +1 -0
- package/core/protractor/angular-materials/autocomplete-material.d.ts.map +1 -1
- package/core/protractor/angular-materials/autocomplete-material.js +1 -0
- package/core/protractor/angular-materials/autocomplete-material.js.map +1 -1
- package/core/protractor/angular-materials/select-material.d.ts +1 -0
- package/core/protractor/angular-materials/select-material.d.ts.map +1 -1
- package/core/protractor/angular-materials/select-material.js +1 -0
- package/core/protractor/angular-materials/select-material.js.map +1 -1
- package/core/protractor/component-fixture.d.ts +4 -0
- package/core/protractor/component-fixture.d.ts.map +1 -1
- package/core/protractor/component-fixture.js +1 -0
- package/core/protractor/component-fixture.js.map +1 -1
- package/core/protractor/element.d.ts +2 -0
- package/core/protractor/element.d.ts.map +1 -1
- package/core/protractor/element.js +1 -0
- package/core/protractor/element.js.map +1 -1
- package/core/protractor/elements/checkbox-element.d.ts +1 -0
- package/core/protractor/elements/checkbox-element.d.ts.map +1 -1
- package/core/protractor/elements/checkbox-element.js +1 -0
- package/core/protractor/elements/checkbox-element.js.map +1 -1
- package/core/protractor/elements/radio-element.d.ts +1 -0
- 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 +1 -0
- package/core/protractor/elements/select-element.d.ts.map +1 -1
- package/core/protractor/elements/select-element.js +1 -0
- package/core/protractor/elements/select-element.js.map +1 -1
- package/core/protractor/group.d.ts +2 -0
- package/core/protractor/group.d.ts.map +1 -1
- package/core/protractor/group.js +1 -0
- package/core/protractor/group.js.map +1 -1
- package/core/protractor/groups/radio-group.d.ts +1 -0
- 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/page-fixture.d.ts +1 -0
- package/core/protractor/page-fixture.d.ts.map +1 -1
- package/core/protractor/page-fixture.js +1 -0
- package/core/protractor/page-fixture.js.map +1 -1
- package/core/protractor/utils.d.ts +1 -0
- package/core/protractor/utils.d.ts.map +1 -1
- package/core/protractor/utils.js +1 -0
- package/core/protractor/utils.js.map +1 -1
- package/package.json +13 -13
- package/tools/protractor/fetch-manager/_fetch-manager.d.ts +1 -0
- package/tools/protractor/fetch-manager/_fetch-manager.d.ts.map +1 -0
- package/tools/protractor/fetch-manager/_fetch-manager.js +127 -0
- package/tools/protractor/fetch-manager/_fetch-manager.js.map +1 -0
- package/tools/protractor/fetch-manager/utils.d.ts +3 -0
- package/tools/protractor/fetch-manager/utils.d.ts.map +1 -1
- package/tools/protractor/fetch-manager/utils.js +3 -0
- package/tools/protractor/fetch-manager/utils.js.map +1 -1
- package/tools/protractor/post-message-interceptor/_post-message-interceptor.d.ts +5 -0
- package/tools/protractor/post-message-interceptor/_post-message-interceptor.d.ts.map +1 -0
- package/tools/protractor/post-message-interceptor/_post-message-interceptor.js +157 -0
- package/tools/protractor/post-message-interceptor/_post-message-interceptor.js.map +1 -0
- package/tools/protractor/post-message-interceptor/core.d.ts +7 -1
- package/tools/protractor/post-message-interceptor/core.d.ts.map +1 -1
- package/tools/protractor/post-message-interceptor/core.js.map +1 -1
- package/tools/protractor/post-message-interceptor/post-message-interceptor.d.ts +1 -0
- package/tools/protractor/post-message-interceptor/post-message-interceptor.d.ts.map +1 -1
- package/tools/protractor/post-message-interceptor/post-message-interceptor.js +1 -0
- package/tools/protractor/post-message-interceptor/post-message-interceptor.js.map +1 -1
package/core/page-fixture.js
CHANGED
|
@@ -19,7 +19,7 @@ var O3rPageFixture = /** @class */ (function (_super) {
|
|
|
19
19
|
return _super.call(this) || this;
|
|
20
20
|
}
|
|
21
21
|
O3rPageFixture.prototype.getTitle = function () {
|
|
22
|
-
throw new index_1.TranspilationPurposeOnlyError('Should target
|
|
22
|
+
throw new index_1.TranspilationPurposeOnlyError('Should target Playwright implementation');
|
|
23
23
|
};
|
|
24
24
|
return O3rPageFixture;
|
|
25
25
|
}(component_fixture_1.O3rComponentFixture));
|
package/core/page-fixture.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page-fixture.js","sourceRoot":"","sources":["../../src/core/page-fixture.ts"],"names":[],"mappings":";;;;AAAA,yCAAgE;AAChE,yDAAmF;AAanF;;;GAGG;AACH;IAAuE,0CAAsB;IAC3F;;;;OAIG;IACH,wBAAY,YAAgB;QAC1B,OAAA,MAAK,WAAE,SAAC;IACV,CAAC;IAEM,iCAAQ,GAAf;QACE,MAAM,IAAI,qCAA6B,CAAC,yCAAyC,CAAC,CAAC;IACrF,CAAC;IACH,qBAAC;AAAD,CAAC,AAbD,CAAuE,uCAAmB,GAazF;AAbY,wCAAc","sourcesContent":["import { TranspilationPurposeOnlyError } from '../errors/index';\nimport { ComponentFixtureProfile, O3rComponentFixture } from './component-fixture';\nimport { ElementProfile, O3rElement } from './element';\n\n/**\n * Interface to describe a page fixture.\n */\nexport interface PageFixtureProfile<V extends ElementProfile> extends ComponentFixtureProfile<V> {\n /**\n * Returns the title of the page\n */\n getTitle(): Promise<string>;\n}\n\n/**\n * Mock for page fixture class.\n * This class is used for fixture compilation purpose.\n */\nexport class O3rPageFixture<V extends O3rElement = O3rElement> extends O3rComponentFixture<V> implements PageFixtureProfile<V> {\n /**\n * Root element of this fixture. Optional in a Protractor.\n * All further queries will be applied to the element tree if any, otherwise they will be applied to the whole DOM.\n * @param _rootElement\n */\n constructor(_rootElement?: V) {\n super();\n }\n\n public getTitle(): Promise<string> {\n throw new TranspilationPurposeOnlyError('Should target
|
|
1
|
+
{"version":3,"file":"page-fixture.js","sourceRoot":"","sources":["../../src/core/page-fixture.ts"],"names":[],"mappings":";;;;AAAA,yCAAgE;AAChE,yDAAmF;AAanF;;;GAGG;AACH;IAAuE,0CAAsB;IAC3F;;;;OAIG;IACH,wBAAY,YAAgB;QAC1B,OAAA,MAAK,WAAE,SAAC;IACV,CAAC;IAEM,iCAAQ,GAAf;QACE,MAAM,IAAI,qCAA6B,CAAC,yCAAyC,CAAC,CAAC;IACrF,CAAC;IACH,qBAAC;AAAD,CAAC,AAbD,CAAuE,uCAAmB,GAazF;AAbY,wCAAc","sourcesContent":["import { TranspilationPurposeOnlyError } from '../errors/index';\nimport { ComponentFixtureProfile, O3rComponentFixture } from './component-fixture';\nimport { ElementProfile, O3rElement } from './element';\n\n/**\n * Interface to describe a page fixture.\n */\nexport interface PageFixtureProfile<V extends ElementProfile> extends ComponentFixtureProfile<V> {\n /**\n * Returns the title of the page\n */\n getTitle(): Promise<string>;\n}\n\n/**\n * Mock for page fixture class.\n * This class is used for fixture compilation purpose.\n */\nexport class O3rPageFixture<V extends O3rElement = O3rElement> extends O3rComponentFixture<V> implements PageFixtureProfile<V> {\n /**\n * Root element of this fixture. Optional in a Protractor.\n * All further queries will be applied to the element tree if any, otherwise they will be applied to the whole DOM.\n * @param _rootElement\n */\n constructor(_rootElement?: V) {\n super();\n }\n\n public getTitle(): Promise<string> {\n throw new TranspilationPurposeOnlyError('Should target Playwright implementation');\n }\n}\n"]}
|
|
@@ -4,6 +4,7 @@ import { O3rElement } from '../element';
|
|
|
4
4
|
export { SelectElementProfile } from '../../elements';
|
|
5
5
|
/**
|
|
6
6
|
* Implementation dedicated to Protractor.
|
|
7
|
+
* @deprecated Will be removed in v13, please use Playwright instead
|
|
7
8
|
*/
|
|
8
9
|
export declare class MatAutocomplete extends O3rElement implements MatAutocompleteProfile {
|
|
9
10
|
constructor(sourceElement: ElementFinder | O3rElement);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"autocomplete-material.d.ts","sourceRoot":"","sources":["../../../../src/core/protractor/angular-materials/autocomplete-material.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,aAAa,EAAC,MAAM,YAAY,CAAC;AACtD,OAAO,EAAC,sBAAsB,EAAC,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAC,UAAU,EAAC,MAAM,YAAY,CAAC;AAEtC,OAAO,EAAC,oBAAoB,EAAC,MAAM,gBAAgB,CAAC;AAEpD
|
|
1
|
+
{"version":3,"file":"autocomplete-material.d.ts","sourceRoot":"","sources":["../../../../src/core/protractor/angular-materials/autocomplete-material.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,aAAa,EAAC,MAAM,YAAY,CAAC;AACtD,OAAO,EAAC,sBAAsB,EAAC,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAC,UAAU,EAAC,MAAM,YAAY,CAAC;AAEtC,OAAO,EAAC,oBAAoB,EAAC,MAAM,gBAAgB,CAAC;AAEpD;;;GAGG;AACH,qBAAa,eAAgB,SAAQ,UAAW,YAAW,sBAAsB;gBACnE,aAAa,EAAE,aAAa,GAAG,UAAU;IAIrD,kBAAkB;IACL,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM;CAM5D"}
|
|
@@ -6,6 +6,7 @@ var protractor_1 = require("protractor");
|
|
|
6
6
|
var element_1 = require("../element");
|
|
7
7
|
/**
|
|
8
8
|
* Implementation dedicated to Protractor.
|
|
9
|
+
* @deprecated Will be removed in v13, please use Playwright instead
|
|
9
10
|
*/
|
|
10
11
|
var MatAutocomplete = /** @class */ (function (_super) {
|
|
11
12
|
tslib_1.__extends(MatAutocomplete, _super);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"autocomplete-material.js","sourceRoot":"","sources":["../../../../src/core/protractor/angular-materials/autocomplete-material.ts"],"names":[],"mappings":";;;;AAAA,yCAAsD;AAEtD,sCAAsC;AAItC
|
|
1
|
+
{"version":3,"file":"autocomplete-material.js","sourceRoot":"","sources":["../../../../src/core/protractor/angular-materials/autocomplete-material.ts"],"names":[],"mappings":";;;;AAAA,yCAAsD;AAEtD,sCAAsC;AAItC;;;GAGG;AACH;IAAqC,2CAAU;IAC7C,yBAAY,aAAyC;QACnD,OAAA,MAAK,YAAC,aAAa,CAAC,SAAC;IACvB,CAAC;IAED,kBAAkB;IACL,uCAAa,GAA1B,UAA2B,KAAa,EAAE,QAAiB;;;;;4BACzD,qBAAM,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAA;;wBAA1B,SAA0B,CAAC;wBAC3B,qBAAM,IAAI,CAAC,KAAK,EAAE,EAAA;;wBAAlB,SAAkB,CAAC;wBACb,SAAS,GAAG,IAAA,oBAAO,EAAC,eAAE,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAC,CAAC;wBAC7D,sBAAO,IAAI,oBAAU,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,EAAC;;;;KAC1C;IACH,sBAAC;AAAD,CAAC,AAZD,CAAqC,oBAAU,GAY9C;AAZY,0CAAe","sourcesContent":["import {By, element, ElementFinder} from 'protractor';\nimport {MatAutocompleteProfile} from '../../angular-materials';\nimport {O3rElement} from '../element';\n\nexport {SelectElementProfile} from '../../elements';\n\n/**\n * Implementation dedicated to Protractor.\n * @deprecated Will be removed in v13, please use Playwright instead\n */\nexport class MatAutocomplete extends O3rElement implements MatAutocompleteProfile {\n constructor(sourceElement: ElementFinder | O3rElement) {\n super(sourceElement);\n }\n\n /** @inheritdoc */\n public async selectByValue(value: string, _timeout?: number) {\n await this.setValue(value);\n await this.click();\n const matOption = element(By.css('.mat-option, mat-option'));\n return new O3rElement(matOption).click();\n }\n}\n"]}
|
|
@@ -4,6 +4,7 @@ import { O3rElement } from '../element';
|
|
|
4
4
|
export { SelectElementProfile } from '../../elements';
|
|
5
5
|
/**
|
|
6
6
|
* Implementation dedicated to Protractor.
|
|
7
|
+
* @deprecated Will be removed in v13, please use Playwright instead
|
|
7
8
|
*/
|
|
8
9
|
export declare class MatSelect extends O3rElement implements MatSelectProfile {
|
|
9
10
|
constructor(sourceElement: ElementFinder | O3rElement);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select-material.d.ts","sourceRoot":"","sources":["../../../../src/core/protractor/angular-materials/select-material.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,aAAa,EAAC,MAAM,YAAY,CAAC;AACtD,OAAO,EAAC,gBAAgB,EAAC,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAC,UAAU,EAAC,MAAM,YAAY,CAAC;AACtC,OAAO,EAAC,oBAAoB,EAAC,MAAM,gBAAgB,CAAC;AAEpD
|
|
1
|
+
{"version":3,"file":"select-material.d.ts","sourceRoot":"","sources":["../../../../src/core/protractor/angular-materials/select-material.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,aAAa,EAAC,MAAM,YAAY,CAAC;AACtD,OAAO,EAAC,gBAAgB,EAAC,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAC,UAAU,EAAC,MAAM,YAAY,CAAC;AACtC,OAAO,EAAC,oBAAoB,EAAC,MAAM,gBAAgB,CAAC;AAEpD;;;GAGG;AACH,qBAAa,SAAU,SAAQ,UAAW,YAAW,gBAAgB;gBACvD,aAAa,EAAE,aAAa,GAAG,UAAU;IAIrD,kBAAkB;IACL,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM;IAY3D,kBAAkB;IACL,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM;IAe3D,kBAAkB;IACL,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM;IAe3D,kBAAkB;IACX,QAAQ;CAIhB"}
|
|
@@ -6,6 +6,7 @@ var protractor_1 = require("protractor");
|
|
|
6
6
|
var element_1 = require("../element");
|
|
7
7
|
/**
|
|
8
8
|
* Implementation dedicated to Protractor.
|
|
9
|
+
* @deprecated Will be removed in v13, please use Playwright instead
|
|
9
10
|
*/
|
|
10
11
|
var MatSelect = /** @class */ (function (_super) {
|
|
11
12
|
tslib_1.__extends(MatSelect, _super);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select-material.js","sourceRoot":"","sources":["../../../../src/core/protractor/angular-materials/select-material.ts"],"names":[],"mappings":";;;;AAAA,yCAAsD;AAEtD,sCAAsC;AAGtC
|
|
1
|
+
{"version":3,"file":"select-material.js","sourceRoot":"","sources":["../../../../src/core/protractor/angular-materials/select-material.ts"],"names":[],"mappings":";;;;AAAA,yCAAsD;AAEtD,sCAAsC;AAGtC;;;GAGG;AACH;IAA+B,qCAAU;IACvC,mBAAY,aAAyC;QACnD,OAAA,MAAK,YAAC,aAAa,CAAC,SAAC;IACvB,CAAC;IAED,kBAAkB;IACL,iCAAa,GAA1B,UAA2B,KAAa,EAAE,QAAiB;;;;;4BACzD,qBAAM,IAAI,CAAC,KAAK,EAAE,EAAA;;wBAAlB,SAAkB,CAAC;wBAEc,qBAAM,oBAAO,CAAC,GAAG,CAAC,eAAE,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,iBAAiB,EAAE,EAAA;;wBAAtF,OAAO,GAAoB,SAA2D;wBAC5F,IAAI,OAAO,OAAO,CAAC,KAAK,CAAC,KAAK,WAAW,EAAE,CAAC;4BACpC,MAAM,GAAG,IAAI,oBAAU,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;4BAC9C,sBAAO,MAAM,CAAC,KAAK,EAAE,EAAC;wBACxB,CAAC;6BAAM,CAAC;4BACN,sBAAO,OAAO,CAAC,MAAM,CAAC,4BAAqB,KAAK,kCAA+B,CAAC,EAAC;wBACnF,CAAC;;;;;KACF;IAED,kBAAkB;IACL,iCAAa,GAA1B,UAA2B,KAAa,EAAE,QAAiB;;;;;4BACzD,qBAAM,IAAI,CAAC,KAAK,EAAE,EAAA;;wBAAlB,SAAkB,CAAC;wBAEc,qBAAM,oBAAO,CAAC,GAAG,CAAC,eAAE,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,iBAAiB,EAAE,EAAA;;wBAAtF,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C,AAvDD,CAA+B,oBAAU,GAuDxC;AAvDY,8BAAS","sourcesContent":["import {By, element, ElementFinder} from 'protractor';\nimport {MatSelectProfile} from '../../angular-materials';\nimport {O3rElement} from '../element';\nexport {SelectElementProfile} from '../../elements';\n\n/**\n * Implementation dedicated to Protractor.\n * @deprecated Will be removed in v13, please use Playwright instead\n */\nexport class MatSelect extends O3rElement implements MatSelectProfile {\n constructor(sourceElement: ElementFinder | O3rElement) {\n super(sourceElement);\n }\n\n /** @inheritdoc */\n public async selectByIndex(index: number, _timeout?: number) {\n await this.click();\n // eslint-disable-next-line no-underscore-dangle\n const options: ElementFinder[] = await element.all(By.css('mat-option')).asElementFinders_();\n if (typeof options[index] !== 'undefined') {\n const option = new O3rElement(options[index]);\n return option.click();\n } else {\n return Promise.reject(`Option with index ${index} not found in select element.`);\n }\n }\n\n /** @inheritdoc */\n public async selectByValue(value: string, _timeout?: number) {\n await this.click();\n // eslint-disable-next-line no-underscore-dangle\n const options: ElementFinder[] = await element.all(By.css('mat-option')).asElementFinders_();\n\n for (const opt of options) {\n const option = new O3rElement(opt);\n if (await option.getAttribute('ng-reflect-value') === value) {\n return option.click();\n }\n }\n\n return Promise.reject(`Option with value ${value} not found in select element.`);\n }\n\n /** @inheritdoc */\n public async selectByLabel(label: string, _timeout?: number) {\n await this.click();\n // eslint-disable-next-line no-underscore-dangle\n const options: ElementFinder[] = await element.all(By.css('mat-option')).asElementFinders_();\n\n for (const opt of options) {\n const option = new O3rElement(opt);\n if (await option.getText() === label) {\n return option.click();\n }\n }\n\n return Promise.reject(`Option with label ${label} not found in select element.`);\n }\n\n /** @inheritDoc */\n public getValue() {\n console.warn('Usage of \"getValue\" is not recommended on Material Select elements. Use \"getPlainText()\" instead.');\n return super.getValue();\n }\n}\n"]}
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import type { ComponentFixtureProfile } from '../component-fixture';
|
|
2
2
|
import { O3rElement, O3rElementConstructor } from './element';
|
|
3
3
|
import { O3rGroup, O3rGroupConstructor } from './group';
|
|
4
|
+
/**
|
|
5
|
+
* @deprecated Will be removed in v13, please use Playwright instead
|
|
6
|
+
*/
|
|
4
7
|
export type { ComponentFixtureProfile, Constructable, FixtureWithCustom } from '../component-fixture';
|
|
5
8
|
/**
|
|
6
9
|
* Implementation of the fixture dedicated to protractor, hence using the webdriver to interact with the dom.
|
|
10
|
+
* @deprecated Will be removed in v13, please use Playwright instead
|
|
7
11
|
*/
|
|
8
12
|
export declare class O3rComponentFixture<V extends O3rElement = O3rElement> implements ComponentFixtureProfile<V> {
|
|
9
13
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component-fixture.d.ts","sourceRoot":"","sources":["../../../src/core/protractor/component-fixture.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAEpE,OAAO,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAGxD,YAAY,EAAE,uBAAuB,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEtG
|
|
1
|
+
{"version":3,"file":"component-fixture.d.ts","sourceRoot":"","sources":["../../../src/core/protractor/component-fixture.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAEpE,OAAO,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAGxD;;GAEG;AACH,YAAY,EAAE,uBAAuB,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEtG;;;GAGG;AACH,qBAAa,mBAAmB,CAAC,CAAC,SAAS,UAAU,GAAG,UAAU,CAAE,YAAW,uBAAuB,CAAC,CAAC,CAA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AAQ,CAAC,CAAC,SAAS,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,qBAAqB,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,EAAE,CAAC;IAC7I,QAAQ,CAAC,CAAC,SAAS,UAAU,EAAE,CAAC,SAAS,QAAQ,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,qBAAqB,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,mBAAmB,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC;IAyB9L,kBAAkB;IACX,UAAU;IAIjB,kBAAkB;IACX,gBAAgB,IAAI,OAAO,CAAC;QAAC,CAAC,aAAa,EAAE,MAAM,GAAG,uBAAuB,EAAE,CAAA;KAAC,CAAC;IAIxF,kBAAkB;IACL,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CAIpF"}
|
|
@@ -10,6 +10,7 @@ var element_1 = require("./element");
|
|
|
10
10
|
var utils_1 = require("./utils");
|
|
11
11
|
/**
|
|
12
12
|
* Implementation of the fixture dedicated to protractor, hence using the webdriver to interact with the dom.
|
|
13
|
+
* @deprecated Will be removed in v13, please use Playwright instead
|
|
13
14
|
*/
|
|
14
15
|
var O3rComponentFixture = /** @class */ (function () {
|
|
15
16
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component-fixture.js","sourceRoot":"","sources":["../../../src/core/protractor/component-fixture.ts"],"names":[],"mappings":";;;;AAAA,4BAA4B;AAC5B,yCAAiE;AACjE,4CAAuD;AAGvD,sCAAyC;AACzC,qCAA8D;AAE9D,iCAAyC;AAIzC;;GAEG;AACH;IAME;;;;OAIG;IACH,6BAAY,W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AC;4BAGhC,sBAAO,QAAQ,EAAC;;;;KACjB;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;IACL,6CAAe,GAA5B,UAA6B,QAAgB,EAAE,QAAiB;;;;;;wBACxD,aAAa,GAAG,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC;wBAChE,qBAAM,CAAC,aAAa,IAAI,oBAAO,CAAC,CAAC,gBAAgB,CAAC,eAAE,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,EAAA;4BAA5E,sBAAO,CAAC,CAAC,SAAmE,CAAC,EAAC;;;;KAC/E;IACH,0BAAC;AAAD,CAAC,AAjND,IAiNC;AAjNY,kDAAmB","sourcesContent":["/* eslint-disable new-cap */\nimport { browser, By, element, ElementFinder } from 'protractor';\nimport { FixtureUsageError } from '../../errors/index';\n\nimport type { ComponentFixtureProfile } from '../component-fixture';\nimport { withTimeout } from '../helpers';\nimport { O3rElement, O3rElementConstructor } from './element';\nimport { O3rGroup, O3rGroupConstructor } from './group';\nimport { convertPromise } from './utils';\n\nexport type { ComponentFixtureProfile, Constructable, FixtureWithCustom } from '../component-fixture';\n\n/**\n * Implementation of the fixture dedicated to protractor, 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. Optional in a Protractor.\n * All further queries will be applied to the element tree if any, otherwise they will be applied to the whole DOM.\n * @param rootElement\n */\n constructor(rootElement?: V) {\n this.rootElement = rootElement;\n }\n\n /**\n * Throws an exception if the element is undefined.\n * Otherwise returns the element.\n * @param elemnt ElementProfile to test\n * @param _timeout specific timeout that will throw when reach\n */\n protected throwOnUndefinedElement<T extends O3rElement>(elemnt?: T, _timeout?: number): Promise<T> {\n if (!elemnt) {\n throw new Error('Element not found in ' + this.constructor.name);\n }\n return Promise.resolve(elemnt);\n }\n\n /**\n * Throws an exception if the element is undefined.\n * Otherwise returns the element.\n * @param elemnt ElementProfile to test\n * @param timeout specific timeout that will throw when reach\n */\n protected async throwOnUndefined<T extends O3rElement>(elemnt: Promise<T | undefined>, timeout?: number): Promise<T> {\n return withTimeout(elemnt, timeout)\n .then((el) => {\n if (!el) {\n throw new Error('Element not found in ' + this.constructor.name);\n }\n return el;\n });\n }\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 | undefined> {\n let queryElement: O3rElement | undefined;\n if (options.index !== undefined) {\n queryElement = await this.queryNth(selector, options.index, elementConstructor as any);\n } else {\n queryElement = await this.query(selector, elementConstructor as any);\n }\n if (options.shouldThrowIfNotPresent) {\n return this.throwOnUndefinedElement<O3rElement>(queryElement, options.timeout);\n }\n return queryElement;\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> | undefined;\n index?: number;\n shouldThrowIfNotPresent?: boolean;\n timeout?: number;\n } = {}): Promise<string | undefined> {\n const getTextElement = await this.queryWithOptions(selector, options.elementConstructor, options);\n if (!getTextElement || !await getTextElement.isVisible()) {\n return;\n }\n return await getTextElement.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 isVisibleElement = await this.queryWithOptions(selector, options.elementConstructor, options);\n return !!isVisibleElement && await isVisibleElement.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 clickElement = await this.queryWithOptions(selector, options.elementConstructor, options);\n if (!!clickElement && await clickElement.isVisible()) {\n await clickElement.click();\n }\n }\n\n /** @inheritdoc */\n public async query(selector: string, returnType?: undefined): Promise<O3rElement | undefined>;\n public async query<T extends O3rElement>(selector: string, returnType: O3rElementConstructor<T>): Promise<T | undefined>;\n public async query<T extends O3rElement>(selector: string, returnType: O3rElementConstructor<T> | undefined): Promise<T | O3rElement | undefined> {\n const sourceElement = this.rootElement && this.rootElement.sourceElement;\n const cssSelector = By.css(selector);\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n const isElPresent = await (sourceElement! || browser).isElementPresent(cssSelector);\n if (!isElPresent) {\n console.warn(`No component matching ${selector} found`);\n return;\n }\n const queriedElement = sourceElement ? sourceElement.element(cssSelector) : element(cssSelector);\n return returnType ? new returnType(queriedElement) : new O3rElement(queriedElement);\n }\n\n /** @inheritdoc */\n public async queryNth(selector: string, index: number, returnType?: undefined): Promise<O3rElement | undefined>;\n public async queryNth<T extends O3rElement>(selector: string, index: number, returnType: O3rElementConstructor<T>): Promise<T | undefined>;\n public async queryNth<T extends O3rElement>(selector: string, index: number, returnType: O3rElementConstructor<T> | undefined): Promise<T | O3rElement | undefined> {\n const sourceElement = this.rootElement && this.rootElement.sourceElement;\n const item = (sourceElement || element).all(By.css(selector)).get(index);\n if (!(await item.isPresent())) {\n console.warn(`No component matching ${selector}:nth(${index}) found`);\n return;\n }\n return new (returnType || O3rElement)(item);\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?: number\n ): Promise<(T | O3rElement)[] | K> {\n const pElements = (this.rootElement ? this.rootElement.sourceElement.all(By.css(selector)) : element.all(By.css(selector)))\n .filter((item) => typeof item !== 'undefined')\n .then((elf: ElementFinder[]) => elf.map((item) => (returnType ? new returnType(item) : new O3rElement(item))));\n const elements = await convertPromise(pElements);\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 Promise.resolve(group);\n }\n\n return elements;\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 async queryNotPresent(selector: string, _timeout?: number): Promise<boolean> {\n const sourceElement = this.rootElement && this.rootElement.sourceElement;\n return !(await (sourceElement || browser).isElementPresent(By.css(selector)));\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"component-fixture.js","sourceRoot":"","sources":["../../../src/core/protractor/component-fixture.ts"],"names":[],"mappings":";;;;AAAA,4BAA4B;AAC5B,yCAAiE;AACjE,4CAAuD;AAGvD,sCAAyC;AACzC,qCAA8D;AAE9D,iCAAyC;AAOzC;;;GAGG;AACH;IAME;;;;OAIG;IACH,6BAAY,WAAe;QACzB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACjC,CAAC;IAED;;;;;OAKG;IACO,qDAAuB,GAAjC,UAAwD,MAAU,EAAE,QAAiB;QACnF,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,IAAI,KAAK,CAAC,uBAAuB,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QACnE,CAAC;QACD,OAAO,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IACjC,CAAC;IAED;;;;;OAKG;IACa,8CAAgB,GAAhC,UAAuD,MAA8B,EAAE,OAAgB;;;;gBACrG,sBAAO,IAAA,qBAAW,EAAC,MAAM,EAAE,OAAO,CAAC;yBAChC,IAAI,CAAC,UAAC,EAAE;wBACP,IAAI,CAAC,EAAE,EAAE,CAAC;4BACR,MAAM,IAAI,KAAK,CAAC,uBAAuB,GAAG,KAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;wBACnE,CAAC;wBACD,OAAO,EAAE,CAAC;oBACZ,CAAC,CAAC,EAAC;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ser, By, element, ElementFinder } from 'protractor';\nimport { FixtureUsageError } from '../../errors/index';\n\nimport type { ComponentFixtureProfile } from '../component-fixture';\nimport { withTimeout } from '../helpers';\nimport { O3rElement, O3rElementConstructor } from './element';\nimport { O3rGroup, O3rGroupConstructor } from './group';\nimport { convertPromise } from './utils';\n\n/**\n * @deprecated Will be removed in v13, please use Playwright instead\n */\nexport type { ComponentFixtureProfile, Constructable, FixtureWithCustom } from '../component-fixture';\n\n/**\n * Implementation of the fixture dedicated to protractor, hence using the webdriver to interact with the dom.\n * @deprecated Will be removed in v13, please use Playwright instead\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. Optional in a Protractor.\n * All further queries will be applied to the element tree if any, otherwise they will be applied to the whole DOM.\n * @param rootElement\n */\n constructor(rootElement?: V) {\n this.rootElement = rootElement;\n }\n\n /**\n * Throws an exception if the element is undefined.\n * Otherwise returns the element.\n * @param elemnt ElementProfile to test\n * @param _timeout specific timeout that will throw when reach\n */\n protected throwOnUndefinedElement<T extends O3rElement>(elemnt?: T, _timeout?: number): Promise<T> {\n if (!elemnt) {\n throw new Error('Element not found in ' + this.constructor.name);\n }\n return Promise.resolve(elemnt);\n }\n\n /**\n * Throws an exception if the element is undefined.\n * Otherwise returns the element.\n * @param elemnt ElementProfile to test\n * @param timeout specific timeout that will throw when reach\n */\n protected async throwOnUndefined<T extends O3rElement>(elemnt: Promise<T | undefined>, timeout?: number): Promise<T> {\n return withTimeout(elemnt, timeout)\n .then((el) => {\n if (!el) {\n throw new Error('Element not found in ' + this.constructor.name);\n }\n return el;\n });\n }\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 | undefined> {\n let queryElement: O3rElement | undefined;\n if (options.index !== undefined) {\n queryElement = await this.queryNth(selector, options.index, elementConstructor as any);\n } else {\n queryElement = await this.query(selector, elementConstructor as any);\n }\n if (options.shouldThrowIfNotPresent) {\n return this.throwOnUndefinedElement<O3rElement>(queryElement, options.timeout);\n }\n return queryElement;\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> | undefined;\n index?: number;\n shouldThrowIfNotPresent?: boolean;\n timeout?: number;\n } = {}): Promise<string | undefined> {\n const getTextElement = await this.queryWithOptions(selector, options.elementConstructor, options);\n if (!getTextElement || !await getTextElement.isVisible()) {\n return;\n }\n return await getTextElement.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 isVisibleElement = await this.queryWithOptions(selector, options.elementConstructor, options);\n return !!isVisibleElement && await isVisibleElement.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 clickElement = await this.queryWithOptions(selector, options.elementConstructor, options);\n if (!!clickElement && await clickElement.isVisible()) {\n await clickElement.click();\n }\n }\n\n /** @inheritdoc */\n public async query(selector: string, returnType?: undefined): Promise<O3rElement | undefined>;\n public async query<T extends O3rElement>(selector: string, returnType: O3rElementConstructor<T>): Promise<T | undefined>;\n public async query<T extends O3rElement>(selector: string, returnType: O3rElementConstructor<T> | undefined): Promise<T | O3rElement | undefined> {\n const sourceElement = this.rootElement && this.rootElement.sourceElement;\n const cssSelector = By.css(selector);\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n const isElPresent = await (sourceElement! || browser).isElementPresent(cssSelector);\n if (!isElPresent) {\n console.warn(`No component matching ${selector} found`);\n return;\n }\n const queriedElement = sourceElement ? sourceElement.element(cssSelector) : element(cssSelector);\n return returnType ? new returnType(queriedElement) : new O3rElement(queriedElement);\n }\n\n /** @inheritdoc */\n public async queryNth(selector: string, index: number, returnType?: undefined): Promise<O3rElement | undefined>;\n public async queryNth<T extends O3rElement>(selector: string, index: number, returnType: O3rElementConstructor<T>): Promise<T | undefined>;\n public async queryNth<T extends O3rElement>(selector: string, index: number, returnType: O3rElementConstructor<T> | undefined): Promise<T | O3rElement | undefined> {\n const sourceElement = this.rootElement && this.rootElement.sourceElement;\n const item = (sourceElement || element).all(By.css(selector)).get(index);\n if (!(await item.isPresent())) {\n console.warn(`No component matching ${selector}:nth(${index}) found`);\n return;\n }\n return new (returnType || O3rElement)(item);\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?: number\n ): Promise<(T | O3rElement)[] | K> {\n const pElements = (this.rootElement ? this.rootElement.sourceElement.all(By.css(selector)) : element.all(By.css(selector)))\n .filter((item) => typeof item !== 'undefined')\n .then((elf: ElementFinder[]) => elf.map((item) => (returnType ? new returnType(item) : new O3rElement(item))));\n const elements = await convertPromise(pElements);\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 Promise.resolve(group);\n }\n\n return elements;\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 async queryNotPresent(selector: string, _timeout?: number): Promise<boolean> {\n const sourceElement = this.rootElement && this.rootElement.sourceElement;\n return !(await (sourceElement || browser).isElementPresent(By.css(selector)));\n }\n}\n"]}
|
|
@@ -3,6 +3,7 @@ import { ElementProfile } from '../element';
|
|
|
3
3
|
export { ElementProfile } from '../element';
|
|
4
4
|
/**
|
|
5
5
|
* Implementation dedicated to protractor.
|
|
6
|
+
* @deprecated Will be removed in v13, please use Playwright instead
|
|
6
7
|
*/
|
|
7
8
|
export declare class O3rElement implements ElementProfile {
|
|
8
9
|
/** Protractor ElementProfile */
|
|
@@ -31,6 +32,7 @@ export declare class O3rElement implements ElementProfile {
|
|
|
31
32
|
}
|
|
32
33
|
/**
|
|
33
34
|
* Constructor of a O3rElement
|
|
35
|
+
* @deprecated Will be removed in v13, please use Playwright instead
|
|
34
36
|
*/
|
|
35
37
|
export type O3rElementConstructor<T extends ElementProfile> = new (sourceElement: ElementFinder | O3rElement) => T;
|
|
36
38
|
//# sourceMappingURL=element.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"element.d.ts","sourceRoot":"","sources":["../../../src/core/protractor/element.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,aAAa,EAAC,MAAM,YAAY,CAAC;AAGlD,OAAO,EAAC,cAAc,EAAC,MAAM,YAAY,CAAC;AAG1C,OAAO,EAAC,cAAc,EAAC,MAAM,YAAY,CAAC;AAE1C
|
|
1
|
+
{"version":3,"file":"element.d.ts","sourceRoot":"","sources":["../../../src/core/protractor/element.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,aAAa,EAAC,MAAM,YAAY,CAAC;AAGlD,OAAO,EAAC,cAAc,EAAC,MAAM,YAAY,CAAC;AAG1C,OAAO,EAAC,cAAc,EAAC,MAAM,YAAY,CAAC;AAE1C;;;GAGG;AACH,qBAAa,UAAW,YAAW,cAAc;IAC/C,gCAAgC;IACzB,aAAa,EAAE,aAAa,CAAC;gBAExB,aAAa,EAAE,aAAa,GAAG,UAAU;IAIrD,kBAAkB;IACX,OAAO;IAId,kBAAkB;IACL,YAAY;IAKzB,kBAAkB;IACX,YAAY,IAAI,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAIlD,kBAAkB;IACX,SAAS;IAShB,kBAAkB;IACL,QAAQ;IAKrB,kBAAkB;IACL,QAAQ,CAAC,KAAK,EAAE,MAAM;IAQnC,kBAAkB;IACL,UAAU;IAQvB,kBAAkB;IACL,KAAK;IAKlB,kBAAkB;IACL,SAAS;IAItB,kBAAkB;IACL,YAAY,CAAC,aAAa,EAAE,MAAM;CAIhD;AAED;;;GAGG;AACH,MAAM,MAAM,qBAAqB,CAAC,CAAC,SAAS,cAAc,IAAI,KAAK,aAAa,EAAE,aAAa,GAAG,UAAU,KAAK,CAAC,CAAC"}
|
|
@@ -8,6 +8,7 @@ var protractor_2 = require("../../tools/protractor");
|
|
|
8
8
|
var utils_1 = require("./utils");
|
|
9
9
|
/**
|
|
10
10
|
* Implementation dedicated to protractor.
|
|
11
|
+
* @deprecated Will be removed in v13, please use Playwright instead
|
|
11
12
|
*/
|
|
12
13
|
var O3rElement = /** @class */ (function () {
|
|
13
14
|
function O3rElement(sourceElement) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"element.js","sourceRoot":"","sources":["../../../src/core/protractor/element.ts"],"names":[],"mappings":";;;;AAAA,yCAAkD;AAClD,8CAAyD;AACzD,qDAA0D;AAE1D,iCAAuC;AAIvC
|
|
1
|
+
{"version":3,"file":"element.js","sourceRoot":"","sources":["../../../src/core/protractor/element.ts"],"names":[],"mappings":";;;;AAAA,yCAAkD;AAClD,8CAAyD;AACzD,qDAA0D;AAE1D,iCAAuC;AAIvC;;;GAGG;AACH;IAIE,oBAAY,aAAyC;QACnD,IAAI,CAAC,aAAa,GAAG,aAAa,YAAY,UAAU,CAAC,CAAC,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC,CAAC,aAAa,CAAC;IACzG,CAAC;IAED,kBAAkB;IACX,4BAAO,GAAd;QACE,OAAO,IAAA,sBAAc,EAAC,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,CAAC,CAAC;IACtD,CAAC;IAED,kBAAkB;IACL,iCAAY,GAAzB;;;;;4BACoB,qBAAM,IAAI,CAAC,OAAO,EAAE,EAAA;;wBAAhC,SAAS,GAAG,SAAoB;wBACtC,sBAAO,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,iBAAiB,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,GAAG,CAA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Q,WAAI,KAAK,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,iBAAI,CAAC,GAAG,CAAC,UAAU,CAAC,GAAC;;wBAA9F,SAA8F,CAAC;;;;;;KAElG;IAED,kBAAkB;IACL,0BAAK,GAAlB;;;;4BACE,qBAAM,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,EAAA;;wBAAhC,SAAgC,CAAC;wBACjC,sBAAO,IAAA,+BAAkB,GAAE,EAAC;;;;KAC7B;IAED,kBAAkB;IACL,8BAAS,GAAtB;;;;4BACS,qBAAM,IAAI,CAAC,aAAa,CAAC,WAAW,EAAE,EAAA;4BAA7C,sBAAO,SAAsC,EAAC;;;;KAC/C;IAED,kBAAkB;IACL,iCAAY,GAAzB,UAA0B,aAAqB;;;;;4BAC3B,qBAAM,IAAI,CAAC,aAAa,CAAC,YAAY,CAAC,aAAa,CAAC,EAAA;;wBAAhE,SAAS,GAAG,SAAoD;wBACtE,sBAAO,SAAS,KAAK,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,EAAC;;;;KACnD;IACH,iBAAC;AAAD,CAAC,AA1ED,IA0EC;AA1EY,gCAAU","sourcesContent":["import {browser, ElementFinder} from 'protractor';\nimport {protractor as ptor} from 'protractor/built/ptor';\nimport {waitForOtterStable} from '../../tools/protractor';\nimport {ElementProfile} from '../element';\nimport {convertPromise} from './utils';\n\nexport {ElementProfile} from '../element';\n\n/**\n * Implementation dedicated to protractor.\n * @deprecated Will be removed in v13, please use Playwright instead\n */\nexport class O3rElement implements ElementProfile {\n /** Protractor ElementProfile */\n public sourceElement: ElementFinder;\n\n constructor(sourceElement: ElementFinder | O3rElement) {\n this.sourceElement = sourceElement instanceof O3rElement ? sourceElement.sourceElement : sourceElement;\n }\n\n /** @inheritdoc */\n public getText() {\n return convertPromise(this.sourceElement.getText());\n }\n\n /** @inheritdoc */\n public async getPlainText() {\n const innerText = await this.getText();\n return Promise.resolve(innerText ? innerText.replace(/(?:\\r\\n|\\r|\\n)/g, ' ').replace(/\\s\\s+/g, ' ').trim() : undefined);\n }\n\n /** @inheritdoc */\n public getInnerHTML(): Promise<string | undefined> {\n return convertPromise(this.sourceElement.getInnerHtml());\n }\n\n /** @inheritdoc */\n public mouseOver() {\n return convertPromise(\n browser\n .actions()\n .mouseMove(this.sourceElement)\n .perform()\n );\n }\n\n /** @inheritdoc */\n public async getValue() {\n const value = await this.sourceElement.getAttribute('value');\n return value !== null ? value : undefined;\n }\n\n /** @inheritdoc */\n public async setValue(input: string) {\n // Clears the value in the field\n await this.clearValue();\n await this.sourceElement.sendKeys(input);\n await this.sourceElement.sendKeys(ptor.Key.TAB);\n return waitForOtterStable();\n }\n\n /** @inheritdoc */\n public async clearValue() {\n const currentValue = await this.getValue();\n\n if (currentValue !== undefined) {\n await this.sourceElement.sendKeys(...Array(currentValue.length + 1).fill(ptor.Key.BACK_SPACE));\n }\n }\n\n /** @inheritdoc */\n public async click() {\n await this.sourceElement.click();\n return waitForOtterStable();\n }\n\n /** @inheritdoc */\n public async isVisible() {\n return await this.sourceElement.isDisplayed();\n }\n\n /** @inheritdoc */\n public async getAttribute(attributeName: string) {\n const attribute = await this.sourceElement.getAttribute(attributeName);\n return attribute !== null ? attribute : undefined;\n }\n}\n\n/**\n * Constructor of a O3rElement\n * @deprecated Will be removed in v13, please use Playwright instead\n */\nexport type O3rElementConstructor<T extends ElementProfile> = new (sourceElement: ElementFinder | O3rElement) => T;\n"]}
|
|
@@ -3,6 +3,7 @@ import { CheckboxElementProfile } from '../../elements';
|
|
|
3
3
|
import { O3rElement } from '../element';
|
|
4
4
|
/**
|
|
5
5
|
* Implementation dedicated to karma / TestBed.
|
|
6
|
+
* @deprecated Will be removed in v13, please use Playwright instead
|
|
6
7
|
*/
|
|
7
8
|
export declare class O3rCheckboxElement extends O3rElement implements CheckboxElementProfile {
|
|
8
9
|
constructor(sourceElement: ElementFinder);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkbox-element.d.ts","sourceRoot":"","sources":["../../../../src/core/protractor/elements/checkbox-element.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,YAAY,CAAC;AACzC,OAAO,EAAC,sBAAsB,EAAC,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAC,UAAU,EAAC,MAAM,YAAY,CAAC;AAEtC
|
|
1
|
+
{"version":3,"file":"checkbox-element.d.ts","sourceRoot":"","sources":["../../../../src/core/protractor/elements/checkbox-element.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,YAAY,CAAC;AACzC,OAAO,EAAC,sBAAsB,EAAC,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAC,UAAU,EAAC,MAAM,YAAY,CAAC;AAEtC;;;GAGG;AACH,qBAAa,kBAAmB,SAAQ,UAAW,YAAW,sBAAsB;gBACtE,aAAa,EAAE,aAAa;IAIxC,kBAAkB;IACL,KAAK,CAAC,KAAK,UAAO,EAAE,eAAe,CAAC,EAAE,UAAU;IAS7D,kBAAkB;IACX,OAAO;IAId,kBAAkB;IACL,SAAS,IAAI,OAAO,CAAC,OAAO,CAAC;CAI3C"}
|
|
@@ -5,6 +5,7 @@ var tslib_1 = require("tslib");
|
|
|
5
5
|
var element_1 = require("../element");
|
|
6
6
|
/**
|
|
7
7
|
* Implementation dedicated to karma / TestBed.
|
|
8
|
+
* @deprecated Will be removed in v13, please use Playwright instead
|
|
8
9
|
*/
|
|
9
10
|
var O3rCheckboxElement = /** @class */ (function (_super) {
|
|
10
11
|
tslib_1.__extends(O3rCheckboxElement, _super);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkbox-element.js","sourceRoot":"","sources":["../../../../src/core/protractor/elements/checkbox-element.ts"],"names":[],"mappings":";;;;AAEA,sCAAsC;AAEtC
|
|
1
|
+
{"version":3,"file":"checkbox-element.js","sourceRoot":"","sources":["../../../../src/core/protractor/elements/checkbox-element.ts"],"names":[],"mappings":";;;;AAEA,sCAAsC;AAEtC;;;GAGG;AACH;IAAwC,8CAAU;IAChD,4BAAY,aAA4B;QACtC,OAAA,MAAK,YAAC,aAAa,CAAC,SAAC;IACvB,CAAC;IAED,kBAAkB;IACL,kCAAK,GAAlB;oEAAmB,KAAY,EAAE,eAA4B;;YAA1C,sBAAA,EAAA,YAAY;;;4BACR,qBAAM,IAAI,CAAC,SAAS,EAAE,EAAA;;wBAArC,YAAY,GAAG,SAAsB;wBAC3C,IAAI,YAAY,KAAK,KAAK,EAAE,CAAC;4BAC3B,sBAAO,OAAO,CAAC,OAAO,EAAE,EAAC;wBAC3B,CAAC;wBAED,sBAAO,eAAe,CAAC,CAAC,CAAC,eAAe,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,EAAC;;;;KACjE;IAED,kBAAkB;IACX,oCAAO,GAAd;QACE,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC3B,CAAC;IAED,kBAAkB;IACL,sCAAS,GAAtB;;;;;4BACgB,qBAAM,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,EAAA;;wBAA7C,KAAK,GAAG,SAAqC;wBACnD,sBAAO,KAAK,EAAC;;;;KACd;IACH,yBAAC;AAAD,CAAC,AAzBD,CAAwC,oBAAU,GAyBjD;AAzBY,gDAAkB","sourcesContent":["import {ElementFinder} from 'protractor';\nimport {CheckboxElementProfile} from '../../elements';\nimport {O3rElement} from '../element';\n\n/**\n * Implementation dedicated to karma / TestBed.\n * @deprecated Will be removed in v13, please use Playwright instead\n */\nexport class O3rCheckboxElement extends O3rElement implements CheckboxElementProfile {\n constructor(sourceElement: ElementFinder) {\n super(sourceElement);\n }\n\n /** @inheritDoc */\n public async check(value = true, associatedLabel?: O3rElement) {\n const currentValue = await this.isChecked();\n if (currentValue === value) {\n return Promise.resolve();\n }\n\n return associatedLabel ? associatedLabel.click() : this.click();\n }\n\n /** @inheritDoc */\n public uncheck() {\n return this.check(false);\n }\n\n /** @inheritDoc */\n public async isChecked(): Promise<boolean> {\n const value = await this.sourceElement.isSelected();\n return value;\n }\n}\n"]}
|
|
@@ -3,6 +3,7 @@ import { RadioElementProfile } from '../../elements';
|
|
|
3
3
|
import { O3rElement } from '../element';
|
|
4
4
|
/**
|
|
5
5
|
* Implementation dedicated to karma / TestBed.
|
|
6
|
+
* @deprecated Will be removed in v13, please use Playwright instead
|
|
6
7
|
*/
|
|
7
8
|
export declare class O3rRadioElement extends O3rElement implements RadioElementProfile {
|
|
8
9
|
constructor(sourceElement: ElementFinder);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"radio-element.d.ts","sourceRoot":"","sources":["../../../../src/core/protractor/elements/radio-element.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,YAAY,CAAC;AACzC,OAAO,EAAC,mBAAmB,EAAC,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAC,UAAU,EAAC,MAAM,YAAY,CAAC;AAEtC
|
|
1
|
+
{"version":3,"file":"radio-element.d.ts","sourceRoot":"","sources":["../../../../src/core/protractor/elements/radio-element.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,YAAY,CAAC;AACzC,OAAO,EAAC,mBAAmB,EAAC,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAC,UAAU,EAAC,MAAM,YAAY,CAAC;AAEtC;;;GAGG;AACH,qBAAa,eAAgB,SAAQ,UAAW,YAAW,mBAAmB;gBAChE,aAAa,EAAE,aAAa;IAIxC,kBAAkB;IACL,KAAK,CAAC,KAAK,UAAO;IAU/B,kBAAkB;IACX,OAAO;IAId,kBAAkB;IACL,SAAS,IAAI,OAAO,CAAC,OAAO,CAAC;CAI3C"}
|
|
@@ -5,6 +5,7 @@ var tslib_1 = require("tslib");
|
|
|
5
5
|
var element_1 = require("../element");
|
|
6
6
|
/**
|
|
7
7
|
* Implementation dedicated to karma / TestBed.
|
|
8
|
+
* @deprecated Will be removed in v13, please use Playwright instead
|
|
8
9
|
*/
|
|
9
10
|
var O3rRadioElement = /** @class */ (function (_super) {
|
|
10
11
|
tslib_1.__extends(O3rRadioElement, _super);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"radio-element.js","sourceRoot":"","sources":["../../../../src/core/protractor/elements/radio-element.ts"],"names":[],"mappings":";;;;AAEA,sCAAsC;AAEtC
|
|
1
|
+
{"version":3,"file":"radio-element.js","sourceRoot":"","sources":["../../../../src/core/protractor/elements/radio-element.ts"],"names":[],"mappings":";;;;AAEA,sCAAsC;AAEtC;;;GAGG;AACH;IAAqC,2CAAU;IAC7C,yBAAY,aAA4B;QACtC,OAAA,MAAK,YAAC,aAAa,CAAC,SAAC;IACvB,CAAC;IAED,kBAAkB;IACL,+BAAK,GAAlB;oEAAmB,KAAY;;YAAZ,sBAAA,EAAA,YAAY;;;4BACR,qBAAM,IAAI,CAAC,SAAS,EAAE,EAAA;;wBAArC,YAAY,GAAG,SAAsB;wBAC3C,IAAI,YAAY,KAAK,KAAK,EAAE,CAAC;4BAC3B,OAAO,CAAC,IAAI,CAAC,qCAA8B,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,CAAE,CAAC,CAAC;4BAC9E,sBAAO,OAAO,CAAC,OAAO,EAAE,EAAC;wBAC3B,CAAC;wBAED,sBAAO,IAAI,CAAC,KAAK,EAAE,EAAC;;;;KACrB;IAED,kBAAkB;IACX,iCAAO,GAAd;QACE,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC3B,CAAC;IAED,kBAAkB;IACL,mCAAS,GAAtB;;;;;4BACkB,qBAAM,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,EAAA;;wBAA5C,OAAO,GAAG,SAAkC;wBAClD,sBAAO,OAAO,KAAK,SAAS,EAAC;;;;KAC9B;IACH,sBAAC;AAAD,CAAC,AA1BD,CAAqC,oBAAU,GA0B9C;AA1BY,0CAAe","sourcesContent":["import {ElementFinder} from 'protractor';\nimport {RadioElementProfile} from '../../elements';\nimport {O3rElement} from '../element';\n\n/**\n * Implementation dedicated to karma / TestBed.\n * @deprecated Will be removed in v13, please use Playwright instead\n */\nexport class O3rRadioElement extends O3rElement implements RadioElementProfile {\n constructor(sourceElement: ElementFinder) {\n super(sourceElement);\n }\n\n /** @inheritDoc */\n public async check(value = true) {\n const currentValue = await this.isChecked();\n if (currentValue === value) {\n console.warn(`O3rRadioElement is already ${value ? 'checked' : 'unchecked'}`);\n return Promise.resolve();\n }\n\n return this.click();\n }\n\n /** @inheritDoc */\n public uncheck() {\n return this.check(false);\n }\n\n /** @inheritDoc */\n public async isChecked(): Promise<boolean> {\n const checked = await this.getAttribute('checked');\n return checked !== undefined;\n }\n}\n"]}
|
|
@@ -4,6 +4,7 @@ import { O3rElement } from '../element';
|
|
|
4
4
|
export { SelectElementProfile } from '../../elements';
|
|
5
5
|
/**
|
|
6
6
|
* Implementation dedicated to Protractor.
|
|
7
|
+
* @deprecated Will be removed in v13, please use Playwright instead
|
|
7
8
|
*/
|
|
8
9
|
export declare class O3rSelectElement extends O3rElement implements SelectElementProfile {
|
|
9
10
|
constructor(sourceElement: ElementFinder | O3rElement);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select-element.d.ts","sourceRoot":"","sources":["../../../../src/core/protractor/elements/select-element.ts"],"names":[],"mappings":"AAAA,OAAO,EAAK,aAAa,EAAC,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAC,oBAAoB,EAAC,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAC,UAAU,EAAC,MAAM,YAAY,CAAC;AAEtC,OAAO,EAAC,oBAAoB,EAAC,MAAM,gBAAgB,CAAC;AAEpD
|
|
1
|
+
{"version":3,"file":"select-element.d.ts","sourceRoot":"","sources":["../../../../src/core/protractor/elements/select-element.ts"],"names":[],"mappings":"AAAA,OAAO,EAAK,aAAa,EAAC,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAC,oBAAoB,EAAC,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAC,UAAU,EAAC,MAAM,YAAY,CAAC;AAEtC,OAAO,EAAC,oBAAoB,EAAC,MAAM,gBAAgB,CAAC;AAEpD;;;GAGG;AACH,qBAAa,gBAAiB,SAAQ,UAAW,YAAW,oBAAoB;gBAClE,aAAa,EAAE,aAAa,GAAG,UAAU;IAIrD,kBAAkB;IACL,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM;IAM3D,kBAAkB;IACL,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM;CAK5D"}
|
|
@@ -6,6 +6,7 @@ var protractor_1 = require("protractor");
|
|
|
6
6
|
var element_1 = require("../element");
|
|
7
7
|
/**
|
|
8
8
|
* Implementation dedicated to Protractor.
|
|
9
|
+
* @deprecated Will be removed in v13, please use Playwright instead
|
|
9
10
|
*/
|
|
10
11
|
var O3rSelectElement = /** @class */ (function (_super) {
|
|
11
12
|
tslib_1.__extends(O3rSelectElement, _super);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select-element.js","sourceRoot":"","sources":["../../../../src/core/protractor/elements/select-element.ts"],"names":[],"mappings":";;;;AAAA,yCAA6C;AAE7C,sCAAsC;AAItC
|
|
1
|
+
{"version":3,"file":"select-element.js","sourceRoot":"","sources":["../../../../src/core/protractor/elements/select-element.ts"],"names":[],"mappings":";;;;AAAA,yCAA6C;AAE7C,sCAAsC;AAItC;;;GAGG;AACH;IAAsC,4CAAU;IAC9C,0BAAY,aAAyC;QACnD,OAAA,MAAK,YAAC,aAAa,CAAC,SAAC;IACvB,CAAC;IAED,kBAAkB;IACL,wCAAa,GAA1B,UAA2B,KAAa,EAAE,QAAiB;;;;;4BACzD,qBAAM,IAAI,CAAC,KAAK,EAAE,EAAA;;wBAAlB,SAAkB,CAAC;wBACb,OAAO,GAAG,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,eAAE,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;wBAC7D,sBAAO,IAAI,oBAAU,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,EAAE,EAAC;;;;KACnD;IAED,kBAAkB;IACL,wCAAa,GAA1B,UAA2B,KAAa,EAAE,QAAiB;;;;;4BACzD,qBAAM,IAAI,CAAC,KAAK,EAAE,EAAA;;wBAAlB,SAAkB,CAAC;wBACb,MAAM,GAAG,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,eAAE,CAAC,GAAG,CAAC,wBAAiB,KAAK,OAAI,CAAC,CAAC,CAAC;wBAC9E,sBAAO,IAAI,oBAAU,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAC;;;;KACvC;IACH,uBAAC;AAAD,CAAC,AAlBD,CAAsC,oBAAU,GAkB/C;AAlBY,4CAAgB","sourcesContent":["import {By, ElementFinder} from 'protractor';\nimport {SelectElementProfile} from '../../elements';\nimport {O3rElement} from '../element';\n\nexport {SelectElementProfile} from '../../elements';\n\n/**\n * Implementation dedicated to Protractor.\n * @deprecated Will be removed in v13, please use Playwright instead\n */\nexport class O3rSelectElement extends O3rElement implements SelectElementProfile {\n constructor(sourceElement: ElementFinder | O3rElement) {\n super(sourceElement);\n }\n\n /** @inheritdoc */\n public async selectByIndex(index: number, _timeout?: number) {\n await this.click();\n const options = this.sourceElement.all(By.tagName('option'));\n return new O3rElement(options.get(index)).click();\n }\n\n /** @inheritdoc */\n public async selectByValue(value: string, _timeout?: number) {\n await this.click();\n const option = this.sourceElement.element(By.css(`option[value='${value}']`));\n return new O3rElement(option).click();\n }\n}\n"]}
|
|
@@ -3,10 +3,12 @@ import { ElementProfile, O3rElement } from './element';
|
|
|
3
3
|
export { GroupProfile } from '../group';
|
|
4
4
|
/**
|
|
5
5
|
* Constructor of a O3rGroup
|
|
6
|
+
* @deprecated Will be removed in v13, please use Playwright instead
|
|
6
7
|
*/
|
|
7
8
|
export type O3rGroupConstructor<T extends GroupProfile<V>, V extends ElementProfile> = new (sourceElement: V[]) => T;
|
|
8
9
|
/**
|
|
9
10
|
* Implementation dedicated to karma / TestBed.
|
|
11
|
+
* @deprecated Will be removed in v13, please use Playwright instead
|
|
10
12
|
*/
|
|
11
13
|
export declare class O3rGroup<T extends O3rElement> implements GroupProfile<T> {
|
|
12
14
|
protected sourceElement: T[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"group.d.ts","sourceRoot":"","sources":["../../../src/core/protractor/group.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEvD,OAAO,EAAC,YAAY,EAAC,MAAM,UAAU,CAAC;AAEtC
|
|
1
|
+
{"version":3,"file":"group.d.ts","sourceRoot":"","sources":["../../../src/core/protractor/group.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEvD,OAAO,EAAC,YAAY,EAAC,MAAM,UAAU,CAAC;AAEtC;;;GAGG;AAEH,MAAM,MAAM,mBAAmB,CAAC,CAAC,SAAS,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC,SAAS,cAAc,IAAI,KAAK,aAAa,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC;AAErH;;;GAGG;AACH,qBAAa,QAAQ,CAAC,CAAC,SAAS,UAAU,CAAE,YAAW,YAAY,CAAC,CAAC,CAAC;IAOxD,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"}
|
package/core/protractor/group.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.O3rGroup = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* Implementation dedicated to karma / TestBed.
|
|
6
|
+
* @deprecated Will be removed in v13, please use Playwright instead
|
|
6
7
|
*/
|
|
7
8
|
var O3rGroup = /** @class */ (function () {
|
|
8
9
|
function O3rGroup(sourceElement) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"group.js","sourceRoot":"","sources":["../../../src/core/protractor/group.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"group.js","sourceRoot":"","sources":["../../../src/core/protractor/group.ts"],"names":[],"mappings":";;;AAYA;;;GAGG;AACH;IAOE,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,AAbD,IAaC;AAbY,4BAAQ","sourcesContent":["import { GroupProfile } from '../group';\nimport { ElementProfile, O3rElement } from './element';\n\nexport {GroupProfile} from '../group';\n\n/**\n * Constructor of a O3rGroup\n * @deprecated Will be removed in v13, please use Playwright instead\n */\n// eslint-disable-next-line no-use-before-define\nexport type O3rGroupConstructor<T extends GroupProfile<V>, V extends ElementProfile> = new (sourceElement: V[]) => T;\n\n/**\n * Implementation dedicated to karma / TestBed.\n * @deprecated Will be removed in v13, please use Playwright instead\n */\nexport class O3rGroup<T extends O3rElement> implements GroupProfile<T> {\n\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"]}
|
|
@@ -3,6 +3,7 @@ import { O3rRadioElement } from '../elements/radio-element';
|
|
|
3
3
|
import { O3rGroup } from '../group';
|
|
4
4
|
/**
|
|
5
5
|
* Group element to manage a radio group
|
|
6
|
+
* @deprecated Will be removed in v13, please use Playwright instead
|
|
6
7
|
*/
|
|
7
8
|
export declare class O3rRadioGroup extends O3rGroup<O3rRadioElement> implements RadioGroupProfile {
|
|
8
9
|
constructor(sourceElement: O3rRadioElement[]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"radio-group.d.ts","sourceRoot":"","sources":["../../../../src/core/protractor/groups/radio-group.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEpC
|
|
1
|
+
{"version":3,"file":"radio-group.d.ts","sourceRoot":"","sources":["../../../../src/core/protractor/groups/radio-group.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEpC;;;GAGG;AACH,qBAAa,aAAc,SAAQ,QAAQ,CAAC,eAAe,CAAE,YAAW,iBAAiB;gBAC3E,aAAa,EAAE,eAAe,EAAE;IAI5C,kBAAkB;IACL,YAAY;IAiBzB;;OAEG;IACU,eAAe;CAW7B"}
|
|
@@ -5,6 +5,7 @@ var tslib_1 = require("tslib");
|
|
|
5
5
|
var group_1 = require("../group");
|
|
6
6
|
/**
|
|
7
7
|
* Group element to manage a radio group
|
|
8
|
+
* @deprecated Will be removed in v13, please use Playwright instead
|
|
8
9
|
*/
|
|
9
10
|
var O3rRadioGroup = /** @class */ (function (_super) {
|
|
10
11
|
tslib_1.__extends(O3rRadioGroup, _super);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"radio-group.js","sourceRoot":"","sources":["../../../../src/core/protractor/groups/radio-group.ts"],"names":[],"mappings":";;;;AAEA,kCAAoC;AAEpC
|
|
1
|
+
{"version":3,"file":"radio-group.js","sourceRoot":"","sources":["../../../../src/core/protractor/groups/radio-group.ts"],"names":[],"mappings":";;;;AAEA,kCAAoC;AAEpC;;;GAGG;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,OAAO,CAAC,IAAI,CAAC,uFAAgF,IAAI,kBAAQ,QAAQ,IAAI,WAAW,CAAE,CAAC,CAAC;4BACpI,sBAAO,KAAK,EAAC;wBACf,CAAC;wBACD,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;4BAC3B,IAAI,GAAG,QAAQ,CAAC;wBAClB,CAAC;;;wBARgB,IAAU,CAAA;;4BAW7B,sBAAO,IAAI,EAAC;;;;KACb;IAED;;OAEG;IACU,uCAAe,GAA5B;;;;;;8BAE+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,AArCD,CAAmC,gBAAQ,GAqC1C;AArCY,sCAAa","sourcesContent":["import { RadioGroupProfile } from '../../groups/radio-group';\nimport { O3rRadioElement } from '../elements/radio-element';\nimport { O3rGroup } from '../group';\n\n/**\n * Group element to manage a radio group\n * @deprecated Will be removed in v13, please use Playwright instead\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 console.warn(`Items in this radio group are not consistent, incompatible input names found ${name} and ${itemName || 'undefined'}`);\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\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"]}
|
|
@@ -4,6 +4,7 @@ import { O3rElement } from './element';
|
|
|
4
4
|
export { PageFixtureProfile } from '../page-fixture';
|
|
5
5
|
/**
|
|
6
6
|
* Implementation of the page fixture dedicated to protractor.
|
|
7
|
+
* @deprecated Will be removed in v13, please use Playwright instead
|
|
7
8
|
*/
|
|
8
9
|
export declare class O3rPageFixture<V extends O3rElement = O3rElement> extends O3rComponentFixture<V> implements PageFixtureProfile<V> {
|
|
9
10
|
constructor(rootElement?: V);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page-fixture.d.ts","sourceRoot":"","sources":["../../../src/core/protractor/page-fixture.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,kBAAkB,EAAC,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAC,mBAAmB,EAAC,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAC,UAAU,EAAC,MAAM,WAAW,CAAC;AAGrC,OAAO,EAAC,kBAAkB,EAAC,MAAM,iBAAiB,CAAC;AAEnD
|
|
1
|
+
{"version":3,"file":"page-fixture.d.ts","sourceRoot":"","sources":["../../../src/core/protractor/page-fixture.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,kBAAkB,EAAC,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAC,mBAAmB,EAAC,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAC,UAAU,EAAC,MAAM,WAAW,CAAC;AAGrC,OAAO,EAAC,kBAAkB,EAAC,MAAM,iBAAiB,CAAC;AAEnD;;;GAGG;AACH,qBAAa,cAAc,CAAC,CAAC,SAAS,UAAU,GAAG,UAAU,CAAE,SAAQ,mBAAmB,CAAC,CAAC,CAAE,YAAW,kBAAkB,CAAC,CAAC,CAAC;gBAChH,WAAW,CAAC,EAAE,CAAC;IAIpB,QAAQ;CAGhB"}
|
|
@@ -7,6 +7,7 @@ var component_fixture_1 = require("./component-fixture");
|
|
|
7
7
|
var utils_1 = require("./utils");
|
|
8
8
|
/**
|
|
9
9
|
* Implementation of the page fixture dedicated to protractor.
|
|
10
|
+
* @deprecated Will be removed in v13, please use Playwright instead
|
|
10
11
|
*/
|
|
11
12
|
var O3rPageFixture = /** @class */ (function (_super) {
|
|
12
13
|
tslib_1.__extends(O3rPageFixture, _super);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page-fixture.js","sourceRoot":"","sources":["../../../src/core/protractor/page-fixture.ts"],"names":[],"mappings":";;;;AAAA,yCAAmC;AAEnC,yDAAwD;AAExD,iCAAuC;AAIvC
|
|
1
|
+
{"version":3,"file":"page-fixture.js","sourceRoot":"","sources":["../../../src/core/protractor/page-fixture.ts"],"names":[],"mappings":";;;;AAAA,yCAAmC;AAEnC,yDAAwD;AAExD,iCAAuC;AAIvC;;;GAGG;AACH;IAAuE,0CAAsB;IAC3F,wBAAY,WAAe;QACzB,OAAA,MAAK,YAAC,WAAW,CAAC,SAAC;IACrB,CAAC;IAEM,iCAAQ,GAAf;QACE,OAAO,IAAA,sBAAc,EAAC,oBAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;IAC5C,CAAC;IACH,qBAAC;AAAD,CAAC,AARD,CAAuE,uCAAmB,GAQzF;AARY,wCAAc","sourcesContent":["import {browser} from 'protractor';\nimport {PageFixtureProfile} from '../page-fixture';\nimport {O3rComponentFixture} from './component-fixture';\nimport {O3rElement} from './element';\nimport {convertPromise} from './utils';\n\nexport {PageFixtureProfile} from '../page-fixture';\n\n/**\n * Implementation of the page fixture dedicated to protractor.\n * @deprecated Will be removed in v13, please use Playwright instead\n */\nexport class O3rPageFixture<V extends O3rElement = O3rElement> extends O3rComponentFixture<V> implements PageFixtureProfile<V> {\n constructor(rootElement?: V) {\n super(rootElement);\n }\n\n public getTitle() {\n return convertPromise(browser.getTitle());\n }\n}\n"]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { promise as pPromise } from 'protractor';
|
|
2
2
|
/**
|
|
3
3
|
* Converts a webdriver promise to ES6 promise so the rest of the framework handles ES6 promises only
|
|
4
|
+
* @deprecated Will be removed in v13, please use Playwright instead
|
|
4
5
|
* @param promise
|
|
5
6
|
*/
|
|
6
7
|
export declare function convertPromise<T>(promise: pPromise.Promise<T>): Promise<T>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/core/protractor/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,IAAI,QAAQ,EAAC,MAAM,YAAY,CAAC;AAE/C
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/core/protractor/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,IAAI,QAAQ,EAAC,MAAM,YAAY,CAAC;AAE/C;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,cAE7D"}
|
package/core/protractor/utils.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.convertPromise = convertPromise;
|
|
4
4
|
/**
|
|
5
5
|
* Converts a webdriver promise to ES6 promise so the rest of the framework handles ES6 promises only
|
|
6
|
+
* @deprecated Will be removed in v13, please use Playwright instead
|
|
6
7
|
* @param promise
|
|
7
8
|
*/
|
|
8
9
|
function convertPromise(promise) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/core/protractor/utils.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/core/protractor/utils.ts"],"names":[],"mappings":";;AAOA,wCAEC;AAPD;;;;GAIG;AACH,SAAgB,cAAc,CAAI,OAA4B;IAC5D,OAAO,IAAI,OAAO,CAAI,UAAC,OAAO,EAAE,MAAM,IAAK,OAAA,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,EAA7B,CAA6B,CAAC,CAAC;AAC5E,CAAC","sourcesContent":["import {promise as pPromise} from 'protractor';\n\n/**\n * Converts a webdriver promise to ES6 promise so the rest of the framework handles ES6 promises only\n * @deprecated Will be removed in v13, please use Playwright instead\n * @param promise\n */\nexport function convertPromise<T>(promise: pPromise.Promise<T>) {\n return new Promise<T>((resolve, reject) => promise.then(resolve, reject));\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@o3r/testing",
|
|
3
|
-
"version": "11.3.0-
|
|
3
|
+
"version": "11.3.0-rc.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -105,10 +105,10 @@
|
|
|
105
105
|
"@material/slider": "^14.0.0",
|
|
106
106
|
"@ngrx/store": "~18.0.0",
|
|
107
107
|
"@ngx-translate/core": "~15.0.0",
|
|
108
|
-
"@o3r/core": "^11.3.0-
|
|
109
|
-
"@o3r/localization": "^11.3.0-
|
|
110
|
-
"@o3r/schematics": "^11.3.0-
|
|
111
|
-
"@playwright/test": "~1.
|
|
108
|
+
"@o3r/core": "^11.3.0-rc.0",
|
|
109
|
+
"@o3r/localization": "^11.3.0-rc.0",
|
|
110
|
+
"@o3r/schematics": "^11.3.0-rc.0",
|
|
111
|
+
"@playwright/test": "~1.47.0",
|
|
112
112
|
"@schematics/angular": "~18.2.0",
|
|
113
113
|
"pixelmatch": "^5.2.1",
|
|
114
114
|
"pngjs": "^7.0.0",
|
|
@@ -162,7 +162,7 @@
|
|
|
162
162
|
}
|
|
163
163
|
},
|
|
164
164
|
"dependencies": {
|
|
165
|
-
"esbuild": "~0.
|
|
165
|
+
"esbuild": "~0.24.0",
|
|
166
166
|
"module-from-string": "^3.2.0",
|
|
167
167
|
"tslib": "^2.6.2"
|
|
168
168
|
},
|
|
@@ -188,13 +188,13 @@
|
|
|
188
188
|
"@ngx-translate/core": "~15.0.0",
|
|
189
189
|
"@nx/eslint-plugin": "~19.5.0",
|
|
190
190
|
"@nx/jest": "~19.5.0",
|
|
191
|
-
"@o3r/build-helpers": "^11.3.0-
|
|
192
|
-
"@o3r/core": "^11.3.0-
|
|
193
|
-
"@o3r/eslint-plugin": "^11.3.0-
|
|
194
|
-
"@o3r/localization": "^11.3.0-
|
|
195
|
-
"@o3r/schematics": "^11.3.0-
|
|
196
|
-
"@o3r/test-helpers": "^11.3.0-
|
|
197
|
-
"@playwright/test": "~1.
|
|
191
|
+
"@o3r/build-helpers": "^11.3.0-rc.0",
|
|
192
|
+
"@o3r/core": "^11.3.0-rc.0",
|
|
193
|
+
"@o3r/eslint-plugin": "^11.3.0-rc.0",
|
|
194
|
+
"@o3r/localization": "^11.3.0-rc.0",
|
|
195
|
+
"@o3r/schematics": "^11.3.0-rc.0",
|
|
196
|
+
"@o3r/test-helpers": "^11.3.0-rc.0",
|
|
197
|
+
"@playwright/test": "~1.47.0",
|
|
198
198
|
"@schematics/angular": "~18.2.0",
|
|
199
199
|
"@stylistic/eslint-plugin-ts": "~2.4.0",
|
|
200
200
|
"@types/jest": "~29.5.2",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=_fetch-manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_fetch-manager.d.ts","sourceRoot":"","sources":["../../../../src/tools/protractor/fetch-manager/_fetch-manager.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Note: This file is not part of the running script, it is injected in the browser while running e2e tests.
|
|
4
|
+
*/
|
|
5
|
+
(function () {
|
|
6
|
+
var MAX_WAITING_TIME_FOR_FETCH = 45 * 1000; // 45 seconds
|
|
7
|
+
var fetchManager = /** @class */ (function () {
|
|
8
|
+
function FetchManager() {
|
|
9
|
+
this.nbCurrentFetch = 0;
|
|
10
|
+
}
|
|
11
|
+
FetchManager.prototype.interceptor = function (ref, nativeFetch) {
|
|
12
|
+
var args = [];
|
|
13
|
+
for (var _i = 2; _i < arguments.length; _i++) {
|
|
14
|
+
args[_i - 2] = arguments[_i];
|
|
15
|
+
}
|
|
16
|
+
var promise = Promise.resolve(args);
|
|
17
|
+
promise = promise.then(function () {
|
|
18
|
+
ref.nbCurrentFetch++;
|
|
19
|
+
return [args[0], args[1]];
|
|
20
|
+
}, function (error) {
|
|
21
|
+
return Promise.reject(error);
|
|
22
|
+
});
|
|
23
|
+
promise = promise.then(function () { return nativeFetch.apply(void 0, args); });
|
|
24
|
+
promise = promise.then(function (response) {
|
|
25
|
+
ref.nbCurrentFetch--;
|
|
26
|
+
return response;
|
|
27
|
+
}, function (error) {
|
|
28
|
+
ref.nbCurrentFetch--;
|
|
29
|
+
return Promise.reject(error);
|
|
30
|
+
});
|
|
31
|
+
return promise;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Register the fetchs events to count the number of pending fetchs.
|
|
35
|
+
*/
|
|
36
|
+
FetchManager.prototype.registerFetchInterceptor = function () {
|
|
37
|
+
var _this = this;
|
|
38
|
+
var nativeFetch = window.fetch;
|
|
39
|
+
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
40
|
+
var that = this;
|
|
41
|
+
Object.assign(window, { fetch: function () {
|
|
42
|
+
var args = [];
|
|
43
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
44
|
+
args[_i] = arguments[_i];
|
|
45
|
+
}
|
|
46
|
+
return _this.interceptor.apply(_this, __spreadArray([that, nativeFetch], args, false));
|
|
47
|
+
} });
|
|
48
|
+
};
|
|
49
|
+
FetchManager.prototype.unregisterFetchInterceptor = function () {
|
|
50
|
+
Object.assign(window, { fetch: this.windowFetch });
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Returns the single instance of FetchManager
|
|
54
|
+
*/
|
|
55
|
+
FetchManager.getInstance = function () {
|
|
56
|
+
return this._instance || (this._instance = new this());
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* Initialize the fetch manager
|
|
60
|
+
*/
|
|
61
|
+
FetchManager.prototype.init = function () {
|
|
62
|
+
this.nbCurrentFetch = 0;
|
|
63
|
+
this.registerFetchInterceptor();
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
*
|
|
67
|
+
*/
|
|
68
|
+
FetchManager.prototype.stop = function () {
|
|
69
|
+
this.nbCurrentFetch = 0;
|
|
70
|
+
this.unregisterFetchInterceptor();
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* Get the number of active fetchs on the page.
|
|
74
|
+
*/
|
|
75
|
+
FetchManager.prototype.getPendingFetchs = function () {
|
|
76
|
+
return this.nbCurrentFetch;
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* This function waits for all fetchs calls to be resolved and the page to be stable to call the callback.
|
|
80
|
+
* It permits to easily run synchronous tests with protractor.
|
|
81
|
+
* This is very usefull in the case of Otter calls to backend because protractor synchronization manager do not care
|
|
82
|
+
* about fetchs calls. As a consequence, the `waitForAngular` method will not work.
|
|
83
|
+
* @param callback : Callback called when all the fetchs are finished and the page is stable.
|
|
84
|
+
* @param timeoutInterval : Interval in milliseconds between two checks of the number of pending fetchs
|
|
85
|
+
*/
|
|
86
|
+
FetchManager.prototype.waitForFetchs = function (callback, timeoutInterval) {
|
|
87
|
+
var _this = this;
|
|
88
|
+
if (timeoutInterval === void 0) { timeoutInterval = 100; }
|
|
89
|
+
var interval;
|
|
90
|
+
var timeout;
|
|
91
|
+
if (!this.getPendingFetchs()) {
|
|
92
|
+
callback();
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
var cancelPolling = function () {
|
|
96
|
+
if (interval) {
|
|
97
|
+
clearInterval(interval);
|
|
98
|
+
interval = undefined;
|
|
99
|
+
}
|
|
100
|
+
if (timeout) {
|
|
101
|
+
clearTimeout(timeout);
|
|
102
|
+
timeout = undefined;
|
|
103
|
+
}
|
|
104
|
+
// Handle polling result
|
|
105
|
+
if (_this.getPendingFetchs() > 0) {
|
|
106
|
+
// Error case will just log in console
|
|
107
|
+
// and allow to continue as o3r elements might be checking fetchManager
|
|
108
|
+
// concurrently
|
|
109
|
+
_this.nbCurrentFetch = 0;
|
|
110
|
+
callback();
|
|
111
|
+
throw new Error('Fetch timeout. Please check network requests.');
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
callback();
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
var polling = function () { return _this.getPendingFetchs() > 0 || cancelPolling(); };
|
|
118
|
+
interval = setInterval(polling, timeoutInterval);
|
|
119
|
+
timeout = setTimeout(cancelPolling, MAX_WAITING_TIME_FOR_FETCH);
|
|
120
|
+
};
|
|
121
|
+
return FetchManager;
|
|
122
|
+
}());
|
|
123
|
+
if (!('fetchManager' in window)) {
|
|
124
|
+
Object.assign(window, { fetchManager: fetchManager });
|
|
125
|
+
}
|
|
126
|
+
})();
|
|
127
|
+
//# sourceMappingURL=_fetch-manager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_fetch-manager.js","sourceRoot":"","sources":["../../../../src/tools/protractor/fetch-manager/_fetch-manager.ts"],"names":[],"mappings":";AAAA;;GAEG;AACH,CAAC;IAUC,IAAM,0BAA0B,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,aAAa;IAE3D,IAAM,YAAY;QAMhB;YAHQ,mBAAc,GAAG,CAAC,CAAC;QAGJ,CAAC;QAEhB,kCAAW,GAAnB,UAAoB,GAAiB,EAAE,WAAgB;YAAE,cAAc;iBAAd,UAAc,EAAd,qBAAc,EAAd,IAAc;gBAAd,6BAAc;;YACrE,IAAI,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YACpC,OAAO,GAAG,OAAO,CAAC,IAAI,CACpB;gBACE,GAAG,CAAC,cAAc,EAAE,CAAC;gBACrB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;YAC5B,CAAC,EACD,UAAC,KAAK;gBACJ,OAAO,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YAC/B,CAAC,CAAC,CAAC;YACL,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,cAAM,OAAA,WAAW,eAAI,IAAI,GAAnB,CAAoB,CAAC,CAAC;YACnD,OAAO,GAAG,OAAO,CAAC,IAAI,CACpB,UAAC,QAAQ;gBACP,GAAG,CAAC,cAAc,EAAE,CAAC;gBACrB,OAAO,QAAQ,CAAC;YAClB,CAAC,EACD,UAAC,KAAK;gBACJ,GAAG,CAAC,cAAc,EAAE,CAAC;gBACrB,OAAO,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YAC/B,CAAC,CAAC,CAAC;YACL,OAAO,OAAO,CAAC;QACjB,CAAC;QAED;;WAEG;QACK,+CAAwB,GAAhC;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AAM,aAAa,GAAG;gBACpB,IAAI,QAAQ,EAAE,CAAC;oBACb,aAAa,CAAC,QAAQ,CAAC,CAAC;oBACxB,QAAQ,GAAG,SAAS,CAAC;gBACvB,CAAC;gBAED,IAAI,OAAO,EAAE,CAAC;oBACZ,YAAY,CAAC,OAAO,CAAC,CAAC;oBACtB,OAAO,GAAG,SAAS,CAAC;gBACtB,CAAC;gBAED,wBAAwB;gBACxB,IAAI,KAAI,CAAC,gBAAgB,EAAE,GAAG,CAAC,EAAE,CAAC;oBAChC,sCAAsC;oBACtC,uEAAuE;oBACvE,eAAe;oBACf,KAAI,CAAC,cAAc,GAAG,CAAC,CAAC;oBACxB,QAAQ,EAAE,CAAC;oBAEX,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAC;gBACnE,CAAC;qBAAM,CAAC;oBACN,QAAQ,EAAE,CAAC;gBACb,CAAC;YACH,CAAC,CAAC;YAEF,IAAM,OAAO,GAAG,cAAM,OAAA,KAAI,CAAC,gBAAgB,EAAE,GAAG,CAAC,IAAI,aAAa,EAAE,EAA9C,CAA8C,CAAC;YAErE,QAAQ,GAAG,WAAW,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;YACjD,OAAO,GAAG,UAAU,CAAC,aAAa,EAAE,0BAA0B,CAAC,CAAC;QAClE,CAAC;QACH,mBAAC;IAAD,CAAC,AA1HoB,GA0HpB,CAAC;IAEF,IAAI,CAAC,CAAC,cAAc,IAAI,MAAM,CAAC,EAAE,CAAC;QAChC,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,EAAE,YAAY,cAAA,EAAE,CAAC,CAAC;IAC1C,CAAC;AACH,CAAC,CAAC,EAAE,CAAC"}
|
|
@@ -8,15 +8,18 @@
|
|
|
8
8
|
* flow with `initFetchManager()`
|
|
9
9
|
*
|
|
10
10
|
* You can ignore the waiting of fetchs by setting `browser.ignoreSynchronization` to `true`
|
|
11
|
+
* @deprecated Will be removed in v13, please use Playwright instead
|
|
11
12
|
*/
|
|
12
13
|
export declare function waitForOtterStable(): Promise<void>;
|
|
13
14
|
/**
|
|
14
15
|
* This function initiliaze the FetchManager. Set `window.fetch` variable with a custom behaviour in order to count the
|
|
15
16
|
* fetch calls.
|
|
17
|
+
* @deprecated Will be removed in v13, please use Playwright instead
|
|
16
18
|
*/
|
|
17
19
|
export declare function initFetchManager(): Promise<void>;
|
|
18
20
|
/**
|
|
19
21
|
* This function stops the FetchManager. Reset `window.fetch` variable with its native behaviour.
|
|
22
|
+
* @deprecated Will be removed in v13, please use Playwright instead
|
|
20
23
|
*/
|
|
21
24
|
export declare function stopFetchManager(): Promise<void>;
|
|
22
25
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/tools/protractor/fetch-manager/utils.ts"],"names":[],"mappings":"AAIA
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/tools/protractor/fetch-manager/utils.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;GAWG;AACH,wBAAsB,kBAAkB,kBAOvC;AAED;;;;GAIG;AACH,wBAAsB,gBAAgB,kBAQrC;AAED;;;GAGG;AACH,wBAAsB,gBAAgB,kBAErC"}
|
|
@@ -17,6 +17,7 @@ var protractor_1 = require("protractor");
|
|
|
17
17
|
* flow with `initFetchManager()`
|
|
18
18
|
*
|
|
19
19
|
* You can ignore the waiting of fetchs by setting `browser.ignoreSynchronization` to `true`
|
|
20
|
+
* @deprecated Will be removed in v13, please use Playwright instead
|
|
20
21
|
*/
|
|
21
22
|
function waitForOtterStable() {
|
|
22
23
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
@@ -41,6 +42,7 @@ function waitForOtterStable() {
|
|
|
41
42
|
/**
|
|
42
43
|
* This function initiliaze the FetchManager. Set `window.fetch` variable with a custom behaviour in order to count the
|
|
43
44
|
* fetch calls.
|
|
45
|
+
* @deprecated Will be removed in v13, please use Playwright instead
|
|
44
46
|
*/
|
|
45
47
|
function initFetchManager() {
|
|
46
48
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
@@ -62,6 +64,7 @@ function initFetchManager() {
|
|
|
62
64
|
}
|
|
63
65
|
/**
|
|
64
66
|
* This function stops the FetchManager. Reset `window.fetch` variable with its native behaviour.
|
|
67
|
+
* @deprecated Will be removed in v13, please use Playwright instead
|
|
65
68
|
*/
|
|
66
69
|
function stopFetchManager() {
|
|
67
70
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/tools/protractor/fetch-manager/utils.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/tools/protractor/fetch-manager/utils.ts"],"names":[],"mappings":";;AAgBA,gDAOC;AAOD,4CAQC;AAMD,4CAEC;;AA9CD,4BAA8B;AAC9B,gCAAkC;AAClC,yCAAqC;AAErC;;;;;;;;;;;GAWG;AACH,SAAsB,kBAAkB;;;;wBACtC,qBAAM,oBAAO,CAAC,cAAc,EAAE,EAAA;;oBAA9B,SAA8B,CAAC;yBAC3B,CAAC,oBAAO,CAAC,qBAAqB,EAA9B,wBAA8B;oBAChC,qBAAM,oBAAO,CAAC,kBAAkB,CAC9B,mFAAmF,CAAC,EAAA;;oBADtF,SACsF,CAAC;oBACvF,qBAAM,oBAAO,CAAC,cAAc,EAAE,EAAA;;oBAA9B,SAA8B,CAAC;;;;;;CAElC;AAED;;;;GAIG;AACH,SAAsB,gBAAgB;;;;;;oBAC9B,YAAY,GAAG,EAAE,CAAC,YAAY,CAClC,IAAI,CAAC,OAAO,CACV,OAAO,CAAC,GAAG,EAAE,EAAE,cAAc,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,YAAY,EAAE,eAAe,EACxF,mBAAmB,CAAC,EACtB,EAAC,QAAQ,EAAE,MAAM,EAAC,CAAC,CAAC;oBACtB,qBAAM,oBAAO,CAAC,aAAa,CAAC,YAAY,CAAC,EAAA;;oBAAzC,SAAyC,CAAC;oBAC1C,qBAAM,oBAAO,CAAC,aAAa,CAAC,2CAA2C,CAAC,EAAA;;oBAAxE,SAAwE,CAAC;;;;;CAC1E;AAED;;;GAGG;AACH,SAAsB,gBAAgB;;;;wBACpC,qBAAM,oBAAO,CAAC,aAAa,CAAC,2CAA2C,CAAC,EAAA;;oBAAxE,SAAwE,CAAC;;;;;CAC1E","sourcesContent":["import * as fs from 'node:fs';\nimport * as path from 'node:path';\nimport { browser } from 'protractor';\n\n/**\n * This function waits for all fetchs calls to be resolved and the page to be stable to resolve the promise.\n * It permits to easily run synchronous e2e tests on a flow that uses fetchs calls with protractor.\n * This is very useful in the case of Otter calls to backend because protractor synchronization manager do not care\n * about fetchs calls.\n *\n * This function needs the FetchManager to have been initialized and injected in the browser at the beginning of the\n * flow with `initFetchManager()`\n *\n * You can ignore the waiting of fetchs by setting `browser.ignoreSynchronization` to `true`\n * @deprecated Will be removed in v13, please use Playwright instead\n */\nexport async function waitForOtterStable() {\n await browser.waitForAngular();\n if (!browser.ignoreSynchronization) {\n await browser.executeAsyncScript(\n 'window.fetchManager.getInstance().waitForFetchs(arguments[arguments.length - 1]);');\n await browser.waitForAngular();\n }\n}\n\n/**\n * This function initiliaze the FetchManager. Set `window.fetch` variable with a custom behaviour in order to count the\n * fetch calls.\n * @deprecated Will be removed in v13, please use Playwright instead\n */\nexport async function initFetchManager() {\n const fetchManager = fs.readFileSync(\n path.resolve(\n process.cwd(), 'node_modules', '@o3r', 'testing', 'tools', 'protractor', 'fetch-manager',\n '_fetch-manager.js'),\n {encoding: 'utf8'});\n await browser.executeScript(fetchManager);\n await browser.executeScript('window.fetchManager.getInstance().init();');\n}\n\n/**\n * This function stops the FetchManager. Reset `window.fetch` variable with its native behaviour.\n * @deprecated Will be removed in v13, please use Playwright instead\n */\nexport async function stopFetchManager() {\n await browser.executeScript('window.fetchManager.getInstance().stop();');\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_post-message-interceptor.d.ts","sourceRoot":"","sources":["../../../../src/tools/protractor/post-message-interceptor/_post-message-interceptor.ts"],"names":[],"mappings":"AAAA;;GAEG"}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Note: This file is not part of the running script, it is injected in the browser while running e2e tests.
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
// TODO: Move to PollyJS when the winter comes
|
|
7
|
+
(function () {
|
|
8
|
+
/**
|
|
9
|
+
* PostMessageInterceptor permits to intercept calls to postMessage.
|
|
10
|
+
*/
|
|
11
|
+
var postMessageInterceptor = /** @class */ (function () {
|
|
12
|
+
function PostMessageInterceptor() {
|
|
13
|
+
this.lastCalls = [];
|
|
14
|
+
this.listening = false;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Logs a message in the console
|
|
18
|
+
* @param message
|
|
19
|
+
* @param {...any} args
|
|
20
|
+
*/
|
|
21
|
+
PostMessageInterceptor.prototype.log = function (message) {
|
|
22
|
+
var args = [];
|
|
23
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
24
|
+
args[_i - 1] = arguments[_i];
|
|
25
|
+
}
|
|
26
|
+
// eslint-disable-next-line no-console
|
|
27
|
+
console.log.apply(console, __spreadArray(["#postMessageInterceptor: ".concat(message)], args, false));
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Intercepts the native postMessage call
|
|
31
|
+
* @param ref Singleton instance of the interceptor
|
|
32
|
+
* @param nativeMethod native postMessage method
|
|
33
|
+
* @param args all the args passed to the postMessage
|
|
34
|
+
*/
|
|
35
|
+
PostMessageInterceptor.prototype.interceptor = function (ref, nativeMethod) {
|
|
36
|
+
var args = [];
|
|
37
|
+
for (var _i = 2; _i < arguments.length; _i++) {
|
|
38
|
+
args[_i - 2] = arguments[_i];
|
|
39
|
+
}
|
|
40
|
+
this.log('Intercepted', args);
|
|
41
|
+
var postCall = {
|
|
42
|
+
data: args[0],
|
|
43
|
+
targetOrigin: args[1],
|
|
44
|
+
timestamp: new Date()
|
|
45
|
+
};
|
|
46
|
+
if (ref.listening) {
|
|
47
|
+
if (ref.conditionFn && !ref.conditionFn(postCall)) {
|
|
48
|
+
this.log('Intercepted message does not pass the condition');
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
ref.lastCalls.push(postCall);
|
|
52
|
+
this.log('Last call count', ref.lastCalls.length);
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
this.log('Not listening');
|
|
56
|
+
}
|
|
57
|
+
nativeMethod.apply(void 0, args);
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Register the interceptor in the window object
|
|
61
|
+
*/
|
|
62
|
+
PostMessageInterceptor.prototype.registerFetchInterceptor = function () {
|
|
63
|
+
var _this = this;
|
|
64
|
+
var nativeMethod = window.postMessage;
|
|
65
|
+
this.nativeMethod = nativeMethod;
|
|
66
|
+
Object.assign(window, { postMessage: function () {
|
|
67
|
+
var args = [];
|
|
68
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
69
|
+
args[_i] = arguments[_i];
|
|
70
|
+
}
|
|
71
|
+
return _this.interceptor.apply(_this, __spreadArray([_this, nativeMethod], args, false));
|
|
72
|
+
} });
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* Unregister the interceptor from the window object
|
|
76
|
+
*/
|
|
77
|
+
PostMessageInterceptor.prototype.unregisterFetchInterceptor = function () {
|
|
78
|
+
Object.assign(window, { postMessage: this.nativeMethod });
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* Returns the singleton instance of the interceptor
|
|
82
|
+
*/
|
|
83
|
+
PostMessageInterceptor.getInstance = function () {
|
|
84
|
+
return this._instance || (this._instance = new this());
|
|
85
|
+
};
|
|
86
|
+
/**
|
|
87
|
+
* Initialize the interceptor
|
|
88
|
+
*/
|
|
89
|
+
PostMessageInterceptor.prototype.init = function () {
|
|
90
|
+
this.reset();
|
|
91
|
+
this.log('Init');
|
|
92
|
+
this.registerFetchInterceptor();
|
|
93
|
+
};
|
|
94
|
+
/**
|
|
95
|
+
* Stops the interceptor
|
|
96
|
+
*/
|
|
97
|
+
PostMessageInterceptor.prototype.stop = function () {
|
|
98
|
+
this.reset();
|
|
99
|
+
this.log('Stop');
|
|
100
|
+
this.unregisterFetchInterceptor();
|
|
101
|
+
};
|
|
102
|
+
/**
|
|
103
|
+
* Resets the stack of lastCalls
|
|
104
|
+
*/
|
|
105
|
+
PostMessageInterceptor.prototype.reset = function () {
|
|
106
|
+
this.lastCalls = [];
|
|
107
|
+
};
|
|
108
|
+
/**
|
|
109
|
+
* Starts listening and saving postMessages
|
|
110
|
+
* @param conditionFnString The function string to be used as condition checker
|
|
111
|
+
*/
|
|
112
|
+
PostMessageInterceptor.prototype.listen = function (conditionFnString) {
|
|
113
|
+
this.listening = false;
|
|
114
|
+
this.reset();
|
|
115
|
+
if (conditionFnString) {
|
|
116
|
+
// eslint-disable-next-line no-eval
|
|
117
|
+
this.conditionFn = eval(conditionFnString);
|
|
118
|
+
}
|
|
119
|
+
this.listening = true;
|
|
120
|
+
};
|
|
121
|
+
/**
|
|
122
|
+
* Stops listening
|
|
123
|
+
* NOTE: It resets the interceptor and clears the conditionFn (if any)
|
|
124
|
+
*/
|
|
125
|
+
PostMessageInterceptor.prototype.stopListening = function () {
|
|
126
|
+
this.listening = false;
|
|
127
|
+
this.reset();
|
|
128
|
+
this.conditionFn = undefined;
|
|
129
|
+
this.listening = true;
|
|
130
|
+
};
|
|
131
|
+
/**
|
|
132
|
+
* Get the messages stack
|
|
133
|
+
* @param timeoutInterval the interval, in ms, between each check
|
|
134
|
+
* @param retries number of tentatives if fail
|
|
135
|
+
* @param callback
|
|
136
|
+
*/
|
|
137
|
+
PostMessageInterceptor.prototype.getMessages = function (timeoutInterval, retries, callback) {
|
|
138
|
+
var _this = this;
|
|
139
|
+
var activeMessageWatch = function (remainingRetries) {
|
|
140
|
+
if (remainingRetries === 0 || _this.lastCalls.length > 0) {
|
|
141
|
+
var copyCalls = _this.lastCalls.slice();
|
|
142
|
+
_this.reset();
|
|
143
|
+
callback(copyCalls);
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
else if (remainingRetries > 0) {
|
|
147
|
+
remainingRetries--;
|
|
148
|
+
}
|
|
149
|
+
setTimeout(function () { return activeMessageWatch(remainingRetries); }, timeoutInterval);
|
|
150
|
+
};
|
|
151
|
+
activeMessageWatch(retries);
|
|
152
|
+
};
|
|
153
|
+
return PostMessageInterceptor;
|
|
154
|
+
}());
|
|
155
|
+
Object.assign(window, { postMessageInterceptor: postMessageInterceptor });
|
|
156
|
+
})();
|
|
157
|
+
//# sourceMappingURL=_post-message-interceptor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_post-message-interceptor.js","sourceRoot":"","sources":["../../../../src/tools/protractor/post-message-interceptor/_post-message-interceptor.ts"],"names":[],"mappings":";AAAA;;GAEG;;AAIH,8CAA8C;AAC9C,CAAC;IACC;;OAEG;IACH,IAAM,sBAAsB;QAQ1B;YACE,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;YACpB,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;QACzB,CAAC;QAED;;;;WAIG;QACK,oCAAG,GAAX,UAAY,OAAe;YAAE,cAAc;iBAAd,UAAc,EAAd,qBAAc,EAAd,IAAc;gBAAd,6BAAc;;YACzC,sCAAsC;YACtC,OAAO,CAAC,GAAG,OAAX,OAAO,iBAAK,mCAA4B,OAAO,CAAE,GAAK,IAAI,UAAE;QAC9D,CAAC;QAED;;;;;WAKG;QACK,4CAAW,GAAnB,UAAoB,GAA2B,EAAE,YAAiB;YAAE,cAAc;iBAAd,UAAc,EAAd,qBAAc,EAAd,IAAc;gBAAd,6BAAc;;YAChF,I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AI,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;oBACxD,IAAM,SAAS,GAAG,KAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;oBACzC,KAAI,CAAC,KAAK,EAAE,CAAC;oBACb,QAAQ,CAAC,SAAS,CAAC,CAAC;oBACpB,OAAO;gBACT,CAAC;qBAAM,IAAI,gBAAgB,GAAG,CAAC,EAAE,CAAC;oBAChC,gBAAgB,EAAE,CAAC;gBACrB,CAAC;gBAED,UAAU,CAAC,cAAM,OAAA,kBAAkB,CAAC,gBAAgB,CAAC,EAApC,CAAoC,EAAE,eAAe,CAAC,CAAC;YAC1E,CAAC,CAAC;YACF,kBAAkB,CAAC,OAAO,CAAC,CAAC;QAC9B,CAAC;QACH,6BAAC;IAAD,CAAC,AAjJ8B,GAiJ9B,CAAC;IACF,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,EAAC,sBAAsB,wBAAA,EAAC,CAAC,CAAC;AAClD,CAAC,CAAC,EAAE,CAAC"}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* A call to postMessage
|
|
3
|
+
* @deprecated Will be removed in v13, please use Playwright instead
|
|
4
|
+
*/
|
|
2
5
|
export interface PostMessageCall {
|
|
3
6
|
/** Data passed in the message */
|
|
4
7
|
data: any;
|
|
@@ -7,5 +10,8 @@ export interface PostMessageCall {
|
|
|
7
10
|
/** Timestamp of the message */
|
|
8
11
|
timestamp: Date;
|
|
9
12
|
}
|
|
13
|
+
/**
|
|
14
|
+
* @deprecated Will be removed in v13, please use Playwright instead
|
|
15
|
+
*/
|
|
10
16
|
export type ConditionFn = (postCall: PostMessageCall) => boolean;
|
|
11
17
|
//# sourceMappingURL=core.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../../src/tools/protractor/post-message-interceptor/core.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../../src/tools/protractor/post-message-interceptor/core.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,iCAAiC;IACjC,IAAI,EAAE,GAAG,CAAC;IACV,0CAA0C;IAC1C,YAAY,EAAE,MAAM,CAAC;IACrB,+BAA+B;IAC/B,SAAS,EAAE,IAAI,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,QAAQ,EAAE,eAAe,KAAK,OAAO,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.js","sourceRoot":"","sources":["../../../../src/tools/protractor/post-message-interceptor/core.ts"],"names":[],"mappings":"","sourcesContent":["
|
|
1
|
+
{"version":3,"file":"core.js","sourceRoot":"","sources":["../../../../src/tools/protractor/post-message-interceptor/core.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * A call to postMessage\n * @deprecated Will be removed in v13, please use Playwright instead\n */\nexport interface PostMessageCall {\n /** Data passed in the message */\n data: any;\n /** Target origin passed in the message */\n targetOrigin: string;\n /** Timestamp of the message */\n timestamp: Date;\n}\n\n/**\n * @deprecated Will be removed in v13, please use Playwright instead\n */\nexport type ConditionFn = (postCall: PostMessageCall) => boolean;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"post-message-interceptor.d.ts","sourceRoot":"","sources":["../../../../src/tools/protractor/post-message-interceptor/post-message-interceptor.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAEtD
|
|
1
|
+
{"version":3,"file":"post-message-interceptor.d.ts","sourceRoot":"","sources":["../../../../src/tools/protractor/post-message-interceptor/post-message-interceptor.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAEtD;;;GAGG;AACH,qBAAa,sBAAsB;IACjC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAiD;IAE9E;;;;OAIG;YACW,kBAAkB;IAIhC;;;;OAIG;YACW,uBAAuB;IAIrC;;;OAGG;IACU,UAAU;IAWvB;;OAEG;IACU,IAAI;IAIjB;;;OAGG;IACU,MAAM,CAAC,WAAW,CAAC,EAAE,WAAW;IAI7C;;OAEG;IACU,aAAa;IAI1B;;;;OAIG;IACU,WAAW,CAAC,eAAe,SAAM,EAAE,OAAO,SAAK,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;CAG1F"}
|
|
@@ -7,6 +7,7 @@ var path = require("node:path");
|
|
|
7
7
|
var protractor_1 = require("protractor");
|
|
8
8
|
/**
|
|
9
9
|
* Controls the postMessage interceptor
|
|
10
|
+
* @deprecated Will be removed in v13, please use Playwright instead
|
|
10
11
|
*/
|
|
11
12
|
var PostMessageInterceptor = /** @class */ (function () {
|
|
12
13
|
function PostMessageInterceptor() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"post-message-interceptor.js","sourceRoot":"","sources":["../../../../src/tools/protractor/post-message-interceptor/post-message-interceptor.ts"],"names":[],"mappings":";;;;AAAA,4BAA8B;AAC9B,gCAAkC;AAClC,yCAAqC;AAIrC
|
|
1
|
+
{"version":3,"file":"post-message-interceptor.js","sourceRoot":"","sources":["../../../../src/tools/protractor/post-message-interceptor/post-message-interceptor.ts"],"names":[],"mappings":";;;;AAAA,4BAA8B;AAC9B,gCAAkC;AAClC,yCAAqC;AAIrC;;;GAGG;AACH;IAAA;QACmB,iBAAY,GAAG,6CAA6C,CAAC;IAiEhF,CAAC;IA/DC;;;;OAIG;IACW,mDAAkB,GAAhC,UAAiC,UAAkB;QAAE,cAAc;aAAd,UAAc,EAAd,qBAAc,EAAd,IAAc;YAAd,6BAAc;;;;;4BAC1D,qBAAM,oBAAO,CAAC,aAAa,OAArB,oBAAO,yBAAe,UAAG,IAAI,CAAC,YAAY,cAAI,UAAU,oBAAiB,GAAK,IAAI,WAAC;4B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nC,gCAAA,EAAA,qBAAqB;YAAE,wBAAA,EAAA,WAAW,CAAC;;;4BAClD,qBAAM,IAAI,CAAC,uBAAuB,CAAC,aAAa,EAAE,eAAe,EAAE,OAAO,CAAC,EAAA;4BAAnF,sBAAO,CAAC,SAA2E,CAAsB,EAAC;;;;KAC3G;IACH,6BAAC;AAAD,CAAC,AAlED,IAkEC;AAlEY,wDAAsB","sourcesContent":["import * as fs from 'node:fs';\nimport * as path from 'node:path';\nimport { browser } from 'protractor';\n\nimport { ConditionFn, PostMessageCall } from './core';\n\n/**\n * Controls the postMessage interceptor\n * @deprecated Will be removed in v13, please use Playwright instead\n */\nexport class PostMessageInterceptor {\n private readonly GET_INSTANCE = 'window.postMessageInterceptor.getInstance()';\n\n /**\n * Executes a script in the app\n * @param methodName\n * @param {...any} args\n */\n private async execInstanceMethod(methodName: string, ...args: any[]) {\n return await browser.executeScript(`${this.GET_INSTANCE}.${methodName}(...arguments);`, ...args);\n }\n\n /**\n * Executes an async script in the app\n * @param methodName\n * @param {...any} args\n */\n private async execInstanceAsyncMethod(methodName: string, ...args: any[]) {\n return await browser.executeAsyncScript(`${this.GET_INSTANCE}.${methodName}(...arguments);`, ...args);\n }\n\n /**\n * Initializes the PostMessageInterceptor in the app\n * NOTE: It does not start listening right away. You need to call listen()\n */\n public async initialize() {\n const fetchManager = fs.readFileSync(\n path.resolve(process.cwd(), 'node_modules', '@o3r', 'testing', 'tools', 'protractor', 'post-message-interceptor', '_post-message-interceptor.js'),\n {\n encoding: 'utf8'\n }\n );\n await browser.executeScript(fetchManager);\n await this.execInstanceMethod('init');\n }\n\n /**\n * Stops the PostMessageInterceptor.\n */\n public async stop() {\n await this.execInstanceMethod('stop');\n }\n\n /**\n * Listens for post messages\n * @param conditionFn an optional boolean function that will evaluate if the message should be saved or not in the stack\n */\n public async listen(conditionFn?: ConditionFn) {\n await this.execInstanceMethod('listen', conditionFn);\n }\n\n /**\n * Stops listening for post messages, resets the stack and clears the condition\n */\n public async stopListening() {\n await this.execInstanceMethod('stopListening');\n }\n\n /**\n * Get all the post messages\n * @param timeoutInterval Interval in milliseconds between two checks\n * @param retries How many retries to be executed (-1 for infinite retries)\n */\n public async getMessages(timeoutInterval = 100, retries = -1): Promise<PostMessageCall[]> {\n return (await this.execInstanceAsyncMethod('getMessages', timeoutInterval, retries)) as PostMessageCall[];\n }\n}\n"]}
|