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