@o3r/testing 10.0.0-next.8 → 11.0.0-next.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/README.md +1 -1
- package/core/angular/component-fixture.d.ts +0 -15
- package/core/angular/component-fixture.d.ts.map +1 -1
- package/core/angular/component-fixture.js +11 -20
- package/core/angular/component-fixture.js.map +1 -1
- package/core/angular/element.d.ts +0 -1
- package/core/angular/element.d.ts.map +1 -1
- package/core/angular/element.js +0 -1
- package/core/angular/element.js.map +1 -1
- package/core/angular-materials/autocomplete-material.d.ts +0 -1
- package/core/angular-materials/autocomplete-material.d.ts.map +1 -1
- package/core/angular-materials/autocomplete-material.js +0 -1
- package/core/angular-materials/autocomplete-material.js.map +1 -1
- package/core/angular-materials/select-material.d.ts +0 -7
- package/core/angular-materials/select-material.d.ts.map +1 -1
- package/core/angular-materials/select-material.js +0 -9
- package/core/angular-materials/select-material.js.map +1 -1
- package/core/component-fixture.d.ts +20 -12
- package/core/component-fixture.d.ts.map +1 -1
- package/core/component-fixture.js +18 -5
- package/core/component-fixture.js.map +1 -1
- package/core/elements/checkbox-element.d.ts +0 -1
- package/core/elements/checkbox-element.d.ts.map +1 -1
- package/core/elements/checkbox-element.js.map +1 -1
- package/core/elements/radio-element.d.ts +0 -1
- package/core/elements/radio-element.d.ts.map +1 -1
- package/core/elements/radio-element.js.map +1 -1
- package/core/elements/select-element.d.ts +0 -2
- package/core/elements/select-element.d.ts.map +1 -1
- package/core/elements/select-element.js +0 -2
- package/core/elements/select-element.js.map +1 -1
- package/core/helpers.d.ts +0 -2
- package/core/helpers.d.ts.map +1 -1
- package/core/helpers.js +0 -2
- package/core/helpers.js.map +1 -1
- package/core/page-fixture.d.ts +0 -1
- package/core/page-fixture.d.ts.map +1 -1
- package/core/page-fixture.js +0 -1
- package/core/page-fixture.js.map +1 -1
- package/core/playwright/component-fixture.d.ts +0 -15
- package/core/playwright/component-fixture.d.ts.map +1 -1
- package/core/playwright/component-fixture.js +14 -24
- package/core/playwright/component-fixture.js.map +1 -1
- package/core/playwright/element.d.ts +0 -2
- package/core/playwright/element.d.ts.map +1 -1
- package/core/playwright/element.js +0 -1
- package/core/playwright/element.js.map +1 -1
- package/core/protractor/component-fixture.d.ts +0 -15
- package/core/protractor/component-fixture.d.ts.map +1 -1
- package/core/protractor/component-fixture.js +11 -21
- package/core/protractor/component-fixture.js.map +1 -1
- package/core/protractor/utils.d.ts +0 -1
- package/core/protractor/utils.d.ts.map +1 -1
- package/core/protractor/utils.js +0 -1
- package/core/protractor/utils.js.map +1 -1
- package/kassette/update-dates-in-mocks.d.ts +0 -3
- package/kassette/update-dates-in-mocks.d.ts.map +1 -1
- package/kassette/update-dates-in-mocks.js +10 -6
- package/kassette/update-dates-in-mocks.js.map +1 -1
- package/localization/localization-mock.d.ts +0 -1
- package/localization/localization-mock.d.ts.map +1 -1
- package/localization/localization-mock.js +4 -3
- package/localization/localization-mock.js.map +1 -1
- package/mocks/mock-component-generator.d.ts +5 -4
- package/mocks/mock-component-generator.d.ts.map +1 -1
- package/mocks/mock-component-generator.js +5 -9
- package/mocks/mock-component-generator.js.map +1 -1
- package/package.json +65 -54
- package/schematics/add-functions-to-fixture/index.js +1 -1
- package/schematics/add-functions-to-fixture/index.js.map +1 -1
- package/schematics/add-functions-to-fixture/schema.json +1 -1
- package/schematics/fixture-to-component/index.d.ts.map +1 -1
- package/schematics/fixture-to-component/index.js +1 -1
- package/schematics/fixture-to-component/index.js.map +1 -1
- package/schematics/fixture-to-component/schema.json +1 -1
- package/schematics/ng-add/fixture/index.d.ts +2 -1
- package/schematics/ng-add/fixture/index.d.ts.map +1 -1
- package/schematics/ng-add/fixture/index.js +43 -16
- package/schematics/ng-add/fixture/index.js.map +1 -1
- package/schematics/ng-add/index.d.ts +0 -1
- package/schematics/ng-add/index.d.ts.map +1 -1
- package/schematics/ng-add/index.js +17 -18
- package/schematics/ng-add/index.js.map +1 -1
- package/schematics/ng-add/playwright/index.d.ts +0 -1
- package/schematics/ng-add/playwright/index.d.ts.map +1 -1
- package/schematics/ng-add/playwright/index.js +1 -2
- package/schematics/ng-add/playwright/index.js.map +1 -1
- package/schematics/ng-add/schema.json +2 -2
- package/schematics/ng-add/templates/project/jest.config.js.template +1 -1
- package/schematics/ng-add/templates/workspace/jest.config.js.template +1 -1
- package/schematics/ng-add/templates/workspace/jest.config.ut.js.template +53 -41
- package/schematics/playwright/sanity/index.d.ts +0 -1
- package/schematics/playwright/sanity/index.d.ts.map +1 -1
- package/schematics/playwright/sanity/index.js +2 -4
- package/schematics/playwright/sanity/index.js.map +1 -1
- package/schematics/playwright/sanity/schema.json +1 -1
- package/schematics/playwright/scenario/index.d.ts +0 -1
- package/schematics/playwright/scenario/index.d.ts.map +1 -1
- package/schematics/playwright/scenario/index.js +2 -4
- package/schematics/playwright/scenario/index.js.map +1 -1
- package/schematics/playwright/scenario/schema.json +1 -1
- package/store/testable-select.d.ts +0 -3
- package/store/testable-select.d.ts.map +1 -1
- package/store/testable-select.js +0 -6
- package/store/testable-select.js.map +1 -1
- package/store/typings.d.ts +0 -1
- package/store/typings.d.ts.map +1 -1
- package/store/typings.js +0 -1
- package/store/typings.js.map +1 -1
- package/tools/path-replacement/path-replacement.d.ts +0 -1
- package/tools/path-replacement/path-replacement.d.ts.map +1 -1
- package/tools/path-replacement/path-replacement.js +0 -1
- package/tools/path-replacement/path-replacement.js.map +1 -1
- package/tools/protractor/fetch-manager/_fetch-manager.js +0 -1
- package/tools/protractor/fetch-manager/_fetch-manager.js.map +1 -1
- package/tools/protractor/post-message-interceptor/_post-message-interceptor.js +0 -4
- package/tools/protractor/post-message-interceptor/_post-message-interceptor.js.map +1 -1
- package/tools/protractor/post-message-interceptor/post-message-interceptor.d.ts +0 -4
- package/tools/protractor/post-message-interceptor/post-message-interceptor.d.ts.map +1 -1
- package/tools/protractor/post-message-interceptor/post-message-interceptor.js +0 -4
- package/tools/protractor/post-message-interceptor/post-message-interceptor.js.map +1 -1
- package/visual-test/utils.d.ts +0 -2
- package/visual-test/utils.d.ts.map +1 -1
- package/visual-test/utils.js +0 -2
- package/visual-test/utils.js.map +1 -1
- package/visual-test/visual-test.d.ts +1 -5
- package/visual-test/visual-test.d.ts.map +1 -1
- package/visual-test/visual-test.js +1 -5
- package/visual-test/visual-test.js.map +1 -1
|
@@ -13,7 +13,6 @@ var O3rComponentFixture = /** @class */ (function () {
|
|
|
13
13
|
/**
|
|
14
14
|
* Throws an exception if the element is undefined.
|
|
15
15
|
* Otherwise returns the element.
|
|
16
|
-
*
|
|
17
16
|
* @param _element ElementProfile to test
|
|
18
17
|
* @param _timeout specific timeout that will throw when reach
|
|
19
18
|
*/
|
|
@@ -23,7 +22,6 @@ var O3rComponentFixture = /** @class */ (function () {
|
|
|
23
22
|
/**
|
|
24
23
|
* Throws an exception if the element is undefined.
|
|
25
24
|
* Otherwise returns the element.
|
|
26
|
-
*
|
|
27
25
|
* @param _element ElementProfile to test
|
|
28
26
|
* @param _timeout specific timeout that will throw when reach
|
|
29
27
|
*/
|
|
@@ -36,13 +34,18 @@ var O3rComponentFixture = /** @class */ (function () {
|
|
|
36
34
|
};
|
|
37
35
|
/**
|
|
38
36
|
* Get text from the element associated to the given selector, or undefined if the element is not found or not visible
|
|
39
|
-
*
|
|
40
37
|
* @param selector Selector to access the element
|
|
41
38
|
* @param options Options supported
|
|
42
39
|
* @param options.elementConstructor Constructor that will be used to create the Element, defaults to O3rElement
|
|
43
40
|
* @param options.index index Select the element associated to the index
|
|
44
41
|
* @param options.shouldThrowIfNotPresent If set to true the function will throw if the element is not present
|
|
45
42
|
* @param options.timeout Duration to wait for the element to be present before it throws
|
|
43
|
+
* @param _selector
|
|
44
|
+
* @param _options
|
|
45
|
+
* @param _options.elementConstructor
|
|
46
|
+
* @param _options.index
|
|
47
|
+
* @param _options.shouldThrowIfNotPresent
|
|
48
|
+
* @param _options.timeout
|
|
46
49
|
*/
|
|
47
50
|
O3rComponentFixture.prototype.getText = function (_selector, _options) {
|
|
48
51
|
if (_options === void 0) { _options = {}; }
|
|
@@ -50,13 +53,18 @@ var O3rComponentFixture = /** @class */ (function () {
|
|
|
50
53
|
};
|
|
51
54
|
/**
|
|
52
55
|
* Check if the element associated to the given selector is visible
|
|
53
|
-
*
|
|
54
56
|
* @param selector Selector to access the element
|
|
55
57
|
* @param options Options supported
|
|
56
58
|
* @param options.elementConstructor Constructor that will be used to create the Element, defaults to O3rElement
|
|
57
59
|
* @param options.index index Select the element associated to the index
|
|
58
60
|
* @param options.shouldThrowIfNotPresent If set to true the function will throw if the element is not present
|
|
59
61
|
* @param options.timeout Duration to wait for the element to be present before it throws
|
|
62
|
+
* @param _selector
|
|
63
|
+
* @param _options
|
|
64
|
+
* @param _options.elementConstructor
|
|
65
|
+
* @param _options.index
|
|
66
|
+
* @param _options.shouldThrowIfNotPresent
|
|
67
|
+
* @param _options.timeout
|
|
60
68
|
*/
|
|
61
69
|
O3rComponentFixture.prototype.isVisible = function (_selector, _options) {
|
|
62
70
|
if (_options === void 0) { _options = {}; }
|
|
@@ -64,13 +72,18 @@ var O3rComponentFixture = /** @class */ (function () {
|
|
|
64
72
|
};
|
|
65
73
|
/**
|
|
66
74
|
* Click on the element associated to the given selector if it exists and is visible
|
|
67
|
-
*
|
|
68
75
|
* @param selector Selector to access the element
|
|
69
76
|
* @param options Options supported
|
|
70
77
|
* @param options.elementConstructor Constructor that will be used to create the Element, defaults to O3rElement
|
|
71
78
|
* @param options.index index Select the element associated to the index
|
|
72
79
|
* @param options.shouldThrowIfNotPresent If set to true the function will throw if the element is not present
|
|
73
80
|
* @param options.timeout Duration to wait for the element to be present before it throws
|
|
81
|
+
* @param _selector
|
|
82
|
+
* @param _options
|
|
83
|
+
* @param _options.elementConstructor
|
|
84
|
+
* @param _options.index
|
|
85
|
+
* @param _options.shouldThrowIfNotPresent
|
|
86
|
+
* @param _options.timeout
|
|
74
87
|
*/
|
|
75
88
|
O3rComponentFixture.prototype.click = function (_selector, _options) {
|
|
76
89
|
if (_options === void 0) { _options = {}; }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component-fixture.js","sourceRoot":"","sources":["../../src/core/component-fixture.ts"],"names":[],"mappings":";;;AAAA,yCAAgE;AA6FhE;;;GAGG;AACH;IACE,6BAAY,QAAY;QACtB,MAAM,IAAI,qCAA6B,CAAC,uCAAuC,CAAC,CAAC;IACnF,CAAC;IAED;;;;;;OAMG;IACO,qDAAuB,GAAjC,UAAwD,QAAuB,EAAE,QAAiB;QAChG,MAAM,IAAI,qCAA6B,CAAC,uCAAuC,CAAC,CAAC;IACnF,CAAC;IAUD;;;;;;OAMG;IACO,8CAAgB,GAA1B,UAAiD,QAAgC,EAAE,QAAiB;QAClG,MAAM,IAAI,qCAA6B,CAAC,uCAAuC,CAAC,CAAC;IACnF,CAAC;IA8BS,8CAAgB,GAA1B,UACE,SAAiB,EACjB,mBAAyD,EACzD,QAIM;QAJN,yBAAA,EAAA,aAIM;QAEN,MAAM,IAAI,qCAA6B,CAAC,uCAAuC,CAAC,CAAC;IACnF,CAAC;IAED;;;;;;;;;OASG;IACO,qCAAO,GAAjB,UAAwC,SAAiB,EAAE,QAKrD;QALqD,yBAAA,EAAA,aAKrD;QACJ,MAAM,IAAI,qCAA6B,CAAC,uCAAuC,CAAC,CAAC;IACnF,CAAC;IAED;;;;;;;;;OASG;IACO,uCAAS,GAAnB,UAA0C,SAAiB,EAAE,QAKvD;QALuD,yBAAA,EAAA,aAKvD;QACJ,MAAM,IAAI,qCAA6B,CAAC,uCAAuC,CAAC,CAAC;IACnF,CAAC;IAED;;;;;;;;;OASG;IACO,mCAAK,GAAf,UAAsC,SAAiB,EAAE,QAKnD;QALmD,yBAAA,EAAA,aAKnD;QACJ,MAAM,IAAI,qCAA6B,CAAC,uCAAuC,CAAC,CAAC;IACnF,CAAC;IAMD,kBAAkB;IACX,mCAAK,GAAZ,UAAmC,SAAiB,EAAE,WAAiD;QACrG,MAAM,IAAI,qCAA6B,CAAC,uCAAuC,CAAC,CAAC;IACnF,CAAC;IAQD,kBAAkB;IACX,sCAAQ,GAAf,UACE,SAAiB,EACjB,WAAiD,EACjD,UAAiD,EACjD,QAAiB;QAEjB,MAAM,IAAI,qCAA6B,CAAC,uCAAuC,CAAC,CAAC;IACnF,CAAC;IAED,kBAAkB;IACX,wCAAU,GAAjB;QACE,MAAM,IAAI,qCAA6B,CAAC,uCAAuC,CAAC,CAAC;IACnF,CAAC;IAED,kBAAkB;IACX,8CAAgB,GAAvB;QACE,MAAM,IAAI,qCAA6B,CAAC,uCAAuC,CAAC,CAAC;IACnF,CAAC;IAED,kBAAkB;IACX,6CAAe,GAAtB,UAAuB,SAAiB,EAAE,QAAiB;QACzD,MAAM,IAAI,qCAA6B,CAAC,uCAAuC,CAAC,CAAC;IACnF,CAAC;IAOM,sCAAQ,GAAf,UAA0C,SAAiB,EAAE,MAAc,EAAE,WAAiD;QAC5H,MAAM,IAAI,qCAA6B,CAAC,uCAAuC,CAAC,CAAC;IACnF,CAAC;IACH,0BAAC;AAAD,CAAC,AApLD,IAoLC;AApLY,kDAAmB","sourcesContent":["import { TranspilationPurposeOnlyError } from '../errors/index';\nimport { ElementProfile, O3rElement, O3rElementConstructor } from './element';\nimport { GroupProfile, O3rGroupConstructor } from './group';\n\n/**\n * Interface to describe the Component fixture that is used as an abstraction layer to access the DOM of a component.\n * It comes with two implementations that are chosen a build time whether you will use it in a karma or protractor\n * runtime. This way the same fixture is usable for both component and e2e tests.\n */\nexport interface ComponentFixtureProfile<V extends ElementProfile = ElementProfile> {\n /**\n * Return the root element of the component fixture.\n */\n getElement(): V | undefined;\n\n /**\n * Queries an element using the CSS selector passed as argument.\n * If the fixture has a context (was created with a TestBed or Protractor element) the query will be applied\n * to this element's tree only.\n *\n * @param selector CSS selector for the desired element\n * @param returnType Constructor of the element expected\n */\n query(selector: string, returnType?: undefined): Promise<ElementProfile | undefined>;\n query<T extends ElementProfile>(selector: string, returnType: O3rElementConstructor<T>): Promise<T | undefined>;\n query<T extends ElementProfile>(selector: string, returnType: O3rElementConstructor<T> | undefined): Promise<T | ElementProfile | undefined>;\n\n /**\n * Queries the nth element of a list using the CSS selector passed as argument.\n * If the fixture has a context (was created with a TestBed or Protractor element) the query will be applied\n * to this element's tree only.\n *\n * @param selector CSS selector for the desired element\n * @param index Index of the element to retrieve\n * @param returnType Constructor of the element expected\n */\n queryNth(selector: string, index: number, returnType?: undefined): Promise<ElementProfile | undefined>;\n queryNth<T extends ElementProfile>(selector: string, index: number, returnType: O3rElementConstructor<T>): Promise<T | undefined>;\n queryNth<T extends ElementProfile>(selector: string, index: number, returnType: O3rElementConstructor<T> | undefined): Promise<T | ElementProfile | undefined>;\n\n /**\n * Queries a list of elements using the CSS selector passed as argument.\n * If the fixture has a context (was created with a TestBed or Protractor element) the query will be applied\n * to this element's tree only.\n *\n * @param selector CSS selector for the desired elements\n * @param returnType Constructor of the element expected\n * @param groupType\n * @param timeout\n */\n queryAll(selector: string, returnType?: undefined, groupType?: undefined, timeout?: number): Promise<O3rElement[]>;\n queryAll<T extends ElementProfile>(selector: string, returnType: O3rElementConstructor<T>, groupType?: undefined, timeout?: number): Promise<T[]>;\n queryAll<T extends ElementProfile, K extends GroupProfile<T>>(selector: string, returnType: O3rElementConstructor<T>, groupType: O3rGroupConstructor<K, T>, timeout?: number): Promise<K>;\n queryAll<T extends ElementProfile, K extends GroupProfile<T>>(\n selector: string,\n returnType: O3rElementConstructor<T> | undefined,\n groupType: O3rGroupConstructor<K, T> | undefined,\n timeout?: number\n ): Promise<(T | O3rElement)[] | K>;\n\n /**\n * Returns the component fixtures corresponding to the sub-components.\n */\n getSubComponents(): Promise<{ [componentName: string]: ComponentFixtureProfile[] }>;\n\n /**\n * Returns true if the provided selector has no match in the document.\n * A custom timeout value can be passed for asynchronous implementations that support it.\n *\n * @param selector\n * @param timeout\n */\n queryNotPresent(selector: string, timeout?: number): Promise<boolean>;\n}\n\n/**\n * Interface to tell typescript that the element which implements\n * it can be used as a prototype\n */\n// eslint-disable-next-line no-use-before-define\nexport type Constructable<T extends ComponentFixtureProfile, U extends FixtureWithCustom = FixtureWithCustom> = new (elem?: ElementProfile, customFixtures?: U) => T;\n\n/**\n * This is the type that has to be extended by each component fixture context\n * It contains the custom fixture type for a component presenter and its subcomponents fixtures contexts\n * key: presenter name\n * fixture: custom presenter type\n * customSubFixtures: custom fixtures for the presenter subcomponents\n */\nexport interface FixtureWithCustom {\n [fixtureKey: string]: {fixture?: Constructable<ComponentFixtureProfile, FixtureWithCustom>; customSubFixtures?: FixtureWithCustom} | undefined;\n}\n\n/**\n * Mock for Component fixture class.\n * This class is used for fixture compilation purpose.\n */\nexport class O3rComponentFixture<V extends O3rElement = O3rElement> implements ComponentFixtureProfile<V> {\n constructor(_element?: V) {\n throw new TranspilationPurposeOnlyError('Should target a proper implementation');\n }\n\n /**\n * Throws an exception if the element is undefined.\n * Otherwise returns the element.\n *\n * @param _element ElementProfile to test\n * @param _timeout specific timeout that will throw when reach\n */\n protected throwOnUndefinedElement<T extends O3rElement>(_element: T | undefined, _timeout?: number): Promise<T> {\n throw new TranspilationPurposeOnlyError('Should target a proper implementation');\n }\n\n /**\n * Throws an exception if the element is undefined.\n * Otherwise returns the element.\n *\n * @param _element ElementProfile to test\n * @deprecated use {@link Promise} only as {@link throwOnUndefined} parameter or use {@see throwOnUndefinedElement} instead. Will be removed in v10\n */\n protected throwOnUndefined<T extends O3rElement>(_element?: T): T;\n /**\n * Throws an exception if the element is undefined.\n * Otherwise returns the element.\n *\n * @param _element ElementProfile to test\n * @param _timeout specific timeout that will throw when reach\n */\n protected throwOnUndefined<T extends O3rElement>(_element: Promise<T | undefined>, _timeout?: number): Promise<T | undefined> {\n throw new TranspilationPurposeOnlyError('Should target a proper implementation');\n }\n\n /**\n * Get the element associated to the selector if present\n *\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 queryWithOptions(\n _selector: string,\n _elementConstructor: undefined,\n _options: {\n index?: number;\n shouldThrowIfNotPresent?: boolean;\n timeout?: number;\n }\n ): Promise<O3rElement | undefined>;\n protected queryWithOptions<T extends O3rElement>(\n _selector: string,\n _elementConstructor: O3rElementConstructor<T>,\n _options: {\n index?: number;\n shouldThrowIfNotPresent?: boolean;\n timeout?: number;\n }\n ): Promise<T | undefined>;\n protected queryWithOptions<T extends O3rElement>(\n _selector: string,\n _elementConstructor: O3rElementConstructor<T> | undefined,\n _options: {\n index?: number;\n shouldThrowIfNotPresent?: boolean;\n timeout?: number;\n } = {}\n ): Promise<T | O3rElement | undefined> {\n throw new TranspilationPurposeOnlyError('Should target a proper implementation');\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 *\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 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 throw new TranspilationPurposeOnlyError('Should target a proper implementation');\n }\n\n /**\n * Check if the element associated to the given selector is visible\n *\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 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 throw new TranspilationPurposeOnlyError('Should target a proper implementation');\n }\n\n /**\n * Click on the element associated to the given selector if it exists and is visible\n *\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 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 throw new TranspilationPurposeOnlyError('Should target a proper implementation');\n }\n\n /** @inheritdoc */\n public query(_selector: string, _returnType?: undefined, timeout?: number): Promise<O3rElement | undefined>;\n /** @inheritdoc */\n public query<T extends O3rElement>(_selector: string, _returnType: O3rElementConstructor<T>, timeout?: number): Promise<T | undefined>;\n /** @inheritdoc */\n public query<T extends O3rElement>(_selector: string, _returnType: O3rElementConstructor<T> | undefined): Promise<T | O3rElement | undefined> {\n throw new TranspilationPurposeOnlyError('Should target a proper implementation');\n }\n\n /** @inheritdoc */\n public queryAll(_selector: string, _returnType?: undefined, _groupType?: undefined, timeout?: number): Promise<O3rElement[]>;\n /** @inheritdoc */\n public queryAll<T extends O3rElement>(_selector: string, _returnType: O3rElementConstructor<T>, _groupType?: undefined, timeout?: number): Promise<T[]>;\n /** @inheritdoc */\n public queryAll<T extends O3rElement, K extends GroupProfile<T>>(_selector: string, _returnType: O3rElementConstructor<T>, _groupType: O3rGroupConstructor<K, T>, timeout?: number): Promise<K>;\n /** @inheritdoc */\n public queryAll<T extends O3rElement, K extends GroupProfile<T>>(\n _selector: string,\n _returnType: O3rElementConstructor<T> | undefined,\n _groupType: O3rGroupConstructor<K, T> | undefined,\n _timeout?: number\n ): Promise<(T | O3rElement)[] | K> {\n throw new TranspilationPurposeOnlyError('Should target a proper implementation');\n }\n\n /** @inheritdoc */\n public getElement(): V | undefined {\n throw new TranspilationPurposeOnlyError('Should target a proper implementation');\n }\n\n /** @inheritdoc */\n public getSubComponents(): Promise<{[componentName: string]: ComponentFixtureProfile[]}> {\n throw new TranspilationPurposeOnlyError('Should target a proper implementation');\n }\n\n /** @inheritDoc */\n public queryNotPresent(_selector: string, _timeout?: number): Promise<boolean> {\n throw new TranspilationPurposeOnlyError('Should target a proper implementation');\n }\n\n /**\n * @inheritDoc\n */\n public queryNth(_selector: string, _index: number, _returnType?: undefined): Promise<ElementProfile | undefined>;\n public queryNth<T extends ElementProfile>(_selector: string, _index: number, _returnType: O3rElementConstructor<T>): Promise<T | undefined>;\n public queryNth<T extends ElementProfile>(_selector: string, _index: number, _returnType: O3rElementConstructor<T> | undefined): Promise<T | ElementProfile | undefined> {\n throw new TranspilationPurposeOnlyError('Should target a proper implementation');\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"component-fixture.js","sourceRoot":"","sources":["../../src/core/component-fixture.ts"],"names":[],"mappings":";;;AAAA,yCAAgE;AAyFhE;;;GAGG;AACH;IACE,6BAAY,QAAY;QACtB,MAAM,IAAI,qCAA6B,CAAC,uCAAuC,CAAC,CAAC;IACnF,CAAC;IAED;;;;;OAKG;IACO,qDAAuB,GAAjC,UAAwD,QAAuB,EAAE,QAAiB;QAChG,MAAM,IAAI,qCAA6B,CAAC,uCAAuC,CAAC,CAAC;IACnF,CAAC;IAED;;;;;OAKG;IACO,8CAAgB,GAA1B,UAAiD,QAAgC,EAAE,QAAiB;QAClG,MAAM,IAAI,qCAA6B,CAAC,uCAAuC,CAAC,CAAC;IACnF,CAAC;IA6BS,8CAAgB,GAA1B,UACE,SAAiB,EACjB,mBAAyD,EACzD,QAIM;QAJN,yBAAA,EAAA,aAIM;QAEN,MAAM,IAAI,qCAA6B,CAAC,uCAAuC,CAAC,CAAC;IACnF,CAAC;IAED;;;;;;;;;;;;;;OAcG;IACO,qCAAO,GAAjB,UAAwC,SAAiB,EAAE,QAKrD;QALqD,yBAAA,EAAA,aAKrD;QACJ,MAAM,IAAI,qCAA6B,CAAC,uCAAuC,CAAC,CAAC;IACnF,CAAC;IAED;;;;;;;;;;;;;;OAcG;IACO,uCAAS,GAAnB,UAA0C,SAAiB,EAAE,QAKvD;QALuD,yBAAA,EAAA,aAKvD;QACJ,MAAM,IAAI,qCAA6B,CAAC,uCAAuC,CAAC,CAAC;IACnF,CAAC;IAED;;;;;;;;;;;;;;OAcG;IACO,mCAAK,GAAf,UAAsC,SAAiB,EAAE,QAKnD;QALmD,yBAAA,EAAA,aAKnD;QACJ,MAAM,IAAI,qCAA6B,CAAC,uCAAuC,CAAC,CAAC;IACnF,CAAC;IAMD,kBAAkB;IACX,mCAAK,GAAZ,UAAmC,SAAiB,EAAE,WAAiD;QACrG,MAAM,IAAI,qCAA6B,CAAC,uCAAuC,CAAC,CAAC;IACnF,CAAC;IAQD,kBAAkB;IACX,sCAAQ,GAAf,UACE,SAAiB,EACjB,WAAiD,EACjD,UAAiD,EACjD,QAAiB;QAEjB,MAAM,IAAI,qCAA6B,CAAC,uCAAuC,CAAC,CAAC;IACnF,CAAC;IAED,kBAAkB;IACX,wCAAU,GAAjB;QACE,MAAM,IAAI,qCAA6B,CAAC,uCAAuC,CAAC,CAAC;IACnF,CAAC;IAED,kBAAkB;IACX,8CAAgB,GAAvB;QACE,MAAM,IAAI,qCAA6B,CAAC,uCAAuC,CAAC,CAAC;IACnF,CAAC;IAED,kBAAkB;IACX,6CAAe,GAAtB,UAAuB,SAAiB,EAAE,QAAiB;QACzD,MAAM,IAAI,qCAA6B,CAAC,uCAAuC,CAAC,CAAC;IACnF,CAAC;IAOM,sCAAQ,GAAf,UAA0C,SAAiB,EAAE,MAAc,EAAE,WAAiD;QAC5H,MAAM,IAAI,qCAA6B,CAAC,uCAAuC,CAAC,CAAC;IACnF,CAAC;IACH,0BAAC;AAAD,CAAC,AAxLD,IAwLC;AAxLY,kDAAmB","sourcesContent":["import { TranspilationPurposeOnlyError } from '../errors/index';\nimport { ElementProfile, O3rElement, O3rElementConstructor } from './element';\nimport { GroupProfile, O3rGroupConstructor } from './group';\n\n/**\n * Interface to describe the Component fixture that is used as an abstraction layer to access the DOM of a component.\n * It comes with two implementations that are chosen a build time whether you will use it in a karma or protractor\n * runtime. This way the same fixture is usable for both component and e2e tests.\n */\nexport interface ComponentFixtureProfile<V extends ElementProfile = ElementProfile> {\n /**\n * Return the root element of the component fixture.\n */\n getElement(): V | undefined;\n\n /**\n * Queries an element using the CSS selector passed as argument.\n * If the fixture has a context (was created with a TestBed or Protractor element) the query will be applied\n * to this element's tree only.\n * @param selector CSS selector for the desired element\n * @param returnType Constructor of the element expected\n */\n query(selector: string, returnType?: undefined): Promise<ElementProfile | undefined>;\n query<T extends ElementProfile>(selector: string, returnType: O3rElementConstructor<T>): Promise<T | undefined>;\n query<T extends ElementProfile>(selector: string, returnType: O3rElementConstructor<T> | undefined): Promise<T | ElementProfile | undefined>;\n\n /**\n * Queries the nth element of a list using the CSS selector passed as argument.\n * If the fixture has a context (was created with a TestBed or Protractor element) the query will be applied\n * to this element's tree only.\n * @param selector CSS selector for the desired element\n * @param index Index of the element to retrieve\n * @param returnType Constructor of the element expected\n */\n queryNth(selector: string, index: number, returnType?: undefined): Promise<ElementProfile | undefined>;\n queryNth<T extends ElementProfile>(selector: string, index: number, returnType: O3rElementConstructor<T>): Promise<T | undefined>;\n queryNth<T extends ElementProfile>(selector: string, index: number, returnType: O3rElementConstructor<T> | undefined): Promise<T | ElementProfile | undefined>;\n\n /**\n * Queries a list of elements using the CSS selector passed as argument.\n * If the fixture has a context (was created with a TestBed or Protractor element) the query will be applied\n * to this element's tree only.\n * @param selector CSS selector for the desired elements\n * @param returnType Constructor of the element expected\n * @param groupType\n * @param timeout\n */\n queryAll(selector: string, returnType?: undefined, groupType?: undefined, timeout?: number): Promise<O3rElement[]>;\n queryAll<T extends ElementProfile>(selector: string, returnType: O3rElementConstructor<T>, groupType?: undefined, timeout?: number): Promise<T[]>;\n queryAll<T extends ElementProfile, K extends GroupProfile<T>>(selector: string, returnType: O3rElementConstructor<T>, groupType: O3rGroupConstructor<K, T>, timeout?: number): Promise<K>;\n queryAll<T extends ElementProfile, K extends GroupProfile<T>>(\n selector: string,\n returnType: O3rElementConstructor<T> | undefined,\n groupType: O3rGroupConstructor<K, T> | undefined,\n timeout?: number\n ): Promise<(T | O3rElement)[] | K>;\n\n /**\n * Returns the component fixtures corresponding to the sub-components.\n */\n getSubComponents(): Promise<{ [componentName: string]: ComponentFixtureProfile[] }>;\n\n /**\n * Returns true if the provided selector has no match in the document.\n * A custom timeout value can be passed for asynchronous implementations that support it.\n * @param selector\n * @param timeout\n */\n queryNotPresent(selector: string, timeout?: number): Promise<boolean>;\n}\n\n/**\n * Interface to tell typescript that the element which implements\n * it can be used as a prototype\n */\n// eslint-disable-next-line no-use-before-define\nexport type Constructable<T extends ComponentFixtureProfile, U extends FixtureWithCustom = FixtureWithCustom> = new (elem?: ElementProfile, customFixtures?: U) => T;\n\n/**\n * This is the type that has to be extended by each component fixture context\n * It contains the custom fixture type for a component presenter and its subcomponents fixtures contexts\n * key: presenter name\n * fixture: custom presenter type\n * customSubFixtures: custom fixtures for the presenter subcomponents\n */\nexport interface FixtureWithCustom {\n [fixtureKey: string]: {fixture?: Constructable<ComponentFixtureProfile, FixtureWithCustom>; customSubFixtures?: FixtureWithCustom} | undefined;\n}\n\n/**\n * Mock for Component fixture class.\n * This class is used for fixture compilation purpose.\n */\nexport class O3rComponentFixture<V extends O3rElement = O3rElement> implements ComponentFixtureProfile<V> {\n constructor(_element?: V) {\n throw new TranspilationPurposeOnlyError('Should target a proper implementation');\n }\n\n /**\n * Throws an exception if the element is undefined.\n * Otherwise returns the element.\n * @param _element ElementProfile to test\n * @param _timeout specific timeout that will throw when reach\n */\n protected throwOnUndefinedElement<T extends O3rElement>(_element: T | undefined, _timeout?: number): Promise<T> {\n throw new TranspilationPurposeOnlyError('Should target a proper implementation');\n }\n\n /**\n * Throws an exception if the element is undefined.\n * Otherwise returns the element.\n * @param _element ElementProfile to test\n * @param _timeout specific timeout that will throw when reach\n */\n protected throwOnUndefined<T extends O3rElement>(_element: Promise<T | undefined>, _timeout?: number): Promise<T | undefined> {\n throw new TranspilationPurposeOnlyError('Should target a proper implementation');\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 queryWithOptions(\n _selector: string,\n _elementConstructor: undefined,\n _options: {\n index?: number;\n shouldThrowIfNotPresent?: boolean;\n timeout?: number;\n }\n ): Promise<O3rElement | undefined>;\n protected queryWithOptions<T extends O3rElement>(\n _selector: string,\n _elementConstructor: O3rElementConstructor<T>,\n _options: {\n index?: number;\n shouldThrowIfNotPresent?: boolean;\n timeout?: number;\n }\n ): Promise<T | undefined>;\n protected queryWithOptions<T extends O3rElement>(\n _selector: string,\n _elementConstructor: O3rElementConstructor<T> | undefined,\n _options: {\n index?: number;\n shouldThrowIfNotPresent?: boolean;\n timeout?: number;\n } = {}\n ): Promise<T | O3rElement | undefined> {\n throw new TranspilationPurposeOnlyError('Should target a proper implementation');\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 * @param _selector\n * @param _options\n * @param _options.elementConstructor\n * @param _options.index\n * @param _options.shouldThrowIfNotPresent\n * @param _options.timeout\n */\n protected 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 throw new TranspilationPurposeOnlyError('Should target a proper implementation');\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 * @param _selector\n * @param _options\n * @param _options.elementConstructor\n * @param _options.index\n * @param _options.shouldThrowIfNotPresent\n * @param _options.timeout\n */\n protected 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 throw new TranspilationPurposeOnlyError('Should target a proper implementation');\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 * @param _selector\n * @param _options\n * @param _options.elementConstructor\n * @param _options.index\n * @param _options.shouldThrowIfNotPresent\n * @param _options.timeout\n */\n protected 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 throw new TranspilationPurposeOnlyError('Should target a proper implementation');\n }\n\n /** @inheritdoc */\n public query(_selector: string, _returnType?: undefined, timeout?: number): Promise<O3rElement | undefined>;\n /** @inheritdoc */\n public query<T extends O3rElement>(_selector: string, _returnType: O3rElementConstructor<T>, timeout?: number): Promise<T | undefined>;\n /** @inheritdoc */\n public query<T extends O3rElement>(_selector: string, _returnType: O3rElementConstructor<T> | undefined): Promise<T | O3rElement | undefined> {\n throw new TranspilationPurposeOnlyError('Should target a proper implementation');\n }\n\n /** @inheritdoc */\n public queryAll(_selector: string, _returnType?: undefined, _groupType?: undefined, timeout?: number): Promise<O3rElement[]>;\n /** @inheritdoc */\n public queryAll<T extends O3rElement>(_selector: string, _returnType: O3rElementConstructor<T>, _groupType?: undefined, timeout?: number): Promise<T[]>;\n /** @inheritdoc */\n public queryAll<T extends O3rElement, K extends GroupProfile<T>>(_selector: string, _returnType: O3rElementConstructor<T>, _groupType: O3rGroupConstructor<K, T>, timeout?: number): Promise<K>;\n /** @inheritdoc */\n public queryAll<T extends O3rElement, K extends GroupProfile<T>>(\n _selector: string,\n _returnType: O3rElementConstructor<T> | undefined,\n _groupType: O3rGroupConstructor<K, T> | undefined,\n _timeout?: number\n ): Promise<(T | O3rElement)[] | K> {\n throw new TranspilationPurposeOnlyError('Should target a proper implementation');\n }\n\n /** @inheritdoc */\n public getElement(): V | undefined {\n throw new TranspilationPurposeOnlyError('Should target a proper implementation');\n }\n\n /** @inheritdoc */\n public getSubComponents(): Promise<{[componentName: string]: ComponentFixtureProfile[]}> {\n throw new TranspilationPurposeOnlyError('Should target a proper implementation');\n }\n\n /** @inheritDoc */\n public queryNotPresent(_selector: string, _timeout?: number): Promise<boolean> {\n throw new TranspilationPurposeOnlyError('Should target a proper implementation');\n }\n\n /**\n * @inheritDoc\n */\n public queryNth(_selector: string, _index: number, _returnType?: undefined): Promise<ElementProfile | undefined>;\n public queryNth<T extends ElementProfile>(_selector: string, _index: number, _returnType: O3rElementConstructor<T>): Promise<T | undefined>;\n public queryNth<T extends ElementProfile>(_selector: string, _index: number, _returnType: O3rElementConstructor<T> | undefined): Promise<T | ElementProfile | undefined> {\n throw new TranspilationPurposeOnlyError('Should target a proper implementation');\n }\n}\n"]}
|
|
@@ -7,7 +7,6 @@ import { ElementProfile, O3rElement } from '../element';
|
|
|
7
7
|
export interface CheckboxElementProfile extends ElementProfile {
|
|
8
8
|
/**
|
|
9
9
|
* Check the checkbox element
|
|
10
|
-
*
|
|
11
10
|
* @param value If specified, determine the value of the checkbox button
|
|
12
11
|
* @param associatedLabel If specified, specify the label associated to the checkbox
|
|
13
12
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkbox-element.d.ts","sourceRoot":"","sources":["../../../src/core/elements/checkbox-element.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExD;;;;GAIG;AACH,MAAM,WAAW,sBAAuB,SAAQ,cAAc;IAC5D
|
|
1
|
+
{"version":3,"file":"checkbox-element.d.ts","sourceRoot":"","sources":["../../../src/core/elements/checkbox-element.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExD;;;;GAIG;AACH,MAAM,WAAW,sBAAuB,SAAQ,cAAc;IAC5D;;;;OAIG;IACH,KAAK,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,eAAe,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEpE;;OAEG;IACH,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAEzB;;OAEG;IACH,SAAS,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;CAC/B;AAED;;;GAGG;AACH,qBAAa,kBAAmB,SAAQ,UAAW,YAAW,sBAAsB;gBACtE,cAAc,EAAE,GAAG;IAI/B,kBAAkB;IACX,KAAK,CAAC,MAAM,UAAO,EAAE,gBAAgB,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IAIzE,kBAAkB;IACX,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAI/B,kBAAkB;IACX,SAAS,IAAI,OAAO,CAAC,OAAO,CAAC;CAGrC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkbox-element.js","sourceRoot":"","sources":["../../../src/core/elements/checkbox-element.ts"],"names":[],"mappings":";;;;AAAA,4CAAmE;AAEnE,sCAAwD;
|
|
1
|
+
{"version":3,"file":"checkbox-element.js","sourceRoot":"","sources":["../../../src/core/elements/checkbox-element.ts"],"names":[],"mappings":";;;;AAAA,4CAAmE;AAEnE,sCAAwD;AA0BxD;;;GAGG;AACH;IAAwC,8CAAU;IAChD,4BAAY,cAAmB;eAC7B,kBAAM,cAAc,CAAC;IACvB,CAAC;IAED,kBAAkB;IACX,kCAAK,GAAZ,UAAa,MAAa,EAAE,gBAA6B;QAA5C,uBAAA,EAAA,aAAa;QACxB,MAAM,IAAI,qCAA6B,CAAC,uCAAuC,CAAC,CAAC;IACnF,CAAC;IAED,kBAAkB;IACX,oCAAO,GAAd;QACE,MAAM,IAAI,qCAA6B,CAAC,uCAAuC,CAAC,CAAC;IACnF,CAAC;IAED,kBAAkB;IACX,sCAAS,GAAhB;QACE,MAAM,IAAI,qCAA6B,CAAC,uCAAuC,CAAC,CAAC;IACnF,CAAC;IACH,yBAAC;AAAD,CAAC,AAnBD,CAAwC,oBAAU,GAmBjD;AAnBY,gDAAkB","sourcesContent":["import { TranspilationPurposeOnlyError } from '../../errors/index';\n\nimport { ElementProfile, O3rElement } from '../element';\n\n/**\n * Interface to describe the Checkbox elements that are used inside a fixture.\n * As for ComponentFixtureProfile, this abstracts the testing framework that is used by choosing the right\n * implementation at runtime.\n */\nexport interface CheckboxElementProfile extends ElementProfile {\n /**\n * Check the checkbox element\n * @param value If specified, determine the value of the checkbox button\n * @param associatedLabel If specified, specify the label associated to the checkbox\n */\n check(value?: boolean, associatedLabel?: O3rElement): Promise<void>;\n\n /**\n * Uncheck the checkbox element\n */\n uncheck(): Promise<void>;\n\n /**\n * Return true if the checkbox button is checked\n */\n isChecked(): Promise<boolean>;\n}\n\n/**\n * Mock for ElementProfile class.\n * This class is used for fixture compilation purpose.\n */\nexport class O3rCheckboxElement extends O3rElement implements CheckboxElementProfile {\n constructor(_sourceElement: any) {\n super(_sourceElement);\n }\n\n /** @inheritDoc */\n public check(_value = true, _associatedLabel?: O3rElement): Promise<void> {\n throw new TranspilationPurposeOnlyError('Should target a proper implementation');\n }\n\n /** @inheritDoc */\n public uncheck(): Promise<void> {\n throw new TranspilationPurposeOnlyError('Should target a proper implementation');\n }\n\n /** @inheritDoc */\n public isChecked(): Promise<boolean> {\n throw new TranspilationPurposeOnlyError('Should target a proper implementation');\n }\n}\n"]}
|
|
@@ -7,7 +7,6 @@ import { ElementProfile, O3rElement } from '../element';
|
|
|
7
7
|
export interface RadioElementProfile extends ElementProfile {
|
|
8
8
|
/**
|
|
9
9
|
* Check the radio element
|
|
10
|
-
*
|
|
11
10
|
* @param value If specified, determine the value of the radio button
|
|
12
11
|
*/
|
|
13
12
|
check(value?: boolean): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"radio-element.d.ts","sourceRoot":"","sources":["../../../src/core/elements/radio-element.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExD;;;;GAIG;AACH,MAAM,WAAW,mBAAoB,SAAQ,cAAc;IACzD
|
|
1
|
+
{"version":3,"file":"radio-element.d.ts","sourceRoot":"","sources":["../../../src/core/elements/radio-element.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExD;;;;GAIG;AACH,MAAM,WAAW,mBAAoB,SAAQ,cAAc;IACzD;;;OAGG;IACH,KAAK,CAAC,KAAK,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEtC;;OAEG;IACH,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAEzB;;OAEG;IACH,SAAS,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;CAC/B;AAED;;;GAGG;AACH,qBAAa,eAAgB,SAAQ,UAAW,YAAW,mBAAmB;gBAChE,cAAc,EAAE,GAAG;IAI/B,kBAAkB;IACX,KAAK,CAAC,MAAM,UAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAI1C,kBAAkB;IACX,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAI/B,kBAAkB;IACX,SAAS,IAAI,OAAO,CAAC,OAAO,CAAC;CAGrC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"radio-element.js","sourceRoot":"","sources":["../../../src/core/elements/radio-element.ts"],"names":[],"mappings":";;;;AAAA,4CAAmE;AAEnE,sCAAwD;
|
|
1
|
+
{"version":3,"file":"radio-element.js","sourceRoot":"","sources":["../../../src/core/elements/radio-element.ts"],"names":[],"mappings":";;;;AAAA,4CAAmE;AAEnE,sCAAwD;AAyBxD;;;GAGG;AACH;IAAqC,2CAAU;IAC7C,yBAAY,cAAmB;eAC7B,kBAAM,cAAc,CAAC;IACvB,CAAC;IAED,kBAAkB;IACX,+BAAK,GAAZ,UAAa,MAAa;QAAb,uBAAA,EAAA,aAAa;QACxB,MAAM,IAAI,qCAA6B,CAAC,uCAAuC,CAAC,CAAC;IACnF,CAAC;IAED,kBAAkB;IACX,iCAAO,GAAd;QACE,MAAM,IAAI,qCAA6B,CAAC,uCAAuC,CAAC,CAAC;IACnF,CAAC;IAED,kBAAkB;IACX,mCAAS,GAAhB;QACE,MAAM,IAAI,qCAA6B,CAAC,uCAAuC,CAAC,CAAC;IACnF,CAAC;IACH,sBAAC;AAAD,CAAC,AAnBD,CAAqC,oBAAU,GAmB9C;AAnBY,0CAAe","sourcesContent":["import { TranspilationPurposeOnlyError } from '../../errors/index';\n\nimport { ElementProfile, O3rElement } from '../element';\n\n/**\n * Interface to describe the Radio elements that are used inside a fixture.\n * As for ComponentFixtureProfile, this abstracts the testing framework that is used by choosing the right\n * implementation at runtime.\n */\nexport interface RadioElementProfile extends ElementProfile {\n /**\n * Check the radio element\n * @param value If specified, determine the value of the radio button\n */\n check(value?: boolean): Promise<void>;\n\n /**\n * Uncheck the radio element\n */\n uncheck(): Promise<void>;\n\n /**\n * Return true if the radio button is checked\n */\n isChecked(): Promise<boolean>;\n}\n\n/**\n * Mock for ElementProfile class.\n * This class is used for fixture compilation purpose.\n */\nexport class O3rRadioElement extends O3rElement implements RadioElementProfile {\n constructor(_sourceElement: any) {\n super(_sourceElement);\n }\n\n /** @inheritDoc */\n public check(_value = true): Promise<void> {\n throw new TranspilationPurposeOnlyError('Should target a proper implementation');\n }\n\n /** @inheritDoc */\n public uncheck(): Promise<void> {\n throw new TranspilationPurposeOnlyError('Should target a proper implementation');\n }\n\n /** @inheritDoc */\n public isChecked(): Promise<boolean> {\n throw new TranspilationPurposeOnlyError('Should target a proper implementation');\n }\n}\n"]}
|
|
@@ -22,14 +22,12 @@ export declare class O3rSelectElement extends O3rElement implements SelectElemen
|
|
|
22
22
|
constructor(_sourceElement: any);
|
|
23
23
|
/**
|
|
24
24
|
* Select an element in a dropdown by index.
|
|
25
|
-
*
|
|
26
25
|
* @param _index
|
|
27
26
|
* @param _timeout
|
|
28
27
|
*/
|
|
29
28
|
selectByIndex(_index: number, _timeout?: number): Promise<void>;
|
|
30
29
|
/**
|
|
31
30
|
* Select an element in a dropdown by value.
|
|
32
|
-
*
|
|
33
31
|
* @param _value
|
|
34
32
|
* @param _timeout
|
|
35
33
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select-element.d.ts","sourceRoot":"","sources":["../../../src/core/elements/select-element.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExD;;;;GAIG;AACH,MAAM,WAAW,oBAAqB,SAAQ,cAAc;IAC1D;;OAEG;IACH,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE/D;;OAEG;IACH,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAChE;AAED;;;GAGG;AACH,qBAAa,gBAAiB,SAAQ,UAAW,YAAW,oBAAoB;gBAClE,cAAc,EAAE,GAAG;IAI/B
|
|
1
|
+
{"version":3,"file":"select-element.d.ts","sourceRoot":"","sources":["../../../src/core/elements/select-element.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExD;;;;GAIG;AACH,MAAM,WAAW,oBAAqB,SAAQ,cAAc;IAC1D;;OAEG;IACH,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE/D;;OAEG;IACH,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAChE;AAED;;;GAGG;AACH,qBAAa,gBAAiB,SAAQ,UAAW,YAAW,oBAAoB;gBAClE,cAAc,EAAE,GAAG;IAI/B;;;;OAIG;IACI,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAItE;;;;OAIG;IACI,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAGvE"}
|
|
@@ -15,7 +15,6 @@ var O3rSelectElement = /** @class */ (function (_super) {
|
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
17
17
|
* Select an element in a dropdown by index.
|
|
18
|
-
*
|
|
19
18
|
* @param _index
|
|
20
19
|
* @param _timeout
|
|
21
20
|
*/
|
|
@@ -24,7 +23,6 @@ var O3rSelectElement = /** @class */ (function (_super) {
|
|
|
24
23
|
};
|
|
25
24
|
/**
|
|
26
25
|
* Select an element in a dropdown by value.
|
|
27
|
-
*
|
|
28
26
|
* @param _value
|
|
29
27
|
* @param _timeout
|
|
30
28
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select-element.js","sourceRoot":"","sources":["../../../src/core/elements/select-element.ts"],"names":[],"mappings":";;;;AAAA,4CAAmE;AAEnE,sCAAwD;AAmBxD;;;GAGG;AACH;IAAsC,4CAAU;IAC9C,0BAAY,cAAmB;eAC7B,kBAAM,cAAc,CAAC;IACvB,CAAC;IAED
|
|
1
|
+
{"version":3,"file":"select-element.js","sourceRoot":"","sources":["../../../src/core/elements/select-element.ts"],"names":[],"mappings":";;;;AAAA,4CAAmE;AAEnE,sCAAwD;AAmBxD;;;GAGG;AACH;IAAsC,4CAAU;IAC9C,0BAAY,cAAmB;eAC7B,kBAAM,cAAc,CAAC;IACvB,CAAC;IAED;;;;OAIG;IACI,wCAAa,GAApB,UAAqB,MAAc,EAAE,QAAiB;QACpD,MAAM,IAAI,qCAA6B,CAAC,uCAAuC,CAAC,CAAC;IACnF,CAAC;IAED;;;;OAIG;IACI,wCAAa,GAApB,UAAqB,MAAc,EAAE,QAAiB;QACpD,MAAM,IAAI,qCAA6B,CAAC,uCAAuC,CAAC,CAAC;IACnF,CAAC;IACH,uBAAC;AAAD,CAAC,AAtBD,CAAsC,oBAAU,GAsB/C;AAtBY,4CAAgB","sourcesContent":["import { TranspilationPurposeOnlyError } from '../../errors/index';\n\nimport { ElementProfile, O3rElement } from '../element';\n\n/**\n * Interface to describe the Select elements that are used inside a fixture.\n * As for ComponentFixtureProfile, this abstracts the testing framework that is used by choosing the right\n * implementation at runtime.\n */\nexport interface SelectElementProfile extends ElementProfile {\n /**\n * Select an element in a dropdown by index.\n */\n selectByIndex(index: number, _timeout?: number): Promise<void>;\n\n /**\n * Select an element in a dropdown by value.\n */\n selectByValue(value: string, _timeout?: number): Promise<void>;\n}\n\n/**\n * Mock for ElementProfile class.\n * This class is used for fixture compilation purpose.\n */\nexport class O3rSelectElement extends O3rElement implements SelectElementProfile {\n constructor(_sourceElement: any) {\n super(_sourceElement);\n }\n\n /**\n * Select an element in a dropdown by index.\n * @param _index\n * @param _timeout\n */\n public selectByIndex(_index: number, _timeout?: number): Promise<void> {\n throw new TranspilationPurposeOnlyError('Should target a proper implementation');\n }\n\n /**\n * Select an element in a dropdown by value.\n * @param _value\n * @param _timeout\n */\n public selectByValue(_value: string, _timeout?: number): Promise<void> {\n throw new TranspilationPurposeOnlyError('Should target a proper implementation');\n }\n}\n"]}
|
package/core/helpers.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Determine if the given item is a promise
|
|
3
|
-
*
|
|
4
3
|
* @param item Item to check
|
|
5
4
|
*/
|
|
6
5
|
export declare const isPromise: <T>(item: T | Promise<T>) => item is Promise<T>;
|
|
@@ -12,7 +11,6 @@ export declare class TimeoutError extends Error {
|
|
|
12
11
|
}
|
|
13
12
|
/**
|
|
14
13
|
* Apply timeout to a given promise
|
|
15
|
-
*
|
|
16
14
|
* @param promise Promise to timeout
|
|
17
15
|
* @param timeout timeout of the given promise (in ms)
|
|
18
16
|
*/
|
package/core/helpers.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/core/helpers.ts"],"names":[],"mappings":"AACA
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/core/helpers.ts"],"names":[],"mappings":"AACA;;;GAGG;AACH,eAAO,MAAM,SAAS,iDAA6G,CAAC;AAEpI;;GAEG;AACH,qBAAa,YAAa,SAAQ,KAAK;gBACzB,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS;CAGzC;AAED;;;;GAIG;AACH,eAAO,MAAM,WAAW,qCAA4C,MAAM,eAKzE,CAAC"}
|
package/core/helpers.js
CHANGED
|
@@ -4,7 +4,6 @@ exports.withTimeout = exports.TimeoutError = exports.isPromise = void 0;
|
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
5
|
/**
|
|
6
6
|
* Determine if the given item is a promise
|
|
7
|
-
*
|
|
8
7
|
* @param item Item to check
|
|
9
8
|
*/
|
|
10
9
|
var isPromise = function (item) { return !!item && typeof item.then === 'function'; };
|
|
@@ -22,7 +21,6 @@ var TimeoutError = /** @class */ (function (_super) {
|
|
|
22
21
|
exports.TimeoutError = TimeoutError;
|
|
23
22
|
/**
|
|
24
23
|
* Apply timeout to a given promise
|
|
25
|
-
*
|
|
26
24
|
* @param promise Promise to timeout
|
|
27
25
|
* @param timeout timeout of the given promise (in ms)
|
|
28
26
|
*/
|
package/core/helpers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/core/helpers.ts"],"names":[],"mappings":";;;;AACA
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/core/helpers.ts"],"names":[],"mappings":";;;;AACA;;;GAGG;AACI,IAAM,SAAS,GAAG,UAAI,IAAoB,IAAyB,OAAA,CAAC,CAAC,IAAI,IAAI,OAAQ,IAAmB,CAAC,IAAI,KAAK,UAAU,EAAzD,CAAyD,CAAC;AAAvH,QAAA,SAAS,aAA8G;AAEpI;;GAEG;AACH;IAAkC,wCAAK;IACrC,sBAAY,OAA4B;eACtC,kBAAM,OAAO,IAAI,wBAAwB,CAAC;IAC5C,CAAC;IACH,mBAAC;AAAD,CAAC,AAJD,CAAkC,KAAK,GAItC;AAJY,oCAAY;AAMzB;;;;GAIG;AACI,IAAM,WAAW,GAAG,UAAU,OAAmB,EAAE,OAAgB;;QACxE,IAAI,CAAC,OAAO,EAAE;YACZ,sBAAO,OAAO,EAAC;SAChB;QACD,sBAAO,OAAO,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,IAAI,OAAO,CAAI,UAAC,CAAC,EAAE,MAAM,IAAK,OAAA,UAAU,CAAC,cAAM,OAAA,MAAM,CAAC,IAAI,YAAY,EAAE,CAAC,EAA1B,CAA0B,EAAE,OAAO,CAAC,EAArD,CAAqD,CAAC,CAAC,CAAC,EAAC;;KACtH,CAAC;AALW,QAAA,WAAW,eAKtB","sourcesContent":["\n/**\n * Determine if the given item is a promise\n * @param item Item to check\n */\nexport const isPromise = <T>(item: T | Promise<T>): item is Promise<T> => !!item && typeof (item as Promise<T>).then === 'function';\n\n/**\n * Error raised when promise timeout\n */\nexport class TimeoutError extends Error {\n constructor(message?: string | undefined) {\n super(message || 'Timeout of the promise');\n }\n}\n\n/**\n * Apply timeout to a given promise\n * @param promise Promise to timeout\n * @param timeout timeout of the given promise (in ms)\n */\nexport const withTimeout = async <T>(promise: Promise<T>, timeout?: number): Promise<T> => {\n if (!timeout) {\n return promise;\n }\n return Promise.race([promise, new Promise<T>((_, reject) => setTimeout(() => reject(new TimeoutError()), timeout))]);\n};\n"]}
|
package/core/page-fixture.d.ts
CHANGED
|
@@ -17,7 +17,6 @@ export declare class O3rPageFixture<V extends O3rElement = O3rElement> extends O
|
|
|
17
17
|
/**
|
|
18
18
|
* Root element of this fixture. Optional in a Protractor.
|
|
19
19
|
* All further queries will be applied to the element tree if any, otherwise they will be applied to the whole DOM.
|
|
20
|
-
*
|
|
21
20
|
* @param _rootElement
|
|
22
21
|
*/
|
|
23
22
|
constructor(_rootElement?: V);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page-fixture.d.ts","sourceRoot":"","sources":["../../src/core/page-fixture.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AACnF,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEvD;;GAEG;AACH,MAAM,WAAW,kBAAkB,CAAC,CAAC,SAAS,cAAc,CAAE,SAAQ,uBAAuB,CAAC,CAAC,CAAC;IAC9F;;OAEG;IACH,QAAQ,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;CAC7B;AAED;;;GAGG;AACH,qBAAa,cAAc,CAAC,CAAC,SAAS,UAAU,GAAG,UAAU,CAAE,SAAQ,mBAAmB,CAAC,CAAC,CAAE,YAAW,kBAAkB,CAAC,CAAC,CAAC;IAC5H
|
|
1
|
+
{"version":3,"file":"page-fixture.d.ts","sourceRoot":"","sources":["../../src/core/page-fixture.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AACnF,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEvD;;GAEG;AACH,MAAM,WAAW,kBAAkB,CAAC,CAAC,SAAS,cAAc,CAAE,SAAQ,uBAAuB,CAAC,CAAC,CAAC;IAC9F;;OAEG;IACH,QAAQ,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;CAC7B;AAED;;;GAGG;AACH,qBAAa,cAAc,CAAC,CAAC,SAAS,UAAU,GAAG,UAAU,CAAE,SAAQ,mBAAmB,CAAC,CAAC,CAAE,YAAW,kBAAkB,CAAC,CAAC,CAAC;IAC5H;;;;OAIG;gBACS,YAAY,CAAC,EAAE,CAAC;IAIrB,QAAQ,IAAI,OAAO,CAAC,MAAM,CAAC;CAGnC"}
|
package/core/page-fixture.js
CHANGED
|
@@ -13,7 +13,6 @@ var O3rPageFixture = /** @class */ (function (_super) {
|
|
|
13
13
|
/**
|
|
14
14
|
* Root element of this fixture. Optional in a Protractor.
|
|
15
15
|
* All further queries will be applied to the element tree if any, otherwise they will be applied to the whole DOM.
|
|
16
|
-
*
|
|
17
16
|
* @param _rootElement
|
|
18
17
|
*/
|
|
19
18
|
function O3rPageFixture(_rootElement) {
|
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
|
|
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;eAC1B,iBAAO;IACT,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 Protractor implementation');\n }\n}\n"]}
|
|
@@ -13,14 +13,12 @@ export declare class O3rComponentFixture<V extends O3rElement = O3rElement> impl
|
|
|
13
13
|
/**
|
|
14
14
|
* Root element of this fixture.
|
|
15
15
|
* All further queries will be applied to the element tree if any, otherwise they will be applied to the whole DOM.
|
|
16
|
-
*
|
|
17
16
|
* @param rootElement
|
|
18
17
|
*/
|
|
19
18
|
constructor(rootElement: V);
|
|
20
19
|
/**
|
|
21
20
|
* Throws an exception if the element is undefined.
|
|
22
21
|
* Otherwise returns the element.
|
|
23
|
-
*
|
|
24
22
|
* @param element ElementProfile to test
|
|
25
23
|
* @param timeout specific timeout that will throw when reach
|
|
26
24
|
*/
|
|
@@ -28,22 +26,12 @@ export declare class O3rComponentFixture<V extends O3rElement = O3rElement> impl
|
|
|
28
26
|
/**
|
|
29
27
|
* Throws an exception if the element is undefined.
|
|
30
28
|
* Otherwise returns the element.
|
|
31
|
-
*
|
|
32
|
-
* @param element ElementProfile to test
|
|
33
|
-
* @deprecated use {@link Promise} only as {@link throwOnUndefined} parameter or use {@see throwOnUndefinedElement} instead. Will be removed in v10
|
|
34
|
-
*/
|
|
35
|
-
protected throwOnUndefined<T extends O3rElement>(element?: T): T;
|
|
36
|
-
/**
|
|
37
|
-
* Throws an exception if the element is undefined.
|
|
38
|
-
* Otherwise returns the element.
|
|
39
|
-
*
|
|
40
29
|
* @param element ElementProfile to test
|
|
41
30
|
* @param timeout specific timeout that will throw when reach
|
|
42
31
|
*/
|
|
43
32
|
protected throwOnUndefined<T extends O3rElement>(element: Promise<T | undefined>, timeout?: number): Promise<T>;
|
|
44
33
|
/**
|
|
45
34
|
* Get the element associated to the selector if present
|
|
46
|
-
*
|
|
47
35
|
* @param selector Selector to access the element
|
|
48
36
|
* @param elementConstructor Constructor that will be used to create the Element, defaults to O3rElement
|
|
49
37
|
* @param options Options supported
|
|
@@ -58,7 +46,6 @@ export declare class O3rComponentFixture<V extends O3rElement = O3rElement> impl
|
|
|
58
46
|
}): Promise<O3rElement | undefined>;
|
|
59
47
|
/**
|
|
60
48
|
* Get text from the element associated to the given selector, or undefined if the element is not found or not visible
|
|
61
|
-
*
|
|
62
49
|
* @param selector Selector to access the element
|
|
63
50
|
* @param options Options supported
|
|
64
51
|
* @param options.elementConstructor Constructor that will be used to create the Element, defaults to O3rElement
|
|
@@ -74,7 +61,6 @@ export declare class O3rComponentFixture<V extends O3rElement = O3rElement> impl
|
|
|
74
61
|
}): Promise<string | undefined>;
|
|
75
62
|
/**
|
|
76
63
|
* Check if the element associated to the given selector is visible
|
|
77
|
-
*
|
|
78
64
|
* @param selector Selector to access the element
|
|
79
65
|
* @param options Options supported
|
|
80
66
|
* @param options.elementConstructor Constructor that will be used to create the Element, defaults to O3rElement
|
|
@@ -90,7 +76,6 @@ export declare class O3rComponentFixture<V extends O3rElement = O3rElement> impl
|
|
|
90
76
|
}): Promise<boolean>;
|
|
91
77
|
/**
|
|
92
78
|
* Click on the element associated to the given selector if it exists and is visible
|
|
93
|
-
*
|
|
94
79
|
* @param selector Selector to access the element
|
|
95
80
|
* @param options Options supported
|
|
96
81
|
* @param options.elementConstructor Constructor that will be used to create the Element, defaults to O3rElement
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component-fixture.d.ts","sourceRoot":"","sources":["../../../src/core/playwright/component-fixture.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAEpE,OAAO,EAAE,UAAU,EAAE,qBAAqB,EAA2B,MAAM,WAAW,CAAC;AACvF,OAAO,EAAE,QAAQ,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAExD,YAAY,EAAE,uBAAuB,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEtG;;GAEG;AACH,qBAAa,mBAAmB,CAAC,CAAC,SAAS,UAAU,GAAG,UAAU,CAAE,YAAW,uBAAuB,CAAC,CAAC,CAAC;IAEvG;;OAEG;IACH,SAAS,CAAC,WAAW,EAAE,CAAC,CAAC;IAEzB
|
|
1
|
+
{"version":3,"file":"component-fixture.d.ts","sourceRoot":"","sources":["../../../src/core/playwright/component-fixture.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAEpE,OAAO,EAAE,UAAU,EAAE,qBAAqB,EAA2B,MAAM,WAAW,CAAC;AACvF,OAAO,EAAE,QAAQ,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAExD,YAAY,EAAE,uBAAuB,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEtG;;GAEG;AACH,qBAAa,mBAAmB,CAAC,CAAC,SAAS,UAAU,GAAG,UAAU,CAAE,YAAW,uB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AC,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;IAmC9L,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,GAAG,OAAO,CAAC,OAAO,CAAC;CAIjE"}
|
|
@@ -13,7 +13,6 @@ var O3rComponentFixture = /** @class */ (function () {
|
|
|
13
13
|
/**
|
|
14
14
|
* Root element of this fixture.
|
|
15
15
|
* All further queries will be applied to the element tree if any, otherwise they will be applied to the whole DOM.
|
|
16
|
-
*
|
|
17
16
|
* @param rootElement
|
|
18
17
|
*/
|
|
19
18
|
function O3rComponentFixture(rootElement) {
|
|
@@ -22,7 +21,6 @@ var O3rComponentFixture = /** @class */ (function () {
|
|
|
22
21
|
/**
|
|
23
22
|
* Throws an exception if the element is undefined.
|
|
24
23
|
* Otherwise returns the element.
|
|
25
|
-
*
|
|
26
24
|
* @param element ElementProfile to test
|
|
27
25
|
* @param timeout specific timeout that will throw when reach
|
|
28
26
|
*/
|
|
@@ -49,32 +47,27 @@ var O3rComponentFixture = /** @class */ (function () {
|
|
|
49
47
|
/**
|
|
50
48
|
* Throws an exception if the element is undefined.
|
|
51
49
|
* Otherwise returns the element.
|
|
52
|
-
*
|
|
53
50
|
* @param element ElementProfile to test
|
|
54
51
|
* @param timeout specific timeout that will throw when reach
|
|
55
|
-
* @deprecated use {@link Promise} only as {@link throwOnUndefined} parameter or use {@link throwOnUndefinedElement} instead. Will be removed in v10
|
|
56
52
|
*/
|
|
57
53
|
O3rComponentFixture.prototype.throwOnUndefined = function (element, timeout) {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
return (
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
73
|
-
return element;
|
|
54
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
55
|
+
var _this = this;
|
|
56
|
+
return tslib_1.__generator(this, function (_a) {
|
|
57
|
+
return [2 /*return*/, (0, helpers_1.withTimeout)(element, timeout)
|
|
58
|
+
.then(function (el) { return el === null || el === void 0 ? void 0 : el.sourceElement.element.count(); })
|
|
59
|
+
.then(function (count) { return (count || 0) > 0; })
|
|
60
|
+
.then(function (isPresent) {
|
|
61
|
+
if (!isPresent) {
|
|
62
|
+
throw new Error('Element not found in ' + _this.constructor.name);
|
|
63
|
+
}
|
|
64
|
+
})
|
|
65
|
+
.then(function () { return element; })];
|
|
66
|
+
});
|
|
67
|
+
});
|
|
74
68
|
};
|
|
75
69
|
/**
|
|
76
70
|
* Get the element associated to the selector if present
|
|
77
|
-
*
|
|
78
71
|
* @param selector Selector to access the element
|
|
79
72
|
* @param elementConstructor Constructor that will be used to create the Element, defaults to O3rElement
|
|
80
73
|
* @param options Options supported
|
|
@@ -109,7 +102,6 @@ var O3rComponentFixture = /** @class */ (function () {
|
|
|
109
102
|
};
|
|
110
103
|
/**
|
|
111
104
|
* Get text from the element associated to the given selector, or undefined if the element is not found or not visible
|
|
112
|
-
*
|
|
113
105
|
* @param selector Selector to access the element
|
|
114
106
|
* @param options Options supported
|
|
115
107
|
* @param options.elementConstructor Constructor that will be used to create the Element, defaults to O3rElement
|
|
@@ -144,7 +136,6 @@ var O3rComponentFixture = /** @class */ (function () {
|
|
|
144
136
|
};
|
|
145
137
|
/**
|
|
146
138
|
* Check if the element associated to the given selector is visible
|
|
147
|
-
*
|
|
148
139
|
* @param selector Selector to access the element
|
|
149
140
|
* @param options Options supported
|
|
150
141
|
* @param options.elementConstructor Constructor that will be used to create the Element, defaults to O3rElement
|
|
@@ -174,7 +165,6 @@ var O3rComponentFixture = /** @class */ (function () {
|
|
|
174
165
|
};
|
|
175
166
|
/**
|
|
176
167
|
* Click on the element associated to the given selector if it exists and is visible
|
|
177
|
-
*
|
|
178
168
|
* @param selector Selector to access the element
|
|
179
169
|
* @param options Options supported
|
|
180
170
|
* @param options.elementConstructor Constructor that will be used to create the Element, defaults to O3rElement
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component-fixture.js","sourceRoot":"","sources":["../../../src/core/playwright/component-fixture.ts"],"names":[],"mappings":";;;;AAAA,4BAA4B;AAC5B,4CAAuD;AAEvD,sCAAoD;AACpD,qCAAuF;AAKvF;;GAEG;AACH;IAOE;;;;;OAKG;IACH,6BAAY,WAAc;QACxB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACjC,CAAC;IAED;;;;;;OAMG;IACa,qDAAuB,GAAvC,UAA8D,OAAW,EAAE,OAAgB;;;;;;wBACzF,IAAI,CAAC,OAAO,EAAE;4BACZ,MAAM,IAAI,KAAK,CAAC,uBAAuB,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;yBAClE;wBACa,qBAAM,IAAA,qBAAW,EAAC,OAAO,CAAC,aAAa,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,OAAO,CAAC,EAAA;;wBAAzE,KAAK,GAAG,SAAiE;wBAC/E,IAAI,CAAC,KAAK,EAAE;4BACV,MAAM,IAAI,KAAK,CAAC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QAAe,CAAC,CAAC;wBAC7B,qBAAM,KAAK,CAAC,YAAY,EAAE,EAAA;;wBAApC,OAAO,GAAG,SAA0B;wBAE1C,IAAI,CAAC,OAAO,EAAE;4BACZ,MAAM,IAAI,yBAAiB,CAAC,wBAAwB,CAAC,CAAC;yBACvD;wBACD,sBAAO,KAAK,EAAC;4BAGf,sBAAO,QAAQ,EAAC;;;wBAEhB,OAAO,CAAC,IAAI,CAAC,8BAAuB,QAAQ,CAAE,EAAE,KAAG,CAAC,CAAC;wBACrD,sBAAO,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,EAAC;;;;;KAE9B;IAED,kBAAkB;IACX,wCAAU,GAAjB;QACE,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IAED,kBAAkB;IACX,8CAAgB,GAAvB;QACE,OAAO,OAAO,CAAC,OAAO,CAAC,EAAC,KAAK,EAAE,CAAC,IAAI,CAAC,EAAC,CAAC,CAAC;IAC1C,CAAC;IAED,kBAAkB;IACL,6CAAe,GAA5B,UAA6B,QAAgB;;;;gBACrC,OAAO,GAAG,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,CAAC;gBACjF,sBAAO,OAAO,CAAC,QAAQ,EAAE,EAAC;;;KAC3B;IACH,0BAAC;AAAD,CAAC,AAhQD,IAgQC;AAhQY,kDAAmB","sourcesContent":["/* eslint-disable new-cap */\nimport { FixtureUsageError } from '../../errors/index';\nimport type { ComponentFixtureProfile } from '../component-fixture';\nimport { isPromise, withTimeout } from '../helpers';\nimport { O3rElement, O3rElementConstructor, PlaywrightSourceElement } from './element';\nimport { O3rGroup, O3rGroupConstructor } from './group';\n\nexport type { ComponentFixtureProfile, Constructable, FixtureWithCustom } from '../component-fixture';\n\n/**\n * Implementation of the fixture dedicated to Playwright, hence using the webdriver to interact with the dom.\n */\nexport class O3rComponentFixture<V extends O3rElement = O3rElement> implements ComponentFixtureProfile<V> {\n\n /**\n * DOM element linked to the fixture.\n */\n protected rootElement: V;\n\n /**\n * Root element of this fixture.\n * All further queries will be applied to the element tree if any, otherwise they will be applied to the whole DOM.\n *\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 *\n * @param element ElementProfile to test\n * @param timeout specific timeout that will throw when reach\n */\n protected async throwOnUndefinedElement<T extends O3rElement>(element?: T, timeout?: number): Promise<T> {\n if (!element) {\n throw new Error('Element not found in ' + this.constructor.name);\n }\n const count = await withTimeout(element.sourceElement.element.count(), timeout);\n if (!count) {\n throw new Error('Element not found in ' + this.constructor.name);\n }\n return element;\n }\n\n /**\n * Throws an exception if the element is undefined.\n * Otherwise returns the element.\n *\n * @param element ElementProfile to test\n * @deprecated use {@link Promise} only as {@link throwOnUndefined} parameter or use {@see throwOnUndefinedElement} instead. Will be removed in v10\n */\n protected throwOnUndefined<T extends O3rElement>(element?: T): T;\n /**\n * Throws an exception if the element is undefined.\n * Otherwise returns the element.\n *\n * @param element ElementProfile to test\n * @param timeout specific timeout that will throw when reach\n */\n protected async throwOnUndefined<T extends O3rElement>(element: Promise<T | undefined>, timeout?: number): Promise<T>;\n /**\n * Throws an exception if the element is undefined.\n * Otherwise returns the element.\n *\n * @param element ElementProfile to test\n * @param timeout specific timeout that will throw when reach\n * @deprecated use {@link Promise} only as {@link throwOnUndefined} parameter or use {@link throwOnUndefinedElement} instead. Will be removed in v10\n */\n protected throwOnUndefined<T extends O3rElement>(element?: Promise<T | undefined> | T, timeout?: number): Promise<T> | T {\n if (isPromise(element)) {\n return withTimeout(element, timeout)\n .then((el) => el?.sourceElement.element.count())\n .then((count) => (count || 0) > 0)\n .then((isPresent) => {\n if (!isPresent) {\n throw new Error('Element not found in ' + this.constructor.name);\n }\n })\n .then(() => element as Promise<T>);\n }\n\n if (!element) {\n throw new Error('Element not found in ' + this.constructor.name);\n }\n return element;\n }\n\n /**\n * Get the element associated to the selector if present\n *\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 element: O3rElement | undefined;\n if (options.index !== undefined) {\n element = await this.queryNth(selector, options.index, elementConstructor as any);\n } else {\n element = await this.query(selector, elementConstructor as any);\n }\n if (options.shouldThrowIfNotPresent) {\n return this.throwOnUndefinedElement<O3rElement>(element, options.timeout);\n }\n return element;\n }\n\n /**\n * Get text from the element associated to the given selector, or undefined if the element is not found or not visible\n *\n * @param selector Selector to access the element\n * @param options Options supported\n * @param options.elementConstructor Constructor that will be used to create the Element, defaults to O3rElement\n * @param options.index index Select the element associated to the index\n * @param options.shouldThrowIfNotPresent If set to true the function will throw if the element is not present\n * @param options.timeout Duration to wait for the element to be present before it throws\n */\n protected async getText<T extends O3rElement>(selector: string, options: {\n elementConstructor?: O3rElementConstructor<T>;\n index?: number;\n shouldThrowIfNotPresent?: boolean;\n timeout?: number;\n } = {}): Promise<string | undefined> {\n const element = await this.queryWithOptions(selector, options.elementConstructor, options);\n if (!element || !await element.isVisible()) {\n return;\n }\n return await element.getText();\n }\n\n /**\n * Check if the element associated to the given selector is visible\n *\n * @param selector Selector to access the element\n * @param options Options supported\n * @param options.elementConstructor Constructor that will be used to create the Element, defaults to O3rElement\n * @param options.index index Select the element associated to the index\n * @param options.shouldThrowIfNotPresent If set to true the function will throw if the element is not present\n * @param options.timeout Duration to wait for the element to be present before it throws\n */\n protected async isVisible<T extends O3rElement>(selector: string, options: {\n elementConstructor?: O3rElementConstructor<T> | undefined;\n index?: number;\n shouldThrowIfNotPresent?: boolean;\n timeout?: number;\n } = {}): Promise<boolean> {\n const element = await this.queryWithOptions(selector, options.elementConstructor, options);\n return !!element && await element.isVisible();\n }\n\n /**\n * Click on the element associated to the given selector if it exists and is visible\n *\n * @param selector Selector to access the element\n * @param options Options supported\n * @param options.elementConstructor Constructor that will be used to create the Element, defaults to O3rElement\n * @param options.index index Select the element associated to the index\n * @param options.shouldThrowIfNotPresent If set to true the function will throw if the element is not present\n * @param options.timeout Duration to wait for the element to be present before it throws\n */\n protected async click<T extends O3rElement>(selector: string, options: {\n elementConstructor?: O3rElementConstructor<T> | undefined;\n index?: number;\n shouldThrowIfNotPresent?: boolean;\n timeout?: number;\n } = {}): Promise<void> {\n const element = await this.queryWithOptions(selector, options.elementConstructor, options);\n if (!!element && await element.isVisible()) {\n await element.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 try {\n const elements = this.rootElement.sourceElement.element.locator(selector);\n const element = elements.first();\n const selectedElement: PlaywrightSourceElement = {element: element, page: this.rootElement.sourceElement.page};\n return Promise.resolve(new (returnType || O3rElement)(selectedElement));\n } catch (err) {\n console.warn(`Failed to query ${selector}`, err);\n return Promise.resolve(undefined);\n }\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 try {\n const elements = this.rootElement.sourceElement.element.locator(selector);\n const element = elements.nth(index);\n const selectedElement: PlaywrightSourceElement = {element: element, page: this.rootElement.sourceElement.page};\n return Promise.resolve(new (returnType || O3rElement)(selectedElement));\n } catch {\n return Promise.resolve(undefined);\n }\n }\n\n /** @inheritdoc */\n public async queryAll(_selector: string, _returnType?: undefined, groupType?: undefined, timeout?: number): Promise<O3rElement[]>;\n public async queryAll<T extends O3rElement>(selector: string, returnType: O3rElementConstructor<T>, groupType?: undefined, timeout?: number): Promise<T[]>;\n public async queryAll<T extends O3rElement, K extends O3rGroup<T>>(selector: string, returnType: O3rElementConstructor<T>, groupType: O3rGroupConstructor<K, T>, timeout?: number): Promise<K>;\n public async queryAll<T extends O3rElement, K extends O3rGroup<T>>(\n selector: string,\n returnType: O3rElementConstructor<T> | undefined,\n groupType: O3rGroupConstructor<K, T> | undefined,\n timeout = 5000\n ): Promise<(T | O3rElement)[] | K> {\n try {\n const sourceElement = this.rootElement.sourceElement.element;\n const pElements = sourceElement.locator(selector);\n // Mandatory because count is not reliable if we don't wait for the list to be attached\n await pElements.first().waitFor({state: 'attached', timeout});\n const pElementsCount = await pElements.count();\n const elements = [];\n for (let i = 0; i < pElementsCount; i++) {\n const selectedElement: PlaywrightSourceElement = {element: pElements.nth(i), page: this.rootElement.sourceElement.page};\n elements.push(returnType ? new returnType(selectedElement) : new O3rElement(selectedElement));\n }\n if (groupType) {\n const group = new groupType(elements as T[]);\n const isValid = await group.isValidGroup();\n\n if (!isValid) {\n throw new FixtureUsageError('invalid group of items');\n }\n return group;\n }\n\n return elements;\n } catch (err) {\n console.warn(`Failed to query all ${selector}`, err);\n return Promise.resolve([]);\n }\n }\n\n /** @inheritdoc */\n public getElement() {\n return this.rootElement;\n }\n\n /** @inheritdoc */\n public getSubComponents(): Promise<{[componentName: string]: ComponentFixtureProfile[]}> {\n return Promise.resolve({block: [this]});\n }\n\n /** @inheritDoc */\n public async queryNotPresent(selector: string): Promise<boolean> {\n const element = this.rootElement.sourceElement.element.locator(selector).first();\n return element.isHidden();\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"component-fixture.js","sourceRoot":"","sources":["../../../src/core/playwright/component-fixture.ts"],"names":[],"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cesContent":["/* eslint-disable new-cap */\nimport { FixtureUsageError } from '../../errors/index';\nimport type { ComponentFixtureProfile } from '../component-fixture';\nimport { withTimeout } from '../helpers';\nimport { O3rElement, O3rElementConstructor, PlaywrightSourceElement } from './element';\nimport { O3rGroup, O3rGroupConstructor } from './group';\n\nexport type { ComponentFixtureProfile, Constructable, FixtureWithCustom } from '../component-fixture';\n\n/**\n * Implementation of the fixture dedicated to Playwright, hence using the webdriver to interact with the dom.\n */\nexport class O3rComponentFixture<V extends O3rElement = O3rElement> implements ComponentFixtureProfile<V> {\n\n /**\n * DOM element linked to the fixture.\n */\n protected rootElement: V;\n\n /**\n * Root element of this fixture.\n * All further queries will be applied to the element tree if any, otherwise they will be applied to the whole DOM.\n * @param rootElement\n */\n constructor(rootElement: V) {\n this.rootElement = rootElement;\n }\n\n /**\n * Throws an exception if the element is undefined.\n * Otherwise returns the element.\n * @param element ElementProfile to test\n * @param timeout specific timeout that will throw when reach\n */\n protected async throwOnUndefinedElement<T extends O3rElement>(element?: T, timeout?: number): Promise<T> {\n if (!element) {\n throw new Error('Element not found in ' + this.constructor.name);\n }\n const count = await withTimeout(element.sourceElement.element.count(), timeout);\n if (!count) {\n throw new Error('Element not found in ' + this.constructor.name);\n }\n return element;\n }\n\n /**\n * Throws an exception if the element is undefined.\n * Otherwise returns the element.\n * @param element ElementProfile to test\n * @param timeout specific timeout that will throw when reach\n */\n protected async throwOnUndefined<T extends O3rElement>(element: Promise<T | undefined>, timeout?: number): Promise<T> {\n return withTimeout(element, timeout)\n .then((el) => el?.sourceElement.element.count())\n .then((count) => (count || 0) > 0)\n .then((isPresent) => {\n if (!isPresent) {\n throw new Error('Element not found in ' + this.constructor.name);\n }\n })\n .then(() => element as Promise<T>);\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 element: O3rElement | undefined;\n if (options.index !== undefined) {\n element = await this.queryNth(selector, options.index, elementConstructor as any);\n } else {\n element = await this.query(selector, elementConstructor as any);\n }\n if (options.shouldThrowIfNotPresent) {\n return this.throwOnUndefinedElement<O3rElement>(element, options.timeout);\n }\n return element;\n }\n\n /**\n * Get text from the element associated to the given selector, or undefined if the element is not found or not visible\n * @param selector Selector to access the element\n * @param options Options supported\n * @param options.elementConstructor Constructor that will be used to create the Element, defaults to O3rElement\n * @param options.index index Select the element associated to the index\n * @param options.shouldThrowIfNotPresent If set to true the function will throw if the element is not present\n * @param options.timeout Duration to wait for the element to be present before it throws\n */\n protected async getText<T extends O3rElement>(selector: string, options: {\n elementConstructor?: O3rElementConstructor<T>;\n index?: number;\n shouldThrowIfNotPresent?: boolean;\n timeout?: number;\n } = {}): Promise<string | undefined> {\n const element = await this.queryWithOptions(selector, options.elementConstructor, options);\n if (!element || !await element.isVisible()) {\n return;\n }\n return await element.getText();\n }\n\n /**\n * Check if the element associated to the given selector is visible\n * @param selector Selector to access the element\n * @param options Options supported\n * @param options.elementConstructor Constructor that will be used to create the Element, defaults to O3rElement\n * @param options.index index Select the element associated to the index\n * @param options.shouldThrowIfNotPresent If set to true the function will throw if the element is not present\n * @param options.timeout Duration to wait for the element to be present before it throws\n */\n protected async isVisible<T extends O3rElement>(selector: string, options: {\n elementConstructor?: O3rElementConstructor<T> | undefined;\n index?: number;\n shouldThrowIfNotPresent?: boolean;\n timeout?: number;\n } = {}): Promise<boolean> {\n const element = await this.queryWithOptions(selector, options.elementConstructor, options);\n return !!element && await element.isVisible();\n }\n\n /**\n * Click on the element associated to the given selector if it exists and is visible\n * @param selector Selector to access the element\n * @param options Options supported\n * @param options.elementConstructor Constructor that will be used to create the Element, defaults to O3rElement\n * @param options.index index Select the element associated to the index\n * @param options.shouldThrowIfNotPresent If set to true the function will throw if the element is not present\n * @param options.timeout Duration to wait for the element to be present before it throws\n */\n protected async click<T extends O3rElement>(selector: string, options: {\n elementConstructor?: O3rElementConstructor<T> | undefined;\n index?: number;\n shouldThrowIfNotPresent?: boolean;\n timeout?: number;\n } = {}): Promise<void> {\n const element = await this.queryWithOptions(selector, options.elementConstructor, options);\n if (!!element && await element.isVisible()) {\n await element.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 try {\n const elements = this.rootElement.sourceElement.element.locator(selector);\n const element = elements.first();\n const selectedElement: PlaywrightSourceElement = {element: element, page: this.rootElement.sourceElement.page};\n return Promise.resolve(new (returnType || O3rElement)(selectedElement));\n } catch (err) {\n console.warn(`Failed to query ${selector}`, err);\n return Promise.resolve(undefined);\n }\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 try {\n const elements = this.rootElement.sourceElement.element.locator(selector);\n const element = elements.nth(index);\n const selectedElement: PlaywrightSourceElement = {element: element, page: this.rootElement.sourceElement.page};\n return Promise.resolve(new (returnType || O3rElement)(selectedElement));\n } catch {\n return Promise.resolve(undefined);\n }\n }\n\n /** @inheritdoc */\n public async queryAll(_selector: string, _returnType?: undefined, groupType?: undefined, timeout?: number): Promise<O3rElement[]>;\n public async queryAll<T extends O3rElement>(selector: string, returnType: O3rElementConstructor<T>, groupType?: undefined, timeout?: number): Promise<T[]>;\n public async queryAll<T extends O3rElement, K extends O3rGroup<T>>(selector: string, returnType: O3rElementConstructor<T>, groupType: O3rGroupConstructor<K, T>, timeout?: number): Promise<K>;\n public async queryAll<T extends O3rElement, K extends O3rGroup<T>>(\n selector: string,\n returnType: O3rElementConstructor<T> | undefined,\n groupType: O3rGroupConstructor<K, T> | undefined,\n timeout = 5000\n ): Promise<(T | O3rElement)[] | K> {\n try {\n const sourceElement = this.rootElement.sourceElement.element;\n const pElements = sourceElement.locator(selector);\n // Mandatory because count is not reliable if we don't wait for the list to be attached\n await pElements.first().waitFor({state: 'attached', timeout});\n const pElementsCount = await pElements.count();\n const elements = [];\n for (let i = 0; i < pElementsCount; i++) {\n const selectedElement: PlaywrightSourceElement = {element: pElements.nth(i), page: this.rootElement.sourceElement.page};\n elements.push(returnType ? new returnType(selectedElement) : new O3rElement(selectedElement));\n }\n if (groupType) {\n const group = new groupType(elements as T[]);\n const isValid = await group.isValidGroup();\n\n if (!isValid) {\n throw new FixtureUsageError('invalid group of items');\n }\n return group;\n }\n\n return elements;\n } catch (err) {\n console.warn(`Failed to query all ${selector}`, err);\n return Promise.resolve([]);\n }\n }\n\n /** @inheritdoc */\n public getElement() {\n return this.rootElement;\n }\n\n /** @inheritdoc */\n public getSubComponents(): Promise<{[componentName: string]: ComponentFixtureProfile[]}> {\n return Promise.resolve({block: [this]});\n }\n\n /** @inheritDoc */\n public async queryNotPresent(selector: string): Promise<boolean> {\n const element = this.rootElement.sourceElement.element.locator(selector).first();\n return element.isHidden();\n }\n}\n"]}
|