@o3r/testing 13.0.0-next.1 → 13.0.0-next.3
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/package.json +10 -27
- package/tools/index.d.ts +0 -1
- package/tools/index.d.ts.map +1 -1
- package/tools/index.js +0 -1
- package/tools/index.js.map +1 -1
- package/tools/path-replacement/path-replacement.d.ts +2 -2
- package/tools/path-replacement/path-replacement.d.ts.map +1 -1
- package/tools/path-replacement/path-replacement.js +2 -1
- package/tools/path-replacement/path-replacement.js.map +1 -1
- package/core/protractor/angular-materials/autocomplete-material.d.ts +0 -13
- package/core/protractor/angular-materials/autocomplete-material.d.ts.map +0 -1
- package/core/protractor/angular-materials/autocomplete-material.js +0 -37
- package/core/protractor/angular-materials/autocomplete-material.js.map +0 -1
- package/core/protractor/angular-materials/index.d.ts +0 -3
- package/core/protractor/angular-materials/index.d.ts.map +0 -1
- package/core/protractor/angular-materials/index.js +0 -6
- package/core/protractor/angular-materials/index.js.map +0 -1
- package/core/protractor/angular-materials/select-material.d.ts +0 -19
- package/core/protractor/angular-materials/select-material.d.ts.map +0 -1
- package/core/protractor/angular-materials/select-material.js +0 -113
- package/core/protractor/angular-materials/select-material.js.map +0 -1
- package/core/protractor/component-fixture.d.ts +0 -126
- package/core/protractor/component-fixture.d.ts.map +0 -1
- package/core/protractor/component-fixture.js +0 -274
- package/core/protractor/component-fixture.js.map +0 -1
- package/core/protractor/element.d.ts +0 -38
- package/core/protractor/element.d.ts.map +0 -1
- package/core/protractor/element.js +0 -145
- package/core/protractor/element.js.map +0 -1
- package/core/protractor/elements/checkbox-element.d.ts +0 -17
- package/core/protractor/elements/checkbox-element.d.ts.map +0 -1
- package/core/protractor/elements/checkbox-element.js +0 -54
- package/core/protractor/elements/checkbox-element.js.map +0 -1
- package/core/protractor/elements/index.d.ts +0 -4
- package/core/protractor/elements/index.d.ts.map +0 -1
- package/core/protractor/elements/index.js +0 -7
- package/core/protractor/elements/index.js.map +0 -1
- package/core/protractor/elements/radio-element.d.ts +0 -17
- package/core/protractor/elements/radio-element.d.ts.map +0 -1
- package/core/protractor/elements/radio-element.js +0 -56
- package/core/protractor/elements/radio-element.js.map +0 -1
- package/core/protractor/elements/select-element.d.ts +0 -15
- package/core/protractor/elements/select-element.d.ts.map +0 -1
- package/core/protractor/elements/select-element.js +0 -49
- package/core/protractor/elements/select-element.js.map +0 -1
- package/core/protractor/group.d.ts +0 -21
- package/core/protractor/group.d.ts.map +0 -1
- package/core/protractor/group.js +0 -27
- package/core/protractor/group.js.map +0 -1
- package/core/protractor/groups/index.d.ts +0 -2
- package/core/protractor/groups/index.d.ts.map +0 -1
- package/core/protractor/groups/index.js +0 -5
- package/core/protractor/groups/index.js.map +0 -1
- package/core/protractor/groups/radio-group.d.ts +0 -17
- package/core/protractor/groups/radio-group.d.ts.map +0 -1
- package/core/protractor/groups/radio-group.js +0 -80
- package/core/protractor/groups/radio-group.js.map +0 -1
- package/core/protractor/index.d.ts +0 -9
- package/core/protractor/index.d.ts.map +0 -1
- package/core/protractor/index.js +0 -11
- package/core/protractor/index.js.map +0 -1
- package/core/protractor/page-fixture.d.ts +0 -13
- package/core/protractor/page-fixture.d.ts.map +0 -1
- package/core/protractor/page-fixture.js +0 -23
- package/core/protractor/page-fixture.js.map +0 -1
- package/core/protractor/utils.d.ts +0 -8
- package/core/protractor/utils.d.ts.map +0 -1
- package/core/protractor/utils.js +0 -12
- package/core/protractor/utils.js.map +0 -1
- package/tools/protractor/fetch-manager/_fetch-manager.d.ts +0 -1
- package/tools/protractor/fetch-manager/_fetch-manager.d.ts.map +0 -1
- package/tools/protractor/fetch-manager/_fetch-manager.js +0 -127
- package/tools/protractor/fetch-manager/_fetch-manager.js.map +0 -1
- package/tools/protractor/fetch-manager/index.d.ts +0 -2
- package/tools/protractor/fetch-manager/index.d.ts.map +0 -1
- package/tools/protractor/fetch-manager/index.js +0 -5
- package/tools/protractor/fetch-manager/index.js.map +0 -1
- package/tools/protractor/fetch-manager/utils.d.ts +0 -25
- package/tools/protractor/fetch-manager/utils.d.ts.map +0 -1
- package/tools/protractor/fetch-manager/utils.js +0 -81
- package/tools/protractor/fetch-manager/utils.js.map +0 -1
- package/tools/protractor/index.d.ts +0 -3
- package/tools/protractor/index.d.ts.map +0 -1
- package/tools/protractor/index.js +0 -6
- package/tools/protractor/index.js.map +0 -1
- package/tools/protractor/post-message-interceptor/_post-message-interceptor.d.ts +0 -5
- package/tools/protractor/post-message-interceptor/_post-message-interceptor.d.ts.map +0 -1
- package/tools/protractor/post-message-interceptor/_post-message-interceptor.js +0 -157
- package/tools/protractor/post-message-interceptor/_post-message-interceptor.js.map +0 -1
- package/tools/protractor/post-message-interceptor/core.d.ts +0 -17
- package/tools/protractor/post-message-interceptor/core.d.ts.map +0 -1
- package/tools/protractor/post-message-interceptor/core.js +0 -3
- package/tools/protractor/post-message-interceptor/core.js.map +0 -1
- package/tools/protractor/post-message-interceptor/index.d.ts +0 -3
- package/tools/protractor/post-message-interceptor/index.d.ts.map +0 -1
- package/tools/protractor/post-message-interceptor/index.js +0 -6
- package/tools/protractor/post-message-interceptor/index.js.map +0 -1
- package/tools/protractor/post-message-interceptor/post-message-interceptor.d.ts +0 -45
- package/tools/protractor/post-message-interceptor/post-message-interceptor.d.ts.map +0 -1
- package/tools/protractor/post-message-interceptor/post-message-interceptor.js +0 -144
- package/tools/protractor/post-message-interceptor/post-message-interceptor.js.map +0 -1
@@ -1,81 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.waitForOtterStable = waitForOtterStable;
|
4
|
-
exports.initFetchManager = initFetchManager;
|
5
|
-
exports.stopFetchManager = stopFetchManager;
|
6
|
-
var tslib_1 = require("tslib");
|
7
|
-
var fs = require("node:fs");
|
8
|
-
var path = require("node:path");
|
9
|
-
var protractor_1 = require("protractor");
|
10
|
-
/**
|
11
|
-
* This function waits for all fetchs calls to be resolved and the page to be stable to resolve the promise.
|
12
|
-
* It permits to easily run synchronous e2e tests on a flow that uses fetchs calls with protractor.
|
13
|
-
* This is very useful in the case of Otter calls to backend because protractor synchronization manager do not care
|
14
|
-
* about fetchs calls.
|
15
|
-
*
|
16
|
-
* This function needs the FetchManager to have been initialized and injected in the browser at the beginning of the
|
17
|
-
* flow with `initFetchManager()`
|
18
|
-
*
|
19
|
-
* You can ignore the waiting of fetchs by setting `browser.ignoreSynchronization` to `true`
|
20
|
-
* @deprecated Will be removed in v13, please use Playwright instead
|
21
|
-
*/
|
22
|
-
function waitForOtterStable() {
|
23
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
24
|
-
return tslib_1.__generator(this, function (_a) {
|
25
|
-
switch (_a.label) {
|
26
|
-
case 0: return [4 /*yield*/, protractor_1.browser.waitForAngular()];
|
27
|
-
case 1:
|
28
|
-
_a.sent();
|
29
|
-
if (!!protractor_1.browser.ignoreSynchronization) return [3 /*break*/, 4];
|
30
|
-
return [4 /*yield*/, protractor_1.browser.executeAsyncScript('window.fetchManager.getInstance().waitForFetchs(arguments[arguments.length - 1]);')];
|
31
|
-
case 2:
|
32
|
-
_a.sent();
|
33
|
-
return [4 /*yield*/, protractor_1.browser.waitForAngular()];
|
34
|
-
case 3:
|
35
|
-
_a.sent();
|
36
|
-
_a.label = 4;
|
37
|
-
case 4: return [2 /*return*/];
|
38
|
-
}
|
39
|
-
});
|
40
|
-
});
|
41
|
-
}
|
42
|
-
/**
|
43
|
-
* This function initiliaze the FetchManager. Set `window.fetch` variable with a custom behaviour in order to count the
|
44
|
-
* fetch calls.
|
45
|
-
* @deprecated Will be removed in v13, please use Playwright instead
|
46
|
-
*/
|
47
|
-
function initFetchManager() {
|
48
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
49
|
-
var fetchManager;
|
50
|
-
return tslib_1.__generator(this, function (_a) {
|
51
|
-
switch (_a.label) {
|
52
|
-
case 0:
|
53
|
-
fetchManager = fs.readFileSync(path.resolve(process.cwd(), 'node_modules', '@o3r', 'testing', 'tools', 'protractor', 'fetch-manager', '_fetch-manager.js'), { encoding: 'utf8' });
|
54
|
-
return [4 /*yield*/, protractor_1.browser.executeScript(fetchManager)];
|
55
|
-
case 1:
|
56
|
-
_a.sent();
|
57
|
-
return [4 /*yield*/, protractor_1.browser.executeScript('window.fetchManager.getInstance().init();')];
|
58
|
-
case 2:
|
59
|
-
_a.sent();
|
60
|
-
return [2 /*return*/];
|
61
|
-
}
|
62
|
-
});
|
63
|
-
});
|
64
|
-
}
|
65
|
-
/**
|
66
|
-
* This function stops the FetchManager. Reset `window.fetch` variable with its native behaviour.
|
67
|
-
* @deprecated Will be removed in v13, please use Playwright instead
|
68
|
-
*/
|
69
|
-
function stopFetchManager() {
|
70
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
71
|
-
return tslib_1.__generator(this, function (_a) {
|
72
|
-
switch (_a.label) {
|
73
|
-
case 0: return [4 /*yield*/, protractor_1.browser.executeScript('window.fetchManager.getInstance().stop();')];
|
74
|
-
case 1:
|
75
|
-
_a.sent();
|
76
|
-
return [2 /*return*/];
|
77
|
-
}
|
78
|
-
});
|
79
|
-
});
|
80
|
-
}
|
81
|
-
//# sourceMappingURL=utils.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/tools/protractor/fetch-manager/utils.ts"],"names":[],"mappings":";;AAkBA,gDAOC;AAOD,4CAQC;AAMD,4CAEC;;AAhDD,4BAA8B;AAC9B,gCAAkC;AAClC,yCAEoB;AAEpB;;;;;;;;;;;GAWG;AACH,SAAsB,kBAAkB;;;;wBACtC,qBAAM,oBAAO,CAAC,cAAc,EAAE,EAAA;;oBAA9B,SAA8B,CAAC;yBAC3B,CAAC,oBAAO,CAAC,qBAAqB,EAA9B,wBAA8B;oBAChC,qBAAM,oBAAO,CAAC,kBAAkB,CAC9B,mFAAmF,CAAC,EAAA;;oBADtF,SACsF,CAAC;oBACvF,qBAAM,oBAAO,CAAC,cAAc,EAAE,EAAA;;oBAA9B,SAA8B,CAAC;;;;;;CAElC;AAED;;;;GAIG;AACH,SAAsB,gBAAgB;;;;;;oBAC9B,YAAY,GAAG,EAAE,CAAC,YAAY,CAClC,IAAI,CAAC,OAAO,CACV,OAAO,CAAC,GAAG,EAAE,EAAE,cAAc,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,YAAY,EAAE,eAAe,EACxF,mBAAmB,CAAC,EACtB,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC;oBACxB,qBAAM,oBAAO,CAAC,aAAa,CAAC,YAAY,CAAC,EAAA;;oBAAzC,SAAyC,CAAC;oBAC1C,qBAAM,oBAAO,CAAC,aAAa,CAAC,2CAA2C,CAAC,EAAA;;oBAAxE,SAAwE,CAAC;;;;;CAC1E;AAED;;;GAGG;AACH,SAAsB,gBAAgB;;;;wBACpC,qBAAM,oBAAO,CAAC,aAAa,CAAC,2CAA2C,CAAC,EAAA;;oBAAxE,SAAwE,CAAC;;;;;CAC1E","sourcesContent":["import * as fs from 'node:fs';\nimport * as path from 'node:path';\nimport {\n browser,\n} from 'protractor';\n\n/**\n * This function waits for all fetchs calls to be resolved and the page to be stable to resolve the promise.\n * It permits to easily run synchronous e2e tests on a flow that uses fetchs calls with protractor.\n * This is very useful in the case of Otter calls to backend because protractor synchronization manager do not care\n * about fetchs calls.\n *\n * This function needs the FetchManager to have been initialized and injected in the browser at the beginning of the\n * flow with `initFetchManager()`\n *\n * You can ignore the waiting of fetchs by setting `browser.ignoreSynchronization` to `true`\n * @deprecated Will be removed in v13, please use Playwright instead\n */\nexport async function waitForOtterStable() {\n await browser.waitForAngular();\n if (!browser.ignoreSynchronization) {\n await browser.executeAsyncScript(\n 'window.fetchManager.getInstance().waitForFetchs(arguments[arguments.length - 1]);');\n await browser.waitForAngular();\n }\n}\n\n/**\n * This function initiliaze the FetchManager. Set `window.fetch` variable with a custom behaviour in order to count the\n * fetch calls.\n * @deprecated Will be removed in v13, please use Playwright instead\n */\nexport async function initFetchManager() {\n const fetchManager = fs.readFileSync(\n path.resolve(\n process.cwd(), 'node_modules', '@o3r', 'testing', 'tools', 'protractor', 'fetch-manager',\n '_fetch-manager.js'),\n { encoding: 'utf8' });\n await browser.executeScript(fetchManager);\n await browser.executeScript('window.fetchManager.getInstance().init();');\n}\n\n/**\n * This function stops the FetchManager. Reset `window.fetch` variable with its native behaviour.\n * @deprecated Will be removed in v13, please use Playwright instead\n */\nexport async function stopFetchManager() {\n await browser.executeScript('window.fetchManager.getInstance().stop();');\n}\n"]}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/protractor/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,4BAA4B,CAAC"}
|
@@ -1,6 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
var tslib_1 = require("tslib");
|
4
|
-
tslib_1.__exportStar(require("./fetch-manager"), exports);
|
5
|
-
tslib_1.__exportStar(require("./post-message-interceptor"), exports);
|
6
|
-
//# sourceMappingURL=index.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tools/protractor/index.ts"],"names":[],"mappings":";;;AAAA,0DAAgC;AAChC,qEAA2C","sourcesContent":["export * from './fetch-manager';\nexport * from './post-message-interceptor';\n"]}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"_post-message-interceptor.d.ts","sourceRoot":"","sources":["../../../../src/tools/protractor/post-message-interceptor/_post-message-interceptor.ts"],"names":[],"mappings":"AAAA;;GAEG"}
|
@@ -1,157 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
/**
|
3
|
-
* Note: This file is not part of the running script, it is injected in the browser while running e2e tests.
|
4
|
-
*/
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
// TODO: Move to PollyJS when the winter comes
|
7
|
-
(function () {
|
8
|
-
/**
|
9
|
-
* PostMessageInterceptor permits to intercept calls to postMessage.
|
10
|
-
*/
|
11
|
-
var postMessageInterceptor = /** @class */ (function () {
|
12
|
-
function PostMessageInterceptor() {
|
13
|
-
this.lastCalls = [];
|
14
|
-
this.listening = false;
|
15
|
-
}
|
16
|
-
/**
|
17
|
-
* Logs a message in the console
|
18
|
-
* @param message
|
19
|
-
* @param {...any} args
|
20
|
-
*/
|
21
|
-
PostMessageInterceptor.prototype.log = function (message) {
|
22
|
-
var args = [];
|
23
|
-
for (var _i = 1; _i < arguments.length; _i++) {
|
24
|
-
args[_i - 1] = arguments[_i];
|
25
|
-
}
|
26
|
-
// eslint-disable-next-line no-console -- this is the purpose of this method
|
27
|
-
console.log.apply(console, __spreadArray(["#postMessageInterceptor: ".concat(message)], args, false));
|
28
|
-
};
|
29
|
-
/**
|
30
|
-
* Intercepts the native postMessage call
|
31
|
-
* @param ref Singleton instance of the interceptor
|
32
|
-
* @param nativeMethod native postMessage method
|
33
|
-
* @param args all the args passed to the postMessage
|
34
|
-
*/
|
35
|
-
PostMessageInterceptor.prototype.interceptor = function (ref, nativeMethod) {
|
36
|
-
var args = [];
|
37
|
-
for (var _i = 2; _i < arguments.length; _i++) {
|
38
|
-
args[_i - 2] = arguments[_i];
|
39
|
-
}
|
40
|
-
this.log('Intercepted', args);
|
41
|
-
var postCall = {
|
42
|
-
data: args[0],
|
43
|
-
targetOrigin: args[1],
|
44
|
-
timestamp: new Date()
|
45
|
-
};
|
46
|
-
if (ref.listening) {
|
47
|
-
if (ref.conditionFn && !ref.conditionFn(postCall)) {
|
48
|
-
this.log('Intercepted message does not pass the condition');
|
49
|
-
return;
|
50
|
-
}
|
51
|
-
ref.lastCalls.push(postCall);
|
52
|
-
this.log('Last call count', ref.lastCalls.length);
|
53
|
-
}
|
54
|
-
else {
|
55
|
-
this.log('Not listening');
|
56
|
-
}
|
57
|
-
nativeMethod.apply(void 0, args);
|
58
|
-
};
|
59
|
-
/**
|
60
|
-
* Register the interceptor in the window object
|
61
|
-
*/
|
62
|
-
PostMessageInterceptor.prototype.registerFetchInterceptor = function () {
|
63
|
-
var _this = this;
|
64
|
-
var nativeMethod = window.postMessage;
|
65
|
-
this.nativeMethod = nativeMethod;
|
66
|
-
Object.assign(window, { postMessage: function () {
|
67
|
-
var args = [];
|
68
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
69
|
-
args[_i] = arguments[_i];
|
70
|
-
}
|
71
|
-
return _this.interceptor.apply(_this, __spreadArray([_this, nativeMethod], args, false));
|
72
|
-
} });
|
73
|
-
};
|
74
|
-
/**
|
75
|
-
* Unregister the interceptor from the window object
|
76
|
-
*/
|
77
|
-
PostMessageInterceptor.prototype.unregisterFetchInterceptor = function () {
|
78
|
-
Object.assign(window, { postMessage: this.nativeMethod });
|
79
|
-
};
|
80
|
-
/**
|
81
|
-
* Returns the singleton instance of the interceptor
|
82
|
-
*/
|
83
|
-
PostMessageInterceptor.getInstance = function () {
|
84
|
-
return this._instance || (this._instance = new this());
|
85
|
-
};
|
86
|
-
/**
|
87
|
-
* Initialize the interceptor
|
88
|
-
*/
|
89
|
-
PostMessageInterceptor.prototype.init = function () {
|
90
|
-
this.reset();
|
91
|
-
this.log('Init');
|
92
|
-
this.registerFetchInterceptor();
|
93
|
-
};
|
94
|
-
/**
|
95
|
-
* Stops the interceptor
|
96
|
-
*/
|
97
|
-
PostMessageInterceptor.prototype.stop = function () {
|
98
|
-
this.reset();
|
99
|
-
this.log('Stop');
|
100
|
-
this.unregisterFetchInterceptor();
|
101
|
-
};
|
102
|
-
/**
|
103
|
-
* Resets the stack of lastCalls
|
104
|
-
*/
|
105
|
-
PostMessageInterceptor.prototype.reset = function () {
|
106
|
-
this.lastCalls = [];
|
107
|
-
};
|
108
|
-
/**
|
109
|
-
* Starts listening and saving postMessages
|
110
|
-
* @param conditionFnString The function string to be used as condition checker
|
111
|
-
*/
|
112
|
-
PostMessageInterceptor.prototype.listen = function (conditionFnString) {
|
113
|
-
this.listening = false;
|
114
|
-
this.reset();
|
115
|
-
if (conditionFnString) {
|
116
|
-
// eslint-disable-next-line no-eval -- done on purpose
|
117
|
-
this.conditionFn = eval(conditionFnString);
|
118
|
-
}
|
119
|
-
this.listening = true;
|
120
|
-
};
|
121
|
-
/**
|
122
|
-
* Stops listening
|
123
|
-
* NOTE: It resets the interceptor and clears the conditionFn (if any)
|
124
|
-
*/
|
125
|
-
PostMessageInterceptor.prototype.stopListening = function () {
|
126
|
-
this.listening = false;
|
127
|
-
this.reset();
|
128
|
-
this.conditionFn = undefined;
|
129
|
-
this.listening = true;
|
130
|
-
};
|
131
|
-
/**
|
132
|
-
* Get the messages stack
|
133
|
-
* @param timeoutInterval the interval, in ms, between each check
|
134
|
-
* @param retries number of tentatives if fail
|
135
|
-
* @param callback
|
136
|
-
*/
|
137
|
-
PostMessageInterceptor.prototype.getMessages = function (timeoutInterval, retries, callback) {
|
138
|
-
var _this = this;
|
139
|
-
var activeMessageWatch = function (remainingRetries) {
|
140
|
-
if (remainingRetries === 0 || _this.lastCalls.length > 0) {
|
141
|
-
var copyCalls = _this.lastCalls.slice();
|
142
|
-
_this.reset();
|
143
|
-
callback(copyCalls);
|
144
|
-
return;
|
145
|
-
}
|
146
|
-
else if (remainingRetries > 0) {
|
147
|
-
remainingRetries--;
|
148
|
-
}
|
149
|
-
setTimeout(function () { return activeMessageWatch(remainingRetries); }, timeoutInterval);
|
150
|
-
};
|
151
|
-
activeMessageWatch(retries);
|
152
|
-
};
|
153
|
-
return PostMessageInterceptor;
|
154
|
-
}());
|
155
|
-
Object.assign(window, { postMessageInterceptor: postMessageInterceptor });
|
156
|
-
})();
|
157
|
-
//# sourceMappingURL=_post-message-interceptor.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"_post-message-interceptor.js","sourceRoot":"","sources":["../../../../src/tools/protractor/post-message-interceptor/_post-message-interceptor.ts"],"names":[],"mappings":";AAAA;;G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ated Will be removed in v13, please use Playwright instead
|
4
|
-
*/
|
5
|
-
export interface PostMessageCall {
|
6
|
-
/** Data passed in the message */
|
7
|
-
data: any;
|
8
|
-
/** Target origin passed in the message */
|
9
|
-
targetOrigin: string;
|
10
|
-
/** Timestamp of the message */
|
11
|
-
timestamp: Date;
|
12
|
-
}
|
13
|
-
/**
|
14
|
-
* @deprecated Will be removed in v13, please use Playwright instead
|
15
|
-
*/
|
16
|
-
export type ConditionFn = (postCall: PostMessageCall) => boolean;
|
17
|
-
//# sourceMappingURL=core.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../../src/tools/protractor/post-message-interceptor/core.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,iCAAiC;IACjC,IAAI,EAAE,GAAG,CAAC;IACV,0CAA0C;IAC1C,YAAY,EAAE,MAAM,CAAC;IACrB,+BAA+B;IAC/B,SAAS,EAAE,IAAI,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,QAAQ,EAAE,eAAe,KAAK,OAAO,CAAC"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"core.js","sourceRoot":"","sources":["../../../../src/tools/protractor/post-message-interceptor/core.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * A call to postMessage\n * @deprecated Will be removed in v13, please use Playwright instead\n */\nexport interface PostMessageCall {\n /** Data passed in the message */\n data: any;\n /** Target origin passed in the message */\n targetOrigin: string;\n /** Timestamp of the message */\n timestamp: Date;\n}\n\n/**\n * @deprecated Will be removed in v13, please use Playwright instead\n */\nexport type ConditionFn = (postCall: PostMessageCall) => boolean;\n"]}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/tools/protractor/post-message-interceptor/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,4BAA4B,CAAC"}
|
@@ -1,6 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
var tslib_1 = require("tslib");
|
4
|
-
tslib_1.__exportStar(require("./core"), exports);
|
5
|
-
tslib_1.__exportStar(require("./post-message-interceptor"), exports);
|
6
|
-
//# sourceMappingURL=index.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/tools/protractor/post-message-interceptor/index.ts"],"names":[],"mappings":";;;AAAA,iDAAuB;AACvB,qEAA2C","sourcesContent":["export * from './core';\nexport * from './post-message-interceptor';\n"]}
|
@@ -1,45 +0,0 @@
|
|
1
|
-
import { ConditionFn, PostMessageCall } from './core';
|
2
|
-
/**
|
3
|
-
* Controls the postMessage interceptor
|
4
|
-
* @deprecated Will be removed in v13, please use Playwright instead
|
5
|
-
*/
|
6
|
-
export declare class PostMessageInterceptor {
|
7
|
-
private readonly GET_INSTANCE;
|
8
|
-
/**
|
9
|
-
* Executes a script in the app
|
10
|
-
* @param methodName
|
11
|
-
* @param {...any} args
|
12
|
-
*/
|
13
|
-
private execInstanceMethod;
|
14
|
-
/**
|
15
|
-
* Executes an async script in the app
|
16
|
-
* @param methodName
|
17
|
-
* @param {...any} args
|
18
|
-
*/
|
19
|
-
private execInstanceAsyncMethod;
|
20
|
-
/**
|
21
|
-
* Initializes the PostMessageInterceptor in the app
|
22
|
-
* NOTE: It does not start listening right away. You need to call listen()
|
23
|
-
*/
|
24
|
-
initialize(): Promise<void>;
|
25
|
-
/**
|
26
|
-
* Stops the PostMessageInterceptor.
|
27
|
-
*/
|
28
|
-
stop(): Promise<void>;
|
29
|
-
/**
|
30
|
-
* Listens for post messages
|
31
|
-
* @param conditionFn an optional boolean function that will evaluate if the message should be saved or not in the stack
|
32
|
-
*/
|
33
|
-
listen(conditionFn?: ConditionFn): Promise<void>;
|
34
|
-
/**
|
35
|
-
* Stops listening for post messages, resets the stack and clears the condition
|
36
|
-
*/
|
37
|
-
stopListening(): Promise<void>;
|
38
|
-
/**
|
39
|
-
* Get all the post messages
|
40
|
-
* @param timeoutInterval Interval in milliseconds between two checks
|
41
|
-
* @param retries How many retries to be executed (-1 for infinite retries)
|
42
|
-
*/
|
43
|
-
getMessages(timeoutInterval?: number, retries?: number): Promise<PostMessageCall[]>;
|
44
|
-
}
|
45
|
-
//# sourceMappingURL=post-message-interceptor.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"post-message-interceptor.d.ts","sourceRoot":"","sources":["../../../../src/tools/protractor/post-message-interceptor/post-message-interceptor.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,WAAW,EACX,eAAe,EAChB,MAAM,QAAQ,CAAC;AAEhB;;;GAGG;AACH,qBAAa,sBAAsB;IACjC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAiD;IAE9E;;;;OAIG;YACW,kBAAkB;IAIhC;;;;OAIG;YACW,uBAAuB;IAIrC;;;OAGG;IACU,UAAU;IAWvB;;OAEG;IACU,IAAI;IAIjB;;;OAGG;IACU,MAAM,CAAC,WAAW,CAAC,EAAE,WAAW;IAI7C;;OAEG;IACU,aAAa;IAI1B;;;;OAIG;IACU,WAAW,CAAC,eAAe,SAAM,EAAE,OAAO,SAAK,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;CAG1F"}
|
@@ -1,144 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.PostMessageInterceptor = void 0;
|
4
|
-
var tslib_1 = require("tslib");
|
5
|
-
var fs = require("node:fs");
|
6
|
-
var path = require("node:path");
|
7
|
-
var protractor_1 = require("protractor");
|
8
|
-
/**
|
9
|
-
* Controls the postMessage interceptor
|
10
|
-
* @deprecated Will be removed in v13, please use Playwright instead
|
11
|
-
*/
|
12
|
-
var PostMessageInterceptor = /** @class */ (function () {
|
13
|
-
function PostMessageInterceptor() {
|
14
|
-
this.GET_INSTANCE = 'window.postMessageInterceptor.getInstance()';
|
15
|
-
}
|
16
|
-
/**
|
17
|
-
* Executes a script in the app
|
18
|
-
* @param methodName
|
19
|
-
* @param {...any} args
|
20
|
-
*/
|
21
|
-
PostMessageInterceptor.prototype.execInstanceMethod = function (methodName) {
|
22
|
-
var args = [];
|
23
|
-
for (var _i = 1; _i < arguments.length; _i++) {
|
24
|
-
args[_i - 1] = arguments[_i];
|
25
|
-
}
|
26
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
27
|
-
return tslib_1.__generator(this, function (_a) {
|
28
|
-
switch (_a.label) {
|
29
|
-
case 0: return [4 /*yield*/, protractor_1.browser.executeScript.apply(protractor_1.browser, tslib_1.__spreadArray(["".concat(this.GET_INSTANCE, ".").concat(methodName, "(...arguments);")], args, false))];
|
30
|
-
case 1: return [2 /*return*/, _a.sent()];
|
31
|
-
}
|
32
|
-
});
|
33
|
-
});
|
34
|
-
};
|
35
|
-
/**
|
36
|
-
* Executes an async script in the app
|
37
|
-
* @param methodName
|
38
|
-
* @param {...any} args
|
39
|
-
*/
|
40
|
-
PostMessageInterceptor.prototype.execInstanceAsyncMethod = function (methodName) {
|
41
|
-
var args = [];
|
42
|
-
for (var _i = 1; _i < arguments.length; _i++) {
|
43
|
-
args[_i - 1] = arguments[_i];
|
44
|
-
}
|
45
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
46
|
-
return tslib_1.__generator(this, function (_a) {
|
47
|
-
switch (_a.label) {
|
48
|
-
case 0: return [4 /*yield*/, protractor_1.browser.executeAsyncScript.apply(protractor_1.browser, tslib_1.__spreadArray(["".concat(this.GET_INSTANCE, ".").concat(methodName, "(...arguments);")], args, false))];
|
49
|
-
case 1: return [2 /*return*/, _a.sent()];
|
50
|
-
}
|
51
|
-
});
|
52
|
-
});
|
53
|
-
};
|
54
|
-
/**
|
55
|
-
* Initializes the PostMessageInterceptor in the app
|
56
|
-
* NOTE: It does not start listening right away. You need to call listen()
|
57
|
-
*/
|
58
|
-
PostMessageInterceptor.prototype.initialize = function () {
|
59
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
60
|
-
var fetchManager;
|
61
|
-
return tslib_1.__generator(this, function (_a) {
|
62
|
-
switch (_a.label) {
|
63
|
-
case 0:
|
64
|
-
fetchManager = fs.readFileSync(path.resolve(process.cwd(), 'node_modules', '@o3r', 'testing', 'tools', 'protractor', 'post-message-interceptor', '_post-message-interceptor.js'), {
|
65
|
-
encoding: 'utf8'
|
66
|
-
});
|
67
|
-
return [4 /*yield*/, protractor_1.browser.executeScript(fetchManager)];
|
68
|
-
case 1:
|
69
|
-
_a.sent();
|
70
|
-
return [4 /*yield*/, this.execInstanceMethod('init')];
|
71
|
-
case 2:
|
72
|
-
_a.sent();
|
73
|
-
return [2 /*return*/];
|
74
|
-
}
|
75
|
-
});
|
76
|
-
});
|
77
|
-
};
|
78
|
-
/**
|
79
|
-
* Stops the PostMessageInterceptor.
|
80
|
-
*/
|
81
|
-
PostMessageInterceptor.prototype.stop = function () {
|
82
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
83
|
-
return tslib_1.__generator(this, function (_a) {
|
84
|
-
switch (_a.label) {
|
85
|
-
case 0: return [4 /*yield*/, this.execInstanceMethod('stop')];
|
86
|
-
case 1:
|
87
|
-
_a.sent();
|
88
|
-
return [2 /*return*/];
|
89
|
-
}
|
90
|
-
});
|
91
|
-
});
|
92
|
-
};
|
93
|
-
/**
|
94
|
-
* Listens for post messages
|
95
|
-
* @param conditionFn an optional boolean function that will evaluate if the message should be saved or not in the stack
|
96
|
-
*/
|
97
|
-
PostMessageInterceptor.prototype.listen = function (conditionFn) {
|
98
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
99
|
-
return tslib_1.__generator(this, function (_a) {
|
100
|
-
switch (_a.label) {
|
101
|
-
case 0: return [4 /*yield*/, this.execInstanceMethod('listen', conditionFn)];
|
102
|
-
case 1:
|
103
|
-
_a.sent();
|
104
|
-
return [2 /*return*/];
|
105
|
-
}
|
106
|
-
});
|
107
|
-
});
|
108
|
-
};
|
109
|
-
/**
|
110
|
-
* Stops listening for post messages, resets the stack and clears the condition
|
111
|
-
*/
|
112
|
-
PostMessageInterceptor.prototype.stopListening = function () {
|
113
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
114
|
-
return tslib_1.__generator(this, function (_a) {
|
115
|
-
switch (_a.label) {
|
116
|
-
case 0: return [4 /*yield*/, this.execInstanceMethod('stopListening')];
|
117
|
-
case 1:
|
118
|
-
_a.sent();
|
119
|
-
return [2 /*return*/];
|
120
|
-
}
|
121
|
-
});
|
122
|
-
});
|
123
|
-
};
|
124
|
-
/**
|
125
|
-
* Get all the post messages
|
126
|
-
* @param timeoutInterval Interval in milliseconds between two checks
|
127
|
-
* @param retries How many retries to be executed (-1 for infinite retries)
|
128
|
-
*/
|
129
|
-
PostMessageInterceptor.prototype.getMessages = function () {
|
130
|
-
return tslib_1.__awaiter(this, arguments, void 0, function (timeoutInterval, retries) {
|
131
|
-
if (timeoutInterval === void 0) { timeoutInterval = 100; }
|
132
|
-
if (retries === void 0) { retries = -1; }
|
133
|
-
return tslib_1.__generator(this, function (_a) {
|
134
|
-
switch (_a.label) {
|
135
|
-
case 0: return [4 /*yield*/, this.execInstanceAsyncMethod('getMessages', timeoutInterval, retries)];
|
136
|
-
case 1: return [2 /*return*/, (_a.sent())];
|
137
|
-
}
|
138
|
-
});
|
139
|
-
});
|
140
|
-
};
|
141
|
-
return PostMessageInterceptor;
|
142
|
-
}());
|
143
|
-
exports.PostMessageInterceptor = PostMessageInterceptor;
|
144
|
-
//# sourceMappingURL=post-message-interceptor.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"post-message-interceptor.js","sourceRoot":"","sources":["../../../../src/tools/protractor/post-message-interceptor/post-message-interceptor.ts"],"names":[],"mappings":";;;;AAAA,4BAA8B;AAC9B,gCAAkC;AAClC,yCAEoB;AAMpB;;;GAGG;AACH;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C3C,qBAAM,IAAI,CAAC,kBAAkB,CAAC,QAAQ,EAAE,WAAW,CAAC,EAAA;;wBAApD,SAAoD,CAAC;;;;;KACtD;IAED;;OAEG;IACU,8CAAa,GAA1B;;;;4BACE,qBAAM,IAAI,CAAC,kBAAkB,CAAC,eAAe,CAAC,EAAA;;wBAA9C,SAA8C,CAAC;;;;;KAChD;IAED;;;;OAIG;IACU,4CAAW,GAAxB;oEAAyB,eAAqB,EAAE,OAAY;YAAnC,gCAAA,EAAA,qBAAqB;YAAE,wBAAA,EAAA,WAAW,CAAC;;;4BAClD,qBAAM,IAAI,CAAC,uBAAuB,CAAC,aAAa,EAAE,eAAe,EAAE,OAAO,CAAC,EAAA;4BAAnF,sBAAO,CAAC,SAA2E,CAAsB,EAAC;;;;KAC3G;IACH,6BAAC;AAAD,CAAC,AAlED,IAkEC;AAlEY,wDAAsB","sourcesContent":["import * as fs from 'node:fs';\nimport * as path from 'node:path';\nimport {\n browser,\n} from 'protractor';\nimport {\n ConditionFn,\n PostMessageCall,\n} from './core';\n\n/**\n * Controls the postMessage interceptor\n * @deprecated Will be removed in v13, please use Playwright instead\n */\nexport class PostMessageInterceptor {\n private readonly GET_INSTANCE = 'window.postMessageInterceptor.getInstance()';\n\n /**\n * Executes a script in the app\n * @param methodName\n * @param {...any} args\n */\n private async execInstanceMethod(methodName: string, ...args: any[]) {\n return await browser.executeScript(`${this.GET_INSTANCE}.${methodName}(...arguments);`, ...args);\n }\n\n /**\n * Executes an async script in the app\n * @param methodName\n * @param {...any} args\n */\n private async execInstanceAsyncMethod(methodName: string, ...args: any[]) {\n return await browser.executeAsyncScript(`${this.GET_INSTANCE}.${methodName}(...arguments);`, ...args);\n }\n\n /**\n * Initializes the PostMessageInterceptor in the app\n * NOTE: It does not start listening right away. You need to call listen()\n */\n public async initialize() {\n const fetchManager = fs.readFileSync(\n path.resolve(process.cwd(), 'node_modules', '@o3r', 'testing', 'tools', 'protractor', 'post-message-interceptor', '_post-message-interceptor.js'),\n {\n encoding: 'utf8'\n }\n );\n await browser.executeScript(fetchManager);\n await this.execInstanceMethod('init');\n }\n\n /**\n * Stops the PostMessageInterceptor.\n */\n public async stop() {\n await this.execInstanceMethod('stop');\n }\n\n /**\n * Listens for post messages\n * @param conditionFn an optional boolean function that will evaluate if the message should be saved or not in the stack\n */\n public async listen(conditionFn?: ConditionFn) {\n await this.execInstanceMethod('listen', conditionFn);\n }\n\n /**\n * Stops listening for post messages, resets the stack and clears the condition\n */\n public async stopListening() {\n await this.execInstanceMethod('stopListening');\n }\n\n /**\n * Get all the post messages\n * @param timeoutInterval Interval in milliseconds between two checks\n * @param retries How many retries to be executed (-1 for infinite retries)\n */\n public async getMessages(timeoutInterval = 100, retries = -1): Promise<PostMessageCall[]> {\n return (await this.execInstanceAsyncMethod('getMessages', timeoutInterval, retries)) as PostMessageCall[];\n }\n}\n"]}
|