@telefonica/acceptance-testing 2.16.0 → 2.18.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 +30 -1
- package/dist/acceptance-testing.cjs.development.js +765 -1305
- package/dist/acceptance-testing.cjs.development.js.map +1 -1
- package/dist/acceptance-testing.cjs.production.min.js +1 -1
- package/dist/acceptance-testing.cjs.production.min.js.map +1 -1
- package/dist/acceptance-testing.esm.js +765 -1306
- package/dist/acceptance-testing.esm.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/jest-puppeteer-config.js +10 -6
- package/package.json +1 -1
|
@@ -11,6 +11,307 @@ var pptrTestingLibrary = require('pptr-testing-library');
|
|
|
11
11
|
var jestImageSnapshot = require('jest-image-snapshot');
|
|
12
12
|
var globToRegExp = _interopDefault(require('glob-to-regexp'));
|
|
13
13
|
|
|
14
|
+
function _regeneratorRuntime() {
|
|
15
|
+
_regeneratorRuntime = function () {
|
|
16
|
+
return exports;
|
|
17
|
+
};
|
|
18
|
+
var exports = {},
|
|
19
|
+
Op = Object.prototype,
|
|
20
|
+
hasOwn = Op.hasOwnProperty,
|
|
21
|
+
defineProperty = Object.defineProperty || function (obj, key, desc) {
|
|
22
|
+
obj[key] = desc.value;
|
|
23
|
+
},
|
|
24
|
+
$Symbol = "function" == typeof Symbol ? Symbol : {},
|
|
25
|
+
iteratorSymbol = $Symbol.iterator || "@@iterator",
|
|
26
|
+
asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
|
|
27
|
+
toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
|
28
|
+
function define(obj, key, value) {
|
|
29
|
+
return Object.defineProperty(obj, key, {
|
|
30
|
+
value: value,
|
|
31
|
+
enumerable: !0,
|
|
32
|
+
configurable: !0,
|
|
33
|
+
writable: !0
|
|
34
|
+
}), obj[key];
|
|
35
|
+
}
|
|
36
|
+
try {
|
|
37
|
+
define({}, "");
|
|
38
|
+
} catch (err) {
|
|
39
|
+
define = function (obj, key, value) {
|
|
40
|
+
return obj[key] = value;
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
function wrap(innerFn, outerFn, self, tryLocsList) {
|
|
44
|
+
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
|
|
45
|
+
generator = Object.create(protoGenerator.prototype),
|
|
46
|
+
context = new Context(tryLocsList || []);
|
|
47
|
+
return defineProperty(generator, "_invoke", {
|
|
48
|
+
value: makeInvokeMethod(innerFn, self, context)
|
|
49
|
+
}), generator;
|
|
50
|
+
}
|
|
51
|
+
function tryCatch(fn, obj, arg) {
|
|
52
|
+
try {
|
|
53
|
+
return {
|
|
54
|
+
type: "normal",
|
|
55
|
+
arg: fn.call(obj, arg)
|
|
56
|
+
};
|
|
57
|
+
} catch (err) {
|
|
58
|
+
return {
|
|
59
|
+
type: "throw",
|
|
60
|
+
arg: err
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
exports.wrap = wrap;
|
|
65
|
+
var ContinueSentinel = {};
|
|
66
|
+
function Generator() {}
|
|
67
|
+
function GeneratorFunction() {}
|
|
68
|
+
function GeneratorFunctionPrototype() {}
|
|
69
|
+
var IteratorPrototype = {};
|
|
70
|
+
define(IteratorPrototype, iteratorSymbol, function () {
|
|
71
|
+
return this;
|
|
72
|
+
});
|
|
73
|
+
var getProto = Object.getPrototypeOf,
|
|
74
|
+
NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
|
75
|
+
NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
|
|
76
|
+
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
|
|
77
|
+
function defineIteratorMethods(prototype) {
|
|
78
|
+
["next", "throw", "return"].forEach(function (method) {
|
|
79
|
+
define(prototype, method, function (arg) {
|
|
80
|
+
return this._invoke(method, arg);
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
function AsyncIterator(generator, PromiseImpl) {
|
|
85
|
+
function invoke(method, arg, resolve, reject) {
|
|
86
|
+
var record = tryCatch(generator[method], generator, arg);
|
|
87
|
+
if ("throw" !== record.type) {
|
|
88
|
+
var result = record.arg,
|
|
89
|
+
value = result.value;
|
|
90
|
+
return value && "object" == typeof value && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
|
|
91
|
+
invoke("next", value, resolve, reject);
|
|
92
|
+
}, function (err) {
|
|
93
|
+
invoke("throw", err, resolve, reject);
|
|
94
|
+
}) : PromiseImpl.resolve(value).then(function (unwrapped) {
|
|
95
|
+
result.value = unwrapped, resolve(result);
|
|
96
|
+
}, function (error) {
|
|
97
|
+
return invoke("throw", error, resolve, reject);
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
reject(record.arg);
|
|
101
|
+
}
|
|
102
|
+
var previousPromise;
|
|
103
|
+
defineProperty(this, "_invoke", {
|
|
104
|
+
value: function (method, arg) {
|
|
105
|
+
function callInvokeWithMethodAndArg() {
|
|
106
|
+
return new PromiseImpl(function (resolve, reject) {
|
|
107
|
+
invoke(method, arg, resolve, reject);
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
function makeInvokeMethod(innerFn, self, context) {
|
|
115
|
+
var state = "suspendedStart";
|
|
116
|
+
return function (method, arg) {
|
|
117
|
+
if ("executing" === state) throw new Error("Generator is already running");
|
|
118
|
+
if ("completed" === state) {
|
|
119
|
+
if ("throw" === method) throw arg;
|
|
120
|
+
return doneResult();
|
|
121
|
+
}
|
|
122
|
+
for (context.method = method, context.arg = arg;;) {
|
|
123
|
+
var delegate = context.delegate;
|
|
124
|
+
if (delegate) {
|
|
125
|
+
var delegateResult = maybeInvokeDelegate(delegate, context);
|
|
126
|
+
if (delegateResult) {
|
|
127
|
+
if (delegateResult === ContinueSentinel) continue;
|
|
128
|
+
return delegateResult;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
|
|
132
|
+
if ("suspendedStart" === state) throw state = "completed", context.arg;
|
|
133
|
+
context.dispatchException(context.arg);
|
|
134
|
+
} else "return" === context.method && context.abrupt("return", context.arg);
|
|
135
|
+
state = "executing";
|
|
136
|
+
var record = tryCatch(innerFn, self, context);
|
|
137
|
+
if ("normal" === record.type) {
|
|
138
|
+
if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
|
|
139
|
+
return {
|
|
140
|
+
value: record.arg,
|
|
141
|
+
done: context.done
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
"throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
function maybeInvokeDelegate(delegate, context) {
|
|
149
|
+
var methodName = context.method,
|
|
150
|
+
method = delegate.iterator[methodName];
|
|
151
|
+
if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel;
|
|
152
|
+
var record = tryCatch(method, delegate.iterator, context.arg);
|
|
153
|
+
if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
|
|
154
|
+
var info = record.arg;
|
|
155
|
+
return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
|
|
156
|
+
}
|
|
157
|
+
function pushTryEntry(locs) {
|
|
158
|
+
var entry = {
|
|
159
|
+
tryLoc: locs[0]
|
|
160
|
+
};
|
|
161
|
+
1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
|
|
162
|
+
}
|
|
163
|
+
function resetTryEntry(entry) {
|
|
164
|
+
var record = entry.completion || {};
|
|
165
|
+
record.type = "normal", delete record.arg, entry.completion = record;
|
|
166
|
+
}
|
|
167
|
+
function Context(tryLocsList) {
|
|
168
|
+
this.tryEntries = [{
|
|
169
|
+
tryLoc: "root"
|
|
170
|
+
}], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
|
|
171
|
+
}
|
|
172
|
+
function values(iterable) {
|
|
173
|
+
if (iterable) {
|
|
174
|
+
var iteratorMethod = iterable[iteratorSymbol];
|
|
175
|
+
if (iteratorMethod) return iteratorMethod.call(iterable);
|
|
176
|
+
if ("function" == typeof iterable.next) return iterable;
|
|
177
|
+
if (!isNaN(iterable.length)) {
|
|
178
|
+
var i = -1,
|
|
179
|
+
next = function next() {
|
|
180
|
+
for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
|
|
181
|
+
return next.value = undefined, next.done = !0, next;
|
|
182
|
+
};
|
|
183
|
+
return next.next = next;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
return {
|
|
187
|
+
next: doneResult
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
function doneResult() {
|
|
191
|
+
return {
|
|
192
|
+
value: undefined,
|
|
193
|
+
done: !0
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", {
|
|
197
|
+
value: GeneratorFunctionPrototype,
|
|
198
|
+
configurable: !0
|
|
199
|
+
}), defineProperty(GeneratorFunctionPrototype, "constructor", {
|
|
200
|
+
value: GeneratorFunction,
|
|
201
|
+
configurable: !0
|
|
202
|
+
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
|
|
203
|
+
var ctor = "function" == typeof genFun && genFun.constructor;
|
|
204
|
+
return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
|
|
205
|
+
}, exports.mark = function (genFun) {
|
|
206
|
+
return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
|
|
207
|
+
}, exports.awrap = function (arg) {
|
|
208
|
+
return {
|
|
209
|
+
__await: arg
|
|
210
|
+
};
|
|
211
|
+
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
|
|
212
|
+
return this;
|
|
213
|
+
}), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
|
|
214
|
+
void 0 === PromiseImpl && (PromiseImpl = Promise);
|
|
215
|
+
var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
|
|
216
|
+
return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
|
|
217
|
+
return result.done ? result.value : iter.next();
|
|
218
|
+
});
|
|
219
|
+
}, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
|
|
220
|
+
return this;
|
|
221
|
+
}), define(Gp, "toString", function () {
|
|
222
|
+
return "[object Generator]";
|
|
223
|
+
}), exports.keys = function (val) {
|
|
224
|
+
var object = Object(val),
|
|
225
|
+
keys = [];
|
|
226
|
+
for (var key in object) keys.push(key);
|
|
227
|
+
return keys.reverse(), function next() {
|
|
228
|
+
for (; keys.length;) {
|
|
229
|
+
var key = keys.pop();
|
|
230
|
+
if (key in object) return next.value = key, next.done = !1, next;
|
|
231
|
+
}
|
|
232
|
+
return next.done = !0, next;
|
|
233
|
+
};
|
|
234
|
+
}, exports.values = values, Context.prototype = {
|
|
235
|
+
constructor: Context,
|
|
236
|
+
reset: function (skipTempReset) {
|
|
237
|
+
if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
|
|
238
|
+
},
|
|
239
|
+
stop: function () {
|
|
240
|
+
this.done = !0;
|
|
241
|
+
var rootRecord = this.tryEntries[0].completion;
|
|
242
|
+
if ("throw" === rootRecord.type) throw rootRecord.arg;
|
|
243
|
+
return this.rval;
|
|
244
|
+
},
|
|
245
|
+
dispatchException: function (exception) {
|
|
246
|
+
if (this.done) throw exception;
|
|
247
|
+
var context = this;
|
|
248
|
+
function handle(loc, caught) {
|
|
249
|
+
return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
|
|
250
|
+
}
|
|
251
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
252
|
+
var entry = this.tryEntries[i],
|
|
253
|
+
record = entry.completion;
|
|
254
|
+
if ("root" === entry.tryLoc) return handle("end");
|
|
255
|
+
if (entry.tryLoc <= this.prev) {
|
|
256
|
+
var hasCatch = hasOwn.call(entry, "catchLoc"),
|
|
257
|
+
hasFinally = hasOwn.call(entry, "finallyLoc");
|
|
258
|
+
if (hasCatch && hasFinally) {
|
|
259
|
+
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
260
|
+
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
261
|
+
} else if (hasCatch) {
|
|
262
|
+
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
263
|
+
} else {
|
|
264
|
+
if (!hasFinally) throw new Error("try statement without catch or finally");
|
|
265
|
+
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
},
|
|
270
|
+
abrupt: function (type, arg) {
|
|
271
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
272
|
+
var entry = this.tryEntries[i];
|
|
273
|
+
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
|
|
274
|
+
var finallyEntry = entry;
|
|
275
|
+
break;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
|
|
279
|
+
var record = finallyEntry ? finallyEntry.completion : {};
|
|
280
|
+
return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
|
|
281
|
+
},
|
|
282
|
+
complete: function (record, afterLoc) {
|
|
283
|
+
if ("throw" === record.type) throw record.arg;
|
|
284
|
+
return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
|
|
285
|
+
},
|
|
286
|
+
finish: function (finallyLoc) {
|
|
287
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
288
|
+
var entry = this.tryEntries[i];
|
|
289
|
+
if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
|
|
290
|
+
}
|
|
291
|
+
},
|
|
292
|
+
catch: function (tryLoc) {
|
|
293
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
294
|
+
var entry = this.tryEntries[i];
|
|
295
|
+
if (entry.tryLoc === tryLoc) {
|
|
296
|
+
var record = entry.completion;
|
|
297
|
+
if ("throw" === record.type) {
|
|
298
|
+
var thrown = record.arg;
|
|
299
|
+
resetTryEntry(entry);
|
|
300
|
+
}
|
|
301
|
+
return thrown;
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
throw new Error("illegal catch attempt");
|
|
305
|
+
},
|
|
306
|
+
delegateYield: function (iterable, resultName, nextLoc) {
|
|
307
|
+
return this.delegate = {
|
|
308
|
+
iterator: values(iterable),
|
|
309
|
+
resultName: resultName,
|
|
310
|
+
nextLoc: nextLoc
|
|
311
|
+
}, "next" === this.method && (this.arg = undefined), ContinueSentinel;
|
|
312
|
+
}
|
|
313
|
+
}, exports;
|
|
314
|
+
}
|
|
14
315
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
15
316
|
try {
|
|
16
317
|
var info = gen[key](arg);
|
|
@@ -19,803 +320,59 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
|
19
320
|
reject(error);
|
|
20
321
|
return;
|
|
21
322
|
}
|
|
22
|
-
|
|
23
323
|
if (info.done) {
|
|
24
324
|
resolve(value);
|
|
25
325
|
} else {
|
|
26
326
|
Promise.resolve(value).then(_next, _throw);
|
|
27
327
|
}
|
|
28
328
|
}
|
|
29
|
-
|
|
30
329
|
function _asyncToGenerator(fn) {
|
|
31
330
|
return function () {
|
|
32
331
|
var self = this,
|
|
33
|
-
|
|
332
|
+
args = arguments;
|
|
34
333
|
return new Promise(function (resolve, reject) {
|
|
35
334
|
var gen = fn.apply(self, args);
|
|
36
|
-
|
|
37
335
|
function _next(value) {
|
|
38
336
|
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
39
337
|
}
|
|
40
|
-
|
|
41
338
|
function _throw(err) {
|
|
42
339
|
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
43
340
|
}
|
|
44
|
-
|
|
45
341
|
_next(undefined);
|
|
46
342
|
});
|
|
47
343
|
};
|
|
48
344
|
}
|
|
49
|
-
|
|
50
345
|
function _extends() {
|
|
51
|
-
_extends = Object.assign
|
|
346
|
+
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
52
347
|
for (var i = 1; i < arguments.length; i++) {
|
|
53
348
|
var source = arguments[i];
|
|
54
|
-
|
|
55
349
|
for (var key in source) {
|
|
56
350
|
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
57
351
|
target[key] = source[key];
|
|
58
352
|
}
|
|
59
353
|
}
|
|
60
354
|
}
|
|
61
|
-
|
|
62
355
|
return target;
|
|
63
356
|
};
|
|
64
|
-
|
|
65
357
|
return _extends.apply(this, arguments);
|
|
66
358
|
}
|
|
67
|
-
|
|
68
359
|
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
69
360
|
if (source == null) return {};
|
|
70
361
|
var target = {};
|
|
71
362
|
var sourceKeys = Object.keys(source);
|
|
72
363
|
var key, i;
|
|
73
|
-
|
|
74
364
|
for (i = 0; i < sourceKeys.length; i++) {
|
|
75
365
|
key = sourceKeys[i];
|
|
76
366
|
if (excluded.indexOf(key) >= 0) continue;
|
|
77
367
|
target[key] = source[key];
|
|
78
368
|
}
|
|
79
|
-
|
|
80
369
|
return target;
|
|
81
370
|
}
|
|
82
371
|
|
|
83
|
-
function createCommonjsModule(fn, module) {
|
|
84
|
-
return module = { exports: {} }, fn(module, module.exports), module.exports;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
88
|
-
/**
|
|
89
|
-
* Copyright (c) 2014-present, Facebook, Inc.
|
|
90
|
-
*
|
|
91
|
-
* This source code is licensed under the MIT license found in the
|
|
92
|
-
* LICENSE file in the root directory of this source tree.
|
|
93
|
-
*/
|
|
94
|
-
var runtime = function (exports) {
|
|
95
|
-
|
|
96
|
-
var Op = Object.prototype;
|
|
97
|
-
var hasOwn = Op.hasOwnProperty;
|
|
98
|
-
var undefined$1; // More compressible than void 0.
|
|
99
|
-
|
|
100
|
-
var $Symbol = typeof Symbol === "function" ? Symbol : {};
|
|
101
|
-
var iteratorSymbol = $Symbol.iterator || "@@iterator";
|
|
102
|
-
var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
|
|
103
|
-
var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
|
104
|
-
|
|
105
|
-
function define(obj, key, value) {
|
|
106
|
-
Object.defineProperty(obj, key, {
|
|
107
|
-
value: value,
|
|
108
|
-
enumerable: true,
|
|
109
|
-
configurable: true,
|
|
110
|
-
writable: true
|
|
111
|
-
});
|
|
112
|
-
return obj[key];
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
try {
|
|
116
|
-
// IE 8 has a broken Object.defineProperty that only works on DOM objects.
|
|
117
|
-
define({}, "");
|
|
118
|
-
} catch (err) {
|
|
119
|
-
define = function define(obj, key, value) {
|
|
120
|
-
return obj[key] = value;
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
function wrap(innerFn, outerFn, self, tryLocsList) {
|
|
125
|
-
// If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
|
|
126
|
-
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
|
|
127
|
-
var generator = Object.create(protoGenerator.prototype);
|
|
128
|
-
var context = new Context(tryLocsList || []); // The ._invoke method unifies the implementations of the .next,
|
|
129
|
-
// .throw, and .return methods.
|
|
130
|
-
|
|
131
|
-
generator._invoke = makeInvokeMethod(innerFn, self, context);
|
|
132
|
-
return generator;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
exports.wrap = wrap; // Try/catch helper to minimize deoptimizations. Returns a completion
|
|
136
|
-
// record like context.tryEntries[i].completion. This interface could
|
|
137
|
-
// have been (and was previously) designed to take a closure to be
|
|
138
|
-
// invoked without arguments, but in all the cases we care about we
|
|
139
|
-
// already have an existing method we want to call, so there's no need
|
|
140
|
-
// to create a new function object. We can even get away with assuming
|
|
141
|
-
// the method takes exactly one argument, since that happens to be true
|
|
142
|
-
// in every case, so we don't have to touch the arguments object. The
|
|
143
|
-
// only additional allocation required is the completion record, which
|
|
144
|
-
// has a stable shape and so hopefully should be cheap to allocate.
|
|
145
|
-
|
|
146
|
-
function tryCatch(fn, obj, arg) {
|
|
147
|
-
try {
|
|
148
|
-
return {
|
|
149
|
-
type: "normal",
|
|
150
|
-
arg: fn.call(obj, arg)
|
|
151
|
-
};
|
|
152
|
-
} catch (err) {
|
|
153
|
-
return {
|
|
154
|
-
type: "throw",
|
|
155
|
-
arg: err
|
|
156
|
-
};
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
var GenStateSuspendedStart = "suspendedStart";
|
|
161
|
-
var GenStateSuspendedYield = "suspendedYield";
|
|
162
|
-
var GenStateExecuting = "executing";
|
|
163
|
-
var GenStateCompleted = "completed"; // Returning this object from the innerFn has the same effect as
|
|
164
|
-
// breaking out of the dispatch switch statement.
|
|
165
|
-
|
|
166
|
-
var ContinueSentinel = {}; // Dummy constructor functions that we use as the .constructor and
|
|
167
|
-
// .constructor.prototype properties for functions that return Generator
|
|
168
|
-
// objects. For full spec compliance, you may wish to configure your
|
|
169
|
-
// minifier not to mangle the names of these two functions.
|
|
170
|
-
|
|
171
|
-
function Generator() {}
|
|
172
|
-
|
|
173
|
-
function GeneratorFunction() {}
|
|
174
|
-
|
|
175
|
-
function GeneratorFunctionPrototype() {} // This is a polyfill for %IteratorPrototype% for environments that
|
|
176
|
-
// don't natively support it.
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
var IteratorPrototype = {};
|
|
180
|
-
define(IteratorPrototype, iteratorSymbol, function () {
|
|
181
|
-
return this;
|
|
182
|
-
});
|
|
183
|
-
var getProto = Object.getPrototypeOf;
|
|
184
|
-
var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
|
185
|
-
|
|
186
|
-
if (NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
|
|
187
|
-
// This environment has a native %IteratorPrototype%; use it instead
|
|
188
|
-
// of the polyfill.
|
|
189
|
-
IteratorPrototype = NativeIteratorPrototype;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
|
|
193
|
-
GeneratorFunction.prototype = GeneratorFunctionPrototype;
|
|
194
|
-
define(Gp, "constructor", GeneratorFunctionPrototype);
|
|
195
|
-
define(GeneratorFunctionPrototype, "constructor", GeneratorFunction);
|
|
196
|
-
GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"); // Helper for defining the .next, .throw, and .return methods of the
|
|
197
|
-
// Iterator interface in terms of a single ._invoke method.
|
|
198
|
-
|
|
199
|
-
function defineIteratorMethods(prototype) {
|
|
200
|
-
["next", "throw", "return"].forEach(function (method) {
|
|
201
|
-
define(prototype, method, function (arg) {
|
|
202
|
-
return this._invoke(method, arg);
|
|
203
|
-
});
|
|
204
|
-
});
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
exports.isGeneratorFunction = function (genFun) {
|
|
208
|
-
var ctor = typeof genFun === "function" && genFun.constructor;
|
|
209
|
-
return ctor ? ctor === GeneratorFunction || // For the native GeneratorFunction constructor, the best we can
|
|
210
|
-
// do is to check its .name property.
|
|
211
|
-
(ctor.displayName || ctor.name) === "GeneratorFunction" : false;
|
|
212
|
-
};
|
|
213
|
-
|
|
214
|
-
exports.mark = function (genFun) {
|
|
215
|
-
if (Object.setPrototypeOf) {
|
|
216
|
-
Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
|
|
217
|
-
} else {
|
|
218
|
-
genFun.__proto__ = GeneratorFunctionPrototype;
|
|
219
|
-
define(genFun, toStringTagSymbol, "GeneratorFunction");
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
genFun.prototype = Object.create(Gp);
|
|
223
|
-
return genFun;
|
|
224
|
-
}; // Within the body of any async function, `await x` is transformed to
|
|
225
|
-
// `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
|
|
226
|
-
// `hasOwn.call(value, "__await")` to determine if the yielded value is
|
|
227
|
-
// meant to be awaited.
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
exports.awrap = function (arg) {
|
|
231
|
-
return {
|
|
232
|
-
__await: arg
|
|
233
|
-
};
|
|
234
|
-
};
|
|
235
|
-
|
|
236
|
-
function AsyncIterator(generator, PromiseImpl) {
|
|
237
|
-
function invoke(method, arg, resolve, reject) {
|
|
238
|
-
var record = tryCatch(generator[method], generator, arg);
|
|
239
|
-
|
|
240
|
-
if (record.type === "throw") {
|
|
241
|
-
reject(record.arg);
|
|
242
|
-
} else {
|
|
243
|
-
var result = record.arg;
|
|
244
|
-
var value = result.value;
|
|
245
|
-
|
|
246
|
-
if (value && typeof value === "object" && hasOwn.call(value, "__await")) {
|
|
247
|
-
return PromiseImpl.resolve(value.__await).then(function (value) {
|
|
248
|
-
invoke("next", value, resolve, reject);
|
|
249
|
-
}, function (err) {
|
|
250
|
-
invoke("throw", err, resolve, reject);
|
|
251
|
-
});
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
return PromiseImpl.resolve(value).then(function (unwrapped) {
|
|
255
|
-
// When a yielded Promise is resolved, its final value becomes
|
|
256
|
-
// the .value of the Promise<{value,done}> result for the
|
|
257
|
-
// current iteration.
|
|
258
|
-
result.value = unwrapped;
|
|
259
|
-
resolve(result);
|
|
260
|
-
}, function (error) {
|
|
261
|
-
// If a rejected Promise was yielded, throw the rejection back
|
|
262
|
-
// into the async generator function so it can be handled there.
|
|
263
|
-
return invoke("throw", error, resolve, reject);
|
|
264
|
-
});
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
var previousPromise;
|
|
269
|
-
|
|
270
|
-
function enqueue(method, arg) {
|
|
271
|
-
function callInvokeWithMethodAndArg() {
|
|
272
|
-
return new PromiseImpl(function (resolve, reject) {
|
|
273
|
-
invoke(method, arg, resolve, reject);
|
|
274
|
-
});
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
return previousPromise = // If enqueue has been called before, then we want to wait until
|
|
278
|
-
// all previous Promises have been resolved before calling invoke,
|
|
279
|
-
// so that results are always delivered in the correct order. If
|
|
280
|
-
// enqueue has not been called before, then it is important to
|
|
281
|
-
// call invoke immediately, without waiting on a callback to fire,
|
|
282
|
-
// so that the async generator function has the opportunity to do
|
|
283
|
-
// any necessary setup in a predictable way. This predictability
|
|
284
|
-
// is why the Promise constructor synchronously invokes its
|
|
285
|
-
// executor callback, and why async functions synchronously
|
|
286
|
-
// execute code before the first await. Since we implement simple
|
|
287
|
-
// async functions in terms of async generators, it is especially
|
|
288
|
-
// important to get this right, even though it requires care.
|
|
289
|
-
previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, // Avoid propagating failures to Promises returned by later
|
|
290
|
-
// invocations of the iterator.
|
|
291
|
-
callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
292
|
-
} // Define the unified helper method that is used to implement .next,
|
|
293
|
-
// .throw, and .return (see defineIteratorMethods).
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
this._invoke = enqueue;
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
defineIteratorMethods(AsyncIterator.prototype);
|
|
300
|
-
define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
|
|
301
|
-
return this;
|
|
302
|
-
});
|
|
303
|
-
exports.AsyncIterator = AsyncIterator; // Note that simple async functions are implemented on top of
|
|
304
|
-
// AsyncIterator objects; they just return a Promise for the value of
|
|
305
|
-
// the final result produced by the iterator.
|
|
306
|
-
|
|
307
|
-
exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
|
|
308
|
-
if (PromiseImpl === void 0) PromiseImpl = Promise;
|
|
309
|
-
var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
|
|
310
|
-
return exports.isGeneratorFunction(outerFn) ? iter // If outerFn is a generator, return the full iterator.
|
|
311
|
-
: iter.next().then(function (result) {
|
|
312
|
-
return result.done ? result.value : iter.next();
|
|
313
|
-
});
|
|
314
|
-
};
|
|
315
|
-
|
|
316
|
-
function makeInvokeMethod(innerFn, self, context) {
|
|
317
|
-
var state = GenStateSuspendedStart;
|
|
318
|
-
return function invoke(method, arg) {
|
|
319
|
-
if (state === GenStateExecuting) {
|
|
320
|
-
throw new Error("Generator is already running");
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
if (state === GenStateCompleted) {
|
|
324
|
-
if (method === "throw") {
|
|
325
|
-
throw arg;
|
|
326
|
-
} // Be forgiving, per 25.3.3.3.3 of the spec:
|
|
327
|
-
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
return doneResult();
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
context.method = method;
|
|
334
|
-
context.arg = arg;
|
|
335
|
-
|
|
336
|
-
while (true) {
|
|
337
|
-
var delegate = context.delegate;
|
|
338
|
-
|
|
339
|
-
if (delegate) {
|
|
340
|
-
var delegateResult = maybeInvokeDelegate(delegate, context);
|
|
341
|
-
|
|
342
|
-
if (delegateResult) {
|
|
343
|
-
if (delegateResult === ContinueSentinel) continue;
|
|
344
|
-
return delegateResult;
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
if (context.method === "next") {
|
|
349
|
-
// Setting context._sent for legacy support of Babel's
|
|
350
|
-
// function.sent implementation.
|
|
351
|
-
context.sent = context._sent = context.arg;
|
|
352
|
-
} else if (context.method === "throw") {
|
|
353
|
-
if (state === GenStateSuspendedStart) {
|
|
354
|
-
state = GenStateCompleted;
|
|
355
|
-
throw context.arg;
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
context.dispatchException(context.arg);
|
|
359
|
-
} else if (context.method === "return") {
|
|
360
|
-
context.abrupt("return", context.arg);
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
state = GenStateExecuting;
|
|
364
|
-
var record = tryCatch(innerFn, self, context);
|
|
365
|
-
|
|
366
|
-
if (record.type === "normal") {
|
|
367
|
-
// If an exception is thrown from innerFn, we leave state ===
|
|
368
|
-
// GenStateExecuting and loop back for another invocation.
|
|
369
|
-
state = context.done ? GenStateCompleted : GenStateSuspendedYield;
|
|
370
|
-
|
|
371
|
-
if (record.arg === ContinueSentinel) {
|
|
372
|
-
continue;
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
return {
|
|
376
|
-
value: record.arg,
|
|
377
|
-
done: context.done
|
|
378
|
-
};
|
|
379
|
-
} else if (record.type === "throw") {
|
|
380
|
-
state = GenStateCompleted; // Dispatch the exception by looping back around to the
|
|
381
|
-
// context.dispatchException(context.arg) call above.
|
|
382
|
-
|
|
383
|
-
context.method = "throw";
|
|
384
|
-
context.arg = record.arg;
|
|
385
|
-
}
|
|
386
|
-
}
|
|
387
|
-
};
|
|
388
|
-
} // Call delegate.iterator[context.method](context.arg) and handle the
|
|
389
|
-
// result, either by returning a { value, done } result from the
|
|
390
|
-
// delegate iterator, or by modifying context.method and context.arg,
|
|
391
|
-
// setting context.delegate to null, and returning the ContinueSentinel.
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
function maybeInvokeDelegate(delegate, context) {
|
|
395
|
-
var method = delegate.iterator[context.method];
|
|
396
|
-
|
|
397
|
-
if (method === undefined$1) {
|
|
398
|
-
// A .throw or .return when the delegate iterator has no .throw
|
|
399
|
-
// method always terminates the yield* loop.
|
|
400
|
-
context.delegate = null;
|
|
401
|
-
|
|
402
|
-
if (context.method === "throw") {
|
|
403
|
-
// Note: ["return"] must be used for ES3 parsing compatibility.
|
|
404
|
-
if (delegate.iterator["return"]) {
|
|
405
|
-
// If the delegate iterator has a return method, give it a
|
|
406
|
-
// chance to clean up.
|
|
407
|
-
context.method = "return";
|
|
408
|
-
context.arg = undefined$1;
|
|
409
|
-
maybeInvokeDelegate(delegate, context);
|
|
410
|
-
|
|
411
|
-
if (context.method === "throw") {
|
|
412
|
-
// If maybeInvokeDelegate(context) changed context.method from
|
|
413
|
-
// "return" to "throw", let that override the TypeError below.
|
|
414
|
-
return ContinueSentinel;
|
|
415
|
-
}
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
context.method = "throw";
|
|
419
|
-
context.arg = new TypeError("The iterator does not provide a 'throw' method");
|
|
420
|
-
}
|
|
421
|
-
|
|
422
|
-
return ContinueSentinel;
|
|
423
|
-
}
|
|
424
|
-
|
|
425
|
-
var record = tryCatch(method, delegate.iterator, context.arg);
|
|
426
|
-
|
|
427
|
-
if (record.type === "throw") {
|
|
428
|
-
context.method = "throw";
|
|
429
|
-
context.arg = record.arg;
|
|
430
|
-
context.delegate = null;
|
|
431
|
-
return ContinueSentinel;
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
var info = record.arg;
|
|
435
|
-
|
|
436
|
-
if (!info) {
|
|
437
|
-
context.method = "throw";
|
|
438
|
-
context.arg = new TypeError("iterator result is not an object");
|
|
439
|
-
context.delegate = null;
|
|
440
|
-
return ContinueSentinel;
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
if (info.done) {
|
|
444
|
-
// Assign the result of the finished delegate to the temporary
|
|
445
|
-
// variable specified by delegate.resultName (see delegateYield).
|
|
446
|
-
context[delegate.resultName] = info.value; // Resume execution at the desired location (see delegateYield).
|
|
447
|
-
|
|
448
|
-
context.next = delegate.nextLoc; // If context.method was "throw" but the delegate handled the
|
|
449
|
-
// exception, let the outer generator proceed normally. If
|
|
450
|
-
// context.method was "next", forget context.arg since it has been
|
|
451
|
-
// "consumed" by the delegate iterator. If context.method was
|
|
452
|
-
// "return", allow the original .return call to continue in the
|
|
453
|
-
// outer generator.
|
|
454
|
-
|
|
455
|
-
if (context.method !== "return") {
|
|
456
|
-
context.method = "next";
|
|
457
|
-
context.arg = undefined$1;
|
|
458
|
-
}
|
|
459
|
-
} else {
|
|
460
|
-
// Re-yield the result returned by the delegate method.
|
|
461
|
-
return info;
|
|
462
|
-
} // The delegate iterator is finished, so forget it and continue with
|
|
463
|
-
// the outer generator.
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
context.delegate = null;
|
|
467
|
-
return ContinueSentinel;
|
|
468
|
-
} // Define Generator.prototype.{next,throw,return} in terms of the
|
|
469
|
-
// unified ._invoke helper method.
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
defineIteratorMethods(Gp);
|
|
473
|
-
define(Gp, toStringTagSymbol, "Generator"); // A Generator should always return itself as the iterator object when the
|
|
474
|
-
// @@iterator function is called on it. Some browsers' implementations of the
|
|
475
|
-
// iterator prototype chain incorrectly implement this, causing the Generator
|
|
476
|
-
// object to not be returned from this call. This ensures that doesn't happen.
|
|
477
|
-
// See https://github.com/facebook/regenerator/issues/274 for more details.
|
|
478
|
-
|
|
479
|
-
define(Gp, iteratorSymbol, function () {
|
|
480
|
-
return this;
|
|
481
|
-
});
|
|
482
|
-
define(Gp, "toString", function () {
|
|
483
|
-
return "[object Generator]";
|
|
484
|
-
});
|
|
485
|
-
|
|
486
|
-
function pushTryEntry(locs) {
|
|
487
|
-
var entry = {
|
|
488
|
-
tryLoc: locs[0]
|
|
489
|
-
};
|
|
490
|
-
|
|
491
|
-
if (1 in locs) {
|
|
492
|
-
entry.catchLoc = locs[1];
|
|
493
|
-
}
|
|
494
|
-
|
|
495
|
-
if (2 in locs) {
|
|
496
|
-
entry.finallyLoc = locs[2];
|
|
497
|
-
entry.afterLoc = locs[3];
|
|
498
|
-
}
|
|
499
|
-
|
|
500
|
-
this.tryEntries.push(entry);
|
|
501
|
-
}
|
|
502
|
-
|
|
503
|
-
function resetTryEntry(entry) {
|
|
504
|
-
var record = entry.completion || {};
|
|
505
|
-
record.type = "normal";
|
|
506
|
-
delete record.arg;
|
|
507
|
-
entry.completion = record;
|
|
508
|
-
}
|
|
509
|
-
|
|
510
|
-
function Context(tryLocsList) {
|
|
511
|
-
// The root entry object (effectively a try statement without a catch
|
|
512
|
-
// or a finally block) gives us a place to store values thrown from
|
|
513
|
-
// locations where there is no enclosing try statement.
|
|
514
|
-
this.tryEntries = [{
|
|
515
|
-
tryLoc: "root"
|
|
516
|
-
}];
|
|
517
|
-
tryLocsList.forEach(pushTryEntry, this);
|
|
518
|
-
this.reset(true);
|
|
519
|
-
}
|
|
520
|
-
|
|
521
|
-
exports.keys = function (object) {
|
|
522
|
-
var keys = [];
|
|
523
|
-
|
|
524
|
-
for (var key in object) {
|
|
525
|
-
keys.push(key);
|
|
526
|
-
}
|
|
527
|
-
|
|
528
|
-
keys.reverse(); // Rather than returning an object with a next method, we keep
|
|
529
|
-
// things simple and return the next function itself.
|
|
530
|
-
|
|
531
|
-
return function next() {
|
|
532
|
-
while (keys.length) {
|
|
533
|
-
var key = keys.pop();
|
|
534
|
-
|
|
535
|
-
if (key in object) {
|
|
536
|
-
next.value = key;
|
|
537
|
-
next.done = false;
|
|
538
|
-
return next;
|
|
539
|
-
}
|
|
540
|
-
} // To avoid creating an additional object, we just hang the .value
|
|
541
|
-
// and .done properties off the next function object itself. This
|
|
542
|
-
// also ensures that the minifier will not anonymize the function.
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
next.done = true;
|
|
546
|
-
return next;
|
|
547
|
-
};
|
|
548
|
-
};
|
|
549
|
-
|
|
550
|
-
function values(iterable) {
|
|
551
|
-
if (iterable) {
|
|
552
|
-
var iteratorMethod = iterable[iteratorSymbol];
|
|
553
|
-
|
|
554
|
-
if (iteratorMethod) {
|
|
555
|
-
return iteratorMethod.call(iterable);
|
|
556
|
-
}
|
|
557
|
-
|
|
558
|
-
if (typeof iterable.next === "function") {
|
|
559
|
-
return iterable;
|
|
560
|
-
}
|
|
561
|
-
|
|
562
|
-
if (!isNaN(iterable.length)) {
|
|
563
|
-
var i = -1,
|
|
564
|
-
next = function next() {
|
|
565
|
-
while (++i < iterable.length) {
|
|
566
|
-
if (hasOwn.call(iterable, i)) {
|
|
567
|
-
next.value = iterable[i];
|
|
568
|
-
next.done = false;
|
|
569
|
-
return next;
|
|
570
|
-
}
|
|
571
|
-
}
|
|
572
|
-
|
|
573
|
-
next.value = undefined$1;
|
|
574
|
-
next.done = true;
|
|
575
|
-
return next;
|
|
576
|
-
};
|
|
577
|
-
|
|
578
|
-
return next.next = next;
|
|
579
|
-
}
|
|
580
|
-
} // Return an iterator with no values.
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
return {
|
|
584
|
-
next: doneResult
|
|
585
|
-
};
|
|
586
|
-
}
|
|
587
|
-
|
|
588
|
-
exports.values = values;
|
|
589
|
-
|
|
590
|
-
function doneResult() {
|
|
591
|
-
return {
|
|
592
|
-
value: undefined$1,
|
|
593
|
-
done: true
|
|
594
|
-
};
|
|
595
|
-
}
|
|
596
|
-
|
|
597
|
-
Context.prototype = {
|
|
598
|
-
constructor: Context,
|
|
599
|
-
reset: function reset(skipTempReset) {
|
|
600
|
-
this.prev = 0;
|
|
601
|
-
this.next = 0; // Resetting context._sent for legacy support of Babel's
|
|
602
|
-
// function.sent implementation.
|
|
603
|
-
|
|
604
|
-
this.sent = this._sent = undefined$1;
|
|
605
|
-
this.done = false;
|
|
606
|
-
this.delegate = null;
|
|
607
|
-
this.method = "next";
|
|
608
|
-
this.arg = undefined$1;
|
|
609
|
-
this.tryEntries.forEach(resetTryEntry);
|
|
610
|
-
|
|
611
|
-
if (!skipTempReset) {
|
|
612
|
-
for (var name in this) {
|
|
613
|
-
// Not sure about the optimal order of these conditions:
|
|
614
|
-
if (name.charAt(0) === "t" && hasOwn.call(this, name) && !isNaN(+name.slice(1))) {
|
|
615
|
-
this[name] = undefined$1;
|
|
616
|
-
}
|
|
617
|
-
}
|
|
618
|
-
}
|
|
619
|
-
},
|
|
620
|
-
stop: function stop() {
|
|
621
|
-
this.done = true;
|
|
622
|
-
var rootEntry = this.tryEntries[0];
|
|
623
|
-
var rootRecord = rootEntry.completion;
|
|
624
|
-
|
|
625
|
-
if (rootRecord.type === "throw") {
|
|
626
|
-
throw rootRecord.arg;
|
|
627
|
-
}
|
|
628
|
-
|
|
629
|
-
return this.rval;
|
|
630
|
-
},
|
|
631
|
-
dispatchException: function dispatchException(exception) {
|
|
632
|
-
if (this.done) {
|
|
633
|
-
throw exception;
|
|
634
|
-
}
|
|
635
|
-
|
|
636
|
-
var context = this;
|
|
637
|
-
|
|
638
|
-
function handle(loc, caught) {
|
|
639
|
-
record.type = "throw";
|
|
640
|
-
record.arg = exception;
|
|
641
|
-
context.next = loc;
|
|
642
|
-
|
|
643
|
-
if (caught) {
|
|
644
|
-
// If the dispatched exception was caught by a catch block,
|
|
645
|
-
// then let that catch block handle the exception normally.
|
|
646
|
-
context.method = "next";
|
|
647
|
-
context.arg = undefined$1;
|
|
648
|
-
}
|
|
649
|
-
|
|
650
|
-
return !!caught;
|
|
651
|
-
}
|
|
652
|
-
|
|
653
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
654
|
-
var entry = this.tryEntries[i];
|
|
655
|
-
var record = entry.completion;
|
|
656
|
-
|
|
657
|
-
if (entry.tryLoc === "root") {
|
|
658
|
-
// Exception thrown outside of any try block that could handle
|
|
659
|
-
// it, so set the completion value of the entire function to
|
|
660
|
-
// throw the exception.
|
|
661
|
-
return handle("end");
|
|
662
|
-
}
|
|
663
|
-
|
|
664
|
-
if (entry.tryLoc <= this.prev) {
|
|
665
|
-
var hasCatch = hasOwn.call(entry, "catchLoc");
|
|
666
|
-
var hasFinally = hasOwn.call(entry, "finallyLoc");
|
|
667
|
-
|
|
668
|
-
if (hasCatch && hasFinally) {
|
|
669
|
-
if (this.prev < entry.catchLoc) {
|
|
670
|
-
return handle(entry.catchLoc, true);
|
|
671
|
-
} else if (this.prev < entry.finallyLoc) {
|
|
672
|
-
return handle(entry.finallyLoc);
|
|
673
|
-
}
|
|
674
|
-
} else if (hasCatch) {
|
|
675
|
-
if (this.prev < entry.catchLoc) {
|
|
676
|
-
return handle(entry.catchLoc, true);
|
|
677
|
-
}
|
|
678
|
-
} else if (hasFinally) {
|
|
679
|
-
if (this.prev < entry.finallyLoc) {
|
|
680
|
-
return handle(entry.finallyLoc);
|
|
681
|
-
}
|
|
682
|
-
} else {
|
|
683
|
-
throw new Error("try statement without catch or finally");
|
|
684
|
-
}
|
|
685
|
-
}
|
|
686
|
-
}
|
|
687
|
-
},
|
|
688
|
-
abrupt: function abrupt(type, arg) {
|
|
689
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
690
|
-
var entry = this.tryEntries[i];
|
|
691
|
-
|
|
692
|
-
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
|
|
693
|
-
var finallyEntry = entry;
|
|
694
|
-
break;
|
|
695
|
-
}
|
|
696
|
-
}
|
|
697
|
-
|
|
698
|
-
if (finallyEntry && (type === "break" || type === "continue") && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc) {
|
|
699
|
-
// Ignore the finally entry if control is not jumping to a
|
|
700
|
-
// location outside the try/catch block.
|
|
701
|
-
finallyEntry = null;
|
|
702
|
-
}
|
|
703
|
-
|
|
704
|
-
var record = finallyEntry ? finallyEntry.completion : {};
|
|
705
|
-
record.type = type;
|
|
706
|
-
record.arg = arg;
|
|
707
|
-
|
|
708
|
-
if (finallyEntry) {
|
|
709
|
-
this.method = "next";
|
|
710
|
-
this.next = finallyEntry.finallyLoc;
|
|
711
|
-
return ContinueSentinel;
|
|
712
|
-
}
|
|
713
|
-
|
|
714
|
-
return this.complete(record);
|
|
715
|
-
},
|
|
716
|
-
complete: function complete(record, afterLoc) {
|
|
717
|
-
if (record.type === "throw") {
|
|
718
|
-
throw record.arg;
|
|
719
|
-
}
|
|
720
|
-
|
|
721
|
-
if (record.type === "break" || record.type === "continue") {
|
|
722
|
-
this.next = record.arg;
|
|
723
|
-
} else if (record.type === "return") {
|
|
724
|
-
this.rval = this.arg = record.arg;
|
|
725
|
-
this.method = "return";
|
|
726
|
-
this.next = "end";
|
|
727
|
-
} else if (record.type === "normal" && afterLoc) {
|
|
728
|
-
this.next = afterLoc;
|
|
729
|
-
}
|
|
730
|
-
|
|
731
|
-
return ContinueSentinel;
|
|
732
|
-
},
|
|
733
|
-
finish: function finish(finallyLoc) {
|
|
734
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
735
|
-
var entry = this.tryEntries[i];
|
|
736
|
-
|
|
737
|
-
if (entry.finallyLoc === finallyLoc) {
|
|
738
|
-
this.complete(entry.completion, entry.afterLoc);
|
|
739
|
-
resetTryEntry(entry);
|
|
740
|
-
return ContinueSentinel;
|
|
741
|
-
}
|
|
742
|
-
}
|
|
743
|
-
},
|
|
744
|
-
"catch": function _catch(tryLoc) {
|
|
745
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
746
|
-
var entry = this.tryEntries[i];
|
|
747
|
-
|
|
748
|
-
if (entry.tryLoc === tryLoc) {
|
|
749
|
-
var record = entry.completion;
|
|
750
|
-
|
|
751
|
-
if (record.type === "throw") {
|
|
752
|
-
var thrown = record.arg;
|
|
753
|
-
resetTryEntry(entry);
|
|
754
|
-
}
|
|
755
|
-
|
|
756
|
-
return thrown;
|
|
757
|
-
}
|
|
758
|
-
} // The context.catch method must only be called with a location
|
|
759
|
-
// argument that corresponds to a known catch block.
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
throw new Error("illegal catch attempt");
|
|
763
|
-
},
|
|
764
|
-
delegateYield: function delegateYield(iterable, resultName, nextLoc) {
|
|
765
|
-
this.delegate = {
|
|
766
|
-
iterator: values(iterable),
|
|
767
|
-
resultName: resultName,
|
|
768
|
-
nextLoc: nextLoc
|
|
769
|
-
};
|
|
770
|
-
|
|
771
|
-
if (this.method === "next") {
|
|
772
|
-
// Deliberately forget the last sent value so that we don't
|
|
773
|
-
// accidentally pass it on to the delegate.
|
|
774
|
-
this.arg = undefined$1;
|
|
775
|
-
}
|
|
776
|
-
|
|
777
|
-
return ContinueSentinel;
|
|
778
|
-
}
|
|
779
|
-
}; // Regardless of whether this script is executing as a CommonJS module
|
|
780
|
-
// or not, return the runtime object so that we can declare the variable
|
|
781
|
-
// regeneratorRuntime in the outer scope, which allows this module to be
|
|
782
|
-
// injected easily by `bin/regenerator --include-runtime script.js`.
|
|
783
|
-
|
|
784
|
-
return exports;
|
|
785
|
-
}( // If this script is executing as a CommonJS module, use module.exports
|
|
786
|
-
// as the regeneratorRuntime namespace. Otherwise create a new empty
|
|
787
|
-
// object. Either way, the resulting object will be used to initialize
|
|
788
|
-
// the regeneratorRuntime variable at the top of this file.
|
|
789
|
-
module.exports );
|
|
790
|
-
|
|
791
|
-
try {
|
|
792
|
-
regeneratorRuntime = runtime;
|
|
793
|
-
} catch (accidentalStrictMode) {
|
|
794
|
-
// This module should not be running in strict mode, so the above
|
|
795
|
-
// assignment should always work unless something is misconfigured. Just
|
|
796
|
-
// in case runtime.js accidentally runs in strict mode, in modern engines
|
|
797
|
-
// we can explicitly access globalThis. In older engines we can escape
|
|
798
|
-
// strict mode using a global Function call. This could conceivably fail
|
|
799
|
-
// if a Content Security Policy forbids using Function, but in that case
|
|
800
|
-
// the proper solution is to fix the accidental strict mode problem. If
|
|
801
|
-
// you've misconfigured your bundler to force strict mode and applied a
|
|
802
|
-
// CSP to forbid Function, and you're not willing to fix either of those
|
|
803
|
-
// problems, please detail your unique predicament in a GitHub issue.
|
|
804
|
-
if (typeof globalThis === "object") {
|
|
805
|
-
globalThis.regeneratorRuntime = runtime;
|
|
806
|
-
} else {
|
|
807
|
-
Function("r", "regeneratorRuntime = r")(runtime);
|
|
808
|
-
}
|
|
809
|
-
}
|
|
810
|
-
});
|
|
811
|
-
|
|
812
372
|
var _excluded = ["captureBeyondViewport"],
|
|
813
|
-
|
|
814
|
-
|
|
373
|
+
_excluded2 = ["userAgent", "isDarkMode", "viewport", "cookies"];
|
|
815
374
|
var _pkg$acceptanceTests, _ref;
|
|
816
|
-
|
|
817
375
|
var execSync = /*#__PURE__*/require('child_process').execSync;
|
|
818
|
-
|
|
819
376
|
var getGlobalBrowser = function getGlobalBrowser() {
|
|
820
377
|
return global.browser;
|
|
821
378
|
};
|
|
@@ -828,11 +385,9 @@ var serverHostName = /*#__PURE__*/function () {
|
|
|
828
385
|
if (isCi) {
|
|
829
386
|
return 'localhost';
|
|
830
387
|
}
|
|
831
|
-
|
|
832
388
|
if (isUsingDockerizedChromium) {
|
|
833
389
|
return process.platform === 'linux' ? '172.17.0.1' : 'host.docker.internal';
|
|
834
390
|
}
|
|
835
|
-
|
|
836
391
|
return 'localhost';
|
|
837
392
|
}();
|
|
838
393
|
var rootDir = /*#__PURE__*/findRoot( /*#__PURE__*/process.cwd());
|
|
@@ -849,11 +404,10 @@ var toMatchImageSnapshot = /*#__PURE__*/jestImageSnapshot.configureToMatchImageS
|
|
|
849
404
|
}
|
|
850
405
|
});
|
|
851
406
|
var calledToMatchImageSnapshotOutsideDocker = false;
|
|
852
|
-
|
|
853
407
|
var localToMatchImageSnapshot = function localToMatchImageSnapshot() {
|
|
854
|
-
calledToMatchImageSnapshotOutsideDocker = true;
|
|
408
|
+
calledToMatchImageSnapshotOutsideDocker = true;
|
|
409
|
+
// let the expectation pass, then fail in afterEach. This way we allow developers to debug screenshot tests in local
|
|
855
410
|
// but don't allow them to save screenshots taken outside the dockerized chromium
|
|
856
|
-
|
|
857
411
|
return {
|
|
858
412
|
message: function message() {
|
|
859
413
|
return '';
|
|
@@ -861,7 +415,6 @@ var localToMatchImageSnapshot = function localToMatchImageSnapshot() {
|
|
|
861
415
|
pass: true
|
|
862
416
|
};
|
|
863
417
|
};
|
|
864
|
-
|
|
865
418
|
expect.extend({
|
|
866
419
|
toMatchImageSnapshot: isUsingDockerizedChromium ? toMatchImageSnapshot : localToMatchImageSnapshot
|
|
867
420
|
});
|
|
@@ -872,105 +425,87 @@ afterEach(function () {
|
|
|
872
425
|
throw error;
|
|
873
426
|
}
|
|
874
427
|
});
|
|
875
|
-
|
|
876
428
|
var waitForPaintEnd = /*#__PURE__*/function () {
|
|
877
|
-
var _ref3 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/
|
|
878
|
-
var _ref4, _ref4$fullPage, fullPage, captureBeyondViewport, MAX_WAIT, STEP_TIME, t0, buf1, buf2;
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
case 11:
|
|
909
|
-
buf2 = _context.sent;
|
|
910
|
-
|
|
911
|
-
case 12:
|
|
912
|
-
if (!buf1.compare(buf2)) {
|
|
913
|
-
_context.next = 23;
|
|
914
|
-
break;
|
|
915
|
-
}
|
|
916
|
-
|
|
917
|
-
if (!(Date.now() - t0 > MAX_WAIT)) {
|
|
918
|
-
_context.next = 15;
|
|
919
|
-
break;
|
|
920
|
-
}
|
|
921
|
-
|
|
922
|
-
throw Error('Paint end timeout');
|
|
923
|
-
|
|
924
|
-
case 15:
|
|
925
|
-
buf1 = buf2;
|
|
926
|
-
_context.next = 18;
|
|
927
|
-
return new Promise(function (r) {
|
|
928
|
-
return setTimeout(r, STEP_TIME);
|
|
929
|
-
});
|
|
930
|
-
|
|
931
|
-
case 18:
|
|
932
|
-
_context.next = 20;
|
|
933
|
-
return element.screenshot(normalizeSreenshotOptions({
|
|
934
|
-
fullPage: fullPage,
|
|
935
|
-
captureBeyondViewport: captureBeyondViewport
|
|
936
|
-
}));
|
|
937
|
-
|
|
938
|
-
case 20:
|
|
939
|
-
buf2 = _context.sent;
|
|
940
|
-
_context.next = 12;
|
|
429
|
+
var _ref3 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(element, _temp) {
|
|
430
|
+
var _ref4, _ref4$fullPage, fullPage, captureBeyondViewport, MAX_WAIT, STEP_TIME, t0, buf1, buf2;
|
|
431
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
432
|
+
while (1) switch (_context.prev = _context.next) {
|
|
433
|
+
case 0:
|
|
434
|
+
_ref4 = _temp === void 0 ? {} : _temp, _ref4$fullPage = _ref4.fullPage, fullPage = _ref4$fullPage === void 0 ? true : _ref4$fullPage, captureBeyondViewport = _ref4.captureBeyondViewport;
|
|
435
|
+
MAX_WAIT = 15000;
|
|
436
|
+
STEP_TIME = 250;
|
|
437
|
+
t0 = Date.now();
|
|
438
|
+
_context.next = 6;
|
|
439
|
+
return element.screenshot(normalizeSreenshotOptions({
|
|
440
|
+
fullPage: fullPage,
|
|
441
|
+
captureBeyondViewport: captureBeyondViewport
|
|
442
|
+
}));
|
|
443
|
+
case 6:
|
|
444
|
+
buf1 = _context.sent;
|
|
445
|
+
_context.next = 9;
|
|
446
|
+
return new Promise(function (r) {
|
|
447
|
+
return setTimeout(r, STEP_TIME);
|
|
448
|
+
});
|
|
449
|
+
case 9:
|
|
450
|
+
_context.next = 11;
|
|
451
|
+
return element.screenshot(normalizeSreenshotOptions({
|
|
452
|
+
fullPage: fullPage,
|
|
453
|
+
captureBeyondViewport: captureBeyondViewport
|
|
454
|
+
}));
|
|
455
|
+
case 11:
|
|
456
|
+
buf2 = _context.sent;
|
|
457
|
+
case 12:
|
|
458
|
+
if (!buf1.compare(buf2)) {
|
|
459
|
+
_context.next = 23;
|
|
941
460
|
break;
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
461
|
+
}
|
|
462
|
+
if (!(Date.now() - t0 > MAX_WAIT)) {
|
|
463
|
+
_context.next = 15;
|
|
464
|
+
break;
|
|
465
|
+
}
|
|
466
|
+
throw Error('Paint end timeout');
|
|
467
|
+
case 15:
|
|
468
|
+
buf1 = buf2;
|
|
469
|
+
_context.next = 18;
|
|
470
|
+
return new Promise(function (r) {
|
|
471
|
+
return setTimeout(r, STEP_TIME);
|
|
472
|
+
});
|
|
473
|
+
case 18:
|
|
474
|
+
_context.next = 20;
|
|
475
|
+
return element.screenshot(normalizeSreenshotOptions({
|
|
476
|
+
fullPage: fullPage,
|
|
477
|
+
captureBeyondViewport: captureBeyondViewport
|
|
478
|
+
}));
|
|
479
|
+
case 20:
|
|
480
|
+
buf2 = _context.sent;
|
|
481
|
+
_context.next = 12;
|
|
482
|
+
break;
|
|
483
|
+
case 23:
|
|
484
|
+
case "end":
|
|
485
|
+
return _context.stop();
|
|
947
486
|
}
|
|
948
487
|
}, _callee);
|
|
949
488
|
}));
|
|
950
|
-
|
|
951
489
|
return function waitForPaintEnd(_x, _x2) {
|
|
952
490
|
return _ref3.apply(this, arguments);
|
|
953
491
|
};
|
|
954
492
|
}();
|
|
955
|
-
|
|
956
493
|
var normalizeSreenshotOptions = function normalizeSreenshotOptions(_temp2) {
|
|
957
494
|
var _ref5 = _temp2 === void 0 ? {} : _temp2,
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
495
|
+
_ref5$captureBeyondVi = _ref5.captureBeyondViewport,
|
|
496
|
+
captureBeyondViewport = _ref5$captureBeyondVi === void 0 ? false : _ref5$captureBeyondVi,
|
|
497
|
+
options = _objectWithoutPropertiesLoose(_ref5, _excluded);
|
|
962
498
|
// Puppeter default for captureBeyondViewport is true, but we think false is a better default.
|
|
963
499
|
// When this is true, the fixed elements (like fixed footers) are relative to the original page
|
|
964
500
|
// viewport, not to the full page, so those elements look weird in fullPage screenshots.
|
|
965
501
|
return _extends({}, options, {
|
|
966
502
|
captureBeyondViewport: captureBeyondViewport
|
|
967
503
|
});
|
|
968
|
-
};
|
|
504
|
+
};
|
|
505
|
+
// Puppeteer already calls scrollIntoViewIfNeeded before clicking an element. But it doesn't work in all situations
|
|
969
506
|
// For example, when there is a fixed footer in the page and the element to click is under it, the browser won't scroll
|
|
970
507
|
// because the element is already in the viewport (the ifNeeded part is important here). By forcing the scroll to the
|
|
971
508
|
// center, we manage to fix these edge cases.
|
|
972
|
-
|
|
973
|
-
|
|
974
509
|
var scrollIntoView = function scrollIntoView(el) {
|
|
975
510
|
return el.evaluate(function (e) {
|
|
976
511
|
return e.scrollIntoView({
|
|
@@ -978,158 +513,122 @@ var scrollIntoView = function scrollIntoView(el) {
|
|
|
978
513
|
});
|
|
979
514
|
});
|
|
980
515
|
};
|
|
981
|
-
|
|
982
516
|
var getPageApi = function getPageApi(page) {
|
|
983
517
|
var api = Object.create(page);
|
|
984
|
-
|
|
985
518
|
api.type = /*#__PURE__*/function () {
|
|
986
|
-
var _ref6 = _asyncToGenerator( /*#__PURE__*/
|
|
987
|
-
return
|
|
988
|
-
while (1) {
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
case 3:
|
|
998
|
-
case "end":
|
|
999
|
-
return _context2.stop();
|
|
1000
|
-
}
|
|
519
|
+
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(elementHandle, text, options) {
|
|
520
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
521
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
522
|
+
case 0:
|
|
523
|
+
_context2.next = 2;
|
|
524
|
+
return scrollIntoView(elementHandle);
|
|
525
|
+
case 2:
|
|
526
|
+
return _context2.abrupt("return", elementHandle.type(text, options));
|
|
527
|
+
case 3:
|
|
528
|
+
case "end":
|
|
529
|
+
return _context2.stop();
|
|
1001
530
|
}
|
|
1002
531
|
}, _callee2);
|
|
1003
532
|
}));
|
|
1004
|
-
|
|
1005
533
|
return function (_x3, _x4, _x5) {
|
|
1006
534
|
return _ref6.apply(this, arguments);
|
|
1007
535
|
};
|
|
1008
536
|
}();
|
|
1009
|
-
|
|
1010
537
|
api.click = /*#__PURE__*/function () {
|
|
1011
|
-
var _ref7 = _asyncToGenerator( /*#__PURE__*/
|
|
1012
|
-
return
|
|
1013
|
-
while (1) {
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
case 3:
|
|
1023
|
-
case "end":
|
|
1024
|
-
return _context3.stop();
|
|
1025
|
-
}
|
|
538
|
+
var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(elementHandle, options) {
|
|
539
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
540
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
541
|
+
case 0:
|
|
542
|
+
_context3.next = 2;
|
|
543
|
+
return scrollIntoView(elementHandle);
|
|
544
|
+
case 2:
|
|
545
|
+
return _context3.abrupt("return", elementHandle.click(options));
|
|
546
|
+
case 3:
|
|
547
|
+
case "end":
|
|
548
|
+
return _context3.stop();
|
|
1026
549
|
}
|
|
1027
550
|
}, _callee3);
|
|
1028
551
|
}));
|
|
1029
|
-
|
|
1030
552
|
return function (_x6, _x7) {
|
|
1031
553
|
return _ref7.apply(this, arguments);
|
|
1032
554
|
};
|
|
1033
555
|
}();
|
|
1034
|
-
|
|
1035
556
|
api.select = /*#__PURE__*/function () {
|
|
1036
|
-
var _ref8 = _asyncToGenerator( /*#__PURE__*/
|
|
557
|
+
var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(elementHandle) {
|
|
1037
558
|
var _len,
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
return _context4.abrupt("return", elementHandle.select.apply(elementHandle, values));
|
|
1055
|
-
|
|
1056
|
-
case 4:
|
|
1057
|
-
case "end":
|
|
1058
|
-
return _context4.stop();
|
|
1059
|
-
}
|
|
559
|
+
values,
|
|
560
|
+
_key,
|
|
561
|
+
_args4 = arguments;
|
|
562
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
563
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
564
|
+
case 0:
|
|
565
|
+
_context4.next = 2;
|
|
566
|
+
return scrollIntoView(elementHandle);
|
|
567
|
+
case 2:
|
|
568
|
+
for (_len = _args4.length, values = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
569
|
+
values[_key - 1] = _args4[_key];
|
|
570
|
+
}
|
|
571
|
+
return _context4.abrupt("return", elementHandle.select.apply(elementHandle, values));
|
|
572
|
+
case 4:
|
|
573
|
+
case "end":
|
|
574
|
+
return _context4.stop();
|
|
1060
575
|
}
|
|
1061
576
|
}, _callee4);
|
|
1062
577
|
}));
|
|
1063
|
-
|
|
1064
578
|
return function (_x8) {
|
|
1065
579
|
return _ref8.apply(this, arguments);
|
|
1066
580
|
};
|
|
1067
581
|
}();
|
|
1068
|
-
|
|
1069
582
|
api.screenshot = /*#__PURE__*/function () {
|
|
1070
|
-
var _ref9 = _asyncToGenerator( /*#__PURE__*/
|
|
1071
|
-
return
|
|
1072
|
-
while (1) {
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
if (options != null && options.skipNetworkWait) {
|
|
1076
|
-
_context5.next = 3;
|
|
1077
|
-
break;
|
|
1078
|
-
}
|
|
1079
|
-
|
|
583
|
+
var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(options) {
|
|
584
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
585
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
586
|
+
case 0:
|
|
587
|
+
if (options != null && options.skipNetworkWait) {
|
|
1080
588
|
_context5.next = 3;
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
}
|
|
589
|
+
break;
|
|
590
|
+
}
|
|
591
|
+
_context5.next = 3;
|
|
592
|
+
return page.waitForNetworkIdle();
|
|
593
|
+
case 3:
|
|
594
|
+
_context5.next = 5;
|
|
595
|
+
return waitForPaintEnd(page, options);
|
|
596
|
+
case 5:
|
|
597
|
+
return _context5.abrupt("return", page.screenshot(normalizeSreenshotOptions(options)));
|
|
598
|
+
case 6:
|
|
599
|
+
case "end":
|
|
600
|
+
return _context5.stop();
|
|
1094
601
|
}
|
|
1095
602
|
}, _callee5);
|
|
1096
603
|
}));
|
|
1097
|
-
|
|
1098
604
|
return function (_x9) {
|
|
1099
605
|
return _ref9.apply(this, arguments);
|
|
1100
606
|
};
|
|
1101
607
|
}();
|
|
1102
|
-
|
|
1103
608
|
api.clear = /*#__PURE__*/function () {
|
|
1104
|
-
var _ref10 = _asyncToGenerator( /*#__PURE__*/
|
|
1105
|
-
return
|
|
1106
|
-
while (1) {
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
case 4:
|
|
1119
|
-
case "end":
|
|
1120
|
-
return _context6.stop();
|
|
1121
|
-
}
|
|
609
|
+
var _ref10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(elementHandle) {
|
|
610
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
611
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
612
|
+
case 0:
|
|
613
|
+
_context6.next = 2;
|
|
614
|
+
return elementHandle.click({
|
|
615
|
+
clickCount: 3
|
|
616
|
+
});
|
|
617
|
+
case 2:
|
|
618
|
+
_context6.next = 4;
|
|
619
|
+
return elementHandle.press('Delete');
|
|
620
|
+
case 4:
|
|
621
|
+
case "end":
|
|
622
|
+
return _context6.stop();
|
|
1122
623
|
}
|
|
1123
624
|
}, _callee6);
|
|
1124
625
|
}));
|
|
1125
|
-
|
|
1126
626
|
return function (_x10) {
|
|
1127
627
|
return _ref10.apply(this, arguments);
|
|
1128
628
|
};
|
|
1129
|
-
}();
|
|
629
|
+
}();
|
|
630
|
+
// For some reason, puppeteer browserContext.overridePermissions doesn't work with newer chrome versions.
|
|
1130
631
|
// This workaround polyfills the browser geolocation api to return the mocked position
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
632
|
api.setGeolocation = function (position) {
|
|
1134
633
|
return page.evaluate(function (position) {
|
|
1135
634
|
window.navigator.geolocation.getCurrentPosition = function (callback) {
|
|
@@ -1140,32 +639,26 @@ var getPageApi = function getPageApi(page) {
|
|
|
1140
639
|
};
|
|
1141
640
|
}, position);
|
|
1142
641
|
};
|
|
1143
|
-
|
|
1144
642
|
return api;
|
|
1145
643
|
};
|
|
1146
644
|
var needsRequestInterception = false;
|
|
1147
645
|
var requestHandlers = [];
|
|
1148
|
-
|
|
1149
646
|
var requestInterceptor = function requestInterceptor(req) {
|
|
1150
647
|
var _requestHandlers$find;
|
|
1151
|
-
|
|
1152
648
|
var _ref11 = (_requestHandlers$find = requestHandlers.find(function (_ref12) {
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
649
|
+
var matcher = _ref12.matcher;
|
|
650
|
+
return matcher(req);
|
|
651
|
+
})) != null ? _requestHandlers$find : {
|
|
652
|
+
handler: null
|
|
653
|
+
},
|
|
654
|
+
handler = _ref11.handler;
|
|
1160
655
|
if (!handler) {
|
|
1161
656
|
req["continue"]();
|
|
1162
657
|
return;
|
|
1163
658
|
}
|
|
1164
|
-
|
|
1165
659
|
var response = handler(req);
|
|
1166
660
|
req.respond(response);
|
|
1167
661
|
};
|
|
1168
|
-
|
|
1169
662
|
var interceptRequest = function interceptRequest(matcher) {
|
|
1170
663
|
needsRequestInterception = true;
|
|
1171
664
|
var spy = jest.fn();
|
|
@@ -1194,17 +687,14 @@ var createApiEndpointMock = function createApiEndpointMock(_ref13) {
|
|
|
1194
687
|
if (method === void 0) {
|
|
1195
688
|
method = 'GET';
|
|
1196
689
|
}
|
|
1197
|
-
|
|
1198
690
|
var matcher = function matcher(req) {
|
|
1199
691
|
var url = req.url();
|
|
1200
692
|
var urlPath = url.substring(baseUrl.length);
|
|
1201
693
|
return req.method() === method && url.startsWith(baseUrl) && !!urlPath.match(globToRegExp(path));
|
|
1202
694
|
};
|
|
1203
|
-
|
|
1204
695
|
var spy = jest.fn();
|
|
1205
696
|
interceptRequest(matcher).mockImplementation(function (req) {
|
|
1206
697
|
var _spyResult$status;
|
|
1207
|
-
|
|
1208
698
|
var spyResult = spy(req);
|
|
1209
699
|
var status = (_spyResult$status = spyResult.status) != null ? _spyResult$status : 200;
|
|
1210
700
|
var resBody = spyResult.body || spyResult;
|
|
@@ -1222,335 +712,261 @@ var createApiEndpointMock = function createApiEndpointMock(_ref13) {
|
|
|
1222
712
|
};
|
|
1223
713
|
};
|
|
1224
714
|
var openPage = /*#__PURE__*/function () {
|
|
1225
|
-
var _ref15 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/
|
|
715
|
+
var _ref15 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(_ref14) {
|
|
1226
716
|
var userAgent, isDarkMode, viewport, cookies, urlConfig, url, currentUserAgent, page, connectionError;
|
|
1227
|
-
return
|
|
1228
|
-
while (1) {
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
if (urlConfig.url !== undefined) {
|
|
1235
|
-
return urlConfig.url;
|
|
1236
|
-
}
|
|
1237
|
-
|
|
1238
|
-
var _urlConfig$path = urlConfig.path,
|
|
1239
|
-
path = _urlConfig$path === void 0 ? '/' : _urlConfig$path,
|
|
1240
|
-
_urlConfig$port = urlConfig.port,
|
|
1241
|
-
port = _urlConfig$port === void 0 ? serverPort : _urlConfig$port,
|
|
1242
|
-
_urlConfig$protocol = urlConfig.protocol,
|
|
1243
|
-
protocol = _urlConfig$protocol === void 0 ? 'http' : _urlConfig$protocol,
|
|
1244
|
-
_urlConfig$hostname = urlConfig.hostname,
|
|
1245
|
-
hostname = _urlConfig$hostname === void 0 ? serverHostName : _urlConfig$hostname;
|
|
1246
|
-
|
|
1247
|
-
if (!port) {
|
|
1248
|
-
var error = new Error('You must specify a port. You can specify it when calling openPage() or by configuring a dev and ci server in the acceptanceTests config in your package.json'); // Error.captureStackTrace(error, openPage);
|
|
1249
|
-
|
|
1250
|
-
throw error;
|
|
1251
|
-
}
|
|
1252
|
-
|
|
1253
|
-
return protocol + "://" + hostname + ":" + port + path;
|
|
1254
|
-
}();
|
|
1255
|
-
|
|
1256
|
-
_context7.t0 = userAgent;
|
|
1257
|
-
|
|
1258
|
-
if (_context7.t0) {
|
|
1259
|
-
_context7.next = 7;
|
|
1260
|
-
break;
|
|
717
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
718
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
719
|
+
case 0:
|
|
720
|
+
userAgent = _ref14.userAgent, isDarkMode = _ref14.isDarkMode, viewport = _ref14.viewport, cookies = _ref14.cookies, urlConfig = /*#__PURE__*/_objectWithoutPropertiesLoose(_ref14, _excluded2);
|
|
721
|
+
url = function () {
|
|
722
|
+
if (urlConfig.url !== undefined) {
|
|
723
|
+
return urlConfig.url;
|
|
1261
724
|
}
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
case 11:
|
|
1276
|
-
if (!viewport) {
|
|
1277
|
-
_context7.next = 14;
|
|
1278
|
-
break;
|
|
725
|
+
var _urlConfig$path = urlConfig.path,
|
|
726
|
+
path = _urlConfig$path === void 0 ? '/' : _urlConfig$path,
|
|
727
|
+
_urlConfig$port = urlConfig.port,
|
|
728
|
+
port = _urlConfig$port === void 0 ? serverPort : _urlConfig$port,
|
|
729
|
+
_urlConfig$protocol = urlConfig.protocol,
|
|
730
|
+
protocol = _urlConfig$protocol === void 0 ? 'http' : _urlConfig$protocol,
|
|
731
|
+
_urlConfig$hostname = urlConfig.hostname,
|
|
732
|
+
hostname = _urlConfig$hostname === void 0 ? serverHostName : _urlConfig$hostname;
|
|
733
|
+
if (!port) {
|
|
734
|
+
var error = new Error('You must specify a port. You can specify it when calling openPage() or by configuring a dev and ci server in the acceptanceTests config in your package.json');
|
|
735
|
+
// Error.captureStackTrace(error, openPage);
|
|
736
|
+
throw error;
|
|
1279
737
|
}
|
|
1280
|
-
|
|
738
|
+
return protocol + "://" + hostname + ":" + port + path;
|
|
739
|
+
}();
|
|
740
|
+
_context7.t0 = userAgent;
|
|
741
|
+
if (_context7.t0) {
|
|
742
|
+
_context7.next = 7;
|
|
743
|
+
break;
|
|
744
|
+
}
|
|
745
|
+
_context7.next = 6;
|
|
746
|
+
return getGlobalBrowser().userAgent();
|
|
747
|
+
case 6:
|
|
748
|
+
_context7.t0 = _context7.sent;
|
|
749
|
+
case 7:
|
|
750
|
+
currentUserAgent = _context7.t0;
|
|
751
|
+
page = getGlobalPage();
|
|
752
|
+
_context7.next = 11;
|
|
753
|
+
return page.bringToFront();
|
|
754
|
+
case 11:
|
|
755
|
+
if (!viewport) {
|
|
1281
756
|
_context7.next = 14;
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
}
|
|
1289
|
-
|
|
757
|
+
break;
|
|
758
|
+
}
|
|
759
|
+
_context7.next = 14;
|
|
760
|
+
return page.setViewport(viewport);
|
|
761
|
+
case 14:
|
|
762
|
+
if (!cookies) {
|
|
1290
763
|
_context7.next = 17;
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
});
|
|
764
|
+
break;
|
|
765
|
+
}
|
|
766
|
+
_context7.next = 17;
|
|
767
|
+
return page.setCookie.apply(page, cookies);
|
|
768
|
+
case 17:
|
|
769
|
+
_context7.next = 19;
|
|
770
|
+
return page.setUserAgent(currentUserAgent + " acceptance-test");
|
|
771
|
+
case 19:
|
|
772
|
+
_context7.next = 21;
|
|
773
|
+
return page.emulateMediaFeatures([{
|
|
774
|
+
name: 'prefers-color-scheme',
|
|
775
|
+
value: isDarkMode ? 'dark' : 'light'
|
|
776
|
+
}]);
|
|
777
|
+
case 21:
|
|
778
|
+
_context7.next = 23;
|
|
779
|
+
return page.evaluateOnNewDocument(function () {
|
|
780
|
+
var style = document.createElement('style');
|
|
781
|
+
style.innerHTML = "\n *, *:after, *:before {\n transition-delay: 0s !important;\n transition-duration: 0s !important;\n animation-delay: -0.0001s !important;\n animation-duration: 0s !important;\n animation-play-state: paused !important;\n caret-color: transparent !important;\n font-variant-ligatures: none !important;\n }\n *::-webkit-scrollbar {\n display: none !important;\n width: 0 !important;\n height: 0 !important;\n }\n ";
|
|
782
|
+
window.addEventListener('DOMContentLoaded', function () {
|
|
783
|
+
document.head.appendChild(style);
|
|
1312
784
|
});
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
break;
|
|
1318
|
-
}
|
|
1319
|
-
|
|
1320
|
-
_context7.next = 26;
|
|
1321
|
-
return page.setRequestInterception(true);
|
|
1322
|
-
|
|
1323
|
-
case 26:
|
|
1324
|
-
page.on('request', requestInterceptor);
|
|
1325
|
-
|
|
1326
|
-
case 27:
|
|
1327
|
-
_context7.prev = 27;
|
|
1328
|
-
_context7.next = 30;
|
|
1329
|
-
return page["goto"](url);
|
|
1330
|
-
|
|
1331
|
-
case 30:
|
|
1332
|
-
_context7.next = 41;
|
|
785
|
+
});
|
|
786
|
+
case 23:
|
|
787
|
+
if (!needsRequestInterception) {
|
|
788
|
+
_context7.next = 27;
|
|
1333
789
|
break;
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
790
|
+
}
|
|
791
|
+
_context7.next = 26;
|
|
792
|
+
return page.setRequestInterception(true);
|
|
793
|
+
case 26:
|
|
794
|
+
page.on('request', requestInterceptor);
|
|
795
|
+
case 27:
|
|
796
|
+
_context7.prev = 27;
|
|
797
|
+
_context7.next = 30;
|
|
798
|
+
return page["goto"](url);
|
|
799
|
+
case 30:
|
|
800
|
+
_context7.next = 41;
|
|
801
|
+
break;
|
|
802
|
+
case 32:
|
|
803
|
+
_context7.prev = 32;
|
|
804
|
+
_context7.t1 = _context7["catch"](27);
|
|
805
|
+
if (!_context7.t1.message.includes('net::ERR_CONNECTION_REFUSED')) {
|
|
806
|
+
_context7.next = 40;
|
|
807
|
+
break;
|
|
808
|
+
}
|
|
809
|
+
connectionError = new Error("Could not connect to " + url + ". Is the server running?");
|
|
810
|
+
Error.captureStackTrace(connectionError, openPage);
|
|
811
|
+
throw connectionError;
|
|
812
|
+
case 40:
|
|
813
|
+
throw _context7.t1;
|
|
814
|
+
case 41:
|
|
815
|
+
_context7.next = 43;
|
|
816
|
+
return page.waitForFunction('document.fonts.status === "loaded"');
|
|
817
|
+
case 43:
|
|
818
|
+
return _context7.abrupt("return", getPageApi(page));
|
|
819
|
+
case 44:
|
|
820
|
+
case "end":
|
|
821
|
+
return _context7.stop();
|
|
1362
822
|
}
|
|
1363
823
|
}, _callee7, null, [[27, 32]]);
|
|
1364
824
|
}));
|
|
1365
|
-
|
|
1366
825
|
return function openPage(_x11) {
|
|
1367
826
|
return _ref15.apply(this, arguments);
|
|
1368
827
|
};
|
|
1369
828
|
}();
|
|
1370
|
-
|
|
1371
829
|
var buildQueryMethods = function buildQueryMethods(_temp3) {
|
|
1372
830
|
var _ref16 = _temp3 === void 0 ? {} : _temp3,
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
831
|
+
page = _ref16.page,
|
|
832
|
+
element = _ref16.element;
|
|
1376
833
|
var boundQueries = {};
|
|
1377
|
-
|
|
1378
834
|
var _loop = function _loop() {
|
|
1379
835
|
var _Object$entries$_i = _Object$entries[_i],
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
boundQueries[queryName] = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/
|
|
836
|
+
queryName = _Object$entries$_i[0],
|
|
837
|
+
queryFn = _Object$entries$_i[1];
|
|
838
|
+
boundQueries[queryName] = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
|
|
1383
839
|
var doc,
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
}
|
|
1411
|
-
|
|
1412
|
-
queryArgs = [].concat(args);
|
|
1413
|
-
|
|
1414
|
-
if (queryName.startsWith('findBy')) {
|
|
1415
|
-
if (queryArgs.length === 1) {
|
|
1416
|
-
queryArgs.push(undefined);
|
|
1417
|
-
}
|
|
1418
|
-
|
|
1419
|
-
queryArgs.push({
|
|
1420
|
-
timeout: 10000
|
|
1421
|
-
});
|
|
840
|
+
body,
|
|
841
|
+
_len2,
|
|
842
|
+
args,
|
|
843
|
+
_key2,
|
|
844
|
+
queryArgs,
|
|
845
|
+
elementHandle,
|
|
846
|
+
newElementHandle,
|
|
847
|
+
_args12 = arguments;
|
|
848
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
849
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
850
|
+
case 0:
|
|
851
|
+
_context12.next = 2;
|
|
852
|
+
return pptrTestingLibrary.getDocument(page != null ? page : getGlobalPage());
|
|
853
|
+
case 2:
|
|
854
|
+
doc = _context12.sent;
|
|
855
|
+
_context12.next = 5;
|
|
856
|
+
return doc.$('body');
|
|
857
|
+
case 5:
|
|
858
|
+
body = _context12.sent;
|
|
859
|
+
for (_len2 = _args12.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
860
|
+
args[_key2] = _args12[_key2];
|
|
861
|
+
}
|
|
862
|
+
queryArgs = [].concat(args);
|
|
863
|
+
if (queryName.startsWith('findBy')) {
|
|
864
|
+
if (queryArgs.length === 1) {
|
|
865
|
+
queryArgs.push(undefined);
|
|
1422
866
|
}
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
}
|
|
1441
|
-
|
|
1442
|
-
_context8.next = 3;
|
|
1443
|
-
return (page != null ? page : getGlobalPage()).waitForNetworkIdle();
|
|
1444
|
-
|
|
1445
|
-
case 3:
|
|
1446
|
-
_context8.next = 5;
|
|
1447
|
-
return waitForPaintEnd(elementHandle, _extends({}, options, {
|
|
1448
|
-
fullPage: false
|
|
1449
|
-
}));
|
|
1450
|
-
|
|
1451
|
-
case 5:
|
|
1452
|
-
return _context8.abrupt("return", elementHandle.screenshot(normalizeSreenshotOptions(options)));
|
|
1453
|
-
|
|
1454
|
-
case 6:
|
|
1455
|
-
case "end":
|
|
1456
|
-
return _context8.stop();
|
|
1457
|
-
}
|
|
1458
|
-
}
|
|
1459
|
-
}, _callee8);
|
|
1460
|
-
}));
|
|
1461
|
-
|
|
1462
|
-
return function (_x12) {
|
|
1463
|
-
return _ref18.apply(this, arguments);
|
|
1464
|
-
};
|
|
1465
|
-
}();
|
|
1466
|
-
|
|
1467
|
-
newElementHandle.click = /*#__PURE__*/function () {
|
|
1468
|
-
var _ref19 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee9(options) {
|
|
1469
|
-
return runtime_1.wrap(function _callee9$(_context9) {
|
|
1470
|
-
while (1) {
|
|
1471
|
-
switch (_context9.prev = _context9.next) {
|
|
1472
|
-
case 0:
|
|
1473
|
-
_context9.next = 2;
|
|
1474
|
-
return scrollIntoView(elementHandle);
|
|
1475
|
-
|
|
1476
|
-
case 2:
|
|
1477
|
-
return _context9.abrupt("return", elementHandle.click(options));
|
|
1478
|
-
|
|
1479
|
-
case 3:
|
|
1480
|
-
case "end":
|
|
1481
|
-
return _context9.stop();
|
|
1482
|
-
}
|
|
1483
|
-
}
|
|
1484
|
-
}, _callee9);
|
|
1485
|
-
}));
|
|
1486
|
-
|
|
1487
|
-
return function (_x13) {
|
|
1488
|
-
return _ref19.apply(this, arguments);
|
|
1489
|
-
};
|
|
1490
|
-
}();
|
|
1491
|
-
|
|
1492
|
-
newElementHandle.type = /*#__PURE__*/function () {
|
|
1493
|
-
var _ref20 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee10(text, options) {
|
|
1494
|
-
return runtime_1.wrap(function _callee10$(_context10) {
|
|
1495
|
-
while (1) {
|
|
1496
|
-
switch (_context10.prev = _context10.next) {
|
|
1497
|
-
case 0:
|
|
1498
|
-
_context10.next = 2;
|
|
1499
|
-
return scrollIntoView(elementHandle);
|
|
1500
|
-
|
|
1501
|
-
case 2:
|
|
1502
|
-
return _context10.abrupt("return", elementHandle.type(text, options));
|
|
1503
|
-
|
|
1504
|
-
case 3:
|
|
1505
|
-
case "end":
|
|
1506
|
-
return _context10.stop();
|
|
867
|
+
queryArgs.push({
|
|
868
|
+
timeout: 10000
|
|
869
|
+
});
|
|
870
|
+
}
|
|
871
|
+
_context12.next = 11;
|
|
872
|
+
return queryFn.apply(void 0, [element != null ? element : body].concat(queryArgs));
|
|
873
|
+
case 11:
|
|
874
|
+
elementHandle = _context12.sent;
|
|
875
|
+
newElementHandle = Object.create(elementHandle);
|
|
876
|
+
newElementHandle.screenshot = /*#__PURE__*/function () {
|
|
877
|
+
var _ref18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(options) {
|
|
878
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
879
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
880
|
+
case 0:
|
|
881
|
+
if (options != null && options.skipNetworkWait) {
|
|
882
|
+
_context8.next = 3;
|
|
883
|
+
break;
|
|
1507
884
|
}
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
while (1) {
|
|
1521
|
-
switch (_context11.prev = _context11.next) {
|
|
1522
|
-
case 0:
|
|
1523
|
-
_context11.next = 2;
|
|
1524
|
-
return scrollIntoView(elementHandle);
|
|
1525
|
-
|
|
1526
|
-
case 2:
|
|
1527
|
-
return _context11.abrupt("return", elementHandle.select.apply(elementHandle, _args11));
|
|
1528
|
-
|
|
1529
|
-
case 3:
|
|
1530
|
-
case "end":
|
|
1531
|
-
return _context11.stop();
|
|
1532
|
-
}
|
|
885
|
+
_context8.next = 3;
|
|
886
|
+
return (page != null ? page : getGlobalPage()).waitForNetworkIdle();
|
|
887
|
+
case 3:
|
|
888
|
+
_context8.next = 5;
|
|
889
|
+
return waitForPaintEnd(elementHandle, _extends({}, options, {
|
|
890
|
+
fullPage: false
|
|
891
|
+
}));
|
|
892
|
+
case 5:
|
|
893
|
+
return _context8.abrupt("return", elementHandle.screenshot(normalizeSreenshotOptions(options)));
|
|
894
|
+
case 6:
|
|
895
|
+
case "end":
|
|
896
|
+
return _context8.stop();
|
|
1533
897
|
}
|
|
1534
|
-
},
|
|
898
|
+
}, _callee8);
|
|
1535
899
|
}));
|
|
1536
|
-
return
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
900
|
+
return function (_x12) {
|
|
901
|
+
return _ref18.apply(this, arguments);
|
|
902
|
+
};
|
|
903
|
+
}();
|
|
904
|
+
newElementHandle.click = /*#__PURE__*/function () {
|
|
905
|
+
var _ref19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(options) {
|
|
906
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
907
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
908
|
+
case 0:
|
|
909
|
+
_context9.next = 2;
|
|
910
|
+
return scrollIntoView(elementHandle);
|
|
911
|
+
case 2:
|
|
912
|
+
return _context9.abrupt("return", elementHandle.click(options));
|
|
913
|
+
case 3:
|
|
914
|
+
case "end":
|
|
915
|
+
return _context9.stop();
|
|
916
|
+
}
|
|
917
|
+
}, _callee9);
|
|
918
|
+
}));
|
|
919
|
+
return function (_x13) {
|
|
920
|
+
return _ref19.apply(this, arguments);
|
|
921
|
+
};
|
|
922
|
+
}();
|
|
923
|
+
newElementHandle.type = /*#__PURE__*/function () {
|
|
924
|
+
var _ref20 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(text, options) {
|
|
925
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
926
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
927
|
+
case 0:
|
|
928
|
+
_context10.next = 2;
|
|
929
|
+
return scrollIntoView(elementHandle);
|
|
930
|
+
case 2:
|
|
931
|
+
return _context10.abrupt("return", elementHandle.type(text, options));
|
|
932
|
+
case 3:
|
|
933
|
+
case "end":
|
|
934
|
+
return _context10.stop();
|
|
935
|
+
}
|
|
936
|
+
}, _callee10);
|
|
937
|
+
}));
|
|
938
|
+
return function (_x14, _x15) {
|
|
939
|
+
return _ref20.apply(this, arguments);
|
|
940
|
+
};
|
|
941
|
+
}();
|
|
942
|
+
newElementHandle.select = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
|
|
943
|
+
var _args11 = arguments;
|
|
944
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
945
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
946
|
+
case 0:
|
|
947
|
+
_context11.next = 2;
|
|
948
|
+
return scrollIntoView(elementHandle);
|
|
949
|
+
case 2:
|
|
950
|
+
return _context11.abrupt("return", elementHandle.select.apply(elementHandle, _args11));
|
|
951
|
+
case 3:
|
|
952
|
+
case "end":
|
|
953
|
+
return _context11.stop();
|
|
954
|
+
}
|
|
955
|
+
}, _callee11);
|
|
956
|
+
}));
|
|
957
|
+
return _context12.abrupt("return", newElementHandle);
|
|
958
|
+
case 18:
|
|
959
|
+
case "end":
|
|
960
|
+
return _context12.stop();
|
|
1542
961
|
}
|
|
1543
962
|
}, _callee12);
|
|
1544
963
|
}));
|
|
1545
964
|
};
|
|
1546
|
-
|
|
1547
965
|
for (var _i = 0, _Object$entries = Object.entries(pptrTestingLibrary.queries); _i < _Object$entries.length; _i++) {
|
|
1548
966
|
_loop();
|
|
1549
967
|
}
|
|
1550
|
-
|
|
1551
968
|
return boundQueries;
|
|
1552
969
|
};
|
|
1553
|
-
|
|
1554
970
|
var getScreen = function getScreen(page) {
|
|
1555
971
|
return buildQueryMethods({
|
|
1556
972
|
page: page
|
|
@@ -1562,52 +978,43 @@ var within = function within(element) {
|
|
|
1562
978
|
element: element
|
|
1563
979
|
});
|
|
1564
980
|
};
|
|
1565
|
-
beforeEach( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/
|
|
1566
|
-
return
|
|
1567
|
-
while (1) {
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
case 4:
|
|
1578
|
-
case "end":
|
|
1579
|
-
return _context13.stop();
|
|
1580
|
-
}
|
|
981
|
+
beforeEach( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
|
|
982
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
983
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
984
|
+
case 0:
|
|
985
|
+
_context13.next = 2;
|
|
986
|
+
return getGlobalPage().setRequestInterception(false);
|
|
987
|
+
case 2:
|
|
988
|
+
_context13.next = 4;
|
|
989
|
+
return global.jestPuppeteer.resetPage();
|
|
990
|
+
case 4:
|
|
991
|
+
case "end":
|
|
992
|
+
return _context13.stop();
|
|
1581
993
|
}
|
|
1582
994
|
}, _callee13);
|
|
1583
995
|
})));
|
|
1584
|
-
afterEach( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/
|
|
996
|
+
afterEach( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
|
|
1585
997
|
var page;
|
|
1586
|
-
return
|
|
1587
|
-
while (1) {
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
case 11:
|
|
1608
|
-
case "end":
|
|
1609
|
-
return _context14.stop();
|
|
1610
|
-
}
|
|
998
|
+
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
999
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
1000
|
+
case 0:
|
|
1001
|
+
_context14.prev = 0;
|
|
1002
|
+
page = getGlobalPage();
|
|
1003
|
+
requestHandlers = [];
|
|
1004
|
+
needsRequestInterception = false;
|
|
1005
|
+
page.off('request', requestInterceptor);
|
|
1006
|
+
// clear tab, this way we clear the DOM and stop js execution or pending requests
|
|
1007
|
+
_context14.next = 7;
|
|
1008
|
+
return page["goto"]('about:blank');
|
|
1009
|
+
case 7:
|
|
1010
|
+
_context14.next = 11;
|
|
1011
|
+
break;
|
|
1012
|
+
case 9:
|
|
1013
|
+
_context14.prev = 9;
|
|
1014
|
+
_context14.t0 = _context14["catch"](0);
|
|
1015
|
+
case 11:
|
|
1016
|
+
case "end":
|
|
1017
|
+
return _context14.stop();
|
|
1611
1018
|
}
|
|
1612
1019
|
}, _callee14, null, [[0, 9]]);
|
|
1613
1020
|
})));
|
|
@@ -1620,20 +1027,16 @@ afterEach( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
|
1620
1027
|
* To workaround this bug or limitation, this function prepares the file by copying it to /tmp in
|
|
1621
1028
|
* the host and the container.
|
|
1622
1029
|
*/
|
|
1623
|
-
|
|
1624
1030
|
var prepareFile = function prepareFile(filepath) {
|
|
1625
1031
|
var isLocal = !isCi;
|
|
1626
1032
|
var isHeadless = !!process.env.HEADLESS;
|
|
1627
1033
|
var usesDocker = isLocal && isHeadless;
|
|
1628
1034
|
var dockerComposeFile = path.join(__dirname, '..', 'docker-compose.yaml');
|
|
1629
|
-
|
|
1630
1035
|
if (usesDocker) {
|
|
1631
1036
|
var containerId = execSync("docker-compose -f " + dockerComposeFile + " ps -q").toString().trim();
|
|
1632
|
-
|
|
1633
1037
|
if (!containerId) {
|
|
1634
1038
|
throw Error('acceptance-testing container not found');
|
|
1635
1039
|
}
|
|
1636
|
-
|
|
1637
1040
|
execSync("docker cp " + filepath + " " + containerId + ":/tmp");
|
|
1638
1041
|
var newPath = path.join('/tmp', path.basename(filepath));
|
|
1639
1042
|
fs.copyFileSync(filepath, newPath);
|
|
@@ -1645,28 +1048,29 @@ var prepareFile = function prepareFile(filepath) {
|
|
|
1645
1048
|
/**
|
|
1646
1049
|
* A convenience method to defer an expectation
|
|
1647
1050
|
*/
|
|
1648
|
-
|
|
1649
1051
|
var wait = function wait(expectation, timeout, interval) {
|
|
1650
1052
|
if (timeout === void 0) {
|
|
1651
1053
|
timeout = 10000;
|
|
1652
1054
|
}
|
|
1653
|
-
|
|
1654
1055
|
if (interval === void 0) {
|
|
1655
1056
|
interval = 50;
|
|
1656
1057
|
}
|
|
1657
|
-
|
|
1658
1058
|
var startTime = Date.now();
|
|
1059
|
+
var startStack = new Error().stack;
|
|
1659
1060
|
return new Promise(function (resolve, reject) {
|
|
1660
1061
|
var rejectOrRerun = function rejectOrRerun(error) {
|
|
1661
1062
|
if (Date.now() - startTime >= timeout) {
|
|
1063
|
+
if (error instanceof Error) {
|
|
1064
|
+
if (error.message === 'Element not removed') {
|
|
1065
|
+
error.stack = startStack;
|
|
1066
|
+
}
|
|
1067
|
+
}
|
|
1662
1068
|
reject(error);
|
|
1663
1069
|
return;
|
|
1664
|
-
}
|
|
1665
|
-
|
|
1666
|
-
|
|
1070
|
+
}
|
|
1071
|
+
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
1667
1072
|
setTimeout(runExpectation, interval);
|
|
1668
1073
|
};
|
|
1669
|
-
|
|
1670
1074
|
var runExpectation = function runExpectation() {
|
|
1671
1075
|
try {
|
|
1672
1076
|
Promise.resolve(expectation()).then(function (r) {
|
|
@@ -1676,10 +1080,65 @@ var wait = function wait(expectation, timeout, interval) {
|
|
|
1676
1080
|
rejectOrRerun(error);
|
|
1677
1081
|
}
|
|
1678
1082
|
};
|
|
1679
|
-
|
|
1680
1083
|
setTimeout(runExpectation, 0);
|
|
1681
1084
|
});
|
|
1682
1085
|
};
|
|
1086
|
+
var waitForElementToBeRemoved = function waitForElementToBeRemoved(element, timeout, interval) {
|
|
1087
|
+
if (timeout === void 0) {
|
|
1088
|
+
timeout = 10000;
|
|
1089
|
+
}
|
|
1090
|
+
if (interval === void 0) {
|
|
1091
|
+
interval = 100;
|
|
1092
|
+
}
|
|
1093
|
+
var startStack = new Error().stack;
|
|
1094
|
+
var wait = /*#__PURE__*/function () {
|
|
1095
|
+
var _ref24 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
|
|
1096
|
+
var t0, box;
|
|
1097
|
+
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
1098
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
1099
|
+
case 0:
|
|
1100
|
+
t0 = Date.now();
|
|
1101
|
+
case 1:
|
|
1102
|
+
if (!(Date.now() - t0 < timeout)) {
|
|
1103
|
+
_context15.next = 11;
|
|
1104
|
+
break;
|
|
1105
|
+
}
|
|
1106
|
+
_context15.next = 4;
|
|
1107
|
+
return element.boundingBox();
|
|
1108
|
+
case 4:
|
|
1109
|
+
box = _context15.sent;
|
|
1110
|
+
if (box) {
|
|
1111
|
+
_context15.next = 7;
|
|
1112
|
+
break;
|
|
1113
|
+
}
|
|
1114
|
+
return _context15.abrupt("return");
|
|
1115
|
+
case 7:
|
|
1116
|
+
_context15.next = 9;
|
|
1117
|
+
return new Promise(function (resolve) {
|
|
1118
|
+
return setTimeout(resolve, interval);
|
|
1119
|
+
});
|
|
1120
|
+
case 9:
|
|
1121
|
+
_context15.next = 1;
|
|
1122
|
+
break;
|
|
1123
|
+
case 11:
|
|
1124
|
+
throw new Error('Element not removed');
|
|
1125
|
+
case 12:
|
|
1126
|
+
case "end":
|
|
1127
|
+
return _context15.stop();
|
|
1128
|
+
}
|
|
1129
|
+
}, _callee15);
|
|
1130
|
+
}));
|
|
1131
|
+
return function wait() {
|
|
1132
|
+
return _ref24.apply(this, arguments);
|
|
1133
|
+
};
|
|
1134
|
+
}();
|
|
1135
|
+
return wait()["catch"](function (error) {
|
|
1136
|
+
if (error.message === 'Element not removed') {
|
|
1137
|
+
error.stack = startStack;
|
|
1138
|
+
}
|
|
1139
|
+
throw error;
|
|
1140
|
+
});
|
|
1141
|
+
};
|
|
1683
1142
|
|
|
1684
1143
|
exports.createApiEndpointMock = createApiEndpointMock;
|
|
1685
1144
|
exports.getGlobalBrowser = getGlobalBrowser;
|
|
@@ -1693,5 +1152,6 @@ exports.screen = screen;
|
|
|
1693
1152
|
exports.serverHostName = serverHostName;
|
|
1694
1153
|
exports.serverPort = serverPort;
|
|
1695
1154
|
exports.wait = wait;
|
|
1155
|
+
exports.waitForElementToBeRemoved = waitForElementToBeRemoved;
|
|
1696
1156
|
exports.within = within;
|
|
1697
1157
|
//# sourceMappingURL=acceptance-testing.cjs.development.js.map
|