@telefonica/acceptance-testing 1.1.3 → 2.1.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/bin/test-acceptance.js +6 -2
- package/dist/acceptance-testing.cjs.development.js +1207 -354
- 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 +1204 -353
- package/dist/acceptance-testing.esm.js.map +1 -1
- package/dist/index.d.ts +21 -3
- package/dist/index.js.flow +149 -0
- package/docker-compose.yaml +1 -1
- package/jest-puppeteer-config.js +9 -2
- package/package.json +4 -4
|
@@ -10,6 +10,60 @@ var findRoot = _interopDefault(require('find-root'));
|
|
|
10
10
|
var pptrTestingLibrary = require('pptr-testing-library');
|
|
11
11
|
var jestImageSnapshot = require('jest-image-snapshot');
|
|
12
12
|
|
|
13
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
14
|
+
try {
|
|
15
|
+
var info = gen[key](arg);
|
|
16
|
+
var value = info.value;
|
|
17
|
+
} catch (error) {
|
|
18
|
+
reject(error);
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
if (info.done) {
|
|
23
|
+
resolve(value);
|
|
24
|
+
} else {
|
|
25
|
+
Promise.resolve(value).then(_next, _throw);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function _asyncToGenerator(fn) {
|
|
30
|
+
return function () {
|
|
31
|
+
var self = this,
|
|
32
|
+
args = arguments;
|
|
33
|
+
return new Promise(function (resolve, reject) {
|
|
34
|
+
var gen = fn.apply(self, args);
|
|
35
|
+
|
|
36
|
+
function _next(value) {
|
|
37
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function _throw(err) {
|
|
41
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
_next(undefined);
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function _extends() {
|
|
50
|
+
_extends = Object.assign || function (target) {
|
|
51
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
52
|
+
var source = arguments[i];
|
|
53
|
+
|
|
54
|
+
for (var key in source) {
|
|
55
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
56
|
+
target[key] = source[key];
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return target;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
return _extends.apply(this, arguments);
|
|
65
|
+
}
|
|
66
|
+
|
|
13
67
|
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
14
68
|
if (source == null) return {};
|
|
15
69
|
var target = {};
|
|
@@ -25,216 +79,746 @@ function _objectWithoutPropertiesLoose(source, excluded) {
|
|
|
25
79
|
return target;
|
|
26
80
|
}
|
|
27
81
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
82
|
+
function createCommonjsModule(fn, module) {
|
|
83
|
+
return module = { exports: {} }, fn(module, module.exports), module.exports;
|
|
84
|
+
}
|
|
31
85
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
86
|
+
var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
87
|
+
/**
|
|
88
|
+
* Copyright (c) 2014-present, Facebook, Inc.
|
|
89
|
+
*
|
|
90
|
+
* This source code is licensed under the MIT license found in the
|
|
91
|
+
* LICENSE file in the root directory of this source tree.
|
|
92
|
+
*/
|
|
93
|
+
var runtime = function (exports) {
|
|
94
|
+
|
|
95
|
+
var Op = Object.prototype;
|
|
96
|
+
var hasOwn = Op.hasOwnProperty;
|
|
97
|
+
var undefined$1; // More compressible than void 0.
|
|
98
|
+
|
|
99
|
+
var $Symbol = typeof Symbol === "function" ? Symbol : {};
|
|
100
|
+
var iteratorSymbol = $Symbol.iterator || "@@iterator";
|
|
101
|
+
var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
|
|
102
|
+
var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
|
103
|
+
|
|
104
|
+
function define(obj, key, value) {
|
|
105
|
+
Object.defineProperty(obj, key, {
|
|
106
|
+
value: value,
|
|
107
|
+
enumerable: true,
|
|
108
|
+
configurable: true,
|
|
109
|
+
writable: true
|
|
110
|
+
});
|
|
111
|
+
return obj[key];
|
|
112
|
+
}
|
|
35
113
|
|
|
36
|
-
|
|
37
|
-
|
|
114
|
+
try {
|
|
115
|
+
// IE 8 has a broken Object.defineProperty that only works on DOM objects.
|
|
116
|
+
define({}, "");
|
|
117
|
+
} catch (err) {
|
|
118
|
+
define = function define(obj, key, value) {
|
|
119
|
+
return obj[key] = value;
|
|
120
|
+
};
|
|
121
|
+
}
|
|
38
122
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
123
|
+
function wrap(innerFn, outerFn, self, tryLocsList) {
|
|
124
|
+
// If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
|
|
125
|
+
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
|
|
126
|
+
var generator = Object.create(protoGenerator.prototype);
|
|
127
|
+
var context = new Context(tryLocsList || []); // The ._invoke method unifies the implementations of the .next,
|
|
128
|
+
// .throw, and .return methods.
|
|
45
129
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
return this;
|
|
49
|
-
}
|
|
130
|
+
generator._invoke = makeInvokeMethod(innerFn, self, context);
|
|
131
|
+
return generator;
|
|
50
132
|
}
|
|
51
133
|
|
|
52
|
-
|
|
134
|
+
exports.wrap = wrap; // Try/catch helper to minimize deoptimizations. Returns a completion
|
|
135
|
+
// record like context.tryEntries[i].completion. This interface could
|
|
136
|
+
// have been (and was previously) designed to take a closure to be
|
|
137
|
+
// invoked without arguments, but in all the cases we care about we
|
|
138
|
+
// already have an existing method we want to call, so there's no need
|
|
139
|
+
// to create a new function object. We can even get away with assuming
|
|
140
|
+
// the method takes exactly one argument, since that happens to be true
|
|
141
|
+
// in every case, so we don't have to touch the arguments object. The
|
|
142
|
+
// only additional allocation required is the completion record, which
|
|
143
|
+
// has a stable shape and so hopefully should be cheap to allocate.
|
|
144
|
+
|
|
145
|
+
function tryCatch(fn, obj, arg) {
|
|
53
146
|
try {
|
|
54
|
-
|
|
147
|
+
return {
|
|
148
|
+
type: "normal",
|
|
149
|
+
arg: fn.call(obj, arg)
|
|
150
|
+
};
|
|
151
|
+
} catch (err) {
|
|
152
|
+
return {
|
|
153
|
+
type: "throw",
|
|
154
|
+
arg: err
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
var GenStateSuspendedStart = "suspendedStart";
|
|
160
|
+
var GenStateSuspendedYield = "suspendedYield";
|
|
161
|
+
var GenStateExecuting = "executing";
|
|
162
|
+
var GenStateCompleted = "completed"; // Returning this object from the innerFn has the same effect as
|
|
163
|
+
// breaking out of the dispatch switch statement.
|
|
164
|
+
|
|
165
|
+
var ContinueSentinel = {}; // Dummy constructor functions that we use as the .constructor and
|
|
166
|
+
// .constructor.prototype properties for functions that return Generator
|
|
167
|
+
// objects. For full spec compliance, you may wish to configure your
|
|
168
|
+
// minifier not to mangle the names of these two functions.
|
|
169
|
+
|
|
170
|
+
function Generator() {}
|
|
171
|
+
|
|
172
|
+
function GeneratorFunction() {}
|
|
173
|
+
|
|
174
|
+
function GeneratorFunctionPrototype() {} // This is a polyfill for %IteratorPrototype% for environments that
|
|
175
|
+
// don't natively support it.
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
var IteratorPrototype = {};
|
|
179
|
+
define(IteratorPrototype, iteratorSymbol, function () {
|
|
180
|
+
return this;
|
|
181
|
+
});
|
|
182
|
+
var getProto = Object.getPrototypeOf;
|
|
183
|
+
var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
|
55
184
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
185
|
+
if (NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
|
|
186
|
+
// This environment has a native %IteratorPrototype%; use it instead
|
|
187
|
+
// of the polyfill.
|
|
188
|
+
IteratorPrototype = NativeIteratorPrototype;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
|
|
192
|
+
GeneratorFunction.prototype = GeneratorFunctionPrototype;
|
|
193
|
+
define(Gp, "constructor", GeneratorFunctionPrototype);
|
|
194
|
+
define(GeneratorFunctionPrototype, "constructor", GeneratorFunction);
|
|
195
|
+
GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"); // Helper for defining the .next, .throw, and .return methods of the
|
|
196
|
+
// Iterator interface in terms of a single ._invoke method.
|
|
197
|
+
|
|
198
|
+
function defineIteratorMethods(prototype) {
|
|
199
|
+
["next", "throw", "return"].forEach(function (method) {
|
|
200
|
+
define(prototype, method, function (arg) {
|
|
201
|
+
return this._invoke(method, arg);
|
|
202
|
+
});
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
exports.isGeneratorFunction = function (genFun) {
|
|
207
|
+
var ctor = typeof genFun === "function" && genFun.constructor;
|
|
208
|
+
return ctor ? ctor === GeneratorFunction || // For the native GeneratorFunction constructor, the best we can
|
|
209
|
+
// do is to check its .name property.
|
|
210
|
+
(ctor.displayName || ctor.name) === "GeneratorFunction" : false;
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
exports.mark = function (genFun) {
|
|
214
|
+
if (Object.setPrototypeOf) {
|
|
215
|
+
Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
|
|
216
|
+
} else {
|
|
217
|
+
genFun.__proto__ = GeneratorFunctionPrototype;
|
|
218
|
+
define(genFun, toStringTagSymbol, "GeneratorFunction");
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
genFun.prototype = Object.create(Gp);
|
|
222
|
+
return genFun;
|
|
223
|
+
}; // Within the body of any async function, `await x` is transformed to
|
|
224
|
+
// `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
|
|
225
|
+
// `hasOwn.call(value, "__await")` to determine if the yielded value is
|
|
226
|
+
// meant to be awaited.
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
exports.awrap = function (arg) {
|
|
230
|
+
return {
|
|
231
|
+
__await: arg
|
|
232
|
+
};
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
function AsyncIterator(generator, PromiseImpl) {
|
|
236
|
+
function invoke(method, arg, resolve, reject) {
|
|
237
|
+
var record = tryCatch(generator[method], generator, arg);
|
|
238
|
+
|
|
239
|
+
if (record.type === "throw") {
|
|
240
|
+
reject(record.arg);
|
|
60
241
|
} else {
|
|
61
|
-
|
|
242
|
+
var result = record.arg;
|
|
243
|
+
var value = result.value;
|
|
244
|
+
|
|
245
|
+
if (value && typeof value === "object" && hasOwn.call(value, "__await")) {
|
|
246
|
+
return PromiseImpl.resolve(value.__await).then(function (value) {
|
|
247
|
+
invoke("next", value, resolve, reject);
|
|
248
|
+
}, function (err) {
|
|
249
|
+
invoke("throw", err, resolve, reject);
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
return PromiseImpl.resolve(value).then(function (unwrapped) {
|
|
254
|
+
// When a yielded Promise is resolved, its final value becomes
|
|
255
|
+
// the .value of the Promise<{value,done}> result for the
|
|
256
|
+
// current iteration.
|
|
257
|
+
result.value = unwrapped;
|
|
258
|
+
resolve(result);
|
|
259
|
+
}, function (error) {
|
|
260
|
+
// If a rejected Promise was yielded, throw the rejection back
|
|
261
|
+
// into the async generator function so it can be handled there.
|
|
262
|
+
return invoke("throw", error, resolve, reject);
|
|
263
|
+
});
|
|
62
264
|
}
|
|
63
|
-
} catch (e) {
|
|
64
|
-
_settle(result, 2, e);
|
|
65
265
|
}
|
|
266
|
+
|
|
267
|
+
var previousPromise;
|
|
268
|
+
|
|
269
|
+
function enqueue(method, arg) {
|
|
270
|
+
function callInvokeWithMethodAndArg() {
|
|
271
|
+
return new PromiseImpl(function (resolve, reject) {
|
|
272
|
+
invoke(method, arg, resolve, reject);
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
return previousPromise = // If enqueue has been called before, then we want to wait until
|
|
277
|
+
// all previous Promises have been resolved before calling invoke,
|
|
278
|
+
// so that results are always delivered in the correct order. If
|
|
279
|
+
// enqueue has not been called before, then it is important to
|
|
280
|
+
// call invoke immediately, without waiting on a callback to fire,
|
|
281
|
+
// so that the async generator function has the opportunity to do
|
|
282
|
+
// any necessary setup in a predictable way. This predictability
|
|
283
|
+
// is why the Promise constructor synchronously invokes its
|
|
284
|
+
// executor callback, and why async functions synchronously
|
|
285
|
+
// execute code before the first await. Since we implement simple
|
|
286
|
+
// async functions in terms of async generators, it is especially
|
|
287
|
+
// important to get this right, even though it requires care.
|
|
288
|
+
previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, // Avoid propagating failures to Promises returned by later
|
|
289
|
+
// invocations of the iterator.
|
|
290
|
+
callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
291
|
+
} // Define the unified helper method that is used to implement .next,
|
|
292
|
+
// .throw, and .return (see defineIteratorMethods).
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
this._invoke = enqueue;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
defineIteratorMethods(AsyncIterator.prototype);
|
|
299
|
+
define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
|
|
300
|
+
return this;
|
|
301
|
+
});
|
|
302
|
+
exports.AsyncIterator = AsyncIterator; // Note that simple async functions are implemented on top of
|
|
303
|
+
// AsyncIterator objects; they just return a Promise for the value of
|
|
304
|
+
// the final result produced by the iterator.
|
|
305
|
+
|
|
306
|
+
exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
|
|
307
|
+
if (PromiseImpl === void 0) PromiseImpl = Promise;
|
|
308
|
+
var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
|
|
309
|
+
return exports.isGeneratorFunction(outerFn) ? iter // If outerFn is a generator, return the full iterator.
|
|
310
|
+
: iter.next().then(function (result) {
|
|
311
|
+
return result.done ? result.value : iter.next();
|
|
312
|
+
});
|
|
66
313
|
};
|
|
67
314
|
|
|
68
|
-
|
|
69
|
-
|
|
315
|
+
function makeInvokeMethod(innerFn, self, context) {
|
|
316
|
+
var state = GenStateSuspendedStart;
|
|
317
|
+
return function invoke(method, arg) {
|
|
318
|
+
if (state === GenStateExecuting) {
|
|
319
|
+
throw new Error("Generator is already running");
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
if (state === GenStateCompleted) {
|
|
323
|
+
if (method === "throw") {
|
|
324
|
+
throw arg;
|
|
325
|
+
} // Be forgiving, per 25.3.3.3.3 of the spec:
|
|
326
|
+
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
|
|
70
327
|
|
|
71
|
-
return _Pact;
|
|
72
|
-
}(); // Settles a pact synchronously
|
|
73
328
|
|
|
74
|
-
|
|
75
|
-
if (!pact.s) {
|
|
76
|
-
if (value instanceof _Pact) {
|
|
77
|
-
if (value.s) {
|
|
78
|
-
if (state & 1) {
|
|
79
|
-
state = value.s;
|
|
329
|
+
return doneResult();
|
|
80
330
|
}
|
|
81
331
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
332
|
+
context.method = method;
|
|
333
|
+
context.arg = arg;
|
|
334
|
+
|
|
335
|
+
while (true) {
|
|
336
|
+
var delegate = context.delegate;
|
|
337
|
+
|
|
338
|
+
if (delegate) {
|
|
339
|
+
var delegateResult = maybeInvokeDelegate(delegate, context);
|
|
340
|
+
|
|
341
|
+
if (delegateResult) {
|
|
342
|
+
if (delegateResult === ContinueSentinel) continue;
|
|
343
|
+
return delegateResult;
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
if (context.method === "next") {
|
|
348
|
+
// Setting context._sent for legacy support of Babel's
|
|
349
|
+
// function.sent implementation.
|
|
350
|
+
context.sent = context._sent = context.arg;
|
|
351
|
+
} else if (context.method === "throw") {
|
|
352
|
+
if (state === GenStateSuspendedStart) {
|
|
353
|
+
state = GenStateCompleted;
|
|
354
|
+
throw context.arg;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
context.dispatchException(context.arg);
|
|
358
|
+
} else if (context.method === "return") {
|
|
359
|
+
context.abrupt("return", context.arg);
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
state = GenStateExecuting;
|
|
363
|
+
var record = tryCatch(innerFn, self, context);
|
|
364
|
+
|
|
365
|
+
if (record.type === "normal") {
|
|
366
|
+
// If an exception is thrown from innerFn, we leave state ===
|
|
367
|
+
// GenStateExecuting and loop back for another invocation.
|
|
368
|
+
state = context.done ? GenStateCompleted : GenStateSuspendedYield;
|
|
369
|
+
|
|
370
|
+
if (record.arg === ContinueSentinel) {
|
|
371
|
+
continue;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
return {
|
|
375
|
+
value: record.arg,
|
|
376
|
+
done: context.done
|
|
377
|
+
};
|
|
378
|
+
} else if (record.type === "throw") {
|
|
379
|
+
state = GenStateCompleted; // Dispatch the exception by looping back around to the
|
|
380
|
+
// context.dispatchException(context.arg) call above.
|
|
381
|
+
|
|
382
|
+
context.method = "throw";
|
|
383
|
+
context.arg = record.arg;
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
};
|
|
387
|
+
} // Call delegate.iterator[context.method](context.arg) and handle the
|
|
388
|
+
// result, either by returning a { value, done } result from the
|
|
389
|
+
// delegate iterator, or by modifying context.method and context.arg,
|
|
390
|
+
// setting context.delegate to null, and returning the ContinueSentinel.
|
|
391
|
+
|
|
392
|
+
|
|
393
|
+
function maybeInvokeDelegate(delegate, context) {
|
|
394
|
+
var method = delegate.iterator[context.method];
|
|
395
|
+
|
|
396
|
+
if (method === undefined$1) {
|
|
397
|
+
// A .throw or .return when the delegate iterator has no .throw
|
|
398
|
+
// method always terminates the yield* loop.
|
|
399
|
+
context.delegate = null;
|
|
400
|
+
|
|
401
|
+
if (context.method === "throw") {
|
|
402
|
+
// Note: ["return"] must be used for ES3 parsing compatibility.
|
|
403
|
+
if (delegate.iterator["return"]) {
|
|
404
|
+
// If the delegate iterator has a return method, give it a
|
|
405
|
+
// chance to clean up.
|
|
406
|
+
context.method = "return";
|
|
407
|
+
context.arg = undefined$1;
|
|
408
|
+
maybeInvokeDelegate(delegate, context);
|
|
409
|
+
|
|
410
|
+
if (context.method === "throw") {
|
|
411
|
+
// If maybeInvokeDelegate(context) changed context.method from
|
|
412
|
+
// "return" to "throw", let that override the TypeError below.
|
|
413
|
+
return ContinueSentinel;
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
context.method = "throw";
|
|
418
|
+
context.arg = new TypeError("The iterator does not provide a 'throw' method");
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
return ContinueSentinel;
|
|
86
422
|
}
|
|
87
|
-
}
|
|
88
423
|
|
|
89
|
-
|
|
90
|
-
value.then(_settle.bind(null, pact, state), _settle.bind(null, pact, 2));
|
|
91
|
-
return;
|
|
92
|
-
}
|
|
424
|
+
var record = tryCatch(method, delegate.iterator, context.arg);
|
|
93
425
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
426
|
+
if (record.type === "throw") {
|
|
427
|
+
context.method = "throw";
|
|
428
|
+
context.arg = record.arg;
|
|
429
|
+
context.delegate = null;
|
|
430
|
+
return ContinueSentinel;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
var info = record.arg;
|
|
434
|
+
|
|
435
|
+
if (!info) {
|
|
436
|
+
context.method = "throw";
|
|
437
|
+
context.arg = new TypeError("iterator result is not an object");
|
|
438
|
+
context.delegate = null;
|
|
439
|
+
return ContinueSentinel;
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
if (info.done) {
|
|
443
|
+
// Assign the result of the finished delegate to the temporary
|
|
444
|
+
// variable specified by delegate.resultName (see delegateYield).
|
|
445
|
+
context[delegate.resultName] = info.value; // Resume execution at the desired location (see delegateYield).
|
|
446
|
+
|
|
447
|
+
context.next = delegate.nextLoc; // If context.method was "throw" but the delegate handled the
|
|
448
|
+
// exception, let the outer generator proceed normally. If
|
|
449
|
+
// context.method was "next", forget context.arg since it has been
|
|
450
|
+
// "consumed" by the delegate iterator. If context.method was
|
|
451
|
+
// "return", allow the original .return call to continue in the
|
|
452
|
+
// outer generator.
|
|
453
|
+
|
|
454
|
+
if (context.method !== "return") {
|
|
455
|
+
context.method = "next";
|
|
456
|
+
context.arg = undefined$1;
|
|
457
|
+
}
|
|
458
|
+
} else {
|
|
459
|
+
// Re-yield the result returned by the delegate method.
|
|
460
|
+
return info;
|
|
461
|
+
} // The delegate iterator is finished, so forget it and continue with
|
|
462
|
+
// the outer generator.
|
|
463
|
+
|
|
464
|
+
|
|
465
|
+
context.delegate = null;
|
|
466
|
+
return ContinueSentinel;
|
|
467
|
+
} // Define Generator.prototype.{next,throw,return} in terms of the
|
|
468
|
+
// unified ._invoke helper method.
|
|
97
469
|
|
|
98
|
-
if (observer) {
|
|
99
|
-
observer(pact);
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
function _isSettledPact(thenable) {
|
|
104
|
-
return thenable instanceof _Pact && thenable.s & 1;
|
|
105
|
-
} // Converts argument to a function that always returns a Promise
|
|
106
|
-
var _iteratorSymbol = /*#__PURE__*/typeof Symbol !== "undefined" ? Symbol.iterator || (Symbol.iterator = /*#__PURE__*/Symbol("Symbol.iterator")) : "@@iterator"; // Asynchronously iterate through an object's values
|
|
107
|
-
var _asyncIteratorSymbol = /*#__PURE__*/typeof Symbol !== "undefined" ? Symbol.asyncIterator || (Symbol.asyncIterator = /*#__PURE__*/Symbol("Symbol.asyncIterator")) : "@@asyncIterator"; // Asynchronously iterate on a value using it's async iterator if present, or its synchronous iterator if missing
|
|
108
470
|
|
|
109
|
-
|
|
110
|
-
|
|
471
|
+
defineIteratorMethods(Gp);
|
|
472
|
+
define(Gp, toStringTagSymbol, "Generator"); // A Generator should always return itself as the iterator object when the
|
|
473
|
+
// @@iterator function is called on it. Some browsers' implementations of the
|
|
474
|
+
// iterator prototype chain incorrectly implement this, causing the Generator
|
|
475
|
+
// object to not be returned from this call. This ensures that doesn't happen.
|
|
476
|
+
// See https://github.com/facebook/regenerator/issues/274 for more details.
|
|
111
477
|
|
|
112
|
-
|
|
113
|
-
|
|
478
|
+
define(Gp, iteratorSymbol, function () {
|
|
479
|
+
return this;
|
|
480
|
+
});
|
|
481
|
+
define(Gp, "toString", function () {
|
|
482
|
+
return "[object Generator]";
|
|
483
|
+
});
|
|
484
|
+
|
|
485
|
+
function pushTryEntry(locs) {
|
|
486
|
+
var entry = {
|
|
487
|
+
tryLoc: locs[0]
|
|
488
|
+
};
|
|
489
|
+
|
|
490
|
+
if (1 in locs) {
|
|
491
|
+
entry.catchLoc = locs[1];
|
|
492
|
+
}
|
|
114
493
|
|
|
115
|
-
|
|
116
|
-
|
|
494
|
+
if (2 in locs) {
|
|
495
|
+
entry.finallyLoc = locs[2];
|
|
496
|
+
entry.afterLoc = locs[3];
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
this.tryEntries.push(entry);
|
|
117
500
|
}
|
|
118
501
|
|
|
119
|
-
|
|
120
|
-
|
|
502
|
+
function resetTryEntry(entry) {
|
|
503
|
+
var record = entry.completion || {};
|
|
504
|
+
record.type = "normal";
|
|
505
|
+
delete record.arg;
|
|
506
|
+
entry.completion = record;
|
|
121
507
|
}
|
|
122
508
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
509
|
+
function Context(tryLocsList) {
|
|
510
|
+
// The root entry object (effectively a try statement without a catch
|
|
511
|
+
// or a finally block) gives us a place to store values thrown from
|
|
512
|
+
// locations where there is no enclosing try statement.
|
|
513
|
+
this.tryEntries = [{
|
|
514
|
+
tryLoc: "root"
|
|
515
|
+
}];
|
|
516
|
+
tryLocsList.forEach(pushTryEntry, this);
|
|
517
|
+
this.reset(true);
|
|
126
518
|
}
|
|
127
519
|
|
|
128
|
-
|
|
520
|
+
exports.keys = function (object) {
|
|
521
|
+
var keys = [];
|
|
129
522
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
result = result.s;
|
|
133
|
-
} else {
|
|
134
|
-
stage = 1;
|
|
135
|
-
break;
|
|
523
|
+
for (var key in object) {
|
|
524
|
+
keys.push(key);
|
|
136
525
|
}
|
|
526
|
+
|
|
527
|
+
keys.reverse(); // Rather than returning an object with a next method, we keep
|
|
528
|
+
// things simple and return the next function itself.
|
|
529
|
+
|
|
530
|
+
return function next() {
|
|
531
|
+
while (keys.length) {
|
|
532
|
+
var key = keys.pop();
|
|
533
|
+
|
|
534
|
+
if (key in object) {
|
|
535
|
+
next.value = key;
|
|
536
|
+
next.done = false;
|
|
537
|
+
return next;
|
|
538
|
+
}
|
|
539
|
+
} // To avoid creating an additional object, we just hang the .value
|
|
540
|
+
// and .done properties off the next function object itself. This
|
|
541
|
+
// also ensures that the minifier will not anonymize the function.
|
|
542
|
+
|
|
543
|
+
|
|
544
|
+
next.done = true;
|
|
545
|
+
return next;
|
|
546
|
+
};
|
|
547
|
+
};
|
|
548
|
+
|
|
549
|
+
function values(iterable) {
|
|
550
|
+
if (iterable) {
|
|
551
|
+
var iteratorMethod = iterable[iteratorSymbol];
|
|
552
|
+
|
|
553
|
+
if (iteratorMethod) {
|
|
554
|
+
return iteratorMethod.call(iterable);
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
if (typeof iterable.next === "function") {
|
|
558
|
+
return iterable;
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
if (!isNaN(iterable.length)) {
|
|
562
|
+
var i = -1,
|
|
563
|
+
next = function next() {
|
|
564
|
+
while (++i < iterable.length) {
|
|
565
|
+
if (hasOwn.call(iterable, i)) {
|
|
566
|
+
next.value = iterable[i];
|
|
567
|
+
next.done = false;
|
|
568
|
+
return next;
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
next.value = undefined$1;
|
|
573
|
+
next.done = true;
|
|
574
|
+
return next;
|
|
575
|
+
};
|
|
576
|
+
|
|
577
|
+
return next.next = next;
|
|
578
|
+
}
|
|
579
|
+
} // Return an iterator with no values.
|
|
580
|
+
|
|
581
|
+
|
|
582
|
+
return {
|
|
583
|
+
next: doneResult
|
|
584
|
+
};
|
|
137
585
|
}
|
|
138
586
|
|
|
139
|
-
|
|
140
|
-
var updateValue = update();
|
|
587
|
+
exports.values = values;
|
|
141
588
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
589
|
+
function doneResult() {
|
|
590
|
+
return {
|
|
591
|
+
value: undefined$1,
|
|
592
|
+
done: true
|
|
593
|
+
};
|
|
146
594
|
}
|
|
147
|
-
}
|
|
148
595
|
|
|
149
|
-
|
|
596
|
+
Context.prototype = {
|
|
597
|
+
constructor: Context,
|
|
598
|
+
reset: function reset(skipTempReset) {
|
|
599
|
+
this.prev = 0;
|
|
600
|
+
this.next = 0; // Resetting context._sent for legacy support of Babel's
|
|
601
|
+
// function.sent implementation.
|
|
602
|
+
|
|
603
|
+
this.sent = this._sent = undefined$1;
|
|
604
|
+
this.done = false;
|
|
605
|
+
this.delegate = null;
|
|
606
|
+
this.method = "next";
|
|
607
|
+
this.arg = undefined$1;
|
|
608
|
+
this.tryEntries.forEach(resetTryEntry);
|
|
609
|
+
|
|
610
|
+
if (!skipTempReset) {
|
|
611
|
+
for (var name in this) {
|
|
612
|
+
// Not sure about the optimal order of these conditions:
|
|
613
|
+
if (name.charAt(0) === "t" && hasOwn.call(this, name) && !isNaN(+name.slice(1))) {
|
|
614
|
+
this[name] = undefined$1;
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
},
|
|
619
|
+
stop: function stop() {
|
|
620
|
+
this.done = true;
|
|
621
|
+
var rootEntry = this.tryEntries[0];
|
|
622
|
+
var rootRecord = rootEntry.completion;
|
|
623
|
+
|
|
624
|
+
if (rootRecord.type === "throw") {
|
|
625
|
+
throw rootRecord.arg;
|
|
626
|
+
}
|
|
150
627
|
|
|
151
|
-
|
|
628
|
+
return this.rval;
|
|
629
|
+
},
|
|
630
|
+
dispatchException: function dispatchException(exception) {
|
|
631
|
+
if (this.done) {
|
|
632
|
+
throw exception;
|
|
633
|
+
}
|
|
152
634
|
|
|
153
|
-
|
|
154
|
-
return pact;
|
|
635
|
+
var context = this;
|
|
155
636
|
|
|
156
|
-
|
|
157
|
-
|
|
637
|
+
function handle(loc, caught) {
|
|
638
|
+
record.type = "throw";
|
|
639
|
+
record.arg = exception;
|
|
640
|
+
context.next = loc;
|
|
158
641
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
642
|
+
if (caught) {
|
|
643
|
+
// If the dispatched exception was caught by a catch block,
|
|
644
|
+
// then let that catch block handle the exception normally.
|
|
645
|
+
context.method = "next";
|
|
646
|
+
context.arg = undefined$1;
|
|
647
|
+
}
|
|
162
648
|
|
|
163
|
-
|
|
164
|
-
updateValue.then(_resumeAfterUpdate).then(void 0, reject);
|
|
165
|
-
return;
|
|
649
|
+
return !!caught;
|
|
166
650
|
}
|
|
167
|
-
}
|
|
168
651
|
|
|
169
|
-
|
|
652
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
653
|
+
var entry = this.tryEntries[i];
|
|
654
|
+
var record = entry.completion;
|
|
170
655
|
|
|
171
|
-
|
|
172
|
-
|
|
656
|
+
if (entry.tryLoc === "root") {
|
|
657
|
+
// Exception thrown outside of any try block that could handle
|
|
658
|
+
// it, so set the completion value of the entire function to
|
|
659
|
+
// throw the exception.
|
|
660
|
+
return handle("end");
|
|
661
|
+
}
|
|
173
662
|
|
|
174
|
-
|
|
175
|
-
|
|
663
|
+
if (entry.tryLoc <= this.prev) {
|
|
664
|
+
var hasCatch = hasOwn.call(entry, "catchLoc");
|
|
665
|
+
var hasFinally = hasOwn.call(entry, "finallyLoc");
|
|
176
666
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
667
|
+
if (hasCatch && hasFinally) {
|
|
668
|
+
if (this.prev < entry.catchLoc) {
|
|
669
|
+
return handle(entry.catchLoc, true);
|
|
670
|
+
} else if (this.prev < entry.finallyLoc) {
|
|
671
|
+
return handle(entry.finallyLoc);
|
|
672
|
+
}
|
|
673
|
+
} else if (hasCatch) {
|
|
674
|
+
if (this.prev < entry.catchLoc) {
|
|
675
|
+
return handle(entry.catchLoc, true);
|
|
676
|
+
}
|
|
677
|
+
} else if (hasFinally) {
|
|
678
|
+
if (this.prev < entry.finallyLoc) {
|
|
679
|
+
return handle(entry.finallyLoc);
|
|
680
|
+
}
|
|
681
|
+
} else {
|
|
682
|
+
throw new Error("try statement without catch or finally");
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
},
|
|
687
|
+
abrupt: function abrupt(type, arg) {
|
|
688
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
689
|
+
var entry = this.tryEntries[i];
|
|
690
|
+
|
|
691
|
+
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
|
|
692
|
+
var finallyEntry = entry;
|
|
693
|
+
break;
|
|
694
|
+
}
|
|
695
|
+
}
|
|
181
696
|
|
|
182
|
-
|
|
697
|
+
if (finallyEntry && (type === "break" || type === "continue") && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc) {
|
|
698
|
+
// Ignore the finally entry if control is not jumping to a
|
|
699
|
+
// location outside the try/catch block.
|
|
700
|
+
finallyEntry = null;
|
|
701
|
+
}
|
|
183
702
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
} while (!result || !result.then);
|
|
703
|
+
var record = finallyEntry ? finallyEntry.completion : {};
|
|
704
|
+
record.type = type;
|
|
705
|
+
record.arg = arg;
|
|
188
706
|
|
|
189
|
-
|
|
190
|
-
|
|
707
|
+
if (finallyEntry) {
|
|
708
|
+
this.method = "next";
|
|
709
|
+
this.next = finallyEntry.finallyLoc;
|
|
710
|
+
return ContinueSentinel;
|
|
711
|
+
}
|
|
191
712
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
713
|
+
return this.complete(record);
|
|
714
|
+
},
|
|
715
|
+
complete: function complete(record, afterLoc) {
|
|
716
|
+
if (record.type === "throw") {
|
|
717
|
+
throw record.arg;
|
|
718
|
+
}
|
|
195
719
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
720
|
+
if (record.type === "break" || record.type === "continue") {
|
|
721
|
+
this.next = record.arg;
|
|
722
|
+
} else if (record.type === "return") {
|
|
723
|
+
this.rval = this.arg = record.arg;
|
|
724
|
+
this.method = "return";
|
|
725
|
+
this.next = "end";
|
|
726
|
+
} else if (record.type === "normal" && afterLoc) {
|
|
727
|
+
this.next = afterLoc;
|
|
728
|
+
}
|
|
205
729
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
730
|
+
return ContinueSentinel;
|
|
731
|
+
},
|
|
732
|
+
finish: function finish(finallyLoc) {
|
|
733
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
734
|
+
var entry = this.tryEntries[i];
|
|
735
|
+
|
|
736
|
+
if (entry.finallyLoc === finallyLoc) {
|
|
737
|
+
this.complete(entry.completion, entry.afterLoc);
|
|
738
|
+
resetTryEntry(entry);
|
|
739
|
+
return ContinueSentinel;
|
|
740
|
+
}
|
|
741
|
+
}
|
|
742
|
+
},
|
|
743
|
+
"catch": function _catch(tryLoc) {
|
|
744
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
745
|
+
var entry = this.tryEntries[i];
|
|
746
|
+
|
|
747
|
+
if (entry.tryLoc === tryLoc) {
|
|
748
|
+
var record = entry.completion;
|
|
749
|
+
|
|
750
|
+
if (record.type === "throw") {
|
|
751
|
+
var thrown = record.arg;
|
|
752
|
+
resetTryEntry(entry);
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
return thrown;
|
|
756
|
+
}
|
|
757
|
+
} // The context.catch method must only be called with a location
|
|
758
|
+
// argument that corresponds to a known catch block.
|
|
759
|
+
|
|
760
|
+
|
|
761
|
+
throw new Error("illegal catch attempt");
|
|
762
|
+
},
|
|
763
|
+
delegateYield: function delegateYield(iterable, resultName, nextLoc) {
|
|
764
|
+
this.delegate = {
|
|
765
|
+
iterator: values(iterable),
|
|
766
|
+
resultName: resultName,
|
|
767
|
+
nextLoc: nextLoc
|
|
768
|
+
};
|
|
769
|
+
|
|
770
|
+
if (this.method === "next") {
|
|
771
|
+
// Deliberately forget the last sent value so that we don't
|
|
772
|
+
// accidentally pass it on to the delegate.
|
|
773
|
+
this.arg = undefined$1;
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
return ContinueSentinel;
|
|
212
777
|
}
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
778
|
+
}; // Regardless of whether this script is executing as a CommonJS module
|
|
779
|
+
// or not, return the runtime object so that we can declare the variable
|
|
780
|
+
// regeneratorRuntime in the outer scope, which allows this module to be
|
|
781
|
+
// injected easily by `bin/regenerator --include-runtime script.js`.
|
|
782
|
+
|
|
783
|
+
return exports;
|
|
784
|
+
}( // If this script is executing as a CommonJS module, use module.exports
|
|
785
|
+
// as the regeneratorRuntime namespace. Otherwise create a new empty
|
|
786
|
+
// object. Either way, the resulting object will be used to initialize
|
|
787
|
+
// the regeneratorRuntime variable at the top of this file.
|
|
788
|
+
module.exports );
|
|
218
789
|
|
|
219
|
-
function _catch(body, recover) {
|
|
220
790
|
try {
|
|
221
|
-
|
|
222
|
-
} catch (
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
791
|
+
regeneratorRuntime = runtime;
|
|
792
|
+
} catch (accidentalStrictMode) {
|
|
793
|
+
// This module should not be running in strict mode, so the above
|
|
794
|
+
// assignment should always work unless something is misconfigured. Just
|
|
795
|
+
// in case runtime.js accidentally runs in strict mode, in modern engines
|
|
796
|
+
// we can explicitly access globalThis. In older engines we can escape
|
|
797
|
+
// strict mode using a global Function call. This could conceivably fail
|
|
798
|
+
// if a Content Security Policy forbids using Function, but in that case
|
|
799
|
+
// the proper solution is to fix the accidental strict mode problem. If
|
|
800
|
+
// you've misconfigured your bundler to force strict mode and applied a
|
|
801
|
+
// CSP to forbid Function, and you're not willing to fix either of those
|
|
802
|
+
// problems, please detail your unique predicament in a GitHub issue.
|
|
803
|
+
if (typeof globalThis === "object") {
|
|
804
|
+
globalThis.regeneratorRuntime = runtime;
|
|
805
|
+
} else {
|
|
806
|
+
Function("r", "regeneratorRuntime = r")(runtime);
|
|
807
|
+
}
|
|
228
808
|
}
|
|
809
|
+
});
|
|
229
810
|
|
|
230
|
-
|
|
231
|
-
} // Asynchronously await a promise and pass the result to a finally continuation
|
|
811
|
+
var _excluded = ["userAgent", "isDarkMode", "viewport", "cookies"];
|
|
232
812
|
|
|
233
813
|
var _pkg$acceptanceTests, _ref;
|
|
234
|
-
var
|
|
235
|
-
|
|
814
|
+
var getGlobalBrowser = function getGlobalBrowser() {
|
|
815
|
+
return global.browser;
|
|
816
|
+
};
|
|
817
|
+
var getGlobalPage = function getGlobalPage() {
|
|
818
|
+
return global.page;
|
|
819
|
+
};
|
|
236
820
|
var isCi = /*#__PURE__*/process.argv.includes('--ci') || process.env.CI;
|
|
237
|
-
var isUsingDockerizedChromium = isCi || /*#__PURE__*/new URL( /*#__PURE__*/
|
|
821
|
+
var isUsingDockerizedChromium = isCi || /*#__PURE__*/new URL( /*#__PURE__*/getGlobalBrowser().wsEndpoint()).port === '9223';
|
|
238
822
|
var serverHostName = /*#__PURE__*/function () {
|
|
239
823
|
if (isCi) {
|
|
240
824
|
return 'localhost';
|
|
@@ -248,12 +832,16 @@ var serverHostName = /*#__PURE__*/function () {
|
|
|
248
832
|
}();
|
|
249
833
|
var rootDir = /*#__PURE__*/findRoot( /*#__PURE__*/process.cwd());
|
|
250
834
|
var pkg = /*#__PURE__*/JSON.parse( /*#__PURE__*/fs.readFileSync( /*#__PURE__*/path.join(rootDir, 'package.json'), 'utf-8'));
|
|
251
|
-
var projectConfig = (_pkg$acceptanceTests = pkg.acceptanceTests)
|
|
252
|
-
var server = (_ref = isCi ? projectConfig.ciServer : projectConfig.devServer)
|
|
253
|
-
var serverPort = server
|
|
835
|
+
var projectConfig = (_pkg$acceptanceTests = pkg.acceptanceTests) != null ? _pkg$acceptanceTests : {};
|
|
836
|
+
var server = (_ref = isCi ? projectConfig.ciServer : projectConfig.devServer) != null ? _ref : projectConfig.server;
|
|
837
|
+
var serverPort = server == null ? void 0 : server.port;
|
|
254
838
|
var toMatchImageSnapshot = /*#__PURE__*/jestImageSnapshot.configureToMatchImageSnapshot({
|
|
255
839
|
failureThreshold: 0,
|
|
256
|
-
failureThresholdType: 'percent'
|
|
840
|
+
failureThresholdType: 'percent',
|
|
841
|
+
customSnapshotIdentifier: function customSnapshotIdentifier(_ref2) {
|
|
842
|
+
var defaultIdentifier = _ref2.defaultIdentifier;
|
|
843
|
+
return defaultIdentifier;
|
|
844
|
+
}
|
|
257
845
|
});
|
|
258
846
|
var calledToMatchImageSnapshotOutsideDocker = false;
|
|
259
847
|
|
|
@@ -280,234 +868,467 @@ afterEach(function () {
|
|
|
280
868
|
}
|
|
281
869
|
});
|
|
282
870
|
|
|
283
|
-
var waitForPaintEnd = function
|
|
284
|
-
var
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
871
|
+
var waitForPaintEnd = /*#__PURE__*/function () {
|
|
872
|
+
var _ref3 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(element, _temp) {
|
|
873
|
+
var _ref4, _ref4$maxWait, maxWait, _ref4$fullPage, fullPage, STEP_TIME, t0, buf1, buf2;
|
|
874
|
+
|
|
875
|
+
return runtime_1.wrap(function _callee$(_context) {
|
|
876
|
+
while (1) {
|
|
877
|
+
switch (_context.prev = _context.next) {
|
|
878
|
+
case 0:
|
|
879
|
+
_ref4 = _temp === void 0 ? {} : _temp, _ref4$maxWait = _ref4.maxWait, maxWait = _ref4$maxWait === void 0 ? 15000 : _ref4$maxWait, _ref4$fullPage = _ref4.fullPage, fullPage = _ref4$fullPage === void 0 ? true : _ref4$fullPage;
|
|
880
|
+
STEP_TIME = 250;
|
|
881
|
+
t0 = Date.now();
|
|
882
|
+
_context.next = 5;
|
|
883
|
+
return element.screenshot({
|
|
884
|
+
fullPage: fullPage
|
|
885
|
+
});
|
|
289
886
|
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
if (
|
|
308
|
-
|
|
887
|
+
case 5:
|
|
888
|
+
buf1 = _context.sent;
|
|
889
|
+
_context.next = 8;
|
|
890
|
+
return new Promise(function (r) {
|
|
891
|
+
return setTimeout(r, STEP_TIME);
|
|
892
|
+
});
|
|
893
|
+
|
|
894
|
+
case 8:
|
|
895
|
+
_context.next = 10;
|
|
896
|
+
return element.screenshot({
|
|
897
|
+
fullPage: fullPage
|
|
898
|
+
});
|
|
899
|
+
|
|
900
|
+
case 10:
|
|
901
|
+
buf2 = _context.sent;
|
|
902
|
+
|
|
903
|
+
case 11:
|
|
904
|
+
if (!buf1.compare(buf2)) {
|
|
905
|
+
_context.next = 22;
|
|
906
|
+
break;
|
|
907
|
+
}
|
|
908
|
+
|
|
909
|
+
if (!(Date.now() - t0 > maxWait)) {
|
|
910
|
+
_context.next = 14;
|
|
911
|
+
break;
|
|
309
912
|
}
|
|
310
913
|
|
|
914
|
+
throw Error('Paint end timeout');
|
|
915
|
+
|
|
916
|
+
case 14:
|
|
311
917
|
buf1 = buf2;
|
|
312
|
-
|
|
918
|
+
_context.next = 17;
|
|
919
|
+
return new Promise(function (r) {
|
|
313
920
|
return setTimeout(r, STEP_TIME);
|
|
314
|
-
})).then(function () {
|
|
315
|
-
return Promise.resolve(element.screenshot({
|
|
316
|
-
fullPage: fullPage
|
|
317
|
-
})).then(function (_element$screenshot) {
|
|
318
|
-
buf2 = _element$screenshot;
|
|
319
|
-
});
|
|
320
921
|
});
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
922
|
+
|
|
923
|
+
case 17:
|
|
924
|
+
_context.next = 19;
|
|
925
|
+
return element.screenshot({
|
|
926
|
+
fullPage: fullPage
|
|
927
|
+
});
|
|
928
|
+
|
|
929
|
+
case 19:
|
|
930
|
+
buf2 = _context.sent;
|
|
931
|
+
_context.next = 11;
|
|
932
|
+
break;
|
|
933
|
+
|
|
934
|
+
case 22:
|
|
935
|
+
case "end":
|
|
936
|
+
return _context.stop();
|
|
937
|
+
}
|
|
938
|
+
}
|
|
939
|
+
}, _callee);
|
|
940
|
+
}));
|
|
941
|
+
|
|
942
|
+
return function waitForPaintEnd(_x, _x2) {
|
|
943
|
+
return _ref3.apply(this, arguments);
|
|
944
|
+
};
|
|
945
|
+
}();
|
|
946
|
+
|
|
947
|
+
var normalizeSreenshotOptions = function normalizeSreenshotOptions(options) {
|
|
948
|
+
if (options === void 0) {
|
|
949
|
+
options = {};
|
|
327
950
|
}
|
|
328
|
-
};
|
|
329
951
|
|
|
330
|
-
var
|
|
331
|
-
var userAgent = _ref3.userAgent,
|
|
332
|
-
isDarkMode = _ref3.isDarkMode,
|
|
333
|
-
viewport = _ref3.viewport,
|
|
334
|
-
urlConfig = _objectWithoutPropertiesLoose(_ref3, ["userAgent", "isDarkMode", "viewport"]);
|
|
952
|
+
var finalOptions = _extends({}, options);
|
|
335
953
|
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
return Promise.resolve(page.emulateMediaFeatures([{
|
|
343
|
-
name: 'prefers-color-scheme',
|
|
344
|
-
value: isDarkMode ? 'dark' : 'light'
|
|
345
|
-
}])).then(function () {
|
|
346
|
-
var _exit2 = false;
|
|
347
|
-
|
|
348
|
-
function _temp3(_result2) {
|
|
349
|
-
return _exit2 ? _result2 : Promise.resolve(page.waitForFunction('document.fonts.status === "loaded"')).then(function () {
|
|
350
|
-
var api = Object.create(page);
|
|
351
|
-
|
|
352
|
-
api.type = function (elementHandle, text, options) {
|
|
353
|
-
try {
|
|
354
|
-
return Promise.resolve(elementHandle.type(text, options));
|
|
355
|
-
} catch (e) {
|
|
356
|
-
return Promise.reject(e);
|
|
357
|
-
}
|
|
358
|
-
};
|
|
954
|
+
if (typeof options.captureBeyondViewport === 'undefined' && options.fullPage) {
|
|
955
|
+
// Puppeter default is true, but we think false is a better default.
|
|
956
|
+
// When this is true, the fixed elements (like fixed footers) are relative to the original page
|
|
957
|
+
// viewport, not to the full page, so those elements look weird in fullPage screenshots.
|
|
958
|
+
finalOptions.captureBeyondViewport = false;
|
|
959
|
+
}
|
|
359
960
|
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
return Promise.resolve(elementHandle.click(options));
|
|
363
|
-
} catch (e) {
|
|
364
|
-
return Promise.reject(e);
|
|
365
|
-
}
|
|
366
|
-
};
|
|
961
|
+
return finalOptions;
|
|
962
|
+
};
|
|
367
963
|
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
for (var _len = arguments.length, values = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
371
|
-
values[_key - 1] = arguments[_key];
|
|
372
|
-
}
|
|
964
|
+
var getPageApi = function getPageApi(page) {
|
|
965
|
+
var api = Object.create(page);
|
|
373
966
|
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
try {
|
|
382
|
-
return Promise.resolve(page.waitForNetworkIdle()).then(function () {
|
|
383
|
-
return Promise.resolve(waitForPaintEnd(page)).then(function () {
|
|
384
|
-
return page.screenshot(options);
|
|
385
|
-
});
|
|
386
|
-
});
|
|
387
|
-
} catch (e) {
|
|
388
|
-
return Promise.reject(e);
|
|
389
|
-
}
|
|
390
|
-
};
|
|
391
|
-
|
|
392
|
-
api.clear = function (elementHandle) {
|
|
393
|
-
try {
|
|
394
|
-
return Promise.resolve(elementHandle.click({
|
|
395
|
-
clickCount: 3
|
|
396
|
-
})).then(function () {
|
|
397
|
-
return Promise.resolve(elementHandle.press('Delete')).then(function () {});
|
|
398
|
-
});
|
|
399
|
-
} catch (e) {
|
|
400
|
-
return Promise.reject(e);
|
|
401
|
-
}
|
|
402
|
-
};
|
|
967
|
+
api.type = /*#__PURE__*/function () {
|
|
968
|
+
var _ref5 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(elementHandle, text, options) {
|
|
969
|
+
return runtime_1.wrap(function _callee2$(_context2) {
|
|
970
|
+
while (1) {
|
|
971
|
+
switch (_context2.prev = _context2.next) {
|
|
972
|
+
case 0:
|
|
973
|
+
return _context2.abrupt("return", elementHandle.type(text, options));
|
|
403
974
|
|
|
404
|
-
|
|
405
|
-
|
|
975
|
+
case 1:
|
|
976
|
+
case "end":
|
|
977
|
+
return _context2.stop();
|
|
978
|
+
}
|
|
979
|
+
}
|
|
980
|
+
}, _callee2);
|
|
981
|
+
}));
|
|
982
|
+
|
|
983
|
+
return function (_x3, _x4, _x5) {
|
|
984
|
+
return _ref5.apply(this, arguments);
|
|
985
|
+
};
|
|
986
|
+
}();
|
|
987
|
+
|
|
988
|
+
api.click = /*#__PURE__*/function () {
|
|
989
|
+
var _ref6 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3(elementHandle, options) {
|
|
990
|
+
return runtime_1.wrap(function _callee3$(_context3) {
|
|
991
|
+
while (1) {
|
|
992
|
+
switch (_context3.prev = _context3.next) {
|
|
993
|
+
case 0:
|
|
994
|
+
return _context3.abrupt("return", elementHandle.click(options));
|
|
995
|
+
|
|
996
|
+
case 1:
|
|
997
|
+
case "end":
|
|
998
|
+
return _context3.stop();
|
|
999
|
+
}
|
|
1000
|
+
}
|
|
1001
|
+
}, _callee3);
|
|
1002
|
+
}));
|
|
1003
|
+
|
|
1004
|
+
return function (_x6, _x7) {
|
|
1005
|
+
return _ref6.apply(this, arguments);
|
|
1006
|
+
};
|
|
1007
|
+
}();
|
|
1008
|
+
|
|
1009
|
+
api.select = /*#__PURE__*/function () {
|
|
1010
|
+
var _ref7 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4(elementHandle) {
|
|
1011
|
+
var _len,
|
|
1012
|
+
values,
|
|
1013
|
+
_key,
|
|
1014
|
+
_args4 = arguments;
|
|
1015
|
+
|
|
1016
|
+
return runtime_1.wrap(function _callee4$(_context4) {
|
|
1017
|
+
while (1) {
|
|
1018
|
+
switch (_context4.prev = _context4.next) {
|
|
1019
|
+
case 0:
|
|
1020
|
+
for (_len = _args4.length, values = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
1021
|
+
values[_key - 1] = _args4[_key];
|
|
406
1022
|
}
|
|
407
1023
|
|
|
408
|
-
|
|
409
|
-
return Promise.resolve(page["goto"](url)).then(function () {});
|
|
410
|
-
}, function (e) {
|
|
411
|
-
if (e.message.includes('net::ERR_CONNECTION_REFUSED')) {
|
|
412
|
-
var connectionError = new Error("Could not connect to " + url + ". Is the server running?");
|
|
413
|
-
Error.captureStackTrace(connectionError, openPage);
|
|
414
|
-
throw connectionError;
|
|
415
|
-
} else {
|
|
416
|
-
throw e;
|
|
417
|
-
}
|
|
418
|
-
});
|
|
1024
|
+
return _context4.abrupt("return", elementHandle.select.apply(elementHandle, values));
|
|
419
1025
|
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
1026
|
+
case 2:
|
|
1027
|
+
case "end":
|
|
1028
|
+
return _context4.stop();
|
|
1029
|
+
}
|
|
423
1030
|
}
|
|
1031
|
+
}, _callee4);
|
|
1032
|
+
}));
|
|
424
1033
|
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
1034
|
+
return function (_x8) {
|
|
1035
|
+
return _ref7.apply(this, arguments);
|
|
1036
|
+
};
|
|
1037
|
+
}();
|
|
1038
|
+
|
|
1039
|
+
api.screenshot = /*#__PURE__*/function () {
|
|
1040
|
+
var _ref8 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5(options) {
|
|
1041
|
+
return runtime_1.wrap(function _callee5$(_context5) {
|
|
1042
|
+
while (1) {
|
|
1043
|
+
switch (_context5.prev = _context5.next) {
|
|
1044
|
+
case 0:
|
|
1045
|
+
_context5.next = 2;
|
|
1046
|
+
return page.waitForNetworkIdle();
|
|
1047
|
+
|
|
1048
|
+
case 2:
|
|
1049
|
+
_context5.next = 4;
|
|
1050
|
+
return waitForPaintEnd(page);
|
|
1051
|
+
|
|
1052
|
+
case 4:
|
|
1053
|
+
return _context5.abrupt("return", page.screenshot(normalizeSreenshotOptions(options)));
|
|
1054
|
+
|
|
1055
|
+
case 5:
|
|
1056
|
+
case "end":
|
|
1057
|
+
return _context5.stop();
|
|
428
1058
|
}
|
|
429
|
-
}
|
|
1059
|
+
}
|
|
1060
|
+
}, _callee5);
|
|
1061
|
+
}));
|
|
430
1062
|
|
|
431
|
-
|
|
432
|
-
|
|
1063
|
+
return function (_x9) {
|
|
1064
|
+
return _ref8.apply(this, arguments);
|
|
433
1065
|
};
|
|
1066
|
+
}();
|
|
1067
|
+
|
|
1068
|
+
api.clear = /*#__PURE__*/function () {
|
|
1069
|
+
var _ref9 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6(elementHandle) {
|
|
1070
|
+
return runtime_1.wrap(function _callee6$(_context6) {
|
|
1071
|
+
while (1) {
|
|
1072
|
+
switch (_context6.prev = _context6.next) {
|
|
1073
|
+
case 0:
|
|
1074
|
+
_context6.next = 2;
|
|
1075
|
+
return elementHandle.click({
|
|
1076
|
+
clickCount: 3
|
|
1077
|
+
});
|
|
434
1078
|
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
}
|
|
1079
|
+
case 2:
|
|
1080
|
+
_context6.next = 4;
|
|
1081
|
+
return elementHandle.press('Delete');
|
|
439
1082
|
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
hostname = _urlConfig$hostname === void 0 ? serverHostName : _urlConfig$hostname;
|
|
1083
|
+
case 4:
|
|
1084
|
+
case "end":
|
|
1085
|
+
return _context6.stop();
|
|
1086
|
+
}
|
|
1087
|
+
}
|
|
1088
|
+
}, _callee6);
|
|
1089
|
+
}));
|
|
448
1090
|
|
|
449
|
-
|
|
450
|
-
|
|
1091
|
+
return function (_x10) {
|
|
1092
|
+
return _ref9.apply(this, arguments);
|
|
1093
|
+
};
|
|
1094
|
+
}(); // For some reason, puppeteer browserContext.overridePermissions doesn't work with newer chrome versions.
|
|
1095
|
+
// This workaround polyfills the browser geolocation api to return the mocked position
|
|
451
1096
|
|
|
452
|
-
throw error;
|
|
453
|
-
}
|
|
454
1097
|
|
|
455
|
-
|
|
456
|
-
|
|
1098
|
+
api.setGeolocation = function (position) {
|
|
1099
|
+
return page.evaluate(function (position) {
|
|
1100
|
+
window.navigator.geolocation.getCurrentPosition = function (callback) {
|
|
1101
|
+
// @ts-ignore
|
|
1102
|
+
callback({
|
|
1103
|
+
coords: position
|
|
1104
|
+
});
|
|
1105
|
+
};
|
|
1106
|
+
}, position);
|
|
1107
|
+
};
|
|
457
1108
|
|
|
458
|
-
|
|
459
|
-
} catch (e) {
|
|
460
|
-
return Promise.reject(e);
|
|
461
|
-
}
|
|
1109
|
+
return api;
|
|
462
1110
|
};
|
|
1111
|
+
var openPage = /*#__PURE__*/function () {
|
|
1112
|
+
var _ref11 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee7(_ref10) {
|
|
1113
|
+
var userAgent, isDarkMode, viewport, cookies, urlConfig, url, currentUserAgent, page, connectionError;
|
|
1114
|
+
return runtime_1.wrap(function _callee7$(_context7) {
|
|
1115
|
+
while (1) {
|
|
1116
|
+
switch (_context7.prev = _context7.next) {
|
|
1117
|
+
case 0:
|
|
1118
|
+
userAgent = _ref10.userAgent, isDarkMode = _ref10.isDarkMode, viewport = _ref10.viewport, cookies = _ref10.cookies, urlConfig = /*#__PURE__*/_objectWithoutPropertiesLoose(_ref10, _excluded);
|
|
1119
|
+
|
|
1120
|
+
url = function () {
|
|
1121
|
+
if (urlConfig.url !== undefined) {
|
|
1122
|
+
return urlConfig.url;
|
|
1123
|
+
}
|
|
1124
|
+
|
|
1125
|
+
var _urlConfig$path = urlConfig.path,
|
|
1126
|
+
path = _urlConfig$path === void 0 ? '/' : _urlConfig$path,
|
|
1127
|
+
_urlConfig$port = urlConfig.port,
|
|
1128
|
+
port = _urlConfig$port === void 0 ? serverPort : _urlConfig$port,
|
|
1129
|
+
_urlConfig$protocol = urlConfig.protocol,
|
|
1130
|
+
protocol = _urlConfig$protocol === void 0 ? 'http' : _urlConfig$protocol,
|
|
1131
|
+
_urlConfig$hostname = urlConfig.hostname,
|
|
1132
|
+
hostname = _urlConfig$hostname === void 0 ? serverHostName : _urlConfig$hostname;
|
|
1133
|
+
|
|
1134
|
+
if (!port) {
|
|
1135
|
+
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);
|
|
1136
|
+
|
|
1137
|
+
throw error;
|
|
1138
|
+
}
|
|
1139
|
+
|
|
1140
|
+
return protocol + "://" + hostname + ":" + port + path;
|
|
1141
|
+
}();
|
|
1142
|
+
|
|
1143
|
+
_context7.t0 = userAgent;
|
|
1144
|
+
|
|
1145
|
+
if (_context7.t0) {
|
|
1146
|
+
_context7.next = 7;
|
|
1147
|
+
break;
|
|
1148
|
+
}
|
|
1149
|
+
|
|
1150
|
+
_context7.next = 6;
|
|
1151
|
+
return getGlobalBrowser().userAgent();
|
|
1152
|
+
|
|
1153
|
+
case 6:
|
|
1154
|
+
_context7.t0 = _context7.sent;
|
|
1155
|
+
|
|
1156
|
+
case 7:
|
|
1157
|
+
currentUserAgent = _context7.t0;
|
|
1158
|
+
page = getGlobalPage();
|
|
1159
|
+
_context7.next = 11;
|
|
1160
|
+
return page.bringToFront();
|
|
1161
|
+
|
|
1162
|
+
case 11:
|
|
1163
|
+
if (!viewport) {
|
|
1164
|
+
_context7.next = 14;
|
|
1165
|
+
break;
|
|
1166
|
+
}
|
|
1167
|
+
|
|
1168
|
+
_context7.next = 14;
|
|
1169
|
+
return page.setViewport(viewport);
|
|
1170
|
+
|
|
1171
|
+
case 14:
|
|
1172
|
+
if (!cookies) {
|
|
1173
|
+
_context7.next = 17;
|
|
1174
|
+
break;
|
|
1175
|
+
}
|
|
1176
|
+
|
|
1177
|
+
_context7.next = 17;
|
|
1178
|
+
return page.setCookie.apply(page, cookies);
|
|
1179
|
+
|
|
1180
|
+
case 17:
|
|
1181
|
+
_context7.next = 19;
|
|
1182
|
+
return page.setUserAgent(currentUserAgent + " acceptance-test");
|
|
1183
|
+
|
|
1184
|
+
case 19:
|
|
1185
|
+
_context7.next = 21;
|
|
1186
|
+
return page.emulateMediaFeatures([{
|
|
1187
|
+
name: 'prefers-color-scheme',
|
|
1188
|
+
value: isDarkMode ? 'dark' : 'light'
|
|
1189
|
+
}]);
|
|
1190
|
+
|
|
1191
|
+
case 21:
|
|
1192
|
+
_context7.prev = 21;
|
|
1193
|
+
_context7.next = 24;
|
|
1194
|
+
return page["goto"](url);
|
|
1195
|
+
|
|
1196
|
+
case 24:
|
|
1197
|
+
_context7.next = 35;
|
|
1198
|
+
break;
|
|
1199
|
+
|
|
1200
|
+
case 26:
|
|
1201
|
+
_context7.prev = 26;
|
|
1202
|
+
_context7.t1 = _context7["catch"](21);
|
|
463
1203
|
|
|
464
|
-
|
|
1204
|
+
if (!_context7.t1.message.includes('net::ERR_CONNECTION_REFUSED')) {
|
|
1205
|
+
_context7.next = 34;
|
|
1206
|
+
break;
|
|
1207
|
+
}
|
|
1208
|
+
|
|
1209
|
+
connectionError = new Error("Could not connect to " + url + ". Is the server running?");
|
|
1210
|
+
Error.captureStackTrace(connectionError, openPage);
|
|
1211
|
+
throw connectionError;
|
|
1212
|
+
|
|
1213
|
+
case 34:
|
|
1214
|
+
throw _context7.t1;
|
|
1215
|
+
|
|
1216
|
+
case 35:
|
|
1217
|
+
_context7.next = 37;
|
|
1218
|
+
return page.waitForFunction('document.fonts.status === "loaded"');
|
|
1219
|
+
|
|
1220
|
+
case 37:
|
|
1221
|
+
return _context7.abrupt("return", getPageApi(page));
|
|
1222
|
+
|
|
1223
|
+
case 38:
|
|
1224
|
+
case "end":
|
|
1225
|
+
return _context7.stop();
|
|
1226
|
+
}
|
|
1227
|
+
}
|
|
1228
|
+
}, _callee7, null, [[21, 26]]);
|
|
1229
|
+
}));
|
|
1230
|
+
|
|
1231
|
+
return function openPage(_x11) {
|
|
1232
|
+
return _ref11.apply(this, arguments);
|
|
1233
|
+
};
|
|
1234
|
+
}();
|
|
1235
|
+
|
|
1236
|
+
var buildQueryMethods = function buildQueryMethods(page) {
|
|
465
1237
|
var boundQueries = {};
|
|
466
1238
|
|
|
467
1239
|
var _loop = function _loop() {
|
|
468
1240
|
var _Object$entries$_i = _Object$entries[_i],
|
|
469
1241
|
queryName = _Object$entries$_i[0],
|
|
470
1242
|
queryFn = _Object$entries$_i[1];
|
|
1243
|
+
boundQueries[queryName] = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee9() {
|
|
1244
|
+
var doc,
|
|
1245
|
+
body,
|
|
1246
|
+
_len2,
|
|
1247
|
+
args,
|
|
1248
|
+
_key2,
|
|
1249
|
+
queryArgs,
|
|
1250
|
+
elementHandle,
|
|
1251
|
+
newElementHandle,
|
|
1252
|
+
_args9 = arguments;
|
|
1253
|
+
|
|
1254
|
+
return runtime_1.wrap(function _callee9$(_context9) {
|
|
1255
|
+
while (1) {
|
|
1256
|
+
switch (_context9.prev = _context9.next) {
|
|
1257
|
+
case 0:
|
|
1258
|
+
_context9.next = 2;
|
|
1259
|
+
return pptrTestingLibrary.getDocument(page != null ? page : getGlobalPage());
|
|
1260
|
+
|
|
1261
|
+
case 2:
|
|
1262
|
+
doc = _context9.sent;
|
|
1263
|
+
_context9.next = 5;
|
|
1264
|
+
return doc.$('body');
|
|
1265
|
+
|
|
1266
|
+
case 5:
|
|
1267
|
+
body = _context9.sent;
|
|
1268
|
+
|
|
1269
|
+
for (_len2 = _args9.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
1270
|
+
args[_key2] = _args9[_key2];
|
|
1271
|
+
}
|
|
471
1272
|
|
|
472
|
-
|
|
473
|
-
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
474
|
-
args[_key2] = arguments[_key2];
|
|
475
|
-
}
|
|
476
|
-
|
|
477
|
-
try {
|
|
478
|
-
return Promise.resolve(pptrTestingLibrary.getDocument(globalPage)).then(function (doc) {
|
|
479
|
-
var queryArgs = [].concat(args);
|
|
1273
|
+
queryArgs = [].concat(args);
|
|
480
1274
|
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
}
|
|
1275
|
+
if (queryName.startsWith('findBy')) {
|
|
1276
|
+
if (queryArgs.length === 1) {
|
|
1277
|
+
queryArgs.push(undefined);
|
|
1278
|
+
}
|
|
486
1279
|
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
newElementHandle.screenshot = function (options) {
|
|
491
|
-
try {
|
|
492
|
-
return Promise.resolve(globalPage.waitForNetworkIdle()).then(function () {
|
|
493
|
-
return Promise.resolve(waitForPaintEnd(elementHandle, {
|
|
494
|
-
fullPage: false
|
|
495
|
-
})).then(function () {
|
|
496
|
-
return elementHandle.screenshot(options);
|
|
497
|
-
});
|
|
1280
|
+
queryArgs.push({
|
|
1281
|
+
timeout: 10000
|
|
498
1282
|
});
|
|
499
|
-
} catch (e) {
|
|
500
|
-
return Promise.reject(e);
|
|
501
1283
|
}
|
|
502
|
-
};
|
|
503
1284
|
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
1285
|
+
_context9.next = 11;
|
|
1286
|
+
return queryFn.apply(void 0, [body].concat(queryArgs));
|
|
1287
|
+
|
|
1288
|
+
case 11:
|
|
1289
|
+
elementHandle = _context9.sent;
|
|
1290
|
+
newElementHandle = Object.create(elementHandle);
|
|
1291
|
+
|
|
1292
|
+
newElementHandle.screenshot = /*#__PURE__*/function () {
|
|
1293
|
+
var _ref13 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee8(options) {
|
|
1294
|
+
return runtime_1.wrap(function _callee8$(_context8) {
|
|
1295
|
+
while (1) {
|
|
1296
|
+
switch (_context8.prev = _context8.next) {
|
|
1297
|
+
case 0:
|
|
1298
|
+
_context8.next = 2;
|
|
1299
|
+
return (page != null ? page : getGlobalPage()).waitForNetworkIdle();
|
|
1300
|
+
|
|
1301
|
+
case 2:
|
|
1302
|
+
_context8.next = 4;
|
|
1303
|
+
return waitForPaintEnd(elementHandle, {
|
|
1304
|
+
fullPage: false
|
|
1305
|
+
});
|
|
1306
|
+
|
|
1307
|
+
case 4:
|
|
1308
|
+
return _context8.abrupt("return", elementHandle.screenshot(normalizeSreenshotOptions(options)));
|
|
1309
|
+
|
|
1310
|
+
case 5:
|
|
1311
|
+
case "end":
|
|
1312
|
+
return _context8.stop();
|
|
1313
|
+
}
|
|
1314
|
+
}
|
|
1315
|
+
}, _callee8);
|
|
1316
|
+
}));
|
|
1317
|
+
|
|
1318
|
+
return function (_x12) {
|
|
1319
|
+
return _ref13.apply(this, arguments);
|
|
1320
|
+
};
|
|
1321
|
+
}();
|
|
1322
|
+
|
|
1323
|
+
return _context9.abrupt("return", newElementHandle);
|
|
1324
|
+
|
|
1325
|
+
case 15:
|
|
1326
|
+
case "end":
|
|
1327
|
+
return _context9.stop();
|
|
1328
|
+
}
|
|
1329
|
+
}
|
|
1330
|
+
}, _callee9);
|
|
1331
|
+
}));
|
|
511
1332
|
};
|
|
512
1333
|
|
|
513
1334
|
for (var _i = 0, _Object$entries = Object.entries(pptrTestingLibrary.queries); _i < _Object$entries.length; _i++) {
|
|
@@ -517,22 +1338,54 @@ var buildQueryMethods = function buildQueryMethods() {
|
|
|
517
1338
|
return boundQueries;
|
|
518
1339
|
};
|
|
519
1340
|
|
|
1341
|
+
var getScreen = function getScreen(page) {
|
|
1342
|
+
return buildQueryMethods(page);
|
|
1343
|
+
};
|
|
520
1344
|
var screen = /*#__PURE__*/buildQueryMethods();
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
}
|
|
1345
|
+
beforeEach( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee10() {
|
|
1346
|
+
return runtime_1.wrap(function _callee10$(_context10) {
|
|
1347
|
+
while (1) {
|
|
1348
|
+
switch (_context10.prev = _context10.next) {
|
|
1349
|
+
case 0:
|
|
1350
|
+
_context10.next = 2;
|
|
1351
|
+
return global.jestPuppeteer.resetPage();
|
|
1352
|
+
|
|
1353
|
+
case 2:
|
|
1354
|
+
case "end":
|
|
1355
|
+
return _context10.stop();
|
|
1356
|
+
}
|
|
1357
|
+
}
|
|
1358
|
+
}, _callee10);
|
|
1359
|
+
})));
|
|
1360
|
+
afterEach( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee11() {
|
|
1361
|
+
return runtime_1.wrap(function _callee11$(_context11) {
|
|
1362
|
+
while (1) {
|
|
1363
|
+
switch (_context11.prev = _context11.next) {
|
|
1364
|
+
case 0:
|
|
1365
|
+
_context11.prev = 0;
|
|
1366
|
+
_context11.next = 3;
|
|
1367
|
+
return getGlobalPage()["goto"]('about:blank');
|
|
1368
|
+
|
|
1369
|
+
case 3:
|
|
1370
|
+
_context11.next = 7;
|
|
1371
|
+
break;
|
|
1372
|
+
|
|
1373
|
+
case 5:
|
|
1374
|
+
_context11.prev = 5;
|
|
1375
|
+
_context11.t0 = _context11["catch"](0);
|
|
1376
|
+
|
|
1377
|
+
case 7:
|
|
1378
|
+
case "end":
|
|
1379
|
+
return _context11.stop();
|
|
1380
|
+
}
|
|
1381
|
+
}
|
|
1382
|
+
}, _callee11, null, [[0, 5]]);
|
|
1383
|
+
})));
|
|
533
1384
|
|
|
534
|
-
exports.
|
|
535
|
-
exports.
|
|
1385
|
+
exports.getGlobalBrowser = getGlobalBrowser;
|
|
1386
|
+
exports.getGlobalPage = getGlobalPage;
|
|
1387
|
+
exports.getPageApi = getPageApi;
|
|
1388
|
+
exports.getScreen = getScreen;
|
|
536
1389
|
exports.openPage = openPage;
|
|
537
1390
|
exports.screen = screen;
|
|
538
1391
|
exports.serverHostName = serverHostName;
|