@telefonica/acceptance-testing 1.0.0 → 1.1.2-beta2
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/dist/acceptance-testing.cjs.development.js +109 -81
- 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 +109 -81
- package/dist/acceptance-testing.esm.js.map +1 -1
- package/dist/index.d.ts +4 -3
- package/jest-puppeteer-config.js +1 -0
- package/package.json +3 -3
|
@@ -330,91 +330,105 @@ var waitForPaintEnd = function waitForPaintEnd(element, _temp) {
|
|
|
330
330
|
var openPage = function openPage(_ref3) {
|
|
331
331
|
var userAgent = _ref3.userAgent,
|
|
332
332
|
isDarkMode = _ref3.isDarkMode,
|
|
333
|
-
|
|
333
|
+
viewport = _ref3.viewport,
|
|
334
|
+
urlConfig = _objectWithoutPropertiesLoose(_ref3, ["userAgent", "isDarkMode", "viewport"]);
|
|
334
335
|
|
|
335
336
|
try {
|
|
336
|
-
var
|
|
337
|
+
var _temp7 = function _temp7(currentUserAgent) {
|
|
337
338
|
var page = globalPage;
|
|
338
339
|
return Promise.resolve(page.bringToFront()).then(function () {
|
|
339
|
-
|
|
340
|
-
return Promise.resolve(page.
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
340
|
+
function _temp5() {
|
|
341
|
+
return Promise.resolve(page.setUserAgent(currentUserAgent + " acceptance-test")).then(function () {
|
|
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
|
+
};
|
|
359
|
+
|
|
360
|
+
api.click = function (elementHandle, options) {
|
|
361
|
+
try {
|
|
362
|
+
return Promise.resolve(elementHandle.click(options));
|
|
363
|
+
} catch (e) {
|
|
364
|
+
return Promise.reject(e);
|
|
365
|
+
}
|
|
366
|
+
};
|
|
367
|
+
|
|
368
|
+
api.select = function (elementHandle) {
|
|
369
|
+
try {
|
|
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
|
+
}
|
|
373
|
+
|
|
374
|
+
return Promise.resolve(elementHandle.select.apply(elementHandle, values));
|
|
375
|
+
} catch (e) {
|
|
376
|
+
return Promise.reject(e);
|
|
377
|
+
}
|
|
378
|
+
};
|
|
379
|
+
|
|
380
|
+
api.screenshot = function (options) {
|
|
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
|
+
};
|
|
403
|
+
|
|
404
|
+
return api;
|
|
405
|
+
});
|
|
406
|
+
}
|
|
387
407
|
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
}
|
|
396
|
-
|
|
408
|
+
var _temp2 = _catch(function () {
|
|
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;
|
|
397
417
|
}
|
|
398
|
-
};
|
|
399
|
-
|
|
400
|
-
return api;
|
|
401
|
-
}
|
|
418
|
+
});
|
|
402
419
|
|
|
403
|
-
|
|
404
|
-
return Promise.resolve(page["goto"](url)).then(function () {});
|
|
405
|
-
}, function (e) {
|
|
406
|
-
if (e.message.includes('net::ERR_CONNECTION_REFUSED')) {
|
|
407
|
-
var connectionError = new Error("Could not connect to " + url + ". Is the server running?");
|
|
408
|
-
Error.captureStackTrace(connectionError, openPage);
|
|
409
|
-
throw connectionError;
|
|
410
|
-
} else {
|
|
411
|
-
throw e;
|
|
412
|
-
}
|
|
420
|
+
return _temp2 && _temp2.then ? _temp2.then(_temp3) : _temp3(_temp2);
|
|
413
421
|
});
|
|
414
|
-
|
|
415
|
-
return _temp2 && _temp2.then ? _temp2.then(_temp3) : _temp3(_temp2);
|
|
416
422
|
});
|
|
417
|
-
}
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
var _temp4 = function () {
|
|
426
|
+
if (viewport) {
|
|
427
|
+
return Promise.resolve(page.setViewport(viewport)).then(function () {});
|
|
428
|
+
}
|
|
429
|
+
}();
|
|
430
|
+
|
|
431
|
+
return _temp4 && _temp4.then ? _temp4.then(_temp5) : _temp5(_temp4);
|
|
418
432
|
});
|
|
419
433
|
};
|
|
420
434
|
|
|
@@ -441,7 +455,7 @@ var openPage = function openPage(_ref3) {
|
|
|
441
455
|
return protocol + "://" + hostname + ":" + port + path;
|
|
442
456
|
}();
|
|
443
457
|
|
|
444
|
-
return Promise.resolve(userAgent ?
|
|
458
|
+
return Promise.resolve(userAgent ? _temp7(userAgent) : Promise.resolve(globalBrowser.userAgent()).then(_temp7));
|
|
445
459
|
} catch (e) {
|
|
446
460
|
return Promise.reject(e);
|
|
447
461
|
}
|
|
@@ -475,10 +489,12 @@ var buildQueryMethods = function buildQueryMethods() {
|
|
|
475
489
|
|
|
476
490
|
newElementHandle.screenshot = function (options) {
|
|
477
491
|
try {
|
|
478
|
-
return Promise.resolve(
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
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
|
+
});
|
|
482
498
|
});
|
|
483
499
|
} catch (e) {
|
|
484
500
|
return Promise.reject(e);
|
|
@@ -502,6 +518,18 @@ var buildQueryMethods = function buildQueryMethods() {
|
|
|
502
518
|
};
|
|
503
519
|
|
|
504
520
|
var screen = /*#__PURE__*/buildQueryMethods();
|
|
521
|
+
afterEach(function () {
|
|
522
|
+
try {
|
|
523
|
+
var _temp9 = _catch(function () {
|
|
524
|
+
// clear tab, this way we clear the DOM and stop js execution or pending requests
|
|
525
|
+
return Promise.resolve(globalPage["goto"]('about:blank')).then(function () {});
|
|
526
|
+
}, function () {});
|
|
527
|
+
|
|
528
|
+
return Promise.resolve(_temp9 && _temp9.then ? _temp9.then(function () {}) : void 0);
|
|
529
|
+
} catch (e) {
|
|
530
|
+
return Promise.reject(e);
|
|
531
|
+
}
|
|
532
|
+
});
|
|
505
533
|
|
|
506
534
|
exports.globalBrowser = globalBrowser;
|
|
507
535
|
exports.globalPage = globalPage;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acceptance-testing.cjs.development.js","sources":["../../../node_modules/babel-plugin-transform-async-to-promises/helpers.js","../src/index.ts"],"sourcesContent":["// A type of promise-like that resolves synchronously and supports only one observer\nexport const _Pact = /*#__PURE__*/(function() {\n\tfunction _Pact() {}\n\t_Pact.prototype.then = function(onFulfilled, onRejected) {\n\t\tconst result = new _Pact();\n\t\tconst state = this.s;\n\t\tif (state) {\n\t\t\tconst callback = state & 1 ? onFulfilled : onRejected;\n\t\t\tif (callback) {\n\t\t\t\ttry {\n\t\t\t\t\t_settle(result, 1, callback(this.v));\n\t\t\t\t} catch (e) {\n\t\t\t\t\t_settle(result, 2, e);\n\t\t\t\t}\n\t\t\t\treturn result;\n\t\t\t} else {\n\t\t\t\treturn this;\n\t\t\t}\n\t\t}\n\t\tthis.o = function(_this) {\n\t\t\ttry {\n\t\t\t\tconst value = _this.v;\n\t\t\t\tif (_this.s & 1) {\n\t\t\t\t\t_settle(result, 1, onFulfilled ? onFulfilled(value) : value);\n\t\t\t\t} else if (onRejected) {\n\t\t\t\t\t_settle(result, 1, onRejected(value));\n\t\t\t\t} else {\n\t\t\t\t\t_settle(result, 2, value);\n\t\t\t\t}\n\t\t\t} catch (e) {\n\t\t\t\t_settle(result, 2, e);\n\t\t\t}\n\t\t};\n\t\treturn result;\n\t}\n\treturn _Pact;\n})();\n\n// Settles a pact synchronously\nexport function _settle(pact, state, value) {\n\tif (!pact.s) {\n\t\tif (value instanceof _Pact) {\n\t\t\tif (value.s) {\n\t\t\t\tif (state & 1) {\n\t\t\t\t\tstate = value.s;\n\t\t\t\t}\n\t\t\t\tvalue = value.v;\n\t\t\t} else {\n\t\t\t\tvalue.o = _settle.bind(null, pact, state);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\tif (value && value.then) {\n\t\t\tvalue.then(_settle.bind(null, pact, state), _settle.bind(null, pact, 2));\n\t\t\treturn;\n\t\t}\n\t\tpact.s = state;\n\t\tpact.v = value;\n\t\tconst observer = pact.o;\n\t\tif (observer) {\n\t\t\tobserver(pact);\n\t\t}\n\t}\n}\n\nexport function _isSettledPact(thenable) {\n\treturn thenable instanceof _Pact && thenable.s & 1;\n}\n\n// Converts argument to a function that always returns a Promise\nexport function _async(f) {\n\treturn function() {\n\t\tfor (var args = [], i = 0; i < arguments.length; i++) {\n\t\t\targs[i] = arguments[i];\n\t\t}\n\t\ttry {\n\t\t\treturn Promise.resolve(f.apply(this, args));\n\t\t} catch(e) {\n\t\t\treturn Promise.reject(e);\n\t\t}\n\t}\n}\n\n// Awaits on a value that may or may not be a Promise (equivalent to the await keyword in ES2015, with continuations passed explicitly)\nexport function _await(value, then, direct) {\n\tif (direct) {\n\t\treturn then ? then(value) : value;\n\t}\n\tif (!value || !value.then) {\n\t\tvalue = Promise.resolve(value);\n\t}\n\treturn then ? value.then(then) : value;\n}\n\n// Awaits on a value that may or may not be a Promise, then ignores it\nexport function _awaitIgnored(value, direct) {\n\tif (!direct) {\n\t\treturn value && value.then ? value.then(_empty) : Promise.resolve();\n\t}\n}\n\n// Proceeds after a value has resolved, or proceeds immediately if the value is not thenable\nexport function _continue(value, then) {\n\treturn value && value.then ? value.then(then) : then(value);\n}\n\n// Proceeds after a value has resolved, or proceeds immediately if the value is not thenable\nexport function _continueIgnored(value) {\n\tif (value && value.then) {\n\t\treturn value.then(_empty);\n\t}\n}\n\n// Asynchronously iterate through an object that has a length property, passing the index as the first argument to the callback (even as the length property changes)\nexport function _forTo(array, body, check) {\n\tvar i = -1, pact, reject;\n\tfunction _cycle(result) {\n\t\ttry {\n\t\t\twhile (++i < array.length && (!check || !check())) {\n\t\t\t\tresult = body(i);\n\t\t\t\tif (result && result.then) {\n\t\t\t\t\tif (_isSettledPact(result)) {\n\t\t\t\t\t\tresult = result.v;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tresult.then(_cycle, reject || (reject = _settle.bind(null, pact = new _Pact(), 2)));\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (pact) {\n\t\t\t\t_settle(pact, 1, result);\n\t\t\t} else {\n\t\t\t\tpact = result;\n\t\t\t}\n\t\t} catch (e) {\n\t\t\t_settle(pact || (pact = new _Pact()), 2, e);\n\t\t}\n\t}\n\t_cycle();\n\treturn pact;\n}\n\n// Asynchronously iterate through an object's properties (including properties inherited from the prototype)\n// Uses a snapshot of the object's properties\nexport function _forIn(target, body, check) {\n\tvar keys = [];\n\tfor (var key in target) {\n\t\tkeys.push(key);\n\t}\n\treturn _forTo(keys, function(i) { return body(keys[i]); }, check);\n}\n\n// Asynchronously iterate through an object's own properties (excluding properties inherited from the prototype)\n// Uses a snapshot of the object's properties\nexport function _forOwn(target, body, check) {\n\tvar keys = [];\n\tfor (var key in target) {\n\t\tif (Object.prototype.hasOwnProperty.call(target, key)) {\n\t\t\tkeys.push(key);\n\t\t}\n\t}\n\treturn _forTo(keys, function(i) { return body(keys[i]); }, check);\n}\n\nexport const _iteratorSymbol = /*#__PURE__*/ typeof Symbol !== \"undefined\" ? (Symbol.iterator || (Symbol.iterator = Symbol(\"Symbol.iterator\"))) : \"@@iterator\";\n\n// Asynchronously iterate through an object's values\n// Uses for...of if the runtime supports it, otherwise iterates until length on a copy\nexport function _forOf(target, body, check) {\n\tif (typeof target[_iteratorSymbol] === \"function\") {\n\t\tvar iterator = target[_iteratorSymbol](), step, pact, reject;\n\t\tfunction _cycle(result) {\n\t\t\ttry {\n\t\t\t\twhile (!(step = iterator.next()).done && (!check || !check())) {\n\t\t\t\t\tresult = body(step.value);\n\t\t\t\t\tif (result && result.then) {\n\t\t\t\t\t\tif (_isSettledPact(result)) {\n\t\t\t\t\t\t\tresult = result.v;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tresult.then(_cycle, reject || (reject = _settle.bind(null, pact = new _Pact(), 2)));\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (pact) {\n\t\t\t\t\t_settle(pact, 1, result);\n\t\t\t\t} else {\n\t\t\t\t\tpact = result;\n\t\t\t\t}\n\t\t\t} catch (e) {\n\t\t\t\t_settle(pact || (pact = new _Pact()), 2, e);\n\t\t\t}\n\t\t}\n\t\t_cycle();\n\t\tif (iterator.return) {\n\t\t\tvar _fixup = function(value) {\n\t\t\t\ttry {\n\t\t\t\t\tif (!step.done) {\n\t\t\t\t\t\titerator.return();\n\t\t\t\t\t}\n\t\t\t\t} catch(e) {\n\t\t\t\t}\n\t\t\t\treturn value;\n\t\t\t}\n\t\t\tif (pact && pact.then) {\n\t\t\t\treturn pact.then(_fixup, function(e) {\n\t\t\t\t\tthrow _fixup(e);\n\t\t\t\t});\n\t\t\t}\n\t\t\t_fixup();\n\t\t}\n\t\treturn pact;\n\t}\n\t// No support for Symbol.iterator\n\tif (!(\"length\" in target)) {\n\t\tthrow new TypeError(\"Object is not iterable\");\n\t}\n\t// Handle live collections properly\n\tvar values = [];\n\tfor (var i = 0; i < target.length; i++) {\n\t\tvalues.push(target[i]);\n\t}\n\treturn _forTo(values, function(i) { return body(values[i]); }, check);\n}\n\nexport const _asyncIteratorSymbol = /*#__PURE__*/ typeof Symbol !== \"undefined\" ? (Symbol.asyncIterator || (Symbol.asyncIterator = Symbol(\"Symbol.asyncIterator\"))) : \"@@asyncIterator\";\n\n// Asynchronously iterate on a value using it's async iterator if present, or its synchronous iterator if missing\nexport function _forAwaitOf(target, body, check) {\n\tif (typeof target[_asyncIteratorSymbol] === \"function\") {\n\t\tvar pact = new _Pact();\n\t\tvar iterator = target[_asyncIteratorSymbol]();\n\t\titerator.next().then(_resumeAfterNext).then(void 0, _reject);\n\t\treturn pact;\n\t\tfunction _resumeAfterBody(result) {\n\t\t\tif (check && check()) {\n\t\t\t\treturn _settle(pact, 1, iterator.return ? iterator.return().then(function() { return result; }) : result);\n\t\t\t}\n\t\t\titerator.next().then(_resumeAfterNext).then(void 0, _reject);\n\t\t}\n\t\tfunction _resumeAfterNext(step) {\n\t\t\tif (step.done) {\n\t\t\t\t_settle(pact, 1);\n\t\t\t} else {\n\t\t\t\tPromise.resolve(body(step.value)).then(_resumeAfterBody).then(void 0, _reject);\n\t\t\t}\n\t\t}\n\t\tfunction _reject(error) {\n\t\t\t_settle(pact, 2, iterator.return ? iterator.return().then(function() { return error; }) : error);\n\t\t}\n\t}\n\treturn Promise.resolve(_forOf(target, function(value) { return Promise.resolve(value).then(body); }, check));\n}\n\n// Asynchronously implement a generic for loop\nexport function _for(test, update, body) {\n\tvar stage;\n\tfor (;;) {\n\t\tvar shouldContinue = test();\n\t\tif (_isSettledPact(shouldContinue)) {\n\t\t\tshouldContinue = shouldContinue.v;\n\t\t}\n\t\tif (!shouldContinue) {\n\t\t\treturn result;\n\t\t}\n\t\tif (shouldContinue.then) {\n\t\t\tstage = 0;\n\t\t\tbreak;\n\t\t}\n\t\tvar result = body();\n\t\tif (result && result.then) {\n\t\t\tif (_isSettledPact(result)) {\n\t\t\t\tresult = result.s;\n\t\t\t} else {\n\t\t\t\tstage = 1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (update) {\n\t\t\tvar updateValue = update();\n\t\t\tif (updateValue && updateValue.then && !_isSettledPact(updateValue)) {\n\t\t\t\tstage = 2;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\tvar pact = new _Pact();\n\tvar reject = _settle.bind(null, pact, 2);\n\t(stage === 0 ? shouldContinue.then(_resumeAfterTest) : stage === 1 ? result.then(_resumeAfterBody) : updateValue.then(_resumeAfterUpdate)).then(void 0, reject);\n\treturn pact;\n\tfunction _resumeAfterBody(value) {\n\t\tresult = value;\n\t\tdo {\n\t\t\tif (update) {\n\t\t\t\tupdateValue = update();\n\t\t\t\tif (updateValue && updateValue.then && !_isSettledPact(updateValue)) {\n\t\t\t\t\tupdateValue.then(_resumeAfterUpdate).then(void 0, reject);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\tshouldContinue = test();\n\t\t\tif (!shouldContinue || (_isSettledPact(shouldContinue) && !shouldContinue.v)) {\n\t\t\t\t_settle(pact, 1, result);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (shouldContinue.then) {\n\t\t\t\tshouldContinue.then(_resumeAfterTest).then(void 0, reject);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tresult = body();\n\t\t\tif (_isSettledPact(result)) {\n\t\t\t\tresult = result.v;\n\t\t\t}\n\t\t} while (!result || !result.then);\n\t\tresult.then(_resumeAfterBody).then(void 0, reject);\n\t}\n\tfunction _resumeAfterTest(shouldContinue) {\n\t\tif (shouldContinue) {\n\t\t\tresult = body();\n\t\t\tif (result && result.then) {\n\t\t\t\tresult.then(_resumeAfterBody).then(void 0, reject);\n\t\t\t} else {\n\t\t\t\t_resumeAfterBody(result);\n\t\t\t}\n\t\t} else {\n\t\t\t_settle(pact, 1, result);\n\t\t}\n\t}\n\tfunction _resumeAfterUpdate() {\n\t\tif (shouldContinue = test()) {\n\t\t\tif (shouldContinue.then) {\n\t\t\t\tshouldContinue.then(_resumeAfterTest).then(void 0, reject);\n\t\t\t} else {\n\t\t\t\t_resumeAfterTest(shouldContinue);\n\t\t\t}\n\t\t} else {\n\t\t\t_settle(pact, 1, result);\n\t\t}\n\t}\n}\n\n// Asynchronously implement a do ... while loop\nexport function _do(body, test) {\n\tvar awaitBody;\n\tdo {\n\t\tvar result = body();\n\t\tif (result && result.then) {\n\t\t\tif (_isSettledPact(result)) {\n\t\t\t\tresult = result.v;\n\t\t\t} else {\n\t\t\t\tawaitBody = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tvar shouldContinue = test();\n\t\tif (_isSettledPact(shouldContinue)) {\n\t\t\tshouldContinue = shouldContinue.v;\n\t\t}\n\t\tif (!shouldContinue) {\n\t\t\treturn result;\n\t\t}\n\t} while (!shouldContinue.then);\n\tconst pact = new _Pact();\n\tconst reject = _settle.bind(null, pact, 2);\n\t(awaitBody ? result.then(_resumeAfterBody) : shouldContinue.then(_resumeAfterTest)).then(void 0, reject);\n\treturn pact;\n\tfunction _resumeAfterBody(value) {\n\t\tresult = value;\n\t\tfor (;;) {\n\t\t\tshouldContinue = test();\n\t\t\tif (_isSettledPact(shouldContinue)) {\n\t\t\t\tshouldContinue = shouldContinue.v;\n\t\t\t}\n\t\t\tif (!shouldContinue) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (shouldContinue.then) {\n\t\t\t\tshouldContinue.then(_resumeAfterTest).then(void 0, reject);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tresult = body();\n\t\t\tif (result && result.then) {\n\t\t\t\tif (_isSettledPact(result)) {\n\t\t\t\t\tresult = result.v;\n\t\t\t\t} else {\n\t\t\t\t\tresult.then(_resumeAfterBody).then(void 0, reject);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t_settle(pact, 1, result);\n\t}\n\tfunction _resumeAfterTest(shouldContinue) {\n\t\tif (shouldContinue) {\n\t\t\tdo {\n\t\t\t\tresult = body();\n\t\t\t\tif (result && result.then) {\n\t\t\t\t\tif (_isSettledPact(result)) {\n\t\t\t\t\t\tresult = result.v;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tresult.then(_resumeAfterBody).then(void 0, reject);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tshouldContinue = test();\n\t\t\t\tif (_isSettledPact(shouldContinue)) {\n\t\t\t\t\tshouldContinue = shouldContinue.v;\n\t\t\t\t}\n\t\t\t\tif (!shouldContinue) {\n\t\t\t\t\t_settle(pact, 1, result);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t} while (!shouldContinue.then);\n\t\t\tshouldContinue.then(_resumeAfterTest).then(void 0, reject);\n\t\t} else {\n\t\t\t_settle(pact, 1, result);\n\t\t}\n\t}\n}\n\n// Asynchronously implement a switch statement\nexport function _switch(discriminant, cases) {\n\tvar dispatchIndex = -1;\n\tvar awaitBody;\n\touter: {\n\t\tfor (var i = 0; i < cases.length; i++) {\n\t\t\tvar test = cases[i][0];\n\t\t\tif (test) {\n\t\t\t\tvar testValue = test();\n\t\t\t\tif (testValue && testValue.then) {\n\t\t\t\t\tbreak outer;\n\t\t\t\t}\n\t\t\t\tif (testValue === discriminant) {\n\t\t\t\t\tdispatchIndex = i;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// Found the default case, set it as the pending dispatch case\n\t\t\t\tdispatchIndex = i;\n\t\t\t}\n\t\t}\n\t\tif (dispatchIndex !== -1) {\n\t\t\tdo {\n\t\t\t\tvar body = cases[dispatchIndex][1];\n\t\t\t\twhile (!body) {\n\t\t\t\t\tdispatchIndex++;\n\t\t\t\t\tbody = cases[dispatchIndex][1];\n\t\t\t\t}\n\t\t\t\tvar result = body();\n\t\t\t\tif (result && result.then) {\n\t\t\t\t\tawaitBody = true;\n\t\t\t\t\tbreak outer;\n\t\t\t\t}\n\t\t\t\tvar fallthroughCheck = cases[dispatchIndex][2];\n\t\t\t\tdispatchIndex++;\n\t\t\t} while (fallthroughCheck && !fallthroughCheck());\n\t\t\treturn result;\n\t\t}\n\t}\n\tconst pact = new _Pact();\n\tconst reject = _settle.bind(null, pact, 2);\n\t(awaitBody ? result.then(_resumeAfterBody) : testValue.then(_resumeAfterTest)).then(void 0, reject);\n\treturn pact;\n\tfunction _resumeAfterTest(value) {\n\t\tfor (;;) {\n\t\t\tif (value === discriminant) {\n\t\t\t\tdispatchIndex = i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (++i === cases.length) {\n\t\t\t\tif (dispatchIndex !== -1) {\n\t\t\t\t\tbreak;\n\t\t\t\t} else {\n\t\t\t\t\t_settle(pact, 1, result);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\ttest = cases[i][0];\n\t\t\tif (test) {\n\t\t\t\tvalue = test();\n\t\t\t\tif (value && value.then) {\n\t\t\t\t\tvalue.then(_resumeAfterTest).then(void 0, reject);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tdispatchIndex = i;\n\t\t\t}\n\t\t}\n\t\tdo {\n\t\t\tvar body = cases[dispatchIndex][1];\n\t\t\twhile (!body) {\n\t\t\t\tdispatchIndex++;\n\t\t\t\tbody = cases[dispatchIndex][1];\n\t\t\t}\n\t\t\tvar result = body();\n\t\t\tif (result && result.then) {\n\t\t\t\tresult.then(_resumeAfterBody).then(void 0, reject);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tvar fallthroughCheck = cases[dispatchIndex][2];\n\t\t\tdispatchIndex++;\n\t\t} while (fallthroughCheck && !fallthroughCheck());\n\t\t_settle(pact, 1, result);\n\t}\n\tfunction _resumeAfterBody(result) {\n\t\tfor (;;) {\n\t\t\tvar fallthroughCheck = cases[dispatchIndex][2];\n\t\t\tif (!fallthroughCheck || fallthroughCheck()) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdispatchIndex++;\n\t\t\tvar body = cases[dispatchIndex][1];\n\t\t\twhile (!body) {\n\t\t\t\tdispatchIndex++;\n\t\t\t\tbody = cases[dispatchIndex][1];\n\t\t\t}\n\t\t\tresult = body();\n\t\t\tif (result && result.then) {\n\t\t\t\tresult.then(_resumeAfterBody).then(void 0, reject);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\t_settle(pact, 1, result);\n\t}\n}\n\n// Asynchronously call a function and pass the result to explicitly passed continuations\nexport function _call(body, then, direct) {\n\tif (direct) {\n\t\treturn then ? then(body()) : body();\n\t}\n\ttry {\n\t\tvar result = Promise.resolve(body());\n\t\treturn then ? result.then(then) : result;\n\t} catch (e) {\n\t\treturn Promise.reject(e);\n\t}\n}\n\n// Asynchronously call a function and swallow the result\nexport function _callIgnored(body, direct) {\n\treturn _call(body, _empty, direct);\n}\n\n// Asynchronously call a function and pass the result to explicitly passed continuations\nexport function _invoke(body, then) {\n\tvar result = body();\n\tif (result && result.then) {\n\t\treturn result.then(then);\n\t}\n\treturn then(result);\n}\n\n// Asynchronously call a function and swallow the result\nexport function _invokeIgnored(body) {\n\tvar result = body();\n\tif (result && result.then) {\n\t\treturn result.then(_empty);\n\t}\n}\n\n// Asynchronously call a function and send errors to recovery continuation\nexport function _catch(body, recover) {\n\ttry {\n\t\tvar result = body();\n\t} catch(e) {\n\t\treturn recover(e);\n\t}\n\tif (result && result.then) {\n\t\treturn result.then(void 0, recover);\n\t}\n\treturn result;\n}\n\n// Asynchronously await a promise and pass the result to a finally continuation\nexport function _finallyRethrows(body, finalizer) {\n\ttry {\n\t\tvar result = body();\n\t} catch (e) {\n\t\treturn finalizer(true, e);\n\t}\n\tif (result && result.then) {\n\t\treturn result.then(finalizer.bind(null, false), finalizer.bind(null, true));\n\t}\n\treturn finalizer(false, result);\n}\n\n// Asynchronously await a promise and invoke a finally continuation that always overrides the result\nexport function _finally(body, finalizer) {\n\ttry {\n\t\tvar result = body();\n\t} catch (e) {\n\t\treturn finalizer();\n\t}\n\tif (result && result.then) {\n\t\treturn result.then(finalizer, finalizer);\n\t}\n\treturn finalizer();\n}\n\n// Rethrow or return a value from a finally continuation\nexport function _rethrow(thrown, value) {\n\tif (thrown)\n\t\tthrow value;\n\treturn value;\n}\n\n// Empty function to implement break and other control flow that ignores asynchronous results\nexport function _empty() {\n}\n\n// Sentinel value for early returns in generators \nexport const _earlyReturn = /*#__PURE__*/ {};\n\n// Asynchronously call a function and send errors to recovery continuation, skipping early returns\nexport function _catchInGenerator(body, recover) {\n\treturn _catch(body, function(e) {\n\t\tif (e === _earlyReturn) {\n\t\t\tthrow e;\n\t\t}\n\t\treturn recover(e);\n\t});\n}\n\n// Asynchronous generator class; accepts the entrypoint of the generator, to which it passes itself when the generator should start\nexport const _AsyncGenerator = /*#__PURE__*/(function() {\n\tfunction _AsyncGenerator(entry) {\n\t\tthis._entry = entry;\n\t\tthis._pact = null;\n\t\tthis._resolve = null;\n\t\tthis._return = null;\n\t\tthis._promise = null;\n\t}\n\n\tfunction _wrapReturnedValue(value) {\n\t\treturn { value: value, done: true };\n\t}\n\tfunction _wrapYieldedValue(value) {\n\t\treturn { value: value, done: false };\n\t}\n\n\t_AsyncGenerator.prototype._yield = function(value) {\n\t\t// Yield the value to the pending next call\n\t\tthis._resolve(value && value.then ? value.then(_wrapYieldedValue) : _wrapYieldedValue(value));\n\t\t// Return a pact for an upcoming next/return/throw call\n\t\treturn this._pact = new _Pact();\n\t};\n\t_AsyncGenerator.prototype.next = function(value) {\n\t\t// Advance the generator, starting it if it has yet to be started\n\t\tconst _this = this;\n\t\treturn _this._promise = new Promise(function (resolve) {\n\t\t\tconst _pact = _this._pact;\n\t\t\tif (_pact === null) {\n\t\t\t\tconst _entry = _this._entry;\n\t\t\t\tif (_entry === null) {\n\t\t\t\t\t// Generator is started, but not awaiting a yield expression\n\t\t\t\t\t// Abandon the next call!\n\t\t\t\t\treturn resolve(_this._promise);\n\t\t\t\t}\n\t\t\t\t// Start the generator\n\t\t\t\t_this._entry = null;\n\t\t\t\t_this._resolve = resolve;\n\t\t\t\tfunction returnValue(value) {\n\t\t\t\t\t_this._resolve(value && value.then ? value.then(_wrapReturnedValue) : _wrapReturnedValue(value));\n\t\t\t\t\t_this._pact = null;\n\t\t\t\t\t_this._resolve = null;\n\t\t\t\t}\n\t\t\t\tvar result = _entry(_this);\n\t\t\t\tif (result && result.then) {\n\t\t\t\t\tresult.then(returnValue, function(error) {\n\t\t\t\t\t\tif (error === _earlyReturn) {\n\t\t\t\t\t\t\treturnValue(_this._return);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tconst pact = new _Pact();\n\t\t\t\t\t\t\t_this._resolve(pact);\n\t\t\t\t\t\t\t_this._pact = null;\n\t\t\t\t\t\t\t_this._resolve = null;\n\t\t\t\t\t\t\t_resolve(pact, 2, error);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\treturnValue(result);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// Generator is started and a yield expression is pending, settle it\n\t\t\t\t_this._pact = null;\n\t\t\t\t_this._resolve = resolve;\n\t\t\t\t_settle(_pact, 1, value);\n\t\t\t}\n\t\t});\n\t};\n\t_AsyncGenerator.prototype.return = function(value) {\n\t\t// Early return from the generator if started, otherwise abandons the generator\n\t\tconst _this = this;\n\t\treturn _this._promise = new Promise(function (resolve) {\n\t\t\tconst _pact = _this._pact;\n\t\t\tif (_pact === null) {\n\t\t\t\tif (_this._entry === null) {\n\t\t\t\t\t// Generator is started, but not awaiting a yield expression\n\t\t\t\t\t// Abandon the return call!\n\t\t\t\t\treturn resolve(_this._promise);\n\t\t\t\t}\n\t\t\t\t// Generator is not started, abandon it and return the specified value\n\t\t\t\t_this._entry = null;\n\t\t\t\treturn resolve(value && value.then ? value.then(_wrapReturnedValue) : _wrapReturnedValue(value));\n\t\t\t}\n\t\t\t// Settle the yield expression with a rejected \"early return\" value\n\t\t\t_this._return = value;\n\t\t\t_this._resolve = resolve;\n\t\t\t_this._pact = null;\n\t\t\t_settle(_pact, 2, _earlyReturn);\n\t\t});\n\t};\n\t_AsyncGenerator.prototype.throw = function(error) {\n\t\t// Inject an exception into the pending yield expression\n\t\tconst _this = this;\n\t\treturn _this._promise = new Promise(function (resolve, reject) {\n\t\t\tconst _pact = _this._pact;\n\t\t\tif (_pact === null) {\n\t\t\t\tif (_this._entry === null) {\n\t\t\t\t\t// Generator is started, but not awaiting a yield expression\n\t\t\t\t\t// Abandon the throw call!\n\t\t\t\t\treturn resolve(_this._promise);\n\t\t\t\t}\n\t\t\t\t// Generator is not started, abandon it and return a rejected Promise containing the error\n\t\t\t\t_this._entry = null;\n\t\t\t\treturn reject(error);\n\t\t\t}\n\t\t\t// Settle the yield expression with the value as a rejection\n\t\t\t_this._resolve = resolve;\n\t\t\t_this._pact = null;\n\t\t\t_settle(_pact, 2, error);\n\t\t});\n\t};\n\n\t_AsyncGenerator.prototype[_asyncIteratorSymbol] = function() {\n\t\treturn this;\n\t};\n\t\n\treturn _AsyncGenerator;\n})();\n","import path from 'path';\nimport fs from 'fs';\nimport findRoot from 'find-root';\nimport {getDocument, queries} from 'pptr-testing-library';\nimport {configureToMatchImageSnapshot} from 'jest-image-snapshot';\n\nimport type {Page, ElementHandle, ScreenshotOptions, Browser, ClickOptions} from 'puppeteer';\nimport type {getQueriesForElement} from 'pptr-testing-library';\n\nexport const globalBrowser: Browser = (global as any).browser;\nexport const globalPage: Page = (global as any).page;\n\nconst isCi = process.argv.includes('--ci') || process.env.CI;\nconst isUsingDockerizedChromium = isCi || new URL(globalBrowser.wsEndpoint()).port === '9223';\n\nexport const serverHostName = ((): string => {\n if (isCi) {\n return 'localhost';\n }\n\n if (isUsingDockerizedChromium) {\n return process.platform === 'linux' ? '172.17.0.1' : 'host.docker.internal';\n }\n\n return 'localhost';\n})();\n\nconst rootDir = findRoot(process.cwd());\nconst pkg = JSON.parse(fs.readFileSync(path.join(rootDir, 'package.json'), 'utf-8'));\nconst projectConfig = pkg.acceptanceTests ?? {};\nconst server = (isCi ? projectConfig.ciServer : projectConfig.devServer) ?? projectConfig.server;\n\nexport const serverPort = server?.port;\n\nconst toMatchImageSnapshot = configureToMatchImageSnapshot({\n failureThreshold: 0,\n failureThresholdType: 'percent',\n});\n\nlet calledToMatchImageSnapshotOutsideDocker = false;\n\nconst localToMatchImageSnapshot = () => {\n calledToMatchImageSnapshotOutsideDocker = true;\n // let the expectation pass, then fail in afterEach. This way we allow developers to debug screenshot tests in local\n // but don't allow them to save screenshots taken outside the dockerized chromium\n return {\n message: () => '',\n pass: true,\n };\n};\n\nexpect.extend({\n toMatchImageSnapshot: isUsingDockerizedChromium ? toMatchImageSnapshot : localToMatchImageSnapshot,\n});\n\nafterEach(() => {\n if (calledToMatchImageSnapshotOutsideDocker) {\n const error = new Error(\n `Calling .toMatchImageSnapshot() is not allowed outside dockerized browser. Please, run your screenshot test in headless mode.`\n );\n error.stack = (error.stack || '').split('\\n')[0];\n throw error;\n }\n});\n\ntype WaitForPaintEndOptions = {\n maxWait?: number;\n fullPage?: boolean;\n};\n\nconst waitForPaintEnd = async (\n element: ElementHandle | Page,\n {maxWait = 10000, fullPage = true}: WaitForPaintEndOptions = {}\n) => {\n const STEP_TIME = 250;\n const t0 = Date.now();\n\n let buf1 = (await element.screenshot({fullPage})) as Buffer;\n await new Promise((r) => setTimeout(r, STEP_TIME));\n let buf2 = (await element.screenshot({fullPage})) as Buffer;\n\n // buffers are different if compare != 0\n while (buf1.compare(buf2)) {\n if (Date.now() - t0 > maxWait) {\n throw Error('Paint end timeout');\n }\n buf1 = buf2;\n await new Promise((r) => setTimeout(r, STEP_TIME));\n buf2 = (await element.screenshot({fullPage})) as Buffer;\n }\n};\n\nexport interface PageApi extends Omit<Page, 'click' | 'type' | 'select'> {\n clear: (selector: ElementHandle) => Promise<void>;\n // These are overridden:\n type: (selector: ElementHandle, text: string, options?: {delay: number}) => Promise<void>;\n click: (selector: ElementHandle, options?: ClickOptions) => Promise<void>;\n select: (selector: ElementHandle, ...values: string[]) => Promise<string[]>;\n}\n\ninterface OpenPageCommonConfig {\n userAgent?: string;\n isDarkMode?: boolean;\n}\n\ninterface OpenPageUrlConfig extends OpenPageCommonConfig {\n url: string;\n}\n\ninterface OpenPagePathConfig extends OpenPageCommonConfig {\n url?: undefined;\n\n path?: string;\n port?: number;\n protocol?: string;\n hostname?: string;\n}\n\ntype OpenPageConfig = OpenPageUrlConfig | OpenPagePathConfig;\n\nexport const openPage = async ({userAgent, isDarkMode, ...urlConfig}: OpenPageConfig): Promise<PageApi> => {\n const url = ((): string => {\n if (urlConfig.url !== undefined) {\n return urlConfig.url;\n }\n\n const {path = '/', port = serverPort, protocol = 'http', hostname = serverHostName} = urlConfig;\n\n if (!port) {\n const error = new Error(\n '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'\n );\n // Error.captureStackTrace(error, openPage);\n throw error;\n }\n\n return `${protocol}://${hostname}:${port}${path}`;\n })();\n\n const currentUserAgent = userAgent || (await globalBrowser.userAgent());\n const page = globalPage;\n await page.bringToFront();\n await page.setUserAgent(`${currentUserAgent} acceptance-test`);\n await page.emulateMediaFeatures([{name: 'prefers-color-scheme', value: isDarkMode ? 'dark' : 'light'}]);\n try {\n await page.goto(url);\n } catch (e) {\n if ((e as Error).message.includes('net::ERR_CONNECTION_REFUSED')) {\n const connectionError = new Error(`Could not connect to ${url}. Is the server running?`);\n Error.captureStackTrace(connectionError, openPage);\n throw connectionError;\n } else {\n throw e;\n }\n }\n\n const api: PageApi = Object.create(page);\n\n api.type = async (elementHandle, text, options) => elementHandle.type(text, options);\n api.click = async (elementHandle, options) => elementHandle.click(options);\n api.select = async (elementHandle, ...values) => elementHandle.select(...values);\n\n api.screenshot = async (options?: ScreenshotOptions) => {\n await waitForPaintEnd(page);\n return page.screenshot(options);\n };\n\n api.clear = async (elementHandle) => {\n await elementHandle.click({clickCount: 3});\n await elementHandle.press('Delete');\n };\n\n return api;\n};\n\nconst buildQueryMethods = (): ReturnType<typeof getQueriesForElement> => {\n const boundQueries: any = {};\n for (const [queryName, queryFn] of Object.entries(queries)) {\n boundQueries[queryName] = async (...args: any) => {\n const doc = await getDocument(globalPage);\n const queryArgs = [...args];\n if (queryName.startsWith('findBy')) {\n queryArgs.push({timeout: 10000});\n }\n const elementHandle = await queryFn(doc, ...queryArgs);\n\n const newElementHandle = Object.create(elementHandle);\n\n newElementHandle.screenshot = async (options: ScreenshotOptions) => {\n await waitForPaintEnd(elementHandle, {fullPage: false});\n return elementHandle.screenshot(options);\n };\n\n return newElementHandle;\n };\n }\n return boundQueries;\n};\n\nexport const screen = buildQueryMethods();\n\nexport type {ElementHandle} from 'puppeteer';\n"],"names":["_Pact","prototype","then","onFulfilled","onRejected","result","state","s","callback","_settle","v","e","o","_this","value","pact","bind","observer","_isSettledPact","thenable","_iteratorSymbol","Symbol","iterator","_asyncIteratorSymbol","asyncIterator","_for","test","update","body","stage","shouldContinue","updateValue","reject","_resumeAfterTest","_resumeAfterBody","_resumeAfterUpdate","_catch","recover","globalBrowser","global","browser","globalPage","page","isCi","process","argv","includes","env","CI","isUsingDockerizedChromium","URL","wsEndpoint","port","serverHostName","platform","rootDir","findRoot","cwd","pkg","JSON","parse","fs","readFileSync","path","join","projectConfig","acceptanceTests","server","ciServer","devServer","serverPort","toMatchImageSnapshot","configureToMatchImageSnapshot","failureThreshold","failureThresholdType","calledToMatchImageSnapshotOutsideDocker","localToMatchImageSnapshot","message","pass","expect","extend","afterEach","error","Error","stack","split","waitForPaintEnd","element","maxWait","fullPage","STEP_TIME","t0","Date","now","screenshot","buf1","Promise","r","setTimeout","buf2","compare","openPage","userAgent","isDarkMode","urlConfig","currentUserAgent","bringToFront","setUserAgent","emulateMediaFeatures","name","api","Object","create","type","elementHandle","text","options","click","select","values","clear","clickCount","press","url","connectionError","captureStackTrace","undefined","protocol","hostname","buildQueryMethods","boundQueries","queryName","queryFn","args","getDocument","doc","queryArgs","startsWith","push","timeout","newElementHandle","entries","queries","screen"],"mappings":";;;;;;;;;;;;;;;;;;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}
|
|
1
|
+
{"version":3,"file":"acceptance-testing.cjs.development.js","sources":["../../../node_modules/babel-plugin-transform-async-to-promises/helpers.js","../src/index.ts"],"sourcesContent":["// A type of promise-like that resolves synchronously and supports only one observer\nexport const _Pact = /*#__PURE__*/(function() {\n\tfunction _Pact() {}\n\t_Pact.prototype.then = function(onFulfilled, onRejected) {\n\t\tconst result = new _Pact();\n\t\tconst state = this.s;\n\t\tif (state) {\n\t\t\tconst callback = state & 1 ? onFulfilled : onRejected;\n\t\t\tif (callback) {\n\t\t\t\ttry {\n\t\t\t\t\t_settle(result, 1, callback(this.v));\n\t\t\t\t} catch (e) {\n\t\t\t\t\t_settle(result, 2, e);\n\t\t\t\t}\n\t\t\t\treturn result;\n\t\t\t} else {\n\t\t\t\treturn this;\n\t\t\t}\n\t\t}\n\t\tthis.o = function(_this) {\n\t\t\ttry {\n\t\t\t\tconst value = _this.v;\n\t\t\t\tif (_this.s & 1) {\n\t\t\t\t\t_settle(result, 1, onFulfilled ? onFulfilled(value) : value);\n\t\t\t\t} else if (onRejected) {\n\t\t\t\t\t_settle(result, 1, onRejected(value));\n\t\t\t\t} else {\n\t\t\t\t\t_settle(result, 2, value);\n\t\t\t\t}\n\t\t\t} catch (e) {\n\t\t\t\t_settle(result, 2, e);\n\t\t\t}\n\t\t};\n\t\treturn result;\n\t}\n\treturn _Pact;\n})();\n\n// Settles a pact synchronously\nexport function _settle(pact, state, value) {\n\tif (!pact.s) {\n\t\tif (value instanceof _Pact) {\n\t\t\tif (value.s) {\n\t\t\t\tif (state & 1) {\n\t\t\t\t\tstate = value.s;\n\t\t\t\t}\n\t\t\t\tvalue = value.v;\n\t\t\t} else {\n\t\t\t\tvalue.o = _settle.bind(null, pact, state);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\tif (value && value.then) {\n\t\t\tvalue.then(_settle.bind(null, pact, state), _settle.bind(null, pact, 2));\n\t\t\treturn;\n\t\t}\n\t\tpact.s = state;\n\t\tpact.v = value;\n\t\tconst observer = pact.o;\n\t\tif (observer) {\n\t\t\tobserver(pact);\n\t\t}\n\t}\n}\n\nexport function _isSettledPact(thenable) {\n\treturn thenable instanceof _Pact && thenable.s & 1;\n}\n\n// Converts argument to a function that always returns a Promise\nexport function _async(f) {\n\treturn function() {\n\t\tfor (var args = [], i = 0; i < arguments.length; i++) {\n\t\t\targs[i] = arguments[i];\n\t\t}\n\t\ttry {\n\t\t\treturn Promise.resolve(f.apply(this, args));\n\t\t} catch(e) {\n\t\t\treturn Promise.reject(e);\n\t\t}\n\t}\n}\n\n// Awaits on a value that may or may not be a Promise (equivalent to the await keyword in ES2015, with continuations passed explicitly)\nexport function _await(value, then, direct) {\n\tif (direct) {\n\t\treturn then ? then(value) : value;\n\t}\n\tif (!value || !value.then) {\n\t\tvalue = Promise.resolve(value);\n\t}\n\treturn then ? value.then(then) : value;\n}\n\n// Awaits on a value that may or may not be a Promise, then ignores it\nexport function _awaitIgnored(value, direct) {\n\tif (!direct) {\n\t\treturn value && value.then ? value.then(_empty) : Promise.resolve();\n\t}\n}\n\n// Proceeds after a value has resolved, or proceeds immediately if the value is not thenable\nexport function _continue(value, then) {\n\treturn value && value.then ? value.then(then) : then(value);\n}\n\n// Proceeds after a value has resolved, or proceeds immediately if the value is not thenable\nexport function _continueIgnored(value) {\n\tif (value && value.then) {\n\t\treturn value.then(_empty);\n\t}\n}\n\n// Asynchronously iterate through an object that has a length property, passing the index as the first argument to the callback (even as the length property changes)\nexport function _forTo(array, body, check) {\n\tvar i = -1, pact, reject;\n\tfunction _cycle(result) {\n\t\ttry {\n\t\t\twhile (++i < array.length && (!check || !check())) {\n\t\t\t\tresult = body(i);\n\t\t\t\tif (result && result.then) {\n\t\t\t\t\tif (_isSettledPact(result)) {\n\t\t\t\t\t\tresult = result.v;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tresult.then(_cycle, reject || (reject = _settle.bind(null, pact = new _Pact(), 2)));\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (pact) {\n\t\t\t\t_settle(pact, 1, result);\n\t\t\t} else {\n\t\t\t\tpact = result;\n\t\t\t}\n\t\t} catch (e) {\n\t\t\t_settle(pact || (pact = new _Pact()), 2, e);\n\t\t}\n\t}\n\t_cycle();\n\treturn pact;\n}\n\n// Asynchronously iterate through an object's properties (including properties inherited from the prototype)\n// Uses a snapshot of the object's properties\nexport function _forIn(target, body, check) {\n\tvar keys = [];\n\tfor (var key in target) {\n\t\tkeys.push(key);\n\t}\n\treturn _forTo(keys, function(i) { return body(keys[i]); }, check);\n}\n\n// Asynchronously iterate through an object's own properties (excluding properties inherited from the prototype)\n// Uses a snapshot of the object's properties\nexport function _forOwn(target, body, check) {\n\tvar keys = [];\n\tfor (var key in target) {\n\t\tif (Object.prototype.hasOwnProperty.call(target, key)) {\n\t\t\tkeys.push(key);\n\t\t}\n\t}\n\treturn _forTo(keys, function(i) { return body(keys[i]); }, check);\n}\n\nexport const _iteratorSymbol = /*#__PURE__*/ typeof Symbol !== \"undefined\" ? (Symbol.iterator || (Symbol.iterator = Symbol(\"Symbol.iterator\"))) : \"@@iterator\";\n\n// Asynchronously iterate through an object's values\n// Uses for...of if the runtime supports it, otherwise iterates until length on a copy\nexport function _forOf(target, body, check) {\n\tif (typeof target[_iteratorSymbol] === \"function\") {\n\t\tvar iterator = target[_iteratorSymbol](), step, pact, reject;\n\t\tfunction _cycle(result) {\n\t\t\ttry {\n\t\t\t\twhile (!(step = iterator.next()).done && (!check || !check())) {\n\t\t\t\t\tresult = body(step.value);\n\t\t\t\t\tif (result && result.then) {\n\t\t\t\t\t\tif (_isSettledPact(result)) {\n\t\t\t\t\t\t\tresult = result.v;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tresult.then(_cycle, reject || (reject = _settle.bind(null, pact = new _Pact(), 2)));\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (pact) {\n\t\t\t\t\t_settle(pact, 1, result);\n\t\t\t\t} else {\n\t\t\t\t\tpact = result;\n\t\t\t\t}\n\t\t\t} catch (e) {\n\t\t\t\t_settle(pact || (pact = new _Pact()), 2, e);\n\t\t\t}\n\t\t}\n\t\t_cycle();\n\t\tif (iterator.return) {\n\t\t\tvar _fixup = function(value) {\n\t\t\t\ttry {\n\t\t\t\t\tif (!step.done) {\n\t\t\t\t\t\titerator.return();\n\t\t\t\t\t}\n\t\t\t\t} catch(e) {\n\t\t\t\t}\n\t\t\t\treturn value;\n\t\t\t}\n\t\t\tif (pact && pact.then) {\n\t\t\t\treturn pact.then(_fixup, function(e) {\n\t\t\t\t\tthrow _fixup(e);\n\t\t\t\t});\n\t\t\t}\n\t\t\t_fixup();\n\t\t}\n\t\treturn pact;\n\t}\n\t// No support for Symbol.iterator\n\tif (!(\"length\" in target)) {\n\t\tthrow new TypeError(\"Object is not iterable\");\n\t}\n\t// Handle live collections properly\n\tvar values = [];\n\tfor (var i = 0; i < target.length; i++) {\n\t\tvalues.push(target[i]);\n\t}\n\treturn _forTo(values, function(i) { return body(values[i]); }, check);\n}\n\nexport const _asyncIteratorSymbol = /*#__PURE__*/ typeof Symbol !== \"undefined\" ? (Symbol.asyncIterator || (Symbol.asyncIterator = Symbol(\"Symbol.asyncIterator\"))) : \"@@asyncIterator\";\n\n// Asynchronously iterate on a value using it's async iterator if present, or its synchronous iterator if missing\nexport function _forAwaitOf(target, body, check) {\n\tif (typeof target[_asyncIteratorSymbol] === \"function\") {\n\t\tvar pact = new _Pact();\n\t\tvar iterator = target[_asyncIteratorSymbol]();\n\t\titerator.next().then(_resumeAfterNext).then(void 0, _reject);\n\t\treturn pact;\n\t\tfunction _resumeAfterBody(result) {\n\t\t\tif (check && check()) {\n\t\t\t\treturn _settle(pact, 1, iterator.return ? iterator.return().then(function() { return result; }) : result);\n\t\t\t}\n\t\t\titerator.next().then(_resumeAfterNext).then(void 0, _reject);\n\t\t}\n\t\tfunction _resumeAfterNext(step) {\n\t\t\tif (step.done) {\n\t\t\t\t_settle(pact, 1);\n\t\t\t} else {\n\t\t\t\tPromise.resolve(body(step.value)).then(_resumeAfterBody).then(void 0, _reject);\n\t\t\t}\n\t\t}\n\t\tfunction _reject(error) {\n\t\t\t_settle(pact, 2, iterator.return ? iterator.return().then(function() { return error; }) : error);\n\t\t}\n\t}\n\treturn Promise.resolve(_forOf(target, function(value) { return Promise.resolve(value).then(body); }, check));\n}\n\n// Asynchronously implement a generic for loop\nexport function _for(test, update, body) {\n\tvar stage;\n\tfor (;;) {\n\t\tvar shouldContinue = test();\n\t\tif (_isSettledPact(shouldContinue)) {\n\t\t\tshouldContinue = shouldContinue.v;\n\t\t}\n\t\tif (!shouldContinue) {\n\t\t\treturn result;\n\t\t}\n\t\tif (shouldContinue.then) {\n\t\t\tstage = 0;\n\t\t\tbreak;\n\t\t}\n\t\tvar result = body();\n\t\tif (result && result.then) {\n\t\t\tif (_isSettledPact(result)) {\n\t\t\t\tresult = result.s;\n\t\t\t} else {\n\t\t\t\tstage = 1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (update) {\n\t\t\tvar updateValue = update();\n\t\t\tif (updateValue && updateValue.then && !_isSettledPact(updateValue)) {\n\t\t\t\tstage = 2;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\tvar pact = new _Pact();\n\tvar reject = _settle.bind(null, pact, 2);\n\t(stage === 0 ? shouldContinue.then(_resumeAfterTest) : stage === 1 ? result.then(_resumeAfterBody) : updateValue.then(_resumeAfterUpdate)).then(void 0, reject);\n\treturn pact;\n\tfunction _resumeAfterBody(value) {\n\t\tresult = value;\n\t\tdo {\n\t\t\tif (update) {\n\t\t\t\tupdateValue = update();\n\t\t\t\tif (updateValue && updateValue.then && !_isSettledPact(updateValue)) {\n\t\t\t\t\tupdateValue.then(_resumeAfterUpdate).then(void 0, reject);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\tshouldContinue = test();\n\t\t\tif (!shouldContinue || (_isSettledPact(shouldContinue) && !shouldContinue.v)) {\n\t\t\t\t_settle(pact, 1, result);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (shouldContinue.then) {\n\t\t\t\tshouldContinue.then(_resumeAfterTest).then(void 0, reject);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tresult = body();\n\t\t\tif (_isSettledPact(result)) {\n\t\t\t\tresult = result.v;\n\t\t\t}\n\t\t} while (!result || !result.then);\n\t\tresult.then(_resumeAfterBody).then(void 0, reject);\n\t}\n\tfunction _resumeAfterTest(shouldContinue) {\n\t\tif (shouldContinue) {\n\t\t\tresult = body();\n\t\t\tif (result && result.then) {\n\t\t\t\tresult.then(_resumeAfterBody).then(void 0, reject);\n\t\t\t} else {\n\t\t\t\t_resumeAfterBody(result);\n\t\t\t}\n\t\t} else {\n\t\t\t_settle(pact, 1, result);\n\t\t}\n\t}\n\tfunction _resumeAfterUpdate() {\n\t\tif (shouldContinue = test()) {\n\t\t\tif (shouldContinue.then) {\n\t\t\t\tshouldContinue.then(_resumeAfterTest).then(void 0, reject);\n\t\t\t} else {\n\t\t\t\t_resumeAfterTest(shouldContinue);\n\t\t\t}\n\t\t} else {\n\t\t\t_settle(pact, 1, result);\n\t\t}\n\t}\n}\n\n// Asynchronously implement a do ... while loop\nexport function _do(body, test) {\n\tvar awaitBody;\n\tdo {\n\t\tvar result = body();\n\t\tif (result && result.then) {\n\t\t\tif (_isSettledPact(result)) {\n\t\t\t\tresult = result.v;\n\t\t\t} else {\n\t\t\t\tawaitBody = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tvar shouldContinue = test();\n\t\tif (_isSettledPact(shouldContinue)) {\n\t\t\tshouldContinue = shouldContinue.v;\n\t\t}\n\t\tif (!shouldContinue) {\n\t\t\treturn result;\n\t\t}\n\t} while (!shouldContinue.then);\n\tconst pact = new _Pact();\n\tconst reject = _settle.bind(null, pact, 2);\n\t(awaitBody ? result.then(_resumeAfterBody) : shouldContinue.then(_resumeAfterTest)).then(void 0, reject);\n\treturn pact;\n\tfunction _resumeAfterBody(value) {\n\t\tresult = value;\n\t\tfor (;;) {\n\t\t\tshouldContinue = test();\n\t\t\tif (_isSettledPact(shouldContinue)) {\n\t\t\t\tshouldContinue = shouldContinue.v;\n\t\t\t}\n\t\t\tif (!shouldContinue) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (shouldContinue.then) {\n\t\t\t\tshouldContinue.then(_resumeAfterTest).then(void 0, reject);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tresult = body();\n\t\t\tif (result && result.then) {\n\t\t\t\tif (_isSettledPact(result)) {\n\t\t\t\t\tresult = result.v;\n\t\t\t\t} else {\n\t\t\t\t\tresult.then(_resumeAfterBody).then(void 0, reject);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t_settle(pact, 1, result);\n\t}\n\tfunction _resumeAfterTest(shouldContinue) {\n\t\tif (shouldContinue) {\n\t\t\tdo {\n\t\t\t\tresult = body();\n\t\t\t\tif (result && result.then) {\n\t\t\t\t\tif (_isSettledPact(result)) {\n\t\t\t\t\t\tresult = result.v;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tresult.then(_resumeAfterBody).then(void 0, reject);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tshouldContinue = test();\n\t\t\t\tif (_isSettledPact(shouldContinue)) {\n\t\t\t\t\tshouldContinue = shouldContinue.v;\n\t\t\t\t}\n\t\t\t\tif (!shouldContinue) {\n\t\t\t\t\t_settle(pact, 1, result);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t} while (!shouldContinue.then);\n\t\t\tshouldContinue.then(_resumeAfterTest).then(void 0, reject);\n\t\t} else {\n\t\t\t_settle(pact, 1, result);\n\t\t}\n\t}\n}\n\n// Asynchronously implement a switch statement\nexport function _switch(discriminant, cases) {\n\tvar dispatchIndex = -1;\n\tvar awaitBody;\n\touter: {\n\t\tfor (var i = 0; i < cases.length; i++) {\n\t\t\tvar test = cases[i][0];\n\t\t\tif (test) {\n\t\t\t\tvar testValue = test();\n\t\t\t\tif (testValue && testValue.then) {\n\t\t\t\t\tbreak outer;\n\t\t\t\t}\n\t\t\t\tif (testValue === discriminant) {\n\t\t\t\t\tdispatchIndex = i;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// Found the default case, set it as the pending dispatch case\n\t\t\t\tdispatchIndex = i;\n\t\t\t}\n\t\t}\n\t\tif (dispatchIndex !== -1) {\n\t\t\tdo {\n\t\t\t\tvar body = cases[dispatchIndex][1];\n\t\t\t\twhile (!body) {\n\t\t\t\t\tdispatchIndex++;\n\t\t\t\t\tbody = cases[dispatchIndex][1];\n\t\t\t\t}\n\t\t\t\tvar result = body();\n\t\t\t\tif (result && result.then) {\n\t\t\t\t\tawaitBody = true;\n\t\t\t\t\tbreak outer;\n\t\t\t\t}\n\t\t\t\tvar fallthroughCheck = cases[dispatchIndex][2];\n\t\t\t\tdispatchIndex++;\n\t\t\t} while (fallthroughCheck && !fallthroughCheck());\n\t\t\treturn result;\n\t\t}\n\t}\n\tconst pact = new _Pact();\n\tconst reject = _settle.bind(null, pact, 2);\n\t(awaitBody ? result.then(_resumeAfterBody) : testValue.then(_resumeAfterTest)).then(void 0, reject);\n\treturn pact;\n\tfunction _resumeAfterTest(value) {\n\t\tfor (;;) {\n\t\t\tif (value === discriminant) {\n\t\t\t\tdispatchIndex = i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (++i === cases.length) {\n\t\t\t\tif (dispatchIndex !== -1) {\n\t\t\t\t\tbreak;\n\t\t\t\t} else {\n\t\t\t\t\t_settle(pact, 1, result);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\ttest = cases[i][0];\n\t\t\tif (test) {\n\t\t\t\tvalue = test();\n\t\t\t\tif (value && value.then) {\n\t\t\t\t\tvalue.then(_resumeAfterTest).then(void 0, reject);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tdispatchIndex = i;\n\t\t\t}\n\t\t}\n\t\tdo {\n\t\t\tvar body = cases[dispatchIndex][1];\n\t\t\twhile (!body) {\n\t\t\t\tdispatchIndex++;\n\t\t\t\tbody = cases[dispatchIndex][1];\n\t\t\t}\n\t\t\tvar result = body();\n\t\t\tif (result && result.then) {\n\t\t\t\tresult.then(_resumeAfterBody).then(void 0, reject);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tvar fallthroughCheck = cases[dispatchIndex][2];\n\t\t\tdispatchIndex++;\n\t\t} while (fallthroughCheck && !fallthroughCheck());\n\t\t_settle(pact, 1, result);\n\t}\n\tfunction _resumeAfterBody(result) {\n\t\tfor (;;) {\n\t\t\tvar fallthroughCheck = cases[dispatchIndex][2];\n\t\t\tif (!fallthroughCheck || fallthroughCheck()) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdispatchIndex++;\n\t\t\tvar body = cases[dispatchIndex][1];\n\t\t\twhile (!body) {\n\t\t\t\tdispatchIndex++;\n\t\t\t\tbody = cases[dispatchIndex][1];\n\t\t\t}\n\t\t\tresult = body();\n\t\t\tif (result && result.then) {\n\t\t\t\tresult.then(_resumeAfterBody).then(void 0, reject);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\t_settle(pact, 1, result);\n\t}\n}\n\n// Asynchronously call a function and pass the result to explicitly passed continuations\nexport function _call(body, then, direct) {\n\tif (direct) {\n\t\treturn then ? then(body()) : body();\n\t}\n\ttry {\n\t\tvar result = Promise.resolve(body());\n\t\treturn then ? result.then(then) : result;\n\t} catch (e) {\n\t\treturn Promise.reject(e);\n\t}\n}\n\n// Asynchronously call a function and swallow the result\nexport function _callIgnored(body, direct) {\n\treturn _call(body, _empty, direct);\n}\n\n// Asynchronously call a function and pass the result to explicitly passed continuations\nexport function _invoke(body, then) {\n\tvar result = body();\n\tif (result && result.then) {\n\t\treturn result.then(then);\n\t}\n\treturn then(result);\n}\n\n// Asynchronously call a function and swallow the result\nexport function _invokeIgnored(body) {\n\tvar result = body();\n\tif (result && result.then) {\n\t\treturn result.then(_empty);\n\t}\n}\n\n// Asynchronously call a function and send errors to recovery continuation\nexport function _catch(body, recover) {\n\ttry {\n\t\tvar result = body();\n\t} catch(e) {\n\t\treturn recover(e);\n\t}\n\tif (result && result.then) {\n\t\treturn result.then(void 0, recover);\n\t}\n\treturn result;\n}\n\n// Asynchronously await a promise and pass the result to a finally continuation\nexport function _finallyRethrows(body, finalizer) {\n\ttry {\n\t\tvar result = body();\n\t} catch (e) {\n\t\treturn finalizer(true, e);\n\t}\n\tif (result && result.then) {\n\t\treturn result.then(finalizer.bind(null, false), finalizer.bind(null, true));\n\t}\n\treturn finalizer(false, result);\n}\n\n// Asynchronously await a promise and invoke a finally continuation that always overrides the result\nexport function _finally(body, finalizer) {\n\ttry {\n\t\tvar result = body();\n\t} catch (e) {\n\t\treturn finalizer();\n\t}\n\tif (result && result.then) {\n\t\treturn result.then(finalizer, finalizer);\n\t}\n\treturn finalizer();\n}\n\n// Rethrow or return a value from a finally continuation\nexport function _rethrow(thrown, value) {\n\tif (thrown)\n\t\tthrow value;\n\treturn value;\n}\n\n// Empty function to implement break and other control flow that ignores asynchronous results\nexport function _empty() {\n}\n\n// Sentinel value for early returns in generators \nexport const _earlyReturn = /*#__PURE__*/ {};\n\n// Asynchronously call a function and send errors to recovery continuation, skipping early returns\nexport function _catchInGenerator(body, recover) {\n\treturn _catch(body, function(e) {\n\t\tif (e === _earlyReturn) {\n\t\t\tthrow e;\n\t\t}\n\t\treturn recover(e);\n\t});\n}\n\n// Asynchronous generator class; accepts the entrypoint of the generator, to which it passes itself when the generator should start\nexport const _AsyncGenerator = /*#__PURE__*/(function() {\n\tfunction _AsyncGenerator(entry) {\n\t\tthis._entry = entry;\n\t\tthis._pact = null;\n\t\tthis._resolve = null;\n\t\tthis._return = null;\n\t\tthis._promise = null;\n\t}\n\n\tfunction _wrapReturnedValue(value) {\n\t\treturn { value: value, done: true };\n\t}\n\tfunction _wrapYieldedValue(value) {\n\t\treturn { value: value, done: false };\n\t}\n\n\t_AsyncGenerator.prototype._yield = function(value) {\n\t\t// Yield the value to the pending next call\n\t\tthis._resolve(value && value.then ? value.then(_wrapYieldedValue) : _wrapYieldedValue(value));\n\t\t// Return a pact for an upcoming next/return/throw call\n\t\treturn this._pact = new _Pact();\n\t};\n\t_AsyncGenerator.prototype.next = function(value) {\n\t\t// Advance the generator, starting it if it has yet to be started\n\t\tconst _this = this;\n\t\treturn _this._promise = new Promise(function (resolve) {\n\t\t\tconst _pact = _this._pact;\n\t\t\tif (_pact === null) {\n\t\t\t\tconst _entry = _this._entry;\n\t\t\t\tif (_entry === null) {\n\t\t\t\t\t// Generator is started, but not awaiting a yield expression\n\t\t\t\t\t// Abandon the next call!\n\t\t\t\t\treturn resolve(_this._promise);\n\t\t\t\t}\n\t\t\t\t// Start the generator\n\t\t\t\t_this._entry = null;\n\t\t\t\t_this._resolve = resolve;\n\t\t\t\tfunction returnValue(value) {\n\t\t\t\t\t_this._resolve(value && value.then ? value.then(_wrapReturnedValue) : _wrapReturnedValue(value));\n\t\t\t\t\t_this._pact = null;\n\t\t\t\t\t_this._resolve = null;\n\t\t\t\t}\n\t\t\t\tvar result = _entry(_this);\n\t\t\t\tif (result && result.then) {\n\t\t\t\t\tresult.then(returnValue, function(error) {\n\t\t\t\t\t\tif (error === _earlyReturn) {\n\t\t\t\t\t\t\treturnValue(_this._return);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tconst pact = new _Pact();\n\t\t\t\t\t\t\t_this._resolve(pact);\n\t\t\t\t\t\t\t_this._pact = null;\n\t\t\t\t\t\t\t_this._resolve = null;\n\t\t\t\t\t\t\t_resolve(pact, 2, error);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\treturnValue(result);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// Generator is started and a yield expression is pending, settle it\n\t\t\t\t_this._pact = null;\n\t\t\t\t_this._resolve = resolve;\n\t\t\t\t_settle(_pact, 1, value);\n\t\t\t}\n\t\t});\n\t};\n\t_AsyncGenerator.prototype.return = function(value) {\n\t\t// Early return from the generator if started, otherwise abandons the generator\n\t\tconst _this = this;\n\t\treturn _this._promise = new Promise(function (resolve) {\n\t\t\tconst _pact = _this._pact;\n\t\t\tif (_pact === null) {\n\t\t\t\tif (_this._entry === null) {\n\t\t\t\t\t// Generator is started, but not awaiting a yield expression\n\t\t\t\t\t// Abandon the return call!\n\t\t\t\t\treturn resolve(_this._promise);\n\t\t\t\t}\n\t\t\t\t// Generator is not started, abandon it and return the specified value\n\t\t\t\t_this._entry = null;\n\t\t\t\treturn resolve(value && value.then ? value.then(_wrapReturnedValue) : _wrapReturnedValue(value));\n\t\t\t}\n\t\t\t// Settle the yield expression with a rejected \"early return\" value\n\t\t\t_this._return = value;\n\t\t\t_this._resolve = resolve;\n\t\t\t_this._pact = null;\n\t\t\t_settle(_pact, 2, _earlyReturn);\n\t\t});\n\t};\n\t_AsyncGenerator.prototype.throw = function(error) {\n\t\t// Inject an exception into the pending yield expression\n\t\tconst _this = this;\n\t\treturn _this._promise = new Promise(function (resolve, reject) {\n\t\t\tconst _pact = _this._pact;\n\t\t\tif (_pact === null) {\n\t\t\t\tif (_this._entry === null) {\n\t\t\t\t\t// Generator is started, but not awaiting a yield expression\n\t\t\t\t\t// Abandon the throw call!\n\t\t\t\t\treturn resolve(_this._promise);\n\t\t\t\t}\n\t\t\t\t// Generator is not started, abandon it and return a rejected Promise containing the error\n\t\t\t\t_this._entry = null;\n\t\t\t\treturn reject(error);\n\t\t\t}\n\t\t\t// Settle the yield expression with the value as a rejection\n\t\t\t_this._resolve = resolve;\n\t\t\t_this._pact = null;\n\t\t\t_settle(_pact, 2, error);\n\t\t});\n\t};\n\n\t_AsyncGenerator.prototype[_asyncIteratorSymbol] = function() {\n\t\treturn this;\n\t};\n\t\n\treturn _AsyncGenerator;\n})();\n","import path from 'path';\nimport fs from 'fs';\nimport findRoot from 'find-root';\nimport {getDocument, queries} from 'pptr-testing-library';\nimport {configureToMatchImageSnapshot} from 'jest-image-snapshot';\n\nimport type {Page, ElementHandle, ScreenshotOptions, Browser, ClickOptions, Viewport} from 'puppeteer';\nimport type {getQueriesForElement} from 'pptr-testing-library';\n\nexport const globalBrowser: Browser = (global as any).browser;\nexport const globalPage: Page = (global as any).page;\n\nconst isCi = process.argv.includes('--ci') || process.env.CI;\nconst isUsingDockerizedChromium = isCi || new URL(globalBrowser.wsEndpoint()).port === '9223';\n\nexport const serverHostName = ((): string => {\n if (isCi) {\n return 'localhost';\n }\n\n if (isUsingDockerizedChromium) {\n return process.platform === 'linux' ? '172.17.0.1' : 'host.docker.internal';\n }\n\n return 'localhost';\n})();\n\nconst rootDir = findRoot(process.cwd());\nconst pkg = JSON.parse(fs.readFileSync(path.join(rootDir, 'package.json'), 'utf-8'));\nconst projectConfig = pkg.acceptanceTests ?? {};\nconst server = (isCi ? projectConfig.ciServer : projectConfig.devServer) ?? projectConfig.server;\n\nexport const serverPort = server?.port;\n\nconst toMatchImageSnapshot = configureToMatchImageSnapshot({\n failureThreshold: 0,\n failureThresholdType: 'percent',\n});\n\nlet calledToMatchImageSnapshotOutsideDocker = false;\n\nconst localToMatchImageSnapshot = () => {\n calledToMatchImageSnapshotOutsideDocker = true;\n // let the expectation pass, then fail in afterEach. This way we allow developers to debug screenshot tests in local\n // but don't allow them to save screenshots taken outside the dockerized chromium\n return {\n message: () => '',\n pass: true,\n };\n};\n\nexpect.extend({\n toMatchImageSnapshot: isUsingDockerizedChromium ? toMatchImageSnapshot : localToMatchImageSnapshot,\n});\n\nafterEach(() => {\n if (calledToMatchImageSnapshotOutsideDocker) {\n const error = new Error(\n `Calling .toMatchImageSnapshot() is not allowed outside dockerized browser. Please, run your screenshot test in headless mode.`\n );\n error.stack = (error.stack || '').split('\\n')[0];\n throw error;\n }\n});\n\ntype WaitForPaintEndOptions = {\n maxWait?: number;\n fullPage?: boolean;\n};\n\nconst waitForPaintEnd = async (\n element: ElementHandle | Page,\n {maxWait = 10000, fullPage = true}: WaitForPaintEndOptions = {}\n) => {\n const STEP_TIME = 250;\n const t0 = Date.now();\n\n let buf1 = (await element.screenshot({fullPage})) as Buffer;\n await new Promise((r) => setTimeout(r, STEP_TIME));\n let buf2 = (await element.screenshot({fullPage})) as Buffer;\n\n // buffers are different if compare != 0\n while (buf1.compare(buf2)) {\n if (Date.now() - t0 > maxWait) {\n throw Error('Paint end timeout');\n }\n buf1 = buf2;\n await new Promise((r) => setTimeout(r, STEP_TIME));\n buf2 = (await element.screenshot({fullPage})) as Buffer;\n }\n};\n\nexport interface PageApi extends Omit<Page, 'click' | 'type' | 'select'> {\n clear: (selector: ElementHandle) => Promise<void>;\n // These are overridden:\n type: (selector: ElementHandle, text: string, options?: {delay: number}) => Promise<void>;\n click: (selector: ElementHandle, options?: ClickOptions) => Promise<void>;\n select: (selector: ElementHandle, ...values: string[]) => Promise<string[]>;\n}\n\ninterface OpenPageCommonConfig {\n userAgent?: string;\n viewport?: Viewport;\n isDarkMode?: boolean;\n}\n\ninterface OpenPageUrlConfig extends OpenPageCommonConfig {\n url: string;\n}\n\ninterface OpenPagePathConfig extends OpenPageCommonConfig {\n url?: undefined;\n\n path?: string;\n port?: number;\n protocol?: string;\n hostname?: string;\n}\n\ntype OpenPageConfig = OpenPageUrlConfig | OpenPagePathConfig;\n\nexport const openPage = async ({\n userAgent,\n isDarkMode,\n viewport,\n ...urlConfig\n}: OpenPageConfig): Promise<PageApi> => {\n const url = ((): string => {\n if (urlConfig.url !== undefined) {\n return urlConfig.url;\n }\n\n const {path = '/', port = serverPort, protocol = 'http', hostname = serverHostName} = urlConfig;\n\n if (!port) {\n const error = new Error(\n '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'\n );\n // Error.captureStackTrace(error, openPage);\n throw error;\n }\n\n return `${protocol}://${hostname}:${port}${path}`;\n })();\n\n const currentUserAgent = userAgent || (await globalBrowser.userAgent());\n const page = globalPage;\n\n await page.bringToFront();\n if (viewport) {\n await page.setViewport(viewport);\n }\n await page.setUserAgent(`${currentUserAgent} acceptance-test`);\n await page.emulateMediaFeatures([{name: 'prefers-color-scheme', value: isDarkMode ? 'dark' : 'light'}]);\n try {\n await page.goto(url);\n } catch (e) {\n if ((e as Error).message.includes('net::ERR_CONNECTION_REFUSED')) {\n const connectionError = new Error(`Could not connect to ${url}. Is the server running?`);\n Error.captureStackTrace(connectionError, openPage);\n throw connectionError;\n } else {\n throw e;\n }\n }\n await page.waitForFunction('document.fonts.status === \"loaded\"');\n\n const api: PageApi = Object.create(page);\n\n api.type = async (elementHandle, text, options) => elementHandle.type(text, options);\n api.click = async (elementHandle, options) => elementHandle.click(options);\n api.select = async (elementHandle, ...values) => elementHandle.select(...values);\n\n api.screenshot = async (options?: ScreenshotOptions) => {\n await page.waitForNetworkIdle();\n await waitForPaintEnd(page);\n return page.screenshot(options);\n };\n\n api.clear = async (elementHandle) => {\n await elementHandle.click({clickCount: 3});\n await elementHandle.press('Delete');\n };\n\n return api;\n};\n\nconst buildQueryMethods = (): ReturnType<typeof getQueriesForElement> => {\n const boundQueries: any = {};\n for (const [queryName, queryFn] of Object.entries(queries)) {\n boundQueries[queryName] = async (...args: any) => {\n const doc = await getDocument(globalPage);\n const queryArgs = [...args];\n if (queryName.startsWith('findBy')) {\n queryArgs.push({timeout: 10000});\n }\n const elementHandle = await queryFn(doc, ...queryArgs);\n\n const newElementHandle = Object.create(elementHandle);\n\n newElementHandle.screenshot = async (options: ScreenshotOptions) => {\n await globalPage.waitForNetworkIdle();\n await waitForPaintEnd(elementHandle, {fullPage: false});\n return elementHandle.screenshot(options);\n };\n\n return newElementHandle;\n };\n }\n return boundQueries;\n};\n\nexport const screen = buildQueryMethods();\n\nexport type {ElementHandle, Viewport} from 'puppeteer';\n\nafterEach(async () => {\n try {\n // clear tab, this way we clear the DOM and stop js execution or pending requests\n await globalPage.goto('about:blank');\n } catch (e) {\n // ignore, at this point page might be destroyed\n }\n});\n"],"names":["_Pact","prototype","then","onFulfilled","onRejected","result","state","s","callback","_settle","v","e","o","_this","value","pact","bind","observer","_isSettledPact","thenable","_iteratorSymbol","Symbol","iterator","_asyncIteratorSymbol","asyncIterator","_for","test","update","body","stage","shouldContinue","updateValue","reject","_resumeAfterTest","_resumeAfterBody","_resumeAfterUpdate","_catch","recover","globalBrowser","global","browser","globalPage","page","isCi","process","argv","includes","env","CI","isUsingDockerizedChromium","URL","wsEndpoint","port","serverHostName","platform","rootDir","findRoot","cwd","pkg","JSON","parse","fs","readFileSync","path","join","projectConfig","acceptanceTests","server","ciServer","devServer","serverPort","toMatchImageSnapshot","configureToMatchImageSnapshot","failureThreshold","failureThresholdType","calledToMatchImageSnapshotOutsideDocker","localToMatchImageSnapshot","message","pass","expect","extend","afterEach","error","Error","stack","split","waitForPaintEnd","element","maxWait","fullPage","STEP_TIME","t0","Date","now","screenshot","buf1","Promise","r","setTimeout","buf2","compare","openPage","userAgent","isDarkMode","viewport","urlConfig","currentUserAgent","bringToFront","setUserAgent","emulateMediaFeatures","name","waitForFunction","api","Object","create","type","elementHandle","text","options","click","select","values","waitForNetworkIdle","clear","clickCount","press","url","connectionError","captureStackTrace","setViewport","undefined","protocol","hostname","buildQueryMethods","boundQueries","queryName","queryFn","args","getDocument","doc","queryArgs","startsWith","push","timeout","newElementHandle","entries","queries","screen"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACO,IAAMA,KAAK,gBAAiB,YAAW;AAC7C,WAASA,KAAT,GAAiB;;AACjBA,EAAAA,KAAK,CAACC,SAAN,CAAgBC,IAAhB,GAAuB,UAASC,WAAT,EAAsBC,UAAtB,EAAkC;AACxD,QAAMC,MAAM,GAAG,IAAIL,KAAJ,EAAf;AACA,QAAMM,KAAK,GAAG,KAAKC,CAAnB;;AACA,QAAID,KAAJ,EAAW;AACV,UAA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J,GAPQ;AAAA;AAAA;AAAA,EAAT;;;;;;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var r,t,n=e(require("path")),o=e(require("fs")),i=e(require("find-root")),s=require("pptr-testing-library"),
|
|
1
|
+
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var r,t,n=e(require("path")),o=e(require("fs")),i=e(require("find-root")),s=require("pptr-testing-library"),u=require("jest-image-snapshot"),c=function(){function e(){}return e.prototype.then=function(r,t){var n=new e,o=this.s;if(o){var i=1&o?r:t;if(i){try{a(n,1,i(this.v))}catch(e){a(n,2,e)}return n}return this}return this.o=function(e){try{var o=e.v;1&e.s?a(n,1,r?r(o):o):t?a(n,1,t(o)):a(n,2,o)}catch(e){a(n,2,e)}},n},e}();function a(e,r,t){if(!e.s){if(t instanceof c){if(!t.s)return void(t.o=a.bind(null,e,r));1&r&&(r=t.s),t=t.v}if(t&&t.then)return void t.then(a.bind(null,e,r),a.bind(null,e,2));e.s=r,e.v=t;var n=e.o;n&&n(e)}}function l(e){return e instanceof c&&1&e.s}function f(e,r){try{var t=e()}catch(e){return r(e)}return t&&t.then?t.then(void 0,r):t}"undefined"!=typeof Symbol&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));var h=global.browser,v=global.page,m=process.argv.includes("--ci")||process.env.CI,d=m||"9223"===new URL(h.wsEndpoint()).port,p=function(){return m?"localhost":d?"linux"===process.platform?"172.17.0.1":"host.docker.internal":"localhost"}(),P=null!==(r=JSON.parse(o.readFileSync(n.join(i(process.cwd()),"package.json"),"utf-8")).acceptanceTests)&&void 0!==r?r:{},y=null!==(t=m?P.ciServer:P.devServer)&&void 0!==t?t:P.server,g=null==y?void 0:y.port,b=!1;expect.extend({toMatchImageSnapshot:d?u.configureToMatchImageSnapshot({failureThreshold:0,failureThresholdType:"percent"}):function(){return b=!0,{message:function(){return""},pass:!0}}}),afterEach((function(){if(b){var e=new Error("Calling .toMatchImageSnapshot() is not allowed outside dockerized browser. Please, run your screenshot test in headless mode.");throw e.stack=(e.stack||"").split("\n")[0],e}}));var w=function(e,r){var t=void 0===r?{}:r,n=t.maxWait,o=void 0===n?1e4:n,i=t.fullPage,s=void 0===i||i;try{var u=Date.now();return Promise.resolve(e.screenshot({fullPage:s})).then((function(r){return Promise.resolve(new Promise((function(e){return setTimeout(e,250)}))).then((function(){return Promise.resolve(e.screenshot({fullPage:s})).then((function(t){return function(e,r,t){for(var n;;){var o=e();if(l(o)&&(o=o.v),!o)return i;if(o.then){n=0;break}var i=t();if(i&&i.then){if(!l(i)){n=1;break}i=i.s}}var s=new c,u=a.bind(null,s,2);return(0===n?o.then(h):1===n?i.then(f):(void 0).then((function(){(o=e())?o.then?o.then(h).then(void 0,u):h(o):a(s,1,i)}))).then(void 0,u),s;function f(r){i=r;do{if(!(o=e())||l(o)&&!o.v)return void a(s,1,i);if(o.then)return void o.then(h).then(void 0,u);l(i=t())&&(i=i.v)}while(!i||!i.then);i.then(f).then(void 0,u)}function h(e){e?(i=t())&&i.then?i.then(f).then(void 0,u):f(i):a(s,1,i)}}((function(){return!!r.compare(t)}),0,(function(){if(Date.now()-u>o)throw Error("Paint end timeout");return r=t,Promise.resolve(new Promise((function(e){return setTimeout(e,250)}))).then((function(){return Promise.resolve(e.screenshot({fullPage:s})).then((function(e){t=e}))}))}))}))}))}))}catch(e){return Promise.reject(e)}},j=function(){for(var e={},r=function(){var r=n[t],o=r[0],i=r[1];e[o]=function(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++)r[t]=arguments[t];try{return Promise.resolve(s.getDocument(v)).then((function(e){var t=[].concat(r);return o.startsWith("findBy")&&t.push({timeout:1e4}),Promise.resolve(i.apply(void 0,[e].concat(t))).then((function(e){var r=Object.create(e);return r.screenshot=function(r){try{return Promise.resolve(v.waitForNetworkIdle()).then((function(){return Promise.resolve(w(e,{fullPage:!1})).then((function(){return e.screenshot(r)}))}))}catch(e){return Promise.reject(e)}},r}))}))}catch(e){return Promise.reject(e)}}},t=0,n=Object.entries(s.queries);t<n.length;t++)r();return e}();afterEach((function(){try{var e=f((function(){return Promise.resolve(v.goto("about:blank")).then((function(){}))}),(function(){}));return Promise.resolve(e&&e.then?e.then((function(){})):void 0)}catch(e){return Promise.reject(e)}})),exports.globalBrowser=h,exports.globalPage=v,exports.openPage=function e(r){var t=r.userAgent,n=r.isDarkMode,o=r.viewport,i=function(e,r){if(null==e)return{};var t,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r.indexOf(t=i[n])>=0||(o[t]=e[t]);return o}(r,["userAgent","isDarkMode","viewport"]);try{var s=function(r){var t=v;return Promise.resolve(t.bringToFront()).then((function(){function i(){return Promise.resolve(t.setUserAgent(r+" acceptance-test")).then((function(){return Promise.resolve(t.emulateMediaFeatures([{name:"prefers-color-scheme",value:n?"dark":"light"}])).then((function(){function r(e){return Promise.resolve(t.waitForFunction('document.fonts.status === "loaded"')).then((function(){var e=Object.create(t);return e.type=function(e,r,t){try{return Promise.resolve(e.type(r,t))}catch(e){return Promise.reject(e)}},e.click=function(e,r){try{return Promise.resolve(e.click(r))}catch(e){return Promise.reject(e)}},e.select=function(e){try{for(var r=arguments.length,t=new Array(r>1?r-1:0),n=1;n<r;n++)t[n-1]=arguments[n];return Promise.resolve(e.select.apply(e,t))}catch(e){return Promise.reject(e)}},e.screenshot=function(e){try{return Promise.resolve(t.waitForNetworkIdle()).then((function(){return Promise.resolve(w(t)).then((function(){return t.screenshot(e)}))}))}catch(e){return Promise.reject(e)}},e.clear=function(e){try{return Promise.resolve(e.click({clickCount:3})).then((function(){return Promise.resolve(e.press("Delete")).then((function(){}))}))}catch(e){return Promise.reject(e)}},e}))}var n=f((function(){return Promise.resolve(t.goto(u)).then((function(){}))}),(function(r){if(r.message.includes("net::ERR_CONNECTION_REFUSED")){var t=new Error("Could not connect to "+u+". Is the server running?");throw Error.captureStackTrace(t,e),t}throw r}));return n&&n.then?n.then(r):r()}))}))}var s=function(){if(o)return Promise.resolve(t.setViewport(o)).then((function(){}))}();return s&&s.then?s.then(i):i()}))},u=function(){if(void 0!==i.url)return i.url;var e=i.path,r=void 0===e?"/":e,t=i.port,n=void 0===t?g:t,o=i.protocol,s=void 0===o?"http":o,u=i.hostname,c=void 0===u?p:u;if(!n)throw 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");return s+"://"+c+":"+n+r}();return Promise.resolve(t?s(t):Promise.resolve(h.userAgent()).then(s))}catch(e){return Promise.reject(e)}},exports.screen=j,exports.serverHostName=p,exports.serverPort=g;
|
|
2
2
|
//# sourceMappingURL=acceptance-testing.cjs.production.min.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acceptance-testing.cjs.production.min.js","sources":["../../../node_modules/babel-plugin-transform-async-to-promises/helpers.js","../src/index.ts"],"sourcesContent":["// A type of promise-like that resolves synchronously and supports only one observer\nexport const _Pact = /*#__PURE__*/(function() {\n\tfunction _Pact() {}\n\t_Pact.prototype.then = function(onFulfilled, onRejected) {\n\t\tconst result = new _Pact();\n\t\tconst state = this.s;\n\t\tif (state) {\n\t\t\tconst callback = state & 1 ? onFulfilled : onRejected;\n\t\t\tif (callback) {\n\t\t\t\ttry {\n\t\t\t\t\t_settle(result, 1, callback(this.v));\n\t\t\t\t} catch (e) {\n\t\t\t\t\t_settle(result, 2, e);\n\t\t\t\t}\n\t\t\t\treturn result;\n\t\t\t} else {\n\t\t\t\treturn this;\n\t\t\t}\n\t\t}\n\t\tthis.o = function(_this) {\n\t\t\ttry {\n\t\t\t\tconst value = _this.v;\n\t\t\t\tif (_this.s & 1) {\n\t\t\t\t\t_settle(result, 1, onFulfilled ? onFulfilled(value) : value);\n\t\t\t\t} else if (onRejected) {\n\t\t\t\t\t_settle(result, 1, onRejected(value));\n\t\t\t\t} else {\n\t\t\t\t\t_settle(result, 2, value);\n\t\t\t\t}\n\t\t\t} catch (e) {\n\t\t\t\t_settle(result, 2, e);\n\t\t\t}\n\t\t};\n\t\treturn result;\n\t}\n\treturn _Pact;\n})();\n\n// Settles a pact synchronously\nexport function _settle(pact, state, value) {\n\tif (!pact.s) {\n\t\tif (value instanceof _Pact) {\n\t\t\tif (value.s) {\n\t\t\t\tif (state & 1) {\n\t\t\t\t\tstate = value.s;\n\t\t\t\t}\n\t\t\t\tvalue = value.v;\n\t\t\t} else {\n\t\t\t\tvalue.o = _settle.bind(null, pact, state);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\tif (value && value.then) {\n\t\t\tvalue.then(_settle.bind(null, pact, state), _settle.bind(null, pact, 2));\n\t\t\treturn;\n\t\t}\n\t\tpact.s = state;\n\t\tpact.v = value;\n\t\tconst observer = pact.o;\n\t\tif (observer) {\n\t\t\tobserver(pact);\n\t\t}\n\t}\n}\n\nexport function _isSettledPact(thenable) {\n\treturn thenable instanceof _Pact && thenable.s & 1;\n}\n\n// Converts argument to a function that always returns a Promise\nexport function _async(f) {\n\treturn function() {\n\t\tfor (var args = [], i = 0; i < arguments.length; i++) {\n\t\t\targs[i] = arguments[i];\n\t\t}\n\t\ttry {\n\t\t\treturn Promise.resolve(f.apply(this, args));\n\t\t} catch(e) {\n\t\t\treturn Promise.reject(e);\n\t\t}\n\t}\n}\n\n// Awaits on a value that may or may not be a Promise (equivalent to the await keyword in ES2015, with continuations passed explicitly)\nexport function _await(value, then, direct) {\n\tif (direct) {\n\t\treturn then ? then(value) : value;\n\t}\n\tif (!value || !value.then) {\n\t\tvalue = Promise.resolve(value);\n\t}\n\treturn then ? value.then(then) : value;\n}\n\n// Awaits on a value that may or may not be a Promise, then ignores it\nexport function _awaitIgnored(value, direct) {\n\tif (!direct) {\n\t\treturn value && value.then ? value.then(_empty) : Promise.resolve();\n\t}\n}\n\n// Proceeds after a value has resolved, or proceeds immediately if the value is not thenable\nexport function _continue(value, then) {\n\treturn value && value.then ? value.then(then) : then(value);\n}\n\n// Proceeds after a value has resolved, or proceeds immediately if the value is not thenable\nexport function _continueIgnored(value) {\n\tif (value && value.then) {\n\t\treturn value.then(_empty);\n\t}\n}\n\n// Asynchronously iterate through an object that has a length property, passing the index as the first argument to the callback (even as the length property changes)\nexport function _forTo(array, body, check) {\n\tvar i = -1, pact, reject;\n\tfunction _cycle(result) {\n\t\ttry {\n\t\t\twhile (++i < array.length && (!check || !check())) {\n\t\t\t\tresult = body(i);\n\t\t\t\tif (result && result.then) {\n\t\t\t\t\tif (_isSettledPact(result)) {\n\t\t\t\t\t\tresult = result.v;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tresult.then(_cycle, reject || (reject = _settle.bind(null, pact = new _Pact(), 2)));\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (pact) {\n\t\t\t\t_settle(pact, 1, result);\n\t\t\t} else {\n\t\t\t\tpact = result;\n\t\t\t}\n\t\t} catch (e) {\n\t\t\t_settle(pact || (pact = new _Pact()), 2, e);\n\t\t}\n\t}\n\t_cycle();\n\treturn pact;\n}\n\n// Asynchronously iterate through an object's properties (including properties inherited from the prototype)\n// Uses a snapshot of the object's properties\nexport function _forIn(target, body, check) {\n\tvar keys = [];\n\tfor (var key in target) {\n\t\tkeys.push(key);\n\t}\n\treturn _forTo(keys, function(i) { return body(keys[i]); }, check);\n}\n\n// Asynchronously iterate through an object's own properties (excluding properties inherited from the prototype)\n// Uses a snapshot of the object's properties\nexport function _forOwn(target, body, check) {\n\tvar keys = [];\n\tfor (var key in target) {\n\t\tif (Object.prototype.hasOwnProperty.call(target, key)) {\n\t\t\tkeys.push(key);\n\t\t}\n\t}\n\treturn _forTo(keys, function(i) { return body(keys[i]); }, check);\n}\n\nexport const _iteratorSymbol = /*#__PURE__*/ typeof Symbol !== \"undefined\" ? (Symbol.iterator || (Symbol.iterator = Symbol(\"Symbol.iterator\"))) : \"@@iterator\";\n\n// Asynchronously iterate through an object's values\n// Uses for...of if the runtime supports it, otherwise iterates until length on a copy\nexport function _forOf(target, body, check) {\n\tif (typeof target[_iteratorSymbol] === \"function\") {\n\t\tvar iterator = target[_iteratorSymbol](), step, pact, reject;\n\t\tfunction _cycle(result) {\n\t\t\ttry {\n\t\t\t\twhile (!(step = iterator.next()).done && (!check || !check())) {\n\t\t\t\t\tresult = body(step.value);\n\t\t\t\t\tif (result && result.then) {\n\t\t\t\t\t\tif (_isSettledPact(result)) {\n\t\t\t\t\t\t\tresult = result.v;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tresult.then(_cycle, reject || (reject = _settle.bind(null, pact = new _Pact(), 2)));\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (pact) {\n\t\t\t\t\t_settle(pact, 1, result);\n\t\t\t\t} else {\n\t\t\t\t\tpact = result;\n\t\t\t\t}\n\t\t\t} catch (e) {\n\t\t\t\t_settle(pact || (pact = new _Pact()), 2, e);\n\t\t\t}\n\t\t}\n\t\t_cycle();\n\t\tif (iterator.return) {\n\t\t\tvar _fixup = function(value) {\n\t\t\t\ttry {\n\t\t\t\t\tif (!step.done) {\n\t\t\t\t\t\titerator.return();\n\t\t\t\t\t}\n\t\t\t\t} catch(e) {\n\t\t\t\t}\n\t\t\t\treturn value;\n\t\t\t}\n\t\t\tif (pact && pact.then) {\n\t\t\t\treturn pact.then(_fixup, function(e) {\n\t\t\t\t\tthrow _fixup(e);\n\t\t\t\t});\n\t\t\t}\n\t\t\t_fixup();\n\t\t}\n\t\treturn pact;\n\t}\n\t// No support for Symbol.iterator\n\tif (!(\"length\" in target)) {\n\t\tthrow new TypeError(\"Object is not iterable\");\n\t}\n\t// Handle live collections properly\n\tvar values = [];\n\tfor (var i = 0; i < target.length; i++) {\n\t\tvalues.push(target[i]);\n\t}\n\treturn _forTo(values, function(i) { return body(values[i]); }, check);\n}\n\nexport const _asyncIteratorSymbol = /*#__PURE__*/ typeof Symbol !== \"undefined\" ? (Symbol.asyncIterator || (Symbol.asyncIterator = Symbol(\"Symbol.asyncIterator\"))) : \"@@asyncIterator\";\n\n// Asynchronously iterate on a value using it's async iterator if present, or its synchronous iterator if missing\nexport function _forAwaitOf(target, body, check) {\n\tif (typeof target[_asyncIteratorSymbol] === \"function\") {\n\t\tvar pact = new _Pact();\n\t\tvar iterator = target[_asyncIteratorSymbol]();\n\t\titerator.next().then(_resumeAfterNext).then(void 0, _reject);\n\t\treturn pact;\n\t\tfunction _resumeAfterBody(result) {\n\t\t\tif (check && check()) {\n\t\t\t\treturn _settle(pact, 1, iterator.return ? iterator.return().then(function() { return result; }) : result);\n\t\t\t}\n\t\t\titerator.next().then(_resumeAfterNext).then(void 0, _reject);\n\t\t}\n\t\tfunction _resumeAfterNext(step) {\n\t\t\tif (step.done) {\n\t\t\t\t_settle(pact, 1);\n\t\t\t} else {\n\t\t\t\tPromise.resolve(body(step.value)).then(_resumeAfterBody).then(void 0, _reject);\n\t\t\t}\n\t\t}\n\t\tfunction _reject(error) {\n\t\t\t_settle(pact, 2, iterator.return ? iterator.return().then(function() { return error; }) : error);\n\t\t}\n\t}\n\treturn Promise.resolve(_forOf(target, function(value) { return Promise.resolve(value).then(body); }, check));\n}\n\n// Asynchronously implement a generic for loop\nexport function _for(test, update, body) {\n\tvar stage;\n\tfor (;;) {\n\t\tvar shouldContinue = test();\n\t\tif (_isSettledPact(shouldContinue)) {\n\t\t\tshouldContinue = shouldContinue.v;\n\t\t}\n\t\tif (!shouldContinue) {\n\t\t\treturn result;\n\t\t}\n\t\tif (shouldContinue.then) {\n\t\t\tstage = 0;\n\t\t\tbreak;\n\t\t}\n\t\tvar result = body();\n\t\tif (result && result.then) {\n\t\t\tif (_isSettledPact(result)) {\n\t\t\t\tresult = result.s;\n\t\t\t} else {\n\t\t\t\tstage = 1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (update) {\n\t\t\tvar updateValue = update();\n\t\t\tif (updateValue && updateValue.then && !_isSettledPact(updateValue)) {\n\t\t\t\tstage = 2;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\tvar pact = new _Pact();\n\tvar reject = _settle.bind(null, pact, 2);\n\t(stage === 0 ? shouldContinue.then(_resumeAfterTest) : stage === 1 ? result.then(_resumeAfterBody) : updateValue.then(_resumeAfterUpdate)).then(void 0, reject);\n\treturn pact;\n\tfunction _resumeAfterBody(value) {\n\t\tresult = value;\n\t\tdo {\n\t\t\tif (update) {\n\t\t\t\tupdateValue = update();\n\t\t\t\tif (updateValue && updateValue.then && !_isSettledPact(updateValue)) {\n\t\t\t\t\tupdateValue.then(_resumeAfterUpdate).then(void 0, reject);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\tshouldContinue = test();\n\t\t\tif (!shouldContinue || (_isSettledPact(shouldContinue) && !shouldContinue.v)) {\n\t\t\t\t_settle(pact, 1, result);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (shouldContinue.then) {\n\t\t\t\tshouldContinue.then(_resumeAfterTest).then(void 0, reject);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tresult = body();\n\t\t\tif (_isSettledPact(result)) {\n\t\t\t\tresult = result.v;\n\t\t\t}\n\t\t} while (!result || !result.then);\n\t\tresult.then(_resumeAfterBody).then(void 0, reject);\n\t}\n\tfunction _resumeAfterTest(shouldContinue) {\n\t\tif (shouldContinue) {\n\t\t\tresult = body();\n\t\t\tif (result && result.then) {\n\t\t\t\tresult.then(_resumeAfterBody).then(void 0, reject);\n\t\t\t} else {\n\t\t\t\t_resumeAfterBody(result);\n\t\t\t}\n\t\t} else {\n\t\t\t_settle(pact, 1, result);\n\t\t}\n\t}\n\tfunction _resumeAfterUpdate() {\n\t\tif (shouldContinue = test()) {\n\t\t\tif (shouldContinue.then) {\n\t\t\t\tshouldContinue.then(_resumeAfterTest).then(void 0, reject);\n\t\t\t} else {\n\t\t\t\t_resumeAfterTest(shouldContinue);\n\t\t\t}\n\t\t} else {\n\t\t\t_settle(pact, 1, result);\n\t\t}\n\t}\n}\n\n// Asynchronously implement a do ... while loop\nexport function _do(body, test) {\n\tvar awaitBody;\n\tdo {\n\t\tvar result = body();\n\t\tif (result && result.then) {\n\t\t\tif (_isSettledPact(result)) {\n\t\t\t\tresult = result.v;\n\t\t\t} else {\n\t\t\t\tawaitBody = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tvar shouldContinue = test();\n\t\tif (_isSettledPact(shouldContinue)) {\n\t\t\tshouldContinue = shouldContinue.v;\n\t\t}\n\t\tif (!shouldContinue) {\n\t\t\treturn result;\n\t\t}\n\t} while (!shouldContinue.then);\n\tconst pact = new _Pact();\n\tconst reject = _settle.bind(null, pact, 2);\n\t(awaitBody ? result.then(_resumeAfterBody) : shouldContinue.then(_resumeAfterTest)).then(void 0, reject);\n\treturn pact;\n\tfunction _resumeAfterBody(value) {\n\t\tresult = value;\n\t\tfor (;;) {\n\t\t\tshouldContinue = test();\n\t\t\tif (_isSettledPact(shouldContinue)) {\n\t\t\t\tshouldContinue = shouldContinue.v;\n\t\t\t}\n\t\t\tif (!shouldContinue) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (shouldContinue.then) {\n\t\t\t\tshouldContinue.then(_resumeAfterTest).then(void 0, reject);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tresult = body();\n\t\t\tif (result && result.then) {\n\t\t\t\tif (_isSettledPact(result)) {\n\t\t\t\t\tresult = result.v;\n\t\t\t\t} else {\n\t\t\t\t\tresult.then(_resumeAfterBody).then(void 0, reject);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t_settle(pact, 1, result);\n\t}\n\tfunction _resumeAfterTest(shouldContinue) {\n\t\tif (shouldContinue) {\n\t\t\tdo {\n\t\t\t\tresult = body();\n\t\t\t\tif (result && result.then) {\n\t\t\t\t\tif (_isSettledPact(result)) {\n\t\t\t\t\t\tresult = result.v;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tresult.then(_resumeAfterBody).then(void 0, reject);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tshouldContinue = test();\n\t\t\t\tif (_isSettledPact(shouldContinue)) {\n\t\t\t\t\tshouldContinue = shouldContinue.v;\n\t\t\t\t}\n\t\t\t\tif (!shouldContinue) {\n\t\t\t\t\t_settle(pact, 1, result);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t} while (!shouldContinue.then);\n\t\t\tshouldContinue.then(_resumeAfterTest).then(void 0, reject);\n\t\t} else {\n\t\t\t_settle(pact, 1, result);\n\t\t}\n\t}\n}\n\n// Asynchronously implement a switch statement\nexport function _switch(discriminant, cases) {\n\tvar dispatchIndex = -1;\n\tvar awaitBody;\n\touter: {\n\t\tfor (var i = 0; i < cases.length; i++) {\n\t\t\tvar test = cases[i][0];\n\t\t\tif (test) {\n\t\t\t\tvar testValue = test();\n\t\t\t\tif (testValue && testValue.then) {\n\t\t\t\t\tbreak outer;\n\t\t\t\t}\n\t\t\t\tif (testValue === discriminant) {\n\t\t\t\t\tdispatchIndex = i;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// Found the default case, set it as the pending dispatch case\n\t\t\t\tdispatchIndex = i;\n\t\t\t}\n\t\t}\n\t\tif (dispatchIndex !== -1) {\n\t\t\tdo {\n\t\t\t\tvar body = cases[dispatchIndex][1];\n\t\t\t\twhile (!body) {\n\t\t\t\t\tdispatchIndex++;\n\t\t\t\t\tbody = cases[dispatchIndex][1];\n\t\t\t\t}\n\t\t\t\tvar result = body();\n\t\t\t\tif (result && result.then) {\n\t\t\t\t\tawaitBody = true;\n\t\t\t\t\tbreak outer;\n\t\t\t\t}\n\t\t\t\tvar fallthroughCheck = cases[dispatchIndex][2];\n\t\t\t\tdispatchIndex++;\n\t\t\t} while (fallthroughCheck && !fallthroughCheck());\n\t\t\treturn result;\n\t\t}\n\t}\n\tconst pact = new _Pact();\n\tconst reject = _settle.bind(null, pact, 2);\n\t(awaitBody ? result.then(_resumeAfterBody) : testValue.then(_resumeAfterTest)).then(void 0, reject);\n\treturn pact;\n\tfunction _resumeAfterTest(value) {\n\t\tfor (;;) {\n\t\t\tif (value === discriminant) {\n\t\t\t\tdispatchIndex = i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (++i === cases.length) {\n\t\t\t\tif (dispatchIndex !== -1) {\n\t\t\t\t\tbreak;\n\t\t\t\t} else {\n\t\t\t\t\t_settle(pact, 1, result);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\ttest = cases[i][0];\n\t\t\tif (test) {\n\t\t\t\tvalue = test();\n\t\t\t\tif (value && value.then) {\n\t\t\t\t\tvalue.then(_resumeAfterTest).then(void 0, reject);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tdispatchIndex = i;\n\t\t\t}\n\t\t}\n\t\tdo {\n\t\t\tvar body = cases[dispatchIndex][1];\n\t\t\twhile (!body) {\n\t\t\t\tdispatchIndex++;\n\t\t\t\tbody = cases[dispatchIndex][1];\n\t\t\t}\n\t\t\tvar result = body();\n\t\t\tif (result && result.then) {\n\t\t\t\tresult.then(_resumeAfterBody).then(void 0, reject);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tvar fallthroughCheck = cases[dispatchIndex][2];\n\t\t\tdispatchIndex++;\n\t\t} while (fallthroughCheck && !fallthroughCheck());\n\t\t_settle(pact, 1, result);\n\t}\n\tfunction _resumeAfterBody(result) {\n\t\tfor (;;) {\n\t\t\tvar fallthroughCheck = cases[dispatchIndex][2];\n\t\t\tif (!fallthroughCheck || fallthroughCheck()) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdispatchIndex++;\n\t\t\tvar body = cases[dispatchIndex][1];\n\t\t\twhile (!body) {\n\t\t\t\tdispatchIndex++;\n\t\t\t\tbody = cases[dispatchIndex][1];\n\t\t\t}\n\t\t\tresult = body();\n\t\t\tif (result && result.then) {\n\t\t\t\tresult.then(_resumeAfterBody).then(void 0, reject);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\t_settle(pact, 1, result);\n\t}\n}\n\n// Asynchronously call a function and pass the result to explicitly passed continuations\nexport function _call(body, then, direct) {\n\tif (direct) {\n\t\treturn then ? then(body()) : body();\n\t}\n\ttry {\n\t\tvar result = Promise.resolve(body());\n\t\treturn then ? result.then(then) : result;\n\t} catch (e) {\n\t\treturn Promise.reject(e);\n\t}\n}\n\n// Asynchronously call a function and swallow the result\nexport function _callIgnored(body, direct) {\n\treturn _call(body, _empty, direct);\n}\n\n// Asynchronously call a function and pass the result to explicitly passed continuations\nexport function _invoke(body, then) {\n\tvar result = body();\n\tif (result && result.then) {\n\t\treturn result.then(then);\n\t}\n\treturn then(result);\n}\n\n// Asynchronously call a function and swallow the result\nexport function _invokeIgnored(body) {\n\tvar result = body();\n\tif (result && result.then) {\n\t\treturn result.then(_empty);\n\t}\n}\n\n// Asynchronously call a function and send errors to recovery continuation\nexport function _catch(body, recover) {\n\ttry {\n\t\tvar result = body();\n\t} catch(e) {\n\t\treturn recover(e);\n\t}\n\tif (result && result.then) {\n\t\treturn result.then(void 0, recover);\n\t}\n\treturn result;\n}\n\n// Asynchronously await a promise and pass the result to a finally continuation\nexport function _finallyRethrows(body, finalizer) {\n\ttry {\n\t\tvar result = body();\n\t} catch (e) {\n\t\treturn finalizer(true, e);\n\t}\n\tif (result && result.then) {\n\t\treturn result.then(finalizer.bind(null, false), finalizer.bind(null, true));\n\t}\n\treturn finalizer(false, result);\n}\n\n// Asynchronously await a promise and invoke a finally continuation that always overrides the result\nexport function _finally(body, finalizer) {\n\ttry {\n\t\tvar result = body();\n\t} catch (e) {\n\t\treturn finalizer();\n\t}\n\tif (result && result.then) {\n\t\treturn result.then(finalizer, finalizer);\n\t}\n\treturn finalizer();\n}\n\n// Rethrow or return a value from a finally continuation\nexport function _rethrow(thrown, value) {\n\tif (thrown)\n\t\tthrow value;\n\treturn value;\n}\n\n// Empty function to implement break and other control flow that ignores asynchronous results\nexport function _empty() {\n}\n\n// Sentinel value for early returns in generators \nexport const _earlyReturn = /*#__PURE__*/ {};\n\n// Asynchronously call a function and send errors to recovery continuation, skipping early returns\nexport function _catchInGenerator(body, recover) {\n\treturn _catch(body, function(e) {\n\t\tif (e === _earlyReturn) {\n\t\t\tthrow e;\n\t\t}\n\t\treturn recover(e);\n\t});\n}\n\n// Asynchronous generator class; accepts the entrypoint of the generator, to which it passes itself when the generator should start\nexport const _AsyncGenerator = /*#__PURE__*/(function() {\n\tfunction _AsyncGenerator(entry) {\n\t\tthis._entry = entry;\n\t\tthis._pact = null;\n\t\tthis._resolve = null;\n\t\tthis._return = null;\n\t\tthis._promise = null;\n\t}\n\n\tfunction _wrapReturnedValue(value) {\n\t\treturn { value: value, done: true };\n\t}\n\tfunction _wrapYieldedValue(value) {\n\t\treturn { value: value, done: false };\n\t}\n\n\t_AsyncGenerator.prototype._yield = function(value) {\n\t\t// Yield the value to the pending next call\n\t\tthis._resolve(value && value.then ? value.then(_wrapYieldedValue) : _wrapYieldedValue(value));\n\t\t// Return a pact for an upcoming next/return/throw call\n\t\treturn this._pact = new _Pact();\n\t};\n\t_AsyncGenerator.prototype.next = function(value) {\n\t\t// Advance the generator, starting it if it has yet to be started\n\t\tconst _this = this;\n\t\treturn _this._promise = new Promise(function (resolve) {\n\t\t\tconst _pact = _this._pact;\n\t\t\tif (_pact === null) {\n\t\t\t\tconst _entry = _this._entry;\n\t\t\t\tif (_entry === null) {\n\t\t\t\t\t// Generator is started, but not awaiting a yield expression\n\t\t\t\t\t// Abandon the next call!\n\t\t\t\t\treturn resolve(_this._promise);\n\t\t\t\t}\n\t\t\t\t// Start the generator\n\t\t\t\t_this._entry = null;\n\t\t\t\t_this._resolve = resolve;\n\t\t\t\tfunction returnValue(value) {\n\t\t\t\t\t_this._resolve(value && value.then ? value.then(_wrapReturnedValue) : _wrapReturnedValue(value));\n\t\t\t\t\t_this._pact = null;\n\t\t\t\t\t_this._resolve = null;\n\t\t\t\t}\n\t\t\t\tvar result = _entry(_this);\n\t\t\t\tif (result && result.then) {\n\t\t\t\t\tresult.then(returnValue, function(error) {\n\t\t\t\t\t\tif (error === _earlyReturn) {\n\t\t\t\t\t\t\treturnValue(_this._return);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tconst pact = new _Pact();\n\t\t\t\t\t\t\t_this._resolve(pact);\n\t\t\t\t\t\t\t_this._pact = null;\n\t\t\t\t\t\t\t_this._resolve = null;\n\t\t\t\t\t\t\t_resolve(pact, 2, error);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\treturnValue(result);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// Generator is started and a yield expression is pending, settle it\n\t\t\t\t_this._pact = null;\n\t\t\t\t_this._resolve = resolve;\n\t\t\t\t_settle(_pact, 1, value);\n\t\t\t}\n\t\t});\n\t};\n\t_AsyncGenerator.prototype.return = function(value) {\n\t\t// Early return from the generator if started, otherwise abandons the generator\n\t\tconst _this = this;\n\t\treturn _this._promise = new Promise(function (resolve) {\n\t\t\tconst _pact = _this._pact;\n\t\t\tif (_pact === null) {\n\t\t\t\tif (_this._entry === null) {\n\t\t\t\t\t// Generator is started, but not awaiting a yield expression\n\t\t\t\t\t// Abandon the return call!\n\t\t\t\t\treturn resolve(_this._promise);\n\t\t\t\t}\n\t\t\t\t// Generator is not started, abandon it and return the specified value\n\t\t\t\t_this._entry = null;\n\t\t\t\treturn resolve(value && value.then ? value.then(_wrapReturnedValue) : _wrapReturnedValue(value));\n\t\t\t}\n\t\t\t// Settle the yield expression with a rejected \"early return\" value\n\t\t\t_this._return = value;\n\t\t\t_this._resolve = resolve;\n\t\t\t_this._pact = null;\n\t\t\t_settle(_pact, 2, _earlyReturn);\n\t\t});\n\t};\n\t_AsyncGenerator.prototype.throw = function(error) {\n\t\t// Inject an exception into the pending yield expression\n\t\tconst _this = this;\n\t\treturn _this._promise = new Promise(function (resolve, reject) {\n\t\t\tconst _pact = _this._pact;\n\t\t\tif (_pact === null) {\n\t\t\t\tif (_this._entry === null) {\n\t\t\t\t\t// Generator is started, but not awaiting a yield expression\n\t\t\t\t\t// Abandon the throw call!\n\t\t\t\t\treturn resolve(_this._promise);\n\t\t\t\t}\n\t\t\t\t// Generator is not started, abandon it and return a rejected Promise containing the error\n\t\t\t\t_this._entry = null;\n\t\t\t\treturn reject(error);\n\t\t\t}\n\t\t\t// Settle the yield expression with the value as a rejection\n\t\t\t_this._resolve = resolve;\n\t\t\t_this._pact = null;\n\t\t\t_settle(_pact, 2, error);\n\t\t});\n\t};\n\n\t_AsyncGenerator.prototype[_asyncIteratorSymbol] = function() {\n\t\treturn this;\n\t};\n\t\n\treturn _AsyncGenerator;\n})();\n","import path from 'path';\nimport fs from 'fs';\nimport findRoot from 'find-root';\nimport {getDocument, queries} from 'pptr-testing-library';\nimport {configureToMatchImageSnapshot} from 'jest-image-snapshot';\n\nimport type {Page, ElementHandle, ScreenshotOptions, Browser, ClickOptions} from 'puppeteer';\nimport type {getQueriesForElement} from 'pptr-testing-library';\n\nexport const globalBrowser: Browser = (global as any).browser;\nexport const globalPage: Page = (global as any).page;\n\nconst isCi = process.argv.includes('--ci') || process.env.CI;\nconst isUsingDockerizedChromium = isCi || new URL(globalBrowser.wsEndpoint()).port === '9223';\n\nexport const serverHostName = ((): string => {\n if (isCi) {\n return 'localhost';\n }\n\n if (isUsingDockerizedChromium) {\n return process.platform === 'linux' ? '172.17.0.1' : 'host.docker.internal';\n }\n\n return 'localhost';\n})();\n\nconst rootDir = findRoot(process.cwd());\nconst pkg = JSON.parse(fs.readFileSync(path.join(rootDir, 'package.json'), 'utf-8'));\nconst projectConfig = pkg.acceptanceTests ?? {};\nconst server = (isCi ? projectConfig.ciServer : projectConfig.devServer) ?? projectConfig.server;\n\nexport const serverPort = server?.port;\n\nconst toMatchImageSnapshot = configureToMatchImageSnapshot({\n failureThreshold: 0,\n failureThresholdType: 'percent',\n});\n\nlet calledToMatchImageSnapshotOutsideDocker = false;\n\nconst localToMatchImageSnapshot = () => {\n calledToMatchImageSnapshotOutsideDocker = true;\n // let the expectation pass, then fail in afterEach. This way we allow developers to debug screenshot tests in local\n // but don't allow them to save screenshots taken outside the dockerized chromium\n return {\n message: () => '',\n pass: true,\n };\n};\n\nexpect.extend({\n toMatchImageSnapshot: isUsingDockerizedChromium ? toMatchImageSnapshot : localToMatchImageSnapshot,\n});\n\nafterEach(() => {\n if (calledToMatchImageSnapshotOutsideDocker) {\n const error = new Error(\n `Calling .toMatchImageSnapshot() is not allowed outside dockerized browser. Please, run your screenshot test in headless mode.`\n );\n error.stack = (error.stack || '').split('\\n')[0];\n throw error;\n }\n});\n\ntype WaitForPaintEndOptions = {\n maxWait?: number;\n fullPage?: boolean;\n};\n\nconst waitForPaintEnd = async (\n element: ElementHandle | Page,\n {maxWait = 10000, fullPage = true}: WaitForPaintEndOptions = {}\n) => {\n const STEP_TIME = 250;\n const t0 = Date.now();\n\n let buf1 = (await element.screenshot({fullPage})) as Buffer;\n await new Promise((r) => setTimeout(r, STEP_TIME));\n let buf2 = (await element.screenshot({fullPage})) as Buffer;\n\n // buffers are different if compare != 0\n while (buf1.compare(buf2)) {\n if (Date.now() - t0 > maxWait) {\n throw Error('Paint end timeout');\n }\n buf1 = buf2;\n await new Promise((r) => setTimeout(r, STEP_TIME));\n buf2 = (await element.screenshot({fullPage})) as Buffer;\n }\n};\n\nexport interface PageApi extends Omit<Page, 'click' | 'type' | 'select'> {\n clear: (selector: ElementHandle) => Promise<void>;\n // These are overridden:\n type: (selector: ElementHandle, text: string, options?: {delay: number}) => Promise<void>;\n click: (selector: ElementHandle, options?: ClickOptions) => Promise<void>;\n select: (selector: ElementHandle, ...values: string[]) => Promise<string[]>;\n}\n\ninterface OpenPageCommonConfig {\n userAgent?: string;\n isDarkMode?: boolean;\n}\n\ninterface OpenPageUrlConfig extends OpenPageCommonConfig {\n url: string;\n}\n\ninterface OpenPagePathConfig extends OpenPageCommonConfig {\n url?: undefined;\n\n path?: string;\n port?: number;\n protocol?: string;\n hostname?: string;\n}\n\ntype OpenPageConfig = OpenPageUrlConfig | OpenPagePathConfig;\n\nexport const openPage = async ({userAgent, isDarkMode, ...urlConfig}: OpenPageConfig): Promise<PageApi> => {\n const url = ((): string => {\n if (urlConfig.url !== undefined) {\n return urlConfig.url;\n }\n\n const {path = '/', port = serverPort, protocol = 'http', hostname = serverHostName} = urlConfig;\n\n if (!port) {\n const error = new Error(\n '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'\n );\n // Error.captureStackTrace(error, openPage);\n throw error;\n }\n\n return `${protocol}://${hostname}:${port}${path}`;\n })();\n\n const currentUserAgent = userAgent || (await globalBrowser.userAgent());\n const page = globalPage;\n await page.bringToFront();\n await page.setUserAgent(`${currentUserAgent} acceptance-test`);\n await page.emulateMediaFeatures([{name: 'prefers-color-scheme', value: isDarkMode ? 'dark' : 'light'}]);\n try {\n await page.goto(url);\n } catch (e) {\n if ((e as Error).message.includes('net::ERR_CONNECTION_REFUSED')) {\n const connectionError = new Error(`Could not connect to ${url}. Is the server running?`);\n Error.captureStackTrace(connectionError, openPage);\n throw connectionError;\n } else {\n throw e;\n }\n }\n\n const api: PageApi = Object.create(page);\n\n api.type = async (elementHandle, text, options) => elementHandle.type(text, options);\n api.click = async (elementHandle, options) => elementHandle.click(options);\n api.select = async (elementHandle, ...values) => elementHandle.select(...values);\n\n api.screenshot = async (options?: ScreenshotOptions) => {\n await waitForPaintEnd(page);\n return page.screenshot(options);\n };\n\n api.clear = async (elementHandle) => {\n await elementHandle.click({clickCount: 3});\n await elementHandle.press('Delete');\n };\n\n return api;\n};\n\nconst buildQueryMethods = (): ReturnType<typeof getQueriesForElement> => {\n const boundQueries: any = {};\n for (const [queryName, queryFn] of Object.entries(queries)) {\n boundQueries[queryName] = async (...args: any) => {\n const doc = await getDocument(globalPage);\n const queryArgs = [...args];\n if (queryName.startsWith('findBy')) {\n queryArgs.push({timeout: 10000});\n }\n const elementHandle = await queryFn(doc, ...queryArgs);\n\n const newElementHandle = Object.create(elementHandle);\n\n newElementHandle.screenshot = async (options: ScreenshotOptions) => {\n await waitForPaintEnd(elementHandle, {fullPage: false});\n return elementHandle.screenshot(options);\n };\n\n return newElementHandle;\n };\n }\n return boundQueries;\n};\n\nexport const screen = buildQueryMethods();\n\nexport type {ElementHandle} from 'puppeteer';\n"],"names":["_Pact","prototype","then","onFulfilled","onRejected","result","state","this","s","callback","_settle","v","e","o","_this","value","pact","bind","observer","_isSettledPact","thenable","Symbol","iterator","asyncIterator","globalBrowser","global","browser","globalPage","page","isCi","process","argv","includes","env","CI","isUsingDockerizedChromium","URL","wsEndpoint","port","serverHostName","platform","projectConfig","JSON","parse","fs","readFileSync","path","join","findRoot","cwd","acceptanceTests","server","ciServer","devServer","serverPort","calledToMatchImageSnapshotOutsideDocker","expect","extend","toMatchImageSnapshot","configureToMatchImageSnapshot","failureThreshold","failureThresholdType","message","pass","afterEach","error","Error","stack","split","waitForPaintEnd","element","maxWait","fullPage","t0","Date","now","screenshot","buf1","Promise","r","setTimeout","buf2","test","update","body","stage","shouldContinue","reject","_resumeAfterTest","_resumeAfterBody","updateValue","compare","screen","boundQueries","queryName","queryFn","args","getDocument","doc","queryArgs","startsWith","push","timeout","elementHandle","newElementHandle","Object","create","options","entries","queries","buildQueryMethods","openPage","userAgent","isDarkMode","urlConfig","currentUserAgent","bringToFront","setUserAgent","emulateMediaFeatures","name","api","type","text","click","select","values","clear","clickCount","press","recover","url","connectionError","captureStackTrace","undefined","protocol","hostname"],"mappings":"uRACaA,EAAsB,oBACzBA,YACTA,EAAMC,UAAUC,KAAO,SAASC,EAAaC,OACtCC,EAAS,IAAIL,EACbM,EAAQC,KA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avFO,EAAef,OAAOC,OAAO9E,UAEnC4F,EAAIC,cAAclB,EAAemB,EAAMf,8BAAYJ,EAAckB,KAAKC,EAAMf,wCAC5Ea,EAAIG,eAAepB,EAAeI,8BAAYJ,EAAcoB,MAAMhB,wCAClEa,EAAII,gBAAgBrB,kCAAkBsB,mCAAAA,2CAAWtB,EAAcqB,aAAdrB,EAAwBsB,wCAEzEL,EAAI5C,oBAAoB+B,8BACdtC,EAAgBzC,4BACfA,EAAKgD,WAAW+B,0CAG3Ba,EAAIM,eAAevB,8BACTA,EAAcoB,MAAM,CAACI,WAAY,6CACjCxB,EAAcyB,MAAM,uEAGvBR,QDsYJ,SAAgBpC,EAAM6C,WAEvB5H,kBCnaQuB,OAAUsG,yBDoarB,MAAMtH,UACAqH,EAAQrH,UAEZP,GAAUA,EAAOH,KACbG,EAAOH,UAAK,EAAQ+H,GAErB5H,eCzaKO,MACAA,EAAYkD,QAAQ9B,SAAS,oCACxBmG,EAAkB,IAAIjE,8BAA8BgE,oCAC1DhE,MAAMkE,kBAAkBD,EAAiBpB,GACnCoB,QAEAvH,8CA/BRsH,EAAO,mBACaG,IAAlBnB,EAAUgB,WACHhB,EAAUgB,UAGiEhB,EAA/EpE,KAAAA,aAAO,QAAwEoE,EAAnE5E,KAAAA,aAAOgB,MAA4D4D,EAAhDoB,SAAAA,aAAW,WAAqCpB,EAA7BqB,SAAAA,aAAWhG,QAE/DD,QACa,IAAI4B,MACd,uKAMEoE,QAAcC,MAAYjG,EAAOQ,EAflC,0BAkBYkE,IAAAA,mBAAoBxF,EAAcwF"}
|
|
1
|
+
{"version":3,"file":"acceptance-testing.cjs.production.min.js","sources":["../../../node_modules/babel-plugin-transform-async-to-promises/helpers.js","../src/index.ts"],"sourcesContent":["// A type of promise-like that resolves synchronously and supports only one observer\nexport const _Pact = /*#__PURE__*/(function() {\n\tfunction _Pact() {}\n\t_Pact.prototype.then = function(onFulfilled, onRejected) {\n\t\tconst result = new _Pact();\n\t\tconst state = this.s;\n\t\tif (state) {\n\t\t\tconst callback = state & 1 ? onFulfilled : onRejected;\n\t\t\tif (callback) {\n\t\t\t\ttry {\n\t\t\t\t\t_settle(result, 1, callback(this.v));\n\t\t\t\t} catch (e) {\n\t\t\t\t\t_settle(result, 2, e);\n\t\t\t\t}\n\t\t\t\treturn result;\n\t\t\t} else {\n\t\t\t\treturn this;\n\t\t\t}\n\t\t}\n\t\tthis.o = function(_this) {\n\t\t\ttry {\n\t\t\t\tconst value = _this.v;\n\t\t\t\tif (_this.s & 1) {\n\t\t\t\t\t_settle(result, 1, onFulfilled ? onFulfilled(value) : value);\n\t\t\t\t} else if (onRejected) {\n\t\t\t\t\t_settle(result, 1, onRejected(value));\n\t\t\t\t} else {\n\t\t\t\t\t_settle(result, 2, value);\n\t\t\t\t}\n\t\t\t} catch (e) {\n\t\t\t\t_settle(result, 2, e);\n\t\t\t}\n\t\t};\n\t\treturn result;\n\t}\n\treturn _Pact;\n})();\n\n// Settles a pact synchronously\nexport function _settle(pact, state, value) {\n\tif (!pact.s) {\n\t\tif (value instanceof _Pact) {\n\t\t\tif (value.s) {\n\t\t\t\tif (state & 1) {\n\t\t\t\t\tstate = value.s;\n\t\t\t\t}\n\t\t\t\tvalue = value.v;\n\t\t\t} else {\n\t\t\t\tvalue.o = _settle.bind(null, pact, state);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\tif (value && value.then) {\n\t\t\tvalue.then(_settle.bind(null, pact, state), _settle.bind(null, pact, 2));\n\t\t\treturn;\n\t\t}\n\t\tpact.s = state;\n\t\tpact.v = value;\n\t\tconst observer = pact.o;\n\t\tif (observer) {\n\t\t\tobserver(pact);\n\t\t}\n\t}\n}\n\nexport function _isSettledPact(thenable) {\n\treturn thenable instanceof _Pact && thenable.s & 1;\n}\n\n// Converts argument to a function that always returns a Promise\nexport function _async(f) {\n\treturn function() {\n\t\tfor (var args = [], i = 0; i < arguments.length; i++) {\n\t\t\targs[i] = arguments[i];\n\t\t}\n\t\ttry {\n\t\t\treturn Promise.resolve(f.apply(this, args));\n\t\t} catch(e) {\n\t\t\treturn Promise.reject(e);\n\t\t}\n\t}\n}\n\n// Awaits on a value that may or may not be a Promise (equivalent to the await keyword in ES2015, with continuations passed explicitly)\nexport function _await(value, then, direct) {\n\tif (direct) {\n\t\treturn then ? then(value) : value;\n\t}\n\tif (!value || !value.then) {\n\t\tvalue = Promise.resolve(value);\n\t}\n\treturn then ? value.then(then) : value;\n}\n\n// Awaits on a value that may or may not be a Promise, then ignores it\nexport function _awaitIgnored(value, direct) {\n\tif (!direct) {\n\t\treturn value && value.then ? value.then(_empty) : Promise.resolve();\n\t}\n}\n\n// Proceeds after a value has resolved, or proceeds immediately if the value is not thenable\nexport function _continue(value, then) {\n\treturn value && value.then ? value.then(then) : then(value);\n}\n\n// Proceeds after a value has resolved, or proceeds immediately if the value is not thenable\nexport function _continueIgnored(value) {\n\tif (value && value.then) {\n\t\treturn value.then(_empty);\n\t}\n}\n\n// Asynchronously iterate through an object that has a length property, passing the index as the first argument to the callback (even as the length property changes)\nexport function _forTo(array, body, check) {\n\tvar i = -1, pact, reject;\n\tfunction _cycle(result) {\n\t\ttry {\n\t\t\twhile (++i < array.length && (!check || !check())) {\n\t\t\t\tresult = body(i);\n\t\t\t\tif (result && result.then) {\n\t\t\t\t\tif (_isSettledPact(result)) {\n\t\t\t\t\t\tresult = result.v;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tresult.then(_cycle, reject || (reject = _settle.bind(null, pact = new _Pact(), 2)));\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (pact) {\n\t\t\t\t_settle(pact, 1, result);\n\t\t\t} else {\n\t\t\t\tpact = result;\n\t\t\t}\n\t\t} catch (e) {\n\t\t\t_settle(pact || (pact = new _Pact()), 2, e);\n\t\t}\n\t}\n\t_cycle();\n\treturn pact;\n}\n\n// Asynchronously iterate through an object's properties (including properties inherited from the prototype)\n// Uses a snapshot of the object's properties\nexport function _forIn(target, body, check) {\n\tvar keys = [];\n\tfor (var key in target) {\n\t\tkeys.push(key);\n\t}\n\treturn _forTo(keys, function(i) { return body(keys[i]); }, check);\n}\n\n// Asynchronously iterate through an object's own properties (excluding properties inherited from the prototype)\n// Uses a snapshot of the object's properties\nexport function _forOwn(target, body, check) {\n\tvar keys = [];\n\tfor (var key in target) {\n\t\tif (Object.prototype.hasOwnProperty.call(target, key)) {\n\t\t\tkeys.push(key);\n\t\t}\n\t}\n\treturn _forTo(keys, function(i) { return body(keys[i]); }, check);\n}\n\nexport const _iteratorSymbol = /*#__PURE__*/ typeof Symbol !== \"undefined\" ? (Symbol.iterator || (Symbol.iterator = Symbol(\"Symbol.iterator\"))) : \"@@iterator\";\n\n// Asynchronously iterate through an object's values\n// Uses for...of if the runtime supports it, otherwise iterates until length on a copy\nexport function _forOf(target, body, check) {\n\tif (typeof target[_iteratorSymbol] === \"function\") {\n\t\tvar iterator = target[_iteratorSymbol](), step, pact, reject;\n\t\tfunction _cycle(result) {\n\t\t\ttry {\n\t\t\t\twhile (!(step = iterator.next()).done && (!check || !check())) {\n\t\t\t\t\tresult = body(step.value);\n\t\t\t\t\tif (result && result.then) {\n\t\t\t\t\t\tif (_isSettledPact(result)) {\n\t\t\t\t\t\t\tresult = result.v;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tresult.then(_cycle, reject || (reject = _settle.bind(null, pact = new _Pact(), 2)));\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (pact) {\n\t\t\t\t\t_settle(pact, 1, result);\n\t\t\t\t} else {\n\t\t\t\t\tpact = result;\n\t\t\t\t}\n\t\t\t} catch (e) {\n\t\t\t\t_settle(pact || (pact = new _Pact()), 2, e);\n\t\t\t}\n\t\t}\n\t\t_cycle();\n\t\tif (iterator.return) {\n\t\t\tvar _fixup = function(value) {\n\t\t\t\ttry {\n\t\t\t\t\tif (!step.done) {\n\t\t\t\t\t\titerator.return();\n\t\t\t\t\t}\n\t\t\t\t} catch(e) {\n\t\t\t\t}\n\t\t\t\treturn value;\n\t\t\t}\n\t\t\tif (pact && pact.then) {\n\t\t\t\treturn pact.then(_fixup, function(e) {\n\t\t\t\t\tthrow _fixup(e);\n\t\t\t\t});\n\t\t\t}\n\t\t\t_fixup();\n\t\t}\n\t\treturn pact;\n\t}\n\t// No support for Symbol.iterator\n\tif (!(\"length\" in target)) {\n\t\tthrow new TypeError(\"Object is not iterable\");\n\t}\n\t// Handle live collections properly\n\tvar values = [];\n\tfor (var i = 0; i < target.length; i++) {\n\t\tvalues.push(target[i]);\n\t}\n\treturn _forTo(values, function(i) { return body(values[i]); }, check);\n}\n\nexport const _asyncIteratorSymbol = /*#__PURE__*/ typeof Symbol !== \"undefined\" ? (Symbol.asyncIterator || (Symbol.asyncIterator = Symbol(\"Symbol.asyncIterator\"))) : \"@@asyncIterator\";\n\n// Asynchronously iterate on a value using it's async iterator if present, or its synchronous iterator if missing\nexport function _forAwaitOf(target, body, check) {\n\tif (typeof target[_asyncIteratorSymbol] === \"function\") {\n\t\tvar pact = new _Pact();\n\t\tvar iterator = target[_asyncIteratorSymbol]();\n\t\titerator.next().then(_resumeAfterNext).then(void 0, _reject);\n\t\treturn pact;\n\t\tfunction _resumeAfterBody(result) {\n\t\t\tif (check && check()) {\n\t\t\t\treturn _settle(pact, 1, iterator.return ? iterator.return().then(function() { return result; }) : result);\n\t\t\t}\n\t\t\titerator.next().then(_resumeAfterNext).then(void 0, _reject);\n\t\t}\n\t\tfunction _resumeAfterNext(step) {\n\t\t\tif (step.done) {\n\t\t\t\t_settle(pact, 1);\n\t\t\t} else {\n\t\t\t\tPromise.resolve(body(step.value)).then(_resumeAfterBody).then(void 0, _reject);\n\t\t\t}\n\t\t}\n\t\tfunction _reject(error) {\n\t\t\t_settle(pact, 2, iterator.return ? iterator.return().then(function() { return error; }) : error);\n\t\t}\n\t}\n\treturn Promise.resolve(_forOf(target, function(value) { return Promise.resolve(value).then(body); }, check));\n}\n\n// Asynchronously implement a generic for loop\nexport function _for(test, update, body) {\n\tvar stage;\n\tfor (;;) {\n\t\tvar shouldContinue = test();\n\t\tif (_isSettledPact(shouldContinue)) {\n\t\t\tshouldContinue = shouldContinue.v;\n\t\t}\n\t\tif (!shouldContinue) {\n\t\t\treturn result;\n\t\t}\n\t\tif (shouldContinue.then) {\n\t\t\tstage = 0;\n\t\t\tbreak;\n\t\t}\n\t\tvar result = body();\n\t\tif (result && result.then) {\n\t\t\tif (_isSettledPact(result)) {\n\t\t\t\tresult = result.s;\n\t\t\t} else {\n\t\t\t\tstage = 1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (update) {\n\t\t\tvar updateValue = update();\n\t\t\tif (updateValue && updateValue.then && !_isSettledPact(updateValue)) {\n\t\t\t\tstage = 2;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\tvar pact = new _Pact();\n\tvar reject = _settle.bind(null, pact, 2);\n\t(stage === 0 ? shouldContinue.then(_resumeAfterTest) : stage === 1 ? result.then(_resumeAfterBody) : updateValue.then(_resumeAfterUpdate)).then(void 0, reject);\n\treturn pact;\n\tfunction _resumeAfterBody(value) {\n\t\tresult = value;\n\t\tdo {\n\t\t\tif (update) {\n\t\t\t\tupdateValue = update();\n\t\t\t\tif (updateValue && updateValue.then && !_isSettledPact(updateValue)) {\n\t\t\t\t\tupdateValue.then(_resumeAfterUpdate).then(void 0, reject);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\tshouldContinue = test();\n\t\t\tif (!shouldContinue || (_isSettledPact(shouldContinue) && !shouldContinue.v)) {\n\t\t\t\t_settle(pact, 1, result);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (shouldContinue.then) {\n\t\t\t\tshouldContinue.then(_resumeAfterTest).then(void 0, reject);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tresult = body();\n\t\t\tif (_isSettledPact(result)) {\n\t\t\t\tresult = result.v;\n\t\t\t}\n\t\t} while (!result || !result.then);\n\t\tresult.then(_resumeAfterBody).then(void 0, reject);\n\t}\n\tfunction _resumeAfterTest(shouldContinue) {\n\t\tif (shouldContinue) {\n\t\t\tresult = body();\n\t\t\tif (result && result.then) {\n\t\t\t\tresult.then(_resumeAfterBody).then(void 0, reject);\n\t\t\t} else {\n\t\t\t\t_resumeAfterBody(result);\n\t\t\t}\n\t\t} else {\n\t\t\t_settle(pact, 1, result);\n\t\t}\n\t}\n\tfunction _resumeAfterUpdate() {\n\t\tif (shouldContinue = test()) {\n\t\t\tif (shouldContinue.then) {\n\t\t\t\tshouldContinue.then(_resumeAfterTest).then(void 0, reject);\n\t\t\t} else {\n\t\t\t\t_resumeAfterTest(shouldContinue);\n\t\t\t}\n\t\t} else {\n\t\t\t_settle(pact, 1, result);\n\t\t}\n\t}\n}\n\n// Asynchronously implement a do ... while loop\nexport function _do(body, test) {\n\tvar awaitBody;\n\tdo {\n\t\tvar result = body();\n\t\tif (result && result.then) {\n\t\t\tif (_isSettledPact(result)) {\n\t\t\t\tresult = result.v;\n\t\t\t} else {\n\t\t\t\tawaitBody = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tvar shouldContinue = test();\n\t\tif (_isSettledPact(shouldContinue)) {\n\t\t\tshouldContinue = shouldContinue.v;\n\t\t}\n\t\tif (!shouldContinue) {\n\t\t\treturn result;\n\t\t}\n\t} while (!shouldContinue.then);\n\tconst pact = new _Pact();\n\tconst reject = _settle.bind(null, pact, 2);\n\t(awaitBody ? result.then(_resumeAfterBody) : shouldContinue.then(_resumeAfterTest)).then(void 0, reject);\n\treturn pact;\n\tfunction _resumeAfterBody(value) {\n\t\tresult = value;\n\t\tfor (;;) {\n\t\t\tshouldContinue = test();\n\t\t\tif (_isSettledPact(shouldContinue)) {\n\t\t\t\tshouldContinue = shouldContinue.v;\n\t\t\t}\n\t\t\tif (!shouldContinue) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (shouldContinue.then) {\n\t\t\t\tshouldContinue.then(_resumeAfterTest).then(void 0, reject);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tresult = body();\n\t\t\tif (result && result.then) {\n\t\t\t\tif (_isSettledPact(result)) {\n\t\t\t\t\tresult = result.v;\n\t\t\t\t} else {\n\t\t\t\t\tresult.then(_resumeAfterBody).then(void 0, reject);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t_settle(pact, 1, result);\n\t}\n\tfunction _resumeAfterTest(shouldContinue) {\n\t\tif (shouldContinue) {\n\t\t\tdo {\n\t\t\t\tresult = body();\n\t\t\t\tif (result && result.then) {\n\t\t\t\t\tif (_isSettledPact(result)) {\n\t\t\t\t\t\tresult = result.v;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tresult.then(_resumeAfterBody).then(void 0, reject);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tshouldContinue = test();\n\t\t\t\tif (_isSettledPact(shouldContinue)) {\n\t\t\t\t\tshouldContinue = shouldContinue.v;\n\t\t\t\t}\n\t\t\t\tif (!shouldContinue) {\n\t\t\t\t\t_settle(pact, 1, result);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t} while (!shouldContinue.then);\n\t\t\tshouldContinue.then(_resumeAfterTest).then(void 0, reject);\n\t\t} else {\n\t\t\t_settle(pact, 1, result);\n\t\t}\n\t}\n}\n\n// Asynchronously implement a switch statement\nexport function _switch(discriminant, cases) {\n\tvar dispatchIndex = -1;\n\tvar awaitBody;\n\touter: {\n\t\tfor (var i = 0; i < cases.length; i++) {\n\t\t\tvar test = cases[i][0];\n\t\t\tif (test) {\n\t\t\t\tvar testValue = test();\n\t\t\t\tif (testValue && testValue.then) {\n\t\t\t\t\tbreak outer;\n\t\t\t\t}\n\t\t\t\tif (testValue === discriminant) {\n\t\t\t\t\tdispatchIndex = i;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// Found the default case, set it as the pending dispatch case\n\t\t\t\tdispatchIndex = i;\n\t\t\t}\n\t\t}\n\t\tif (dispatchIndex !== -1) {\n\t\t\tdo {\n\t\t\t\tvar body = cases[dispatchIndex][1];\n\t\t\t\twhile (!body) {\n\t\t\t\t\tdispatchIndex++;\n\t\t\t\t\tbody = cases[dispatchIndex][1];\n\t\t\t\t}\n\t\t\t\tvar result = body();\n\t\t\t\tif (result && result.then) {\n\t\t\t\t\tawaitBody = true;\n\t\t\t\t\tbreak outer;\n\t\t\t\t}\n\t\t\t\tvar fallthroughCheck = cases[dispatchIndex][2];\n\t\t\t\tdispatchIndex++;\n\t\t\t} while (fallthroughCheck && !fallthroughCheck());\n\t\t\treturn result;\n\t\t}\n\t}\n\tconst pact = new _Pact();\n\tconst reject = _settle.bind(null, pact, 2);\n\t(awaitBody ? result.then(_resumeAfterBody) : testValue.then(_resumeAfterTest)).then(void 0, reject);\n\treturn pact;\n\tfunction _resumeAfterTest(value) {\n\t\tfor (;;) {\n\t\t\tif (value === discriminant) {\n\t\t\t\tdispatchIndex = i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (++i === cases.length) {\n\t\t\t\tif (dispatchIndex !== -1) {\n\t\t\t\t\tbreak;\n\t\t\t\t} else {\n\t\t\t\t\t_settle(pact, 1, result);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\ttest = cases[i][0];\n\t\t\tif (test) {\n\t\t\t\tvalue = test();\n\t\t\t\tif (value && value.then) {\n\t\t\t\t\tvalue.then(_resumeAfterTest).then(void 0, reject);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tdispatchIndex = i;\n\t\t\t}\n\t\t}\n\t\tdo {\n\t\t\tvar body = cases[dispatchIndex][1];\n\t\t\twhile (!body) {\n\t\t\t\tdispatchIndex++;\n\t\t\t\tbody = cases[dispatchIndex][1];\n\t\t\t}\n\t\t\tvar result = body();\n\t\t\tif (result && result.then) {\n\t\t\t\tresult.then(_resumeAfterBody).then(void 0, reject);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tvar fallthroughCheck = cases[dispatchIndex][2];\n\t\t\tdispatchIndex++;\n\t\t} while (fallthroughCheck && !fallthroughCheck());\n\t\t_settle(pact, 1, result);\n\t}\n\tfunction _resumeAfterBody(result) {\n\t\tfor (;;) {\n\t\t\tvar fallthroughCheck = cases[dispatchIndex][2];\n\t\t\tif (!fallthroughCheck || fallthroughCheck()) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdispatchIndex++;\n\t\t\tvar body = cases[dispatchIndex][1];\n\t\t\twhile (!body) {\n\t\t\t\tdispatchIndex++;\n\t\t\t\tbody = cases[dispatchIndex][1];\n\t\t\t}\n\t\t\tresult = body();\n\t\t\tif (result && result.then) {\n\t\t\t\tresult.then(_resumeAfterBody).then(void 0, reject);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\t_settle(pact, 1, result);\n\t}\n}\n\n// Asynchronously call a function and pass the result to explicitly passed continuations\nexport function _call(body, then, direct) {\n\tif (direct) {\n\t\treturn then ? then(body()) : body();\n\t}\n\ttry {\n\t\tvar result = Promise.resolve(body());\n\t\treturn then ? result.then(then) : result;\n\t} catch (e) {\n\t\treturn Promise.reject(e);\n\t}\n}\n\n// Asynchronously call a function and swallow the result\nexport function _callIgnored(body, direct) {\n\treturn _call(body, _empty, direct);\n}\n\n// Asynchronously call a function and pass the result to explicitly passed continuations\nexport function _invoke(body, then) {\n\tvar result = body();\n\tif (result && result.then) {\n\t\treturn result.then(then);\n\t}\n\treturn then(result);\n}\n\n// Asynchronously call a function and swallow the result\nexport function _invokeIgnored(body) {\n\tvar result = body();\n\tif (result && result.then) {\n\t\treturn result.then(_empty);\n\t}\n}\n\n// Asynchronously call a function and send errors to recovery continuation\nexport function _catch(body, recover) {\n\ttry {\n\t\tvar result = body();\n\t} catch(e) {\n\t\treturn recover(e);\n\t}\n\tif (result && result.then) {\n\t\treturn result.then(void 0, recover);\n\t}\n\treturn result;\n}\n\n// Asynchronously await a promise and pass the result to a finally continuation\nexport function _finallyRethrows(body, finalizer) {\n\ttry {\n\t\tvar result = body();\n\t} catch (e) {\n\t\treturn finalizer(true, e);\n\t}\n\tif (result && result.then) {\n\t\treturn result.then(finalizer.bind(null, false), finalizer.bind(null, true));\n\t}\n\treturn finalizer(false, result);\n}\n\n// Asynchronously await a promise and invoke a finally continuation that always overrides the result\nexport function _finally(body, finalizer) {\n\ttry {\n\t\tvar result = body();\n\t} catch (e) {\n\t\treturn finalizer();\n\t}\n\tif (result && result.then) {\n\t\treturn result.then(finalizer, finalizer);\n\t}\n\treturn finalizer();\n}\n\n// Rethrow or return a value from a finally continuation\nexport function _rethrow(thrown, value) {\n\tif (thrown)\n\t\tthrow value;\n\treturn value;\n}\n\n// Empty function to implement break and other control flow that ignores asynchronous results\nexport function _empty() {\n}\n\n// Sentinel value for early returns in generators \nexport const _earlyReturn = /*#__PURE__*/ {};\n\n// Asynchronously call a function and send errors to recovery continuation, skipping early returns\nexport function _catchInGenerator(body, recover) {\n\treturn _catch(body, function(e) {\n\t\tif (e === _earlyReturn) {\n\t\t\tthrow e;\n\t\t}\n\t\treturn recover(e);\n\t});\n}\n\n// Asynchronous generator class; accepts the entrypoint of the generator, to which it passes itself when the generator should start\nexport const _AsyncGenerator = /*#__PURE__*/(function() {\n\tfunction _AsyncGenerator(entry) {\n\t\tthis._entry = entry;\n\t\tthis._pact = null;\n\t\tthis._resolve = null;\n\t\tthis._return = null;\n\t\tthis._promise = null;\n\t}\n\n\tfunction _wrapReturnedValue(value) {\n\t\treturn { value: value, done: true };\n\t}\n\tfunction _wrapYieldedValue(value) {\n\t\treturn { value: value, done: false };\n\t}\n\n\t_AsyncGenerator.prototype._yield = function(value) {\n\t\t// Yield the value to the pending next call\n\t\tthis._resolve(value && value.then ? value.then(_wrapYieldedValue) : _wrapYieldedValue(value));\n\t\t// Return a pact for an upcoming next/return/throw call\n\t\treturn this._pact = new _Pact();\n\t};\n\t_AsyncGenerator.prototype.next = function(value) {\n\t\t// Advance the generator, starting it if it has yet to be started\n\t\tconst _this = this;\n\t\treturn _this._promise = new Promise(function (resolve) {\n\t\t\tconst _pact = _this._pact;\n\t\t\tif (_pact === null) {\n\t\t\t\tconst _entry = _this._entry;\n\t\t\t\tif (_entry === null) {\n\t\t\t\t\t// Generator is started, but not awaiting a yield expression\n\t\t\t\t\t// Abandon the next call!\n\t\t\t\t\treturn resolve(_this._promise);\n\t\t\t\t}\n\t\t\t\t// Start the generator\n\t\t\t\t_this._entry = null;\n\t\t\t\t_this._resolve = resolve;\n\t\t\t\tfunction returnValue(value) {\n\t\t\t\t\t_this._resolve(value && value.then ? value.then(_wrapReturnedValue) : _wrapReturnedValue(value));\n\t\t\t\t\t_this._pact = null;\n\t\t\t\t\t_this._resolve = null;\n\t\t\t\t}\n\t\t\t\tvar result = _entry(_this);\n\t\t\t\tif (result && result.then) {\n\t\t\t\t\tresult.then(returnValue, function(error) {\n\t\t\t\t\t\tif (error === _earlyReturn) {\n\t\t\t\t\t\t\treturnValue(_this._return);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tconst pact = new _Pact();\n\t\t\t\t\t\t\t_this._resolve(pact);\n\t\t\t\t\t\t\t_this._pact = null;\n\t\t\t\t\t\t\t_this._resolve = null;\n\t\t\t\t\t\t\t_resolve(pact, 2, error);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\treturnValue(result);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// Generator is started and a yield expression is pending, settle it\n\t\t\t\t_this._pact = null;\n\t\t\t\t_this._resolve = resolve;\n\t\t\t\t_settle(_pact, 1, value);\n\t\t\t}\n\t\t});\n\t};\n\t_AsyncGenerator.prototype.return = function(value) {\n\t\t// Early return from the generator if started, otherwise abandons the generator\n\t\tconst _this = this;\n\t\treturn _this._promise = new Promise(function (resolve) {\n\t\t\tconst _pact = _this._pact;\n\t\t\tif (_pact === null) {\n\t\t\t\tif (_this._entry === null) {\n\t\t\t\t\t// Generator is started, but not awaiting a yield expression\n\t\t\t\t\t// Abandon the return call!\n\t\t\t\t\treturn resolve(_this._promise);\n\t\t\t\t}\n\t\t\t\t// Generator is not started, abandon it and return the specified value\n\t\t\t\t_this._entry = null;\n\t\t\t\treturn resolve(value && value.then ? value.then(_wrapReturnedValue) : _wrapReturnedValue(value));\n\t\t\t}\n\t\t\t// Settle the yield expression with a rejected \"early return\" value\n\t\t\t_this._return = value;\n\t\t\t_this._resolve = resolve;\n\t\t\t_this._pact = null;\n\t\t\t_settle(_pact, 2, _earlyReturn);\n\t\t});\n\t};\n\t_AsyncGenerator.prototype.throw = function(error) {\n\t\t// Inject an exception into the pending yield expression\n\t\tconst _this = this;\n\t\treturn _this._promise = new Promise(function (resolve, reject) {\n\t\t\tconst _pact = _this._pact;\n\t\t\tif (_pact === null) {\n\t\t\t\tif (_this._entry === null) {\n\t\t\t\t\t// Generator is started, but not awaiting a yield expression\n\t\t\t\t\t// Abandon the throw call!\n\t\t\t\t\treturn resolve(_this._promise);\n\t\t\t\t}\n\t\t\t\t// Generator is not started, abandon it and return a rejected Promise containing the error\n\t\t\t\t_this._entry = null;\n\t\t\t\treturn reject(error);\n\t\t\t}\n\t\t\t// Settle the yield expression with the value as a rejection\n\t\t\t_this._resolve = resolve;\n\t\t\t_this._pact = null;\n\t\t\t_settle(_pact, 2, error);\n\t\t});\n\t};\n\n\t_AsyncGenerator.prototype[_asyncIteratorSymbol] = function() {\n\t\treturn this;\n\t};\n\t\n\treturn _AsyncGenerator;\n})();\n","import path from 'path';\nimport fs from 'fs';\nimport findRoot from 'find-root';\nimport {getDocument, queries} from 'pptr-testing-library';\nimport {configureToMatchImageSnapshot} from 'jest-image-snapshot';\n\nimport type {Page, ElementHandle, ScreenshotOptions, Browser, ClickOptions, Viewport} from 'puppeteer';\nimport type {getQueriesForElement} from 'pptr-testing-library';\n\nexport const globalBrowser: Browser = (global as any).browser;\nexport const globalPage: Page = (global as any).page;\n\nconst isCi = process.argv.includes('--ci') || process.env.CI;\nconst isUsingDockerizedChromium = isCi || new URL(globalBrowser.wsEndpoint()).port === '9223';\n\nexport const serverHostName = ((): string => {\n if (isCi) {\n return 'localhost';\n }\n\n if (isUsingDockerizedChromium) {\n return process.platform === 'linux' ? '172.17.0.1' : 'host.docker.internal';\n }\n\n return 'localhost';\n})();\n\nconst rootDir = findRoot(process.cwd());\nconst pkg = JSON.parse(fs.readFileSync(path.join(rootDir, 'package.json'), 'utf-8'));\nconst projectConfig = pkg.acceptanceTests ?? {};\nconst server = (isCi ? projectConfig.ciServer : projectConfig.devServer) ?? projectConfig.server;\n\nexport const serverPort = server?.port;\n\nconst toMatchImageSnapshot = configureToMatchImageSnapshot({\n failureThreshold: 0,\n failureThresholdType: 'percent',\n});\n\nlet calledToMatchImageSnapshotOutsideDocker = false;\n\nconst localToMatchImageSnapshot = () => {\n calledToMatchImageSnapshotOutsideDocker = true;\n // let the expectation pass, then fail in afterEach. This way we allow developers to debug screenshot tests in local\n // but don't allow them to save screenshots taken outside the dockerized chromium\n return {\n message: () => '',\n pass: true,\n };\n};\n\nexpect.extend({\n toMatchImageSnapshot: isUsingDockerizedChromium ? toMatchImageSnapshot : localToMatchImageSnapshot,\n});\n\nafterEach(() => {\n if (calledToMatchImageSnapshotOutsideDocker) {\n const error = new Error(\n `Calling .toMatchImageSnapshot() is not allowed outside dockerized browser. Please, run your screenshot test in headless mode.`\n );\n error.stack = (error.stack || '').split('\\n')[0];\n throw error;\n }\n});\n\ntype WaitForPaintEndOptions = {\n maxWait?: number;\n fullPage?: boolean;\n};\n\nconst waitForPaintEnd = async (\n element: ElementHandle | Page,\n {maxWait = 10000, fullPage = true}: WaitForPaintEndOptions = {}\n) => {\n const STEP_TIME = 250;\n const t0 = Date.now();\n\n let buf1 = (await element.screenshot({fullPage})) as Buffer;\n await new Promise((r) => setTimeout(r, STEP_TIME));\n let buf2 = (await element.screenshot({fullPage})) as Buffer;\n\n // buffers are different if compare != 0\n while (buf1.compare(buf2)) {\n if (Date.now() - t0 > maxWait) {\n throw Error('Paint end timeout');\n }\n buf1 = buf2;\n await new Promise((r) => setTimeout(r, STEP_TIME));\n buf2 = (await element.screenshot({fullPage})) as Buffer;\n }\n};\n\nexport interface PageApi extends Omit<Page, 'click' | 'type' | 'select'> {\n clear: (selector: ElementHandle) => Promise<void>;\n // These are overridden:\n type: (selector: ElementHandle, text: string, options?: {delay: number}) => Promise<void>;\n click: (selector: ElementHandle, options?: ClickOptions) => Promise<void>;\n select: (selector: ElementHandle, ...values: string[]) => Promise<string[]>;\n}\n\ninterface OpenPageCommonConfig {\n userAgent?: string;\n viewport?: Viewport;\n isDarkMode?: boolean;\n}\n\ninterface OpenPageUrlConfig extends OpenPageCommonConfig {\n url: string;\n}\n\ninterface OpenPagePathConfig extends OpenPageCommonConfig {\n url?: undefined;\n\n path?: string;\n port?: number;\n protocol?: string;\n hostname?: string;\n}\n\ntype OpenPageConfig = OpenPageUrlConfig | OpenPagePathConfig;\n\nexport const openPage = async ({\n userAgent,\n isDarkMode,\n viewport,\n ...urlConfig\n}: OpenPageConfig): Promise<PageApi> => {\n const url = ((): string => {\n if (urlConfig.url !== undefined) {\n return urlConfig.url;\n }\n\n const {path = '/', port = serverPort, protocol = 'http', hostname = serverHostName} = urlConfig;\n\n if (!port) {\n const error = new Error(\n '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'\n );\n // Error.captureStackTrace(error, openPage);\n throw error;\n }\n\n return `${protocol}://${hostname}:${port}${path}`;\n })();\n\n const currentUserAgent = userAgent || (await globalBrowser.userAgent());\n const page = globalPage;\n\n await page.bringToFront();\n if (viewport) {\n await page.setViewport(viewport);\n }\n await page.setUserAgent(`${currentUserAgent} acceptance-test`);\n await page.emulateMediaFeatures([{name: 'prefers-color-scheme', value: isDarkMode ? 'dark' : 'light'}]);\n try {\n await page.goto(url);\n } catch (e) {\n if ((e as Error).message.includes('net::ERR_CONNECTION_REFUSED')) {\n const connectionError = new Error(`Could not connect to ${url}. Is the server running?`);\n Error.captureStackTrace(connectionError, openPage);\n throw connectionError;\n } else {\n throw e;\n }\n }\n await page.waitForFunction('document.fonts.status === \"loaded\"');\n\n const api: PageApi = Object.create(page);\n\n api.type = async (elementHandle, text, options) => elementHandle.type(text, options);\n api.click = async (elementHandle, options) => elementHandle.click(options);\n api.select = async (elementHandle, ...values) => elementHandle.select(...values);\n\n api.screenshot = async (options?: ScreenshotOptions) => {\n await page.waitForNetworkIdle();\n await waitForPaintEnd(page);\n return page.screenshot(options);\n };\n\n api.clear = async (elementHandle) => {\n await elementHandle.click({clickCount: 3});\n await elementHandle.press('Delete');\n };\n\n return api;\n};\n\nconst buildQueryMethods = (): ReturnType<typeof getQueriesForElement> => {\n const boundQueries: any = {};\n for (const [queryName, queryFn] of Object.entries(queries)) {\n boundQueries[queryName] = async (...args: any) => {\n const doc = await getDocument(globalPage);\n const queryArgs = [...args];\n if (queryName.startsWith('findBy')) {\n queryArgs.push({timeout: 10000});\n }\n const elementHandle = await queryFn(doc, ...queryArgs);\n\n const newElementHandle = Object.create(elementHandle);\n\n newElementHandle.screenshot = async (options: ScreenshotOptions) => {\n await globalPage.waitForNetworkIdle();\n await waitForPaintEnd(elementHandle, {fullPage: false});\n return elementHandle.screenshot(options);\n };\n\n return newElementHandle;\n };\n }\n return boundQueries;\n};\n\nexport const screen = buildQueryMethods();\n\nexport type {ElementHandle, Viewport} from 'puppeteer';\n\nafterEach(async () => {\n try {\n // clear tab, this way we clear the DOM and stop js execution or pending requests\n await globalPage.goto('about:blank');\n } catch (e) {\n // ignore, at this point page might be destroyed\n }\n});\n"],"names":["_Pact","prototype","then","onFulfilled","onRejected","result","state","this","s","callback","_settle","v","e","o","_this","value","pact","bind","observer","_isSettledPact","thenable","_catch","body","recover","Symbol","iterator","asyncIterator","globalBrowser","global","browser","globalPage","page","isCi","process","argv","includes","env","CI","isUsingDockerizedChromium","URL","wsEndpoint","port","serverHostName","platform","projectConfig","JSON","parse","fs","readFileSync","path","join","findRoot","cwd","acceptanceTests","server","ciServer","devServer","serverPort","calledToMatchImageSnapshotOutsideDocker","expect","extend","toMatchImageSnapshot","configureToMatchImageSnapshot","failureThreshold","failureThresholdType","message","pass","afterEach","error","Error","stack","split","waitForPaintEnd","element","maxWait","fullPage","t0","Date","now","screenshot","buf1","Promise","r","setTimeout","buf2","test","update","stage","shouldContinue","reject","_resumeAfterTest","_resumeAfterBody","updateValue","compare","screen","boundQueries","queryName","queryFn","args","getDocument","doc","queryArgs","startsWith","push","timeout","elementHandle","newElementHandle","Object","create","options","waitForNetworkIdle","entries","queries","buildQueryMethods","openPage","userAgent","isDarkMode","viewport","urlConfig","currentUserAgent","bringToFront","setUserAgent","emulateMediaFeatures","name","waitForFunction","api","type","text","click","select","values","clear","clickCount","press","url","connectionError","captureStackTrace","setViewport","undefined","protocol","hostname"],"mappings":"uRACaA,EAAsB,oBACzBA,YACTA,EAAMC,UAAUC,KAAO,SAASC,EAAaC,OACtCC,EAAS,IAAIL,EACbM,EAAQC,KAAKC,KACfF,EAAO,KACJG,EAAmB,EAARH,EAAYH,EAAcC,KACvCK,EAAU,KAEZC,EAAQL,EAAQ,EAAGI,EAASF,KAAKI,IAChC,MAAOC,GACRF,EAAQL,EAAQ,EAAGO,UAEbP,SAEAE,iBAGJM,EAAI,SAASC,WAEVC,EAAQD,EAAMH,EACN,EAAVG,EAAMN,EACTE,EAAQL,EAAQ,EAAGF,EAAcA,EAAYY,GAASA,GAC5CX,EACVM,EAAQL,EAAQ,EAAGD,EAAWW,IAE9BL,EAAQL,EAAQ,EAAGU,GAEnB,MAAOH,GACRF,EAAQL,EAAQ,EAAGO,KAGdP,GAEDL,EAlC2B,GAsC5B,SAASU,EAAQM,EAAMV,EAAOS,OAC/BC,EAAKR,EAAG,IACRO,aAAiBf,EAAO,KACvBe,EAAMP,cAMTO,EAAMF,EAAIH,EAAQO,KAAK,KAAMD,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BgB,EAAIM,eAAe1B,8BACTA,EAAcuB,MAAM,CAACI,WAAY,6CACjC3B,EAAc4B,MAAM,uEAGvBR,gDA7BG9F,OAAUuG,qCACX1H,MACAA,EAAYqD,QAAQ9B,SAAS,oCACxBoG,EAAkB,IAAIlE,8BAA8BiE,oCAC1DjE,MAAMmE,kBAAkBD,EAAiBrB,GACnCqB,QAEA3H,8DAbVyG,yBACMtF,EAAK0G,YAAYpB,+DAvBrBiB,EAAO,mBACaI,IAAlBpB,EAAUgB,WACHhB,EAAUgB,UAGiEhB,EAA/ErE,KAAAA,aAAO,QAAwEqE,EAAnE7E,KAAAA,aAAOgB,MAA4D6D,EAAhDqB,SAAAA,aAAW,WAAqCrB,EAA7BsB,SAAAA,aAAWlG,QAE/DD,QACa,IAAI4B,MACd,uKAMEsE,QAAcC,MAAYnG,EAAOQ,EAflC,0BAkBYkE,IAAAA,mBAAoBxF,EAAcwF"}
|
|
@@ -324,91 +324,105 @@ var waitForPaintEnd = function waitForPaintEnd(element, _temp) {
|
|
|
324
324
|
var openPage = function openPage(_ref3) {
|
|
325
325
|
var userAgent = _ref3.userAgent,
|
|
326
326
|
isDarkMode = _ref3.isDarkMode,
|
|
327
|
-
|
|
327
|
+
viewport = _ref3.viewport,
|
|
328
|
+
urlConfig = _objectWithoutPropertiesLoose(_ref3, ["userAgent", "isDarkMode", "viewport"]);
|
|
328
329
|
|
|
329
330
|
try {
|
|
330
|
-
var
|
|
331
|
+
var _temp7 = function _temp7(currentUserAgent) {
|
|
331
332
|
var page = globalPage;
|
|
332
333
|
return Promise.resolve(page.bringToFront()).then(function () {
|
|
333
|
-
|
|
334
|
-
return Promise.resolve(page.
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
334
|
+
function _temp5() {
|
|
335
|
+
return Promise.resolve(page.setUserAgent(currentUserAgent + " acceptance-test")).then(function () {
|
|
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
|
+
};
|
|
353
|
+
|
|
354
|
+
api.click = function (elementHandle, options) {
|
|
355
|
+
try {
|
|
356
|
+
return Promise.resolve(elementHandle.click(options));
|
|
357
|
+
} catch (e) {
|
|
358
|
+
return Promise.reject(e);
|
|
359
|
+
}
|
|
360
|
+
};
|
|
361
|
+
|
|
362
|
+
api.select = function (elementHandle) {
|
|
363
|
+
try {
|
|
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
|
+
}
|
|
367
|
+
|
|
368
|
+
return Promise.resolve(elementHandle.select.apply(elementHandle, values));
|
|
369
|
+
} catch (e) {
|
|
370
|
+
return Promise.reject(e);
|
|
371
|
+
}
|
|
372
|
+
};
|
|
373
|
+
|
|
374
|
+
api.screenshot = function (options) {
|
|
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
|
+
};
|
|
397
|
+
|
|
398
|
+
return api;
|
|
399
|
+
});
|
|
400
|
+
}
|
|
381
401
|
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
}
|
|
390
|
-
|
|
402
|
+
var _temp2 = _catch(function () {
|
|
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;
|
|
391
411
|
}
|
|
392
|
-
};
|
|
393
|
-
|
|
394
|
-
return api;
|
|
395
|
-
}
|
|
412
|
+
});
|
|
396
413
|
|
|
397
|
-
|
|
398
|
-
return Promise.resolve(page["goto"](url)).then(function () {});
|
|
399
|
-
}, function (e) {
|
|
400
|
-
if (e.message.includes('net::ERR_CONNECTION_REFUSED')) {
|
|
401
|
-
var connectionError = new Error("Could not connect to " + url + ". Is the server running?");
|
|
402
|
-
Error.captureStackTrace(connectionError, openPage);
|
|
403
|
-
throw connectionError;
|
|
404
|
-
} else {
|
|
405
|
-
throw e;
|
|
406
|
-
}
|
|
414
|
+
return _temp2 && _temp2.then ? _temp2.then(_temp3) : _temp3(_temp2);
|
|
407
415
|
});
|
|
408
|
-
|
|
409
|
-
return _temp2 && _temp2.then ? _temp2.then(_temp3) : _temp3(_temp2);
|
|
410
416
|
});
|
|
411
|
-
}
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
var _temp4 = function () {
|
|
420
|
+
if (viewport) {
|
|
421
|
+
return Promise.resolve(page.setViewport(viewport)).then(function () {});
|
|
422
|
+
}
|
|
423
|
+
}();
|
|
424
|
+
|
|
425
|
+
return _temp4 && _temp4.then ? _temp4.then(_temp5) : _temp5(_temp4);
|
|
412
426
|
});
|
|
413
427
|
};
|
|
414
428
|
|
|
@@ -435,7 +449,7 @@ var openPage = function openPage(_ref3) {
|
|
|
435
449
|
return protocol + "://" + hostname + ":" + port + path;
|
|
436
450
|
}();
|
|
437
451
|
|
|
438
|
-
return Promise.resolve(userAgent ?
|
|
452
|
+
return Promise.resolve(userAgent ? _temp7(userAgent) : Promise.resolve(globalBrowser.userAgent()).then(_temp7));
|
|
439
453
|
} catch (e) {
|
|
440
454
|
return Promise.reject(e);
|
|
441
455
|
}
|
|
@@ -469,10 +483,12 @@ var buildQueryMethods = function buildQueryMethods() {
|
|
|
469
483
|
|
|
470
484
|
newElementHandle.screenshot = function (options) {
|
|
471
485
|
try {
|
|
472
|
-
return Promise.resolve(
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
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
|
+
});
|
|
476
492
|
});
|
|
477
493
|
} catch (e) {
|
|
478
494
|
return Promise.reject(e);
|
|
@@ -496,6 +512,18 @@ var buildQueryMethods = function buildQueryMethods() {
|
|
|
496
512
|
};
|
|
497
513
|
|
|
498
514
|
var screen = /*#__PURE__*/buildQueryMethods();
|
|
515
|
+
afterEach(function () {
|
|
516
|
+
try {
|
|
517
|
+
var _temp9 = _catch(function () {
|
|
518
|
+
// clear tab, this way we clear the DOM and stop js execution or pending requests
|
|
519
|
+
return Promise.resolve(globalPage["goto"]('about:blank')).then(function () {});
|
|
520
|
+
}, function () {});
|
|
521
|
+
|
|
522
|
+
return Promise.resolve(_temp9 && _temp9.then ? _temp9.then(function () {}) : void 0);
|
|
523
|
+
} catch (e) {
|
|
524
|
+
return Promise.reject(e);
|
|
525
|
+
}
|
|
526
|
+
});
|
|
499
527
|
|
|
500
528
|
export { globalBrowser, globalPage, openPage, screen, serverHostName, serverPort };
|
|
501
529
|
//# sourceMappingURL=acceptance-testing.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acceptance-testing.esm.js","sources":["../../../node_modules/babel-plugin-transform-async-to-promises/helpers.js","../src/index.ts"],"sourcesContent":["// A type of promise-like that resolves synchronously and supports only one observer\nexport const _Pact = /*#__PURE__*/(function() {\n\tfunction _Pact() {}\n\t_Pact.prototype.then = function(onFulfilled, onRejected) {\n\t\tconst result = new _Pact();\n\t\tconst state = this.s;\n\t\tif (state) {\n\t\t\tconst callback = state & 1 ? onFulfilled : onRejected;\n\t\t\tif (callback) {\n\t\t\t\ttry {\n\t\t\t\t\t_settle(result, 1, callback(this.v));\n\t\t\t\t} catch (e) {\n\t\t\t\t\t_settle(result, 2, e);\n\t\t\t\t}\n\t\t\t\treturn result;\n\t\t\t} else {\n\t\t\t\treturn this;\n\t\t\t}\n\t\t}\n\t\tthis.o = function(_this) {\n\t\t\ttry {\n\t\t\t\tconst value = _this.v;\n\t\t\t\tif (_this.s & 1) {\n\t\t\t\t\t_settle(result, 1, onFulfilled ? onFulfilled(value) : value);\n\t\t\t\t} else if (onRejected) {\n\t\t\t\t\t_settle(result, 1, onRejected(value));\n\t\t\t\t} else {\n\t\t\t\t\t_settle(result, 2, value);\n\t\t\t\t}\n\t\t\t} catch (e) {\n\t\t\t\t_settle(result, 2, e);\n\t\t\t}\n\t\t};\n\t\treturn result;\n\t}\n\treturn _Pact;\n})();\n\n// Settles a pact synchronously\nexport function _settle(pact, state, value) {\n\tif (!pact.s) {\n\t\tif (value instanceof _Pact) {\n\t\t\tif (value.s) {\n\t\t\t\tif (state & 1) {\n\t\t\t\t\tstate = value.s;\n\t\t\t\t}\n\t\t\t\tvalue = value.v;\n\t\t\t} else {\n\t\t\t\tvalue.o = _settle.bind(null, pact, state);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\tif (value && value.then) {\n\t\t\tvalue.then(_settle.bind(null, pact, state), _settle.bind(null, pact, 2));\n\t\t\treturn;\n\t\t}\n\t\tpact.s = state;\n\t\tpact.v = value;\n\t\tconst observer = pact.o;\n\t\tif (observer) {\n\t\t\tobserver(pact);\n\t\t}\n\t}\n}\n\nexport function _isSettledPact(thenable) {\n\treturn thenable instanceof _Pact && thenable.s & 1;\n}\n\n// Converts argument to a function that always returns a Promise\nexport function _async(f) {\n\treturn function() {\n\t\tfor (var args = [], i = 0; i < arguments.length; i++) {\n\t\t\targs[i] = arguments[i];\n\t\t}\n\t\ttry {\n\t\t\treturn Promise.resolve(f.apply(this, args));\n\t\t} catch(e) {\n\t\t\treturn Promise.reject(e);\n\t\t}\n\t}\n}\n\n// Awaits on a value that may or may not be a Promise (equivalent to the await keyword in ES2015, with continuations passed explicitly)\nexport function _await(value, then, direct) {\n\tif (direct) {\n\t\treturn then ? then(value) : value;\n\t}\n\tif (!value || !value.then) {\n\t\tvalue = Promise.resolve(value);\n\t}\n\treturn then ? value.then(then) : value;\n}\n\n// Awaits on a value that may or may not be a Promise, then ignores it\nexport function _awaitIgnored(value, direct) {\n\tif (!direct) {\n\t\treturn value && value.then ? value.then(_empty) : Promise.resolve();\n\t}\n}\n\n// Proceeds after a value has resolved, or proceeds immediately if the value is not thenable\nexport function _continue(value, then) {\n\treturn value && value.then ? value.then(then) : then(value);\n}\n\n// Proceeds after a value has resolved, or proceeds immediately if the value is not thenable\nexport function _continueIgnored(value) {\n\tif (value && value.then) {\n\t\treturn value.then(_empty);\n\t}\n}\n\n// Asynchronously iterate through an object that has a length property, passing the index as the first argument to the callback (even as the length property changes)\nexport function _forTo(array, body, check) {\n\tvar i = -1, pact, reject;\n\tfunction _cycle(result) {\n\t\ttry {\n\t\t\twhile (++i < array.length && (!check || !check())) {\n\t\t\t\tresult = body(i);\n\t\t\t\tif (result && result.then) {\n\t\t\t\t\tif (_isSettledPact(result)) {\n\t\t\t\t\t\tresult = result.v;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tresult.then(_cycle, reject || (reject = _settle.bind(null, pact = new _Pact(), 2)));\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (pact) {\n\t\t\t\t_settle(pact, 1, result);\n\t\t\t} else {\n\t\t\t\tpact = result;\n\t\t\t}\n\t\t} catch (e) {\n\t\t\t_settle(pact || (pact = new _Pact()), 2, e);\n\t\t}\n\t}\n\t_cycle();\n\treturn pact;\n}\n\n// Asynchronously iterate through an object's properties (including properties inherited from the prototype)\n// Uses a snapshot of the object's properties\nexport function _forIn(target, body, check) {\n\tvar keys = [];\n\tfor (var key in target) {\n\t\tkeys.push(key);\n\t}\n\treturn _forTo(keys, function(i) { return body(keys[i]); }, check);\n}\n\n// Asynchronously iterate through an object's own properties (excluding properties inherited from the prototype)\n// Uses a snapshot of the object's properties\nexport function _forOwn(target, body, check) {\n\tvar keys = [];\n\tfor (var key in target) {\n\t\tif (Object.prototype.hasOwnProperty.call(target, key)) {\n\t\t\tkeys.push(key);\n\t\t}\n\t}\n\treturn _forTo(keys, function(i) { return body(keys[i]); }, check);\n}\n\nexport const _iteratorSymbol = /*#__PURE__*/ typeof Symbol !== \"undefined\" ? (Symbol.iterator || (Symbol.iterator = Symbol(\"Symbol.iterator\"))) : \"@@iterator\";\n\n// Asynchronously iterate through an object's values\n// Uses for...of if the runtime supports it, otherwise iterates until length on a copy\nexport function _forOf(target, body, check) {\n\tif (typeof target[_iteratorSymbol] === \"function\") {\n\t\tvar iterator = target[_iteratorSymbol](), step, pact, reject;\n\t\tfunction _cycle(result) {\n\t\t\ttry {\n\t\t\t\twhile (!(step = iterator.next()).done && (!check || !check())) {\n\t\t\t\t\tresult = body(step.value);\n\t\t\t\t\tif (result && result.then) {\n\t\t\t\t\t\tif (_isSettledPact(result)) {\n\t\t\t\t\t\t\tresult = result.v;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tresult.then(_cycle, reject || (reject = _settle.bind(null, pact = new _Pact(), 2)));\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (pact) {\n\t\t\t\t\t_settle(pact, 1, result);\n\t\t\t\t} else {\n\t\t\t\t\tpact = result;\n\t\t\t\t}\n\t\t\t} catch (e) {\n\t\t\t\t_settle(pact || (pact = new _Pact()), 2, e);\n\t\t\t}\n\t\t}\n\t\t_cycle();\n\t\tif (iterator.return) {\n\t\t\tvar _fixup = function(value) {\n\t\t\t\ttry {\n\t\t\t\t\tif (!step.done) {\n\t\t\t\t\t\titerator.return();\n\t\t\t\t\t}\n\t\t\t\t} catch(e) {\n\t\t\t\t}\n\t\t\t\treturn value;\n\t\t\t}\n\t\t\tif (pact && pact.then) {\n\t\t\t\treturn pact.then(_fixup, function(e) {\n\t\t\t\t\tthrow _fixup(e);\n\t\t\t\t});\n\t\t\t}\n\t\t\t_fixup();\n\t\t}\n\t\treturn pact;\n\t}\n\t// No support for Symbol.iterator\n\tif (!(\"length\" in target)) {\n\t\tthrow new TypeError(\"Object is not iterable\");\n\t}\n\t// Handle live collections properly\n\tvar values = [];\n\tfor (var i = 0; i < target.length; i++) {\n\t\tvalues.push(target[i]);\n\t}\n\treturn _forTo(values, function(i) { return body(values[i]); }, check);\n}\n\nexport const _asyncIteratorSymbol = /*#__PURE__*/ typeof Symbol !== \"undefined\" ? (Symbol.asyncIterator || (Symbol.asyncIterator = Symbol(\"Symbol.asyncIterator\"))) : \"@@asyncIterator\";\n\n// Asynchronously iterate on a value using it's async iterator if present, or its synchronous iterator if missing\nexport function _forAwaitOf(target, body, check) {\n\tif (typeof target[_asyncIteratorSymbol] === \"function\") {\n\t\tvar pact = new _Pact();\n\t\tvar iterator = target[_asyncIteratorSymbol]();\n\t\titerator.next().then(_resumeAfterNext).then(void 0, _reject);\n\t\treturn pact;\n\t\tfunction _resumeAfterBody(result) {\n\t\t\tif (check && check()) {\n\t\t\t\treturn _settle(pact, 1, iterator.return ? iterator.return().then(function() { return result; }) : result);\n\t\t\t}\n\t\t\titerator.next().then(_resumeAfterNext).then(void 0, _reject);\n\t\t}\n\t\tfunction _resumeAfterNext(step) {\n\t\t\tif (step.done) {\n\t\t\t\t_settle(pact, 1);\n\t\t\t} else {\n\t\t\t\tPromise.resolve(body(step.value)).then(_resumeAfterBody).then(void 0, _reject);\n\t\t\t}\n\t\t}\n\t\tfunction _reject(error) {\n\t\t\t_settle(pact, 2, iterator.return ? iterator.return().then(function() { return error; }) : error);\n\t\t}\n\t}\n\treturn Promise.resolve(_forOf(target, function(value) { return Promise.resolve(value).then(body); }, check));\n}\n\n// Asynchronously implement a generic for loop\nexport function _for(test, update, body) {\n\tvar stage;\n\tfor (;;) {\n\t\tvar shouldContinue = test();\n\t\tif (_isSettledPact(shouldContinue)) {\n\t\t\tshouldContinue = shouldContinue.v;\n\t\t}\n\t\tif (!shouldContinue) {\n\t\t\treturn result;\n\t\t}\n\t\tif (shouldContinue.then) {\n\t\t\tstage = 0;\n\t\t\tbreak;\n\t\t}\n\t\tvar result = body();\n\t\tif (result && result.then) {\n\t\t\tif (_isSettledPact(result)) {\n\t\t\t\tresult = result.s;\n\t\t\t} else {\n\t\t\t\tstage = 1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (update) {\n\t\t\tvar updateValue = update();\n\t\t\tif (updateValue && updateValue.then && !_isSettledPact(updateValue)) {\n\t\t\t\tstage = 2;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\tvar pact = new _Pact();\n\tvar reject = _settle.bind(null, pact, 2);\n\t(stage === 0 ? shouldContinue.then(_resumeAfterTest) : stage === 1 ? result.then(_resumeAfterBody) : updateValue.then(_resumeAfterUpdate)).then(void 0, reject);\n\treturn pact;\n\tfunction _resumeAfterBody(value) {\n\t\tresult = value;\n\t\tdo {\n\t\t\tif (update) {\n\t\t\t\tupdateValue = update();\n\t\t\t\tif (updateValue && updateValue.then && !_isSettledPact(updateValue)) {\n\t\t\t\t\tupdateValue.then(_resumeAfterUpdate).then(void 0, reject);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\tshouldContinue = test();\n\t\t\tif (!shouldContinue || (_isSettledPact(shouldContinue) && !shouldContinue.v)) {\n\t\t\t\t_settle(pact, 1, result);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (shouldContinue.then) {\n\t\t\t\tshouldContinue.then(_resumeAfterTest).then(void 0, reject);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tresult = body();\n\t\t\tif (_isSettledPact(result)) {\n\t\t\t\tresult = result.v;\n\t\t\t}\n\t\t} while (!result || !result.then);\n\t\tresult.then(_resumeAfterBody).then(void 0, reject);\n\t}\n\tfunction _resumeAfterTest(shouldContinue) {\n\t\tif (shouldContinue) {\n\t\t\tresult = body();\n\t\t\tif (result && result.then) {\n\t\t\t\tresult.then(_resumeAfterBody).then(void 0, reject);\n\t\t\t} else {\n\t\t\t\t_resumeAfterBody(result);\n\t\t\t}\n\t\t} else {\n\t\t\t_settle(pact, 1, result);\n\t\t}\n\t}\n\tfunction _resumeAfterUpdate() {\n\t\tif (shouldContinue = test()) {\n\t\t\tif (shouldContinue.then) {\n\t\t\t\tshouldContinue.then(_resumeAfterTest).then(void 0, reject);\n\t\t\t} else {\n\t\t\t\t_resumeAfterTest(shouldContinue);\n\t\t\t}\n\t\t} else {\n\t\t\t_settle(pact, 1, result);\n\t\t}\n\t}\n}\n\n// Asynchronously implement a do ... while loop\nexport function _do(body, test) {\n\tvar awaitBody;\n\tdo {\n\t\tvar result = body();\n\t\tif (result && result.then) {\n\t\t\tif (_isSettledPact(result)) {\n\t\t\t\tresult = result.v;\n\t\t\t} else {\n\t\t\t\tawaitBody = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tvar shouldContinue = test();\n\t\tif (_isSettledPact(shouldContinue)) {\n\t\t\tshouldContinue = shouldContinue.v;\n\t\t}\n\t\tif (!shouldContinue) {\n\t\t\treturn result;\n\t\t}\n\t} while (!shouldContinue.then);\n\tconst pact = new _Pact();\n\tconst reject = _settle.bind(null, pact, 2);\n\t(awaitBody ? result.then(_resumeAfterBody) : shouldContinue.then(_resumeAfterTest)).then(void 0, reject);\n\treturn pact;\n\tfunction _resumeAfterBody(value) {\n\t\tresult = value;\n\t\tfor (;;) {\n\t\t\tshouldContinue = test();\n\t\t\tif (_isSettledPact(shouldContinue)) {\n\t\t\t\tshouldContinue = shouldContinue.v;\n\t\t\t}\n\t\t\tif (!shouldContinue) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (shouldContinue.then) {\n\t\t\t\tshouldContinue.then(_resumeAfterTest).then(void 0, reject);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tresult = body();\n\t\t\tif (result && result.then) {\n\t\t\t\tif (_isSettledPact(result)) {\n\t\t\t\t\tresult = result.v;\n\t\t\t\t} else {\n\t\t\t\t\tresult.then(_resumeAfterBody).then(void 0, reject);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t_settle(pact, 1, result);\n\t}\n\tfunction _resumeAfterTest(shouldContinue) {\n\t\tif (shouldContinue) {\n\t\t\tdo {\n\t\t\t\tresult = body();\n\t\t\t\tif (result && result.then) {\n\t\t\t\t\tif (_isSettledPact(result)) {\n\t\t\t\t\t\tresult = result.v;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tresult.then(_resumeAfterBody).then(void 0, reject);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tshouldContinue = test();\n\t\t\t\tif (_isSettledPact(shouldContinue)) {\n\t\t\t\t\tshouldContinue = shouldContinue.v;\n\t\t\t\t}\n\t\t\t\tif (!shouldContinue) {\n\t\t\t\t\t_settle(pact, 1, result);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t} while (!shouldContinue.then);\n\t\t\tshouldContinue.then(_resumeAfterTest).then(void 0, reject);\n\t\t} else {\n\t\t\t_settle(pact, 1, result);\n\t\t}\n\t}\n}\n\n// Asynchronously implement a switch statement\nexport function _switch(discriminant, cases) {\n\tvar dispatchIndex = -1;\n\tvar awaitBody;\n\touter: {\n\t\tfor (var i = 0; i < cases.length; i++) {\n\t\t\tvar test = cases[i][0];\n\t\t\tif (test) {\n\t\t\t\tvar testValue = test();\n\t\t\t\tif (testValue && testValue.then) {\n\t\t\t\t\tbreak outer;\n\t\t\t\t}\n\t\t\t\tif (testValue === discriminant) {\n\t\t\t\t\tdispatchIndex = i;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// Found the default case, set it as the pending dispatch case\n\t\t\t\tdispatchIndex = i;\n\t\t\t}\n\t\t}\n\t\tif (dispatchIndex !== -1) {\n\t\t\tdo {\n\t\t\t\tvar body = cases[dispatchIndex][1];\n\t\t\t\twhile (!body) {\n\t\t\t\t\tdispatchIndex++;\n\t\t\t\t\tbody = cases[dispatchIndex][1];\n\t\t\t\t}\n\t\t\t\tvar result = body();\n\t\t\t\tif (result && result.then) {\n\t\t\t\t\tawaitBody = true;\n\t\t\t\t\tbreak outer;\n\t\t\t\t}\n\t\t\t\tvar fallthroughCheck = cases[dispatchIndex][2];\n\t\t\t\tdispatchIndex++;\n\t\t\t} while (fallthroughCheck && !fallthroughCheck());\n\t\t\treturn result;\n\t\t}\n\t}\n\tconst pact = new _Pact();\n\tconst reject = _settle.bind(null, pact, 2);\n\t(awaitBody ? result.then(_resumeAfterBody) : testValue.then(_resumeAfterTest)).then(void 0, reject);\n\treturn pact;\n\tfunction _resumeAfterTest(value) {\n\t\tfor (;;) {\n\t\t\tif (value === discriminant) {\n\t\t\t\tdispatchIndex = i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (++i === cases.length) {\n\t\t\t\tif (dispatchIndex !== -1) {\n\t\t\t\t\tbreak;\n\t\t\t\t} else {\n\t\t\t\t\t_settle(pact, 1, result);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\ttest = cases[i][0];\n\t\t\tif (test) {\n\t\t\t\tvalue = test();\n\t\t\t\tif (value && value.then) {\n\t\t\t\t\tvalue.then(_resumeAfterTest).then(void 0, reject);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tdispatchIndex = i;\n\t\t\t}\n\t\t}\n\t\tdo {\n\t\t\tvar body = cases[dispatchIndex][1];\n\t\t\twhile (!body) {\n\t\t\t\tdispatchIndex++;\n\t\t\t\tbody = cases[dispatchIndex][1];\n\t\t\t}\n\t\t\tvar result = body();\n\t\t\tif (result && result.then) {\n\t\t\t\tresult.then(_resumeAfterBody).then(void 0, reject);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tvar fallthroughCheck = cases[dispatchIndex][2];\n\t\t\tdispatchIndex++;\n\t\t} while (fallthroughCheck && !fallthroughCheck());\n\t\t_settle(pact, 1, result);\n\t}\n\tfunction _resumeAfterBody(result) {\n\t\tfor (;;) {\n\t\t\tvar fallthroughCheck = cases[dispatchIndex][2];\n\t\t\tif (!fallthroughCheck || fallthroughCheck()) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdispatchIndex++;\n\t\t\tvar body = cases[dispatchIndex][1];\n\t\t\twhile (!body) {\n\t\t\t\tdispatchIndex++;\n\t\t\t\tbody = cases[dispatchIndex][1];\n\t\t\t}\n\t\t\tresult = body();\n\t\t\tif (result && result.then) {\n\t\t\t\tresult.then(_resumeAfterBody).then(void 0, reject);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\t_settle(pact, 1, result);\n\t}\n}\n\n// Asynchronously call a function and pass the result to explicitly passed continuations\nexport function _call(body, then, direct) {\n\tif (direct) {\n\t\treturn then ? then(body()) : body();\n\t}\n\ttry {\n\t\tvar result = Promise.resolve(body());\n\t\treturn then ? result.then(then) : result;\n\t} catch (e) {\n\t\treturn Promise.reject(e);\n\t}\n}\n\n// Asynchronously call a function and swallow the result\nexport function _callIgnored(body, direct) {\n\treturn _call(body, _empty, direct);\n}\n\n// Asynchronously call a function and pass the result to explicitly passed continuations\nexport function _invoke(body, then) {\n\tvar result = body();\n\tif (result && result.then) {\n\t\treturn result.then(then);\n\t}\n\treturn then(result);\n}\n\n// Asynchronously call a function and swallow the result\nexport function _invokeIgnored(body) {\n\tvar result = body();\n\tif (result && result.then) {\n\t\treturn result.then(_empty);\n\t}\n}\n\n// Asynchronously call a function and send errors to recovery continuation\nexport function _catch(body, recover) {\n\ttry {\n\t\tvar result = body();\n\t} catch(e) {\n\t\treturn recover(e);\n\t}\n\tif (result && result.then) {\n\t\treturn result.then(void 0, recover);\n\t}\n\treturn result;\n}\n\n// Asynchronously await a promise and pass the result to a finally continuation\nexport function _finallyRethrows(body, finalizer) {\n\ttry {\n\t\tvar result = body();\n\t} catch (e) {\n\t\treturn finalizer(true, e);\n\t}\n\tif (result && result.then) {\n\t\treturn result.then(finalizer.bind(null, false), finalizer.bind(null, true));\n\t}\n\treturn finalizer(false, result);\n}\n\n// Asynchronously await a promise and invoke a finally continuation that always overrides the result\nexport function _finally(body, finalizer) {\n\ttry {\n\t\tvar result = body();\n\t} catch (e) {\n\t\treturn finalizer();\n\t}\n\tif (result && result.then) {\n\t\treturn result.then(finalizer, finalizer);\n\t}\n\treturn finalizer();\n}\n\n// Rethrow or return a value from a finally continuation\nexport function _rethrow(thrown, value) {\n\tif (thrown)\n\t\tthrow value;\n\treturn value;\n}\n\n// Empty function to implement break and other control flow that ignores asynchronous results\nexport function _empty() {\n}\n\n// Sentinel value for early returns in generators \nexport const _earlyReturn = /*#__PURE__*/ {};\n\n// Asynchronously call a function and send errors to recovery continuation, skipping early returns\nexport function _catchInGenerator(body, recover) {\n\treturn _catch(body, function(e) {\n\t\tif (e === _earlyReturn) {\n\t\t\tthrow e;\n\t\t}\n\t\treturn recover(e);\n\t});\n}\n\n// Asynchronous generator class; accepts the entrypoint of the generator, to which it passes itself when the generator should start\nexport const _AsyncGenerator = /*#__PURE__*/(function() {\n\tfunction _AsyncGenerator(entry) {\n\t\tthis._entry = entry;\n\t\tthis._pact = null;\n\t\tthis._resolve = null;\n\t\tthis._return = null;\n\t\tthis._promise = null;\n\t}\n\n\tfunction _wrapReturnedValue(value) {\n\t\treturn { value: value, done: true };\n\t}\n\tfunction _wrapYieldedValue(value) {\n\t\treturn { value: value, done: false };\n\t}\n\n\t_AsyncGenerator.prototype._yield = function(value) {\n\t\t// Yield the value to the pending next call\n\t\tthis._resolve(value && value.then ? value.then(_wrapYieldedValue) : _wrapYieldedValue(value));\n\t\t// Return a pact for an upcoming next/return/throw call\n\t\treturn this._pact = new _Pact();\n\t};\n\t_AsyncGenerator.prototype.next = function(value) {\n\t\t// Advance the generator, starting it if it has yet to be started\n\t\tconst _this = this;\n\t\treturn _this._promise = new Promise(function (resolve) {\n\t\t\tconst _pact = _this._pact;\n\t\t\tif (_pact === null) {\n\t\t\t\tconst _entry = _this._entry;\n\t\t\t\tif (_entry === null) {\n\t\t\t\t\t// Generator is started, but not awaiting a yield expression\n\t\t\t\t\t// Abandon the next call!\n\t\t\t\t\treturn resolve(_this._promise);\n\t\t\t\t}\n\t\t\t\t// Start the generator\n\t\t\t\t_this._entry = null;\n\t\t\t\t_this._resolve = resolve;\n\t\t\t\tfunction returnValue(value) {\n\t\t\t\t\t_this._resolve(value && value.then ? value.then(_wrapReturnedValue) : _wrapReturnedValue(value));\n\t\t\t\t\t_this._pact = null;\n\t\t\t\t\t_this._resolve = null;\n\t\t\t\t}\n\t\t\t\tvar result = _entry(_this);\n\t\t\t\tif (result && result.then) {\n\t\t\t\t\tresult.then(returnValue, function(error) {\n\t\t\t\t\t\tif (error === _earlyReturn) {\n\t\t\t\t\t\t\treturnValue(_this._return);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tconst pact = new _Pact();\n\t\t\t\t\t\t\t_this._resolve(pact);\n\t\t\t\t\t\t\t_this._pact = null;\n\t\t\t\t\t\t\t_this._resolve = null;\n\t\t\t\t\t\t\t_resolve(pact, 2, error);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\treturnValue(result);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// Generator is started and a yield expression is pending, settle it\n\t\t\t\t_this._pact = null;\n\t\t\t\t_this._resolve = resolve;\n\t\t\t\t_settle(_pact, 1, value);\n\t\t\t}\n\t\t});\n\t};\n\t_AsyncGenerator.prototype.return = function(value) {\n\t\t// Early return from the generator if started, otherwise abandons the generator\n\t\tconst _this = this;\n\t\treturn _this._promise = new Promise(function (resolve) {\n\t\t\tconst _pact = _this._pact;\n\t\t\tif (_pact === null) {\n\t\t\t\tif (_this._entry === null) {\n\t\t\t\t\t// Generator is started, but not awaiting a yield expression\n\t\t\t\t\t// Abandon the return call!\n\t\t\t\t\treturn resolve(_this._promise);\n\t\t\t\t}\n\t\t\t\t// Generator is not started, abandon it and return the specified value\n\t\t\t\t_this._entry = null;\n\t\t\t\treturn resolve(value && value.then ? value.then(_wrapReturnedValue) : _wrapReturnedValue(value));\n\t\t\t}\n\t\t\t// Settle the yield expression with a rejected \"early return\" value\n\t\t\t_this._return = value;\n\t\t\t_this._resolve = resolve;\n\t\t\t_this._pact = null;\n\t\t\t_settle(_pact, 2, _earlyReturn);\n\t\t});\n\t};\n\t_AsyncGenerator.prototype.throw = function(error) {\n\t\t// Inject an exception into the pending yield expression\n\t\tconst _this = this;\n\t\treturn _this._promise = new Promise(function (resolve, reject) {\n\t\t\tconst _pact = _this._pact;\n\t\t\tif (_pact === null) {\n\t\t\t\tif (_this._entry === null) {\n\t\t\t\t\t// Generator is started, but not awaiting a yield expression\n\t\t\t\t\t// Abandon the throw call!\n\t\t\t\t\treturn resolve(_this._promise);\n\t\t\t\t}\n\t\t\t\t// Generator is not started, abandon it and return a rejected Promise containing the error\n\t\t\t\t_this._entry = null;\n\t\t\t\treturn reject(error);\n\t\t\t}\n\t\t\t// Settle the yield expression with the value as a rejection\n\t\t\t_this._resolve = resolve;\n\t\t\t_this._pact = null;\n\t\t\t_settle(_pact, 2, error);\n\t\t});\n\t};\n\n\t_AsyncGenerator.prototype[_asyncIteratorSymbol] = function() {\n\t\treturn this;\n\t};\n\t\n\treturn _AsyncGenerator;\n})();\n","import path from 'path';\nimport fs from 'fs';\nimport findRoot from 'find-root';\nimport {getDocument, queries} from 'pptr-testing-library';\nimport {configureToMatchImageSnapshot} from 'jest-image-snapshot';\n\nimport type {Page, ElementHandle, ScreenshotOptions, Browser, ClickOptions} from 'puppeteer';\nimport type {getQueriesForElement} from 'pptr-testing-library';\n\nexport const globalBrowser: Browser = (global as any).browser;\nexport const globalPage: Page = (global as any).page;\n\nconst isCi = process.argv.includes('--ci') || process.env.CI;\nconst isUsingDockerizedChromium = isCi || new URL(globalBrowser.wsEndpoint()).port === '9223';\n\nexport const serverHostName = ((): string => {\n if (isCi) {\n return 'localhost';\n }\n\n if (isUsingDockerizedChromium) {\n return process.platform === 'linux' ? '172.17.0.1' : 'host.docker.internal';\n }\n\n return 'localhost';\n})();\n\nconst rootDir = findRoot(process.cwd());\nconst pkg = JSON.parse(fs.readFileSync(path.join(rootDir, 'package.json'), 'utf-8'));\nconst projectConfig = pkg.acceptanceTests ?? {};\nconst server = (isCi ? projectConfig.ciServer : projectConfig.devServer) ?? projectConfig.server;\n\nexport const serverPort = server?.port;\n\nconst toMatchImageSnapshot = configureToMatchImageSnapshot({\n failureThreshold: 0,\n failureThresholdType: 'percent',\n});\n\nlet calledToMatchImageSnapshotOutsideDocker = false;\n\nconst localToMatchImageSnapshot = () => {\n calledToMatchImageSnapshotOutsideDocker = true;\n // let the expectation pass, then fail in afterEach. This way we allow developers to debug screenshot tests in local\n // but don't allow them to save screenshots taken outside the dockerized chromium\n return {\n message: () => '',\n pass: true,\n };\n};\n\nexpect.extend({\n toMatchImageSnapshot: isUsingDockerizedChromium ? toMatchImageSnapshot : localToMatchImageSnapshot,\n});\n\nafterEach(() => {\n if (calledToMatchImageSnapshotOutsideDocker) {\n const error = new Error(\n `Calling .toMatchImageSnapshot() is not allowed outside dockerized browser. Please, run your screenshot test in headless mode.`\n );\n error.stack = (error.stack || '').split('\\n')[0];\n throw error;\n }\n});\n\ntype WaitForPaintEndOptions = {\n maxWait?: number;\n fullPage?: boolean;\n};\n\nconst waitForPaintEnd = async (\n element: ElementHandle | Page,\n {maxWait = 10000, fullPage = true}: WaitForPaintEndOptions = {}\n) => {\n const STEP_TIME = 250;\n const t0 = Date.now();\n\n let buf1 = (await element.screenshot({fullPage})) as Buffer;\n await new Promise((r) => setTimeout(r, STEP_TIME));\n let buf2 = (await element.screenshot({fullPage})) as Buffer;\n\n // buffers are different if compare != 0\n while (buf1.compare(buf2)) {\n if (Date.now() - t0 > maxWait) {\n throw Error('Paint end timeout');\n }\n buf1 = buf2;\n await new Promise((r) => setTimeout(r, STEP_TIME));\n buf2 = (await element.screenshot({fullPage})) as Buffer;\n }\n};\n\nexport interface PageApi extends Omit<Page, 'click' | 'type' | 'select'> {\n clear: (selector: ElementHandle) => Promise<void>;\n // These are overridden:\n type: (selector: ElementHandle, text: string, options?: {delay: number}) => Promise<void>;\n click: (selector: ElementHandle, options?: ClickOptions) => Promise<void>;\n select: (selector: ElementHandle, ...values: string[]) => Promise<string[]>;\n}\n\ninterface OpenPageCommonConfig {\n userAgent?: string;\n isDarkMode?: boolean;\n}\n\ninterface OpenPageUrlConfig extends OpenPageCommonConfig {\n url: string;\n}\n\ninterface OpenPagePathConfig extends OpenPageCommonConfig {\n url?: undefined;\n\n path?: string;\n port?: number;\n protocol?: string;\n hostname?: string;\n}\n\ntype OpenPageConfig = OpenPageUrlConfig | OpenPagePathConfig;\n\nexport const openPage = async ({userAgent, isDarkMode, ...urlConfig}: OpenPageConfig): Promise<PageApi> => {\n const url = ((): string => {\n if (urlConfig.url !== undefined) {\n return urlConfig.url;\n }\n\n const {path = '/', port = serverPort, protocol = 'http', hostname = serverHostName} = urlConfig;\n\n if (!port) {\n const error = new Error(\n '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'\n );\n // Error.captureStackTrace(error, openPage);\n throw error;\n }\n\n return `${protocol}://${hostname}:${port}${path}`;\n })();\n\n const currentUserAgent = userAgent || (await globalBrowser.userAgent());\n const page = globalPage;\n await page.bringToFront();\n await page.setUserAgent(`${currentUserAgent} acceptance-test`);\n await page.emulateMediaFeatures([{name: 'prefers-color-scheme', value: isDarkMode ? 'dark' : 'light'}]);\n try {\n await page.goto(url);\n } catch (e) {\n if ((e as Error).message.includes('net::ERR_CONNECTION_REFUSED')) {\n const connectionError = new Error(`Could not connect to ${url}. Is the server running?`);\n Error.captureStackTrace(connectionError, openPage);\n throw connectionError;\n } else {\n throw e;\n }\n }\n\n const api: PageApi = Object.create(page);\n\n api.type = async (elementHandle, text, options) => elementHandle.type(text, options);\n api.click = async (elementHandle, options) => elementHandle.click(options);\n api.select = async (elementHandle, ...values) => elementHandle.select(...values);\n\n api.screenshot = async (options?: ScreenshotOptions) => {\n await waitForPaintEnd(page);\n return page.screenshot(options);\n };\n\n api.clear = async (elementHandle) => {\n await elementHandle.click({clickCount: 3});\n await elementHandle.press('Delete');\n };\n\n return api;\n};\n\nconst buildQueryMethods = (): ReturnType<typeof getQueriesForElement> => {\n const boundQueries: any = {};\n for (const [queryName, queryFn] of Object.entries(queries)) {\n boundQueries[queryName] = async (...args: any) => {\n const doc = await getDocument(globalPage);\n const queryArgs = [...args];\n if (queryName.startsWith('findBy')) {\n queryArgs.push({timeout: 10000});\n }\n const elementHandle = await queryFn(doc, ...queryArgs);\n\n const newElementHandle = Object.create(elementHandle);\n\n newElementHandle.screenshot = async (options: ScreenshotOptions) => {\n await waitForPaintEnd(elementHandle, {fullPage: false});\n return elementHandle.screenshot(options);\n };\n\n return newElementHandle;\n };\n }\n return boundQueries;\n};\n\nexport const screen = buildQueryMethods();\n\nexport type {ElementHandle} from 'puppeteer';\n"],"names":["_Pact","prototype","then","onFulfilled","onRejected","result","state","s","callback","_settle","v","e","o","_this","value","pact","bind","observer","_isSettledPact","thenable","_iteratorSymbol","Symbol","iterator","_asyncIteratorSymbol","asyncIterator","_for","test","update","body","stage","shouldContinue","updateValue","reject","_resumeAfterTest","_resumeAfterBody","_resumeAfterUpdate","_catch","recover","globalBrowser","global","browser","globalPage","page","isCi","process","argv","includes","env","CI","isUsingDockerizedChromium","URL","wsEndpoint","port","serverHostName","platform","rootDir","findRoot","cwd","pkg","JSON","parse","fs","readFileSync","path","join","projectConfig","acceptanceTests","server","ciServer","devServer","serverPort","toMatchImageSnapshot","configureToMatchImageSnapshot","failureThreshold","failureThresholdType","calledToMatchImageSnapshotOutsideDocker","localToMatchImageSnapshot","message","pass","expect","extend","afterEach","error","Error","stack","split","waitForPaintEnd","element","maxWait","fullPage","STEP_TIME","t0","Date","now","screenshot","buf1","Promise","r","setTimeout","buf2","compare","openPage","userAgent","isDarkMode","urlConfig","currentUserAgent","bringToFront","setUserAgent","emulateMediaFeatures","name","api","Object","create","type","elementHandle","text","options","click","select","values","clear","clickCount","press","url","connectionError","captureStackTrace","undefined","protocol","hostname","buildQueryMethods","boundQueries","queryName","queryFn","args","getDocument","doc","queryArgs","startsWith","push","timeout","newElementHandle","entries","queries","screen"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AACO,IAAMA,KAAK,gBAAiB,YAAW;AAC7C,WAASA,KAAT,GAAiB;;AACjBA,EAAAA,KAAK,CAACC,SAAN,CAAgBC,IAAhB,GAAuB,UAASC,WAAT,EAAsBC,UAAtB,EAAkC;AACxD,QAAMC,MAAM,GAAG,IAAIL,KAAJ,EAAf;AACA,QAAMM,KAAK,GAAG,KAAKC,CAAnB;;AACA,QAAID,KAAJ,EAAW;AACV,UAAME,QAAQ,GAAGF,KAAK,GAAG,CAAR,GAAYH,WAAZ,GAA0BC,UAA3C;;AACA,UAAII,QAAJ,EAAc;AACb,YAAI;AACHC,UAAAA,OAAO,CAACJ,MAAD,EAAS,CAAT,EAAYG,QAAQ,CAAC,KAAKE,CAAN,CAApB,CAAP;AACA,SAFD,CAEE,OAAOC,CAAP,EAAU;AACXF,UAAAA,OAAO,CAACJ,MAAD,EAAS,CAAT,EAAYM,CAAZ,CAAP;AACA;;AACD,eAAON,MAAP;AACA,OAPD,MAOO;AACN,eAAO,IAAP;AACA;AACD;;AACD,SAAKO,CAAL,GAAS,UAASC,KAAT,EAAgB;AACxB,UAAI;AACH,YAAMC,KAAK,GAAGD,KAAK,CAACH,CAApB;;AACA,YAAIG,KAAK,CAACN,CAAN,GAAU,CAAd,EAAiB;AAChBE,UAAAA,OAAO,CAACJ,MAAD,EAAS,CAAT,EAAYF,WAAW,GAAGA,WAAW,CAACW,KAAD,CAAd,GAAwBA,KAA/C,CAAP;AACA,SAFD,MAEO,IAAIV,UAAJ,EAAgB;AACtBK,UAAAA,OAAO,CAACJ,MAAD,EAAS,CAAT,EAAYD,UAAU,CAACU,KAAD,CAA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BAAP;;;AACH,OAhBD;AAAA;AAAA;AAAA;;;AADJ,qCAAmC7B,MAAM,CAAC8B,OAAP,CAAeC,OAAf,CAAnC,qCAA4D;AAAA;AAkB3D;;AACD,SAAOZ,YAAP;AACH,CAtBD;;AAwBA,IAAaa,MAAM,gBAAGd,iBAAiB,EAAhC;;;;"}
|
|
1
|
+
{"version":3,"file":"acceptance-testing.esm.js","sources":["../../../node_modules/babel-plugin-transform-async-to-promises/helpers.js","../src/index.ts"],"sourcesContent":["// A type of promise-like that resolves synchronously and supports only one observer\nexport const _Pact = /*#__PURE__*/(function() {\n\tfunction _Pact() {}\n\t_Pact.prototype.then = function(onFulfilled, onRejected) {\n\t\tconst result = new _Pact();\n\t\tconst state = this.s;\n\t\tif (state) {\n\t\t\tconst callback = state & 1 ? onFulfilled : onRejected;\n\t\t\tif (callback) {\n\t\t\t\ttry {\n\t\t\t\t\t_settle(result, 1, callback(this.v));\n\t\t\t\t} catch (e) {\n\t\t\t\t\t_settle(result, 2, e);\n\t\t\t\t}\n\t\t\t\treturn result;\n\t\t\t} else {\n\t\t\t\treturn this;\n\t\t\t}\n\t\t}\n\t\tthis.o = function(_this) {\n\t\t\ttry {\n\t\t\t\tconst value = _this.v;\n\t\t\t\tif (_this.s & 1) {\n\t\t\t\t\t_settle(result, 1, onFulfilled ? onFulfilled(value) : value);\n\t\t\t\t} else if (onRejected) {\n\t\t\t\t\t_settle(result, 1, onRejected(value));\n\t\t\t\t} else {\n\t\t\t\t\t_settle(result, 2, value);\n\t\t\t\t}\n\t\t\t} catch (e) {\n\t\t\t\t_settle(result, 2, e);\n\t\t\t}\n\t\t};\n\t\treturn result;\n\t}\n\treturn _Pact;\n})();\n\n// Settles a pact synchronously\nexport function _settle(pact, state, value) {\n\tif (!pact.s) {\n\t\tif (value instanceof _Pact) {\n\t\t\tif (value.s) {\n\t\t\t\tif (state & 1) {\n\t\t\t\t\tstate = value.s;\n\t\t\t\t}\n\t\t\t\tvalue = value.v;\n\t\t\t} else {\n\t\t\t\tvalue.o = _settle.bind(null, pact, state);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\tif (value && value.then) {\n\t\t\tvalue.then(_settle.bind(null, pact, state), _settle.bind(null, pact, 2));\n\t\t\treturn;\n\t\t}\n\t\tpact.s = state;\n\t\tpact.v = value;\n\t\tconst observer = pact.o;\n\t\tif (observer) {\n\t\t\tobserver(pact);\n\t\t}\n\t}\n}\n\nexport function _isSettledPact(thenable) {\n\treturn thenable instanceof _Pact && thenable.s & 1;\n}\n\n// Converts argument to a function that always returns a Promise\nexport function _async(f) {\n\treturn function() {\n\t\tfor (var args = [], i = 0; i < arguments.length; i++) {\n\t\t\targs[i] = arguments[i];\n\t\t}\n\t\ttry {\n\t\t\treturn Promise.resolve(f.apply(this, args));\n\t\t} catch(e) {\n\t\t\treturn Promise.reject(e);\n\t\t}\n\t}\n}\n\n// Awaits on a value that may or may not be a Promise (equivalent to the await keyword in ES2015, with continuations passed explicitly)\nexport function _await(value, then, direct) {\n\tif (direct) {\n\t\treturn then ? then(value) : value;\n\t}\n\tif (!value || !value.then) {\n\t\tvalue = Promise.resolve(value);\n\t}\n\treturn then ? value.then(then) : value;\n}\n\n// Awaits on a value that may or may not be a Promise, then ignores it\nexport function _awaitIgnored(value, direct) {\n\tif (!direct) {\n\t\treturn value && value.then ? value.then(_empty) : Promise.resolve();\n\t}\n}\n\n// Proceeds after a value has resolved, or proceeds immediately if the value is not thenable\nexport function _continue(value, then) {\n\treturn value && value.then ? value.then(then) : then(value);\n}\n\n// Proceeds after a value has resolved, or proceeds immediately if the value is not thenable\nexport function _continueIgnored(value) {\n\tif (value && value.then) {\n\t\treturn value.then(_empty);\n\t}\n}\n\n// Asynchronously iterate through an object that has a length property, passing the index as the first argument to the callback (even as the length property changes)\nexport function _forTo(array, body, check) {\n\tvar i = -1, pact, reject;\n\tfunction _cycle(result) {\n\t\ttry {\n\t\t\twhile (++i < array.length && (!check || !check())) {\n\t\t\t\tresult = body(i);\n\t\t\t\tif (result && result.then) {\n\t\t\t\t\tif (_isSettledPact(result)) {\n\t\t\t\t\t\tresult = result.v;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tresult.then(_cycle, reject || (reject = _settle.bind(null, pact = new _Pact(), 2)));\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (pact) {\n\t\t\t\t_settle(pact, 1, result);\n\t\t\t} else {\n\t\t\t\tpact = result;\n\t\t\t}\n\t\t} catch (e) {\n\t\t\t_settle(pact || (pact = new _Pact()), 2, e);\n\t\t}\n\t}\n\t_cycle();\n\treturn pact;\n}\n\n// Asynchronously iterate through an object's properties (including properties inherited from the prototype)\n// Uses a snapshot of the object's properties\nexport function _forIn(target, body, check) {\n\tvar keys = [];\n\tfor (var key in target) {\n\t\tkeys.push(key);\n\t}\n\treturn _forTo(keys, function(i) { return body(keys[i]); }, check);\n}\n\n// Asynchronously iterate through an object's own properties (excluding properties inherited from the prototype)\n// Uses a snapshot of the object's properties\nexport function _forOwn(target, body, check) {\n\tvar keys = [];\n\tfor (var key in target) {\n\t\tif (Object.prototype.hasOwnProperty.call(target, key)) {\n\t\t\tkeys.push(key);\n\t\t}\n\t}\n\treturn _forTo(keys, function(i) { return body(keys[i]); }, check);\n}\n\nexport const _iteratorSymbol = /*#__PURE__*/ typeof Symbol !== \"undefined\" ? (Symbol.iterator || (Symbol.iterator = Symbol(\"Symbol.iterator\"))) : \"@@iterator\";\n\n// Asynchronously iterate through an object's values\n// Uses for...of if the runtime supports it, otherwise iterates until length on a copy\nexport function _forOf(target, body, check) {\n\tif (typeof target[_iteratorSymbol] === \"function\") {\n\t\tvar iterator = target[_iteratorSymbol](), step, pact, reject;\n\t\tfunction _cycle(result) {\n\t\t\ttry {\n\t\t\t\twhile (!(step = iterator.next()).done && (!check || !check())) {\n\t\t\t\t\tresult = body(step.value);\n\t\t\t\t\tif (result && result.then) {\n\t\t\t\t\t\tif (_isSettledPact(result)) {\n\t\t\t\t\t\t\tresult = result.v;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tresult.then(_cycle, reject || (reject = _settle.bind(null, pact = new _Pact(), 2)));\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (pact) {\n\t\t\t\t\t_settle(pact, 1, result);\n\t\t\t\t} else {\n\t\t\t\t\tpact = result;\n\t\t\t\t}\n\t\t\t} catch (e) {\n\t\t\t\t_settle(pact || (pact = new _Pact()), 2, e);\n\t\t\t}\n\t\t}\n\t\t_cycle();\n\t\tif (iterator.return) {\n\t\t\tvar _fixup = function(value) {\n\t\t\t\ttry {\n\t\t\t\t\tif (!step.done) {\n\t\t\t\t\t\titerator.return();\n\t\t\t\t\t}\n\t\t\t\t} catch(e) {\n\t\t\t\t}\n\t\t\t\treturn value;\n\t\t\t}\n\t\t\tif (pact && pact.then) {\n\t\t\t\treturn pact.then(_fixup, function(e) {\n\t\t\t\t\tthrow _fixup(e);\n\t\t\t\t});\n\t\t\t}\n\t\t\t_fixup();\n\t\t}\n\t\treturn pact;\n\t}\n\t// No support for Symbol.iterator\n\tif (!(\"length\" in target)) {\n\t\tthrow new TypeError(\"Object is not iterable\");\n\t}\n\t// Handle live collections properly\n\tvar values = [];\n\tfor (var i = 0; i < target.length; i++) {\n\t\tvalues.push(target[i]);\n\t}\n\treturn _forTo(values, function(i) { return body(values[i]); }, check);\n}\n\nexport const _asyncIteratorSymbol = /*#__PURE__*/ typeof Symbol !== \"undefined\" ? (Symbol.asyncIterator || (Symbol.asyncIterator = Symbol(\"Symbol.asyncIterator\"))) : \"@@asyncIterator\";\n\n// Asynchronously iterate on a value using it's async iterator if present, or its synchronous iterator if missing\nexport function _forAwaitOf(target, body, check) {\n\tif (typeof target[_asyncIteratorSymbol] === \"function\") {\n\t\tvar pact = new _Pact();\n\t\tvar iterator = target[_asyncIteratorSymbol]();\n\t\titerator.next().then(_resumeAfterNext).then(void 0, _reject);\n\t\treturn pact;\n\t\tfunction _resumeAfterBody(result) {\n\t\t\tif (check && check()) {\n\t\t\t\treturn _settle(pact, 1, iterator.return ? iterator.return().then(function() { return result; }) : result);\n\t\t\t}\n\t\t\titerator.next().then(_resumeAfterNext).then(void 0, _reject);\n\t\t}\n\t\tfunction _resumeAfterNext(step) {\n\t\t\tif (step.done) {\n\t\t\t\t_settle(pact, 1);\n\t\t\t} else {\n\t\t\t\tPromise.resolve(body(step.value)).then(_resumeAfterBody).then(void 0, _reject);\n\t\t\t}\n\t\t}\n\t\tfunction _reject(error) {\n\t\t\t_settle(pact, 2, iterator.return ? iterator.return().then(function() { return error; }) : error);\n\t\t}\n\t}\n\treturn Promise.resolve(_forOf(target, function(value) { return Promise.resolve(value).then(body); }, check));\n}\n\n// Asynchronously implement a generic for loop\nexport function _for(test, update, body) {\n\tvar stage;\n\tfor (;;) {\n\t\tvar shouldContinue = test();\n\t\tif (_isSettledPact(shouldContinue)) {\n\t\t\tshouldContinue = shouldContinue.v;\n\t\t}\n\t\tif (!shouldContinue) {\n\t\t\treturn result;\n\t\t}\n\t\tif (shouldContinue.then) {\n\t\t\tstage = 0;\n\t\t\tbreak;\n\t\t}\n\t\tvar result = body();\n\t\tif (result && result.then) {\n\t\t\tif (_isSettledPact(result)) {\n\t\t\t\tresult = result.s;\n\t\t\t} else {\n\t\t\t\tstage = 1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (update) {\n\t\t\tvar updateValue = update();\n\t\t\tif (updateValue && updateValue.then && !_isSettledPact(updateValue)) {\n\t\t\t\tstage = 2;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\tvar pact = new _Pact();\n\tvar reject = _settle.bind(null, pact, 2);\n\t(stage === 0 ? shouldContinue.then(_resumeAfterTest) : stage === 1 ? result.then(_resumeAfterBody) : updateValue.then(_resumeAfterUpdate)).then(void 0, reject);\n\treturn pact;\n\tfunction _resumeAfterBody(value) {\n\t\tresult = value;\n\t\tdo {\n\t\t\tif (update) {\n\t\t\t\tupdateValue = update();\n\t\t\t\tif (updateValue && updateValue.then && !_isSettledPact(updateValue)) {\n\t\t\t\t\tupdateValue.then(_resumeAfterUpdate).then(void 0, reject);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\tshouldContinue = test();\n\t\t\tif (!shouldContinue || (_isSettledPact(shouldContinue) && !shouldContinue.v)) {\n\t\t\t\t_settle(pact, 1, result);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (shouldContinue.then) {\n\t\t\t\tshouldContinue.then(_resumeAfterTest).then(void 0, reject);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tresult = body();\n\t\t\tif (_isSettledPact(result)) {\n\t\t\t\tresult = result.v;\n\t\t\t}\n\t\t} while (!result || !result.then);\n\t\tresult.then(_resumeAfterBody).then(void 0, reject);\n\t}\n\tfunction _resumeAfterTest(shouldContinue) {\n\t\tif (shouldContinue) {\n\t\t\tresult = body();\n\t\t\tif (result && result.then) {\n\t\t\t\tresult.then(_resumeAfterBody).then(void 0, reject);\n\t\t\t} else {\n\t\t\t\t_resumeAfterBody(result);\n\t\t\t}\n\t\t} else {\n\t\t\t_settle(pact, 1, result);\n\t\t}\n\t}\n\tfunction _resumeAfterUpdate() {\n\t\tif (shouldContinue = test()) {\n\t\t\tif (shouldContinue.then) {\n\t\t\t\tshouldContinue.then(_resumeAfterTest).then(void 0, reject);\n\t\t\t} else {\n\t\t\t\t_resumeAfterTest(shouldContinue);\n\t\t\t}\n\t\t} else {\n\t\t\t_settle(pact, 1, result);\n\t\t}\n\t}\n}\n\n// Asynchronously implement a do ... while loop\nexport function _do(body, test) {\n\tvar awaitBody;\n\tdo {\n\t\tvar result = body();\n\t\tif (result && result.then) {\n\t\t\tif (_isSettledPact(result)) {\n\t\t\t\tresult = result.v;\n\t\t\t} else {\n\t\t\t\tawaitBody = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tvar shouldContinue = test();\n\t\tif (_isSettledPact(shouldContinue)) {\n\t\t\tshouldContinue = shouldContinue.v;\n\t\t}\n\t\tif (!shouldContinue) {\n\t\t\treturn result;\n\t\t}\n\t} while (!shouldContinue.then);\n\tconst pact = new _Pact();\n\tconst reject = _settle.bind(null, pact, 2);\n\t(awaitBody ? result.then(_resumeAfterBody) : shouldContinue.then(_resumeAfterTest)).then(void 0, reject);\n\treturn pact;\n\tfunction _resumeAfterBody(value) {\n\t\tresult = value;\n\t\tfor (;;) {\n\t\t\tshouldContinue = test();\n\t\t\tif (_isSettledPact(shouldContinue)) {\n\t\t\t\tshouldContinue = shouldContinue.v;\n\t\t\t}\n\t\t\tif (!shouldContinue) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (shouldContinue.then) {\n\t\t\t\tshouldContinue.then(_resumeAfterTest).then(void 0, reject);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tresult = body();\n\t\t\tif (result && result.then) {\n\t\t\t\tif (_isSettledPact(result)) {\n\t\t\t\t\tresult = result.v;\n\t\t\t\t} else {\n\t\t\t\t\tresult.then(_resumeAfterBody).then(void 0, reject);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t_settle(pact, 1, result);\n\t}\n\tfunction _resumeAfterTest(shouldContinue) {\n\t\tif (shouldContinue) {\n\t\t\tdo {\n\t\t\t\tresult = body();\n\t\t\t\tif (result && result.then) {\n\t\t\t\t\tif (_isSettledPact(result)) {\n\t\t\t\t\t\tresult = result.v;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tresult.then(_resumeAfterBody).then(void 0, reject);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tshouldContinue = test();\n\t\t\t\tif (_isSettledPact(shouldContinue)) {\n\t\t\t\t\tshouldContinue = shouldContinue.v;\n\t\t\t\t}\n\t\t\t\tif (!shouldContinue) {\n\t\t\t\t\t_settle(pact, 1, result);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t} while (!shouldContinue.then);\n\t\t\tshouldContinue.then(_resumeAfterTest).then(void 0, reject);\n\t\t} else {\n\t\t\t_settle(pact, 1, result);\n\t\t}\n\t}\n}\n\n// Asynchronously implement a switch statement\nexport function _switch(discriminant, cases) {\n\tvar dispatchIndex = -1;\n\tvar awaitBody;\n\touter: {\n\t\tfor (var i = 0; i < cases.length; i++) {\n\t\t\tvar test = cases[i][0];\n\t\t\tif (test) {\n\t\t\t\tvar testValue = test();\n\t\t\t\tif (testValue && testValue.then) {\n\t\t\t\t\tbreak outer;\n\t\t\t\t}\n\t\t\t\tif (testValue === discriminant) {\n\t\t\t\t\tdispatchIndex = i;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// Found the default case, set it as the pending dispatch case\n\t\t\t\tdispatchIndex = i;\n\t\t\t}\n\t\t}\n\t\tif (dispatchIndex !== -1) {\n\t\t\tdo {\n\t\t\t\tvar body = cases[dispatchIndex][1];\n\t\t\t\twhile (!body) {\n\t\t\t\t\tdispatchIndex++;\n\t\t\t\t\tbody = cases[dispatchIndex][1];\n\t\t\t\t}\n\t\t\t\tvar result = body();\n\t\t\t\tif (result && result.then) {\n\t\t\t\t\tawaitBody = true;\n\t\t\t\t\tbreak outer;\n\t\t\t\t}\n\t\t\t\tvar fallthroughCheck = cases[dispatchIndex][2];\n\t\t\t\tdispatchIndex++;\n\t\t\t} while (fallthroughCheck && !fallthroughCheck());\n\t\t\treturn result;\n\t\t}\n\t}\n\tconst pact = new _Pact();\n\tconst reject = _settle.bind(null, pact, 2);\n\t(awaitBody ? result.then(_resumeAfterBody) : testValue.then(_resumeAfterTest)).then(void 0, reject);\n\treturn pact;\n\tfunction _resumeAfterTest(value) {\n\t\tfor (;;) {\n\t\t\tif (value === discriminant) {\n\t\t\t\tdispatchIndex = i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (++i === cases.length) {\n\t\t\t\tif (dispatchIndex !== -1) {\n\t\t\t\t\tbreak;\n\t\t\t\t} else {\n\t\t\t\t\t_settle(pact, 1, result);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\ttest = cases[i][0];\n\t\t\tif (test) {\n\t\t\t\tvalue = test();\n\t\t\t\tif (value && value.then) {\n\t\t\t\t\tvalue.then(_resumeAfterTest).then(void 0, reject);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tdispatchIndex = i;\n\t\t\t}\n\t\t}\n\t\tdo {\n\t\t\tvar body = cases[dispatchIndex][1];\n\t\t\twhile (!body) {\n\t\t\t\tdispatchIndex++;\n\t\t\t\tbody = cases[dispatchIndex][1];\n\t\t\t}\n\t\t\tvar result = body();\n\t\t\tif (result && result.then) {\n\t\t\t\tresult.then(_resumeAfterBody).then(void 0, reject);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tvar fallthroughCheck = cases[dispatchIndex][2];\n\t\t\tdispatchIndex++;\n\t\t} while (fallthroughCheck && !fallthroughCheck());\n\t\t_settle(pact, 1, result);\n\t}\n\tfunction _resumeAfterBody(result) {\n\t\tfor (;;) {\n\t\t\tvar fallthroughCheck = cases[dispatchIndex][2];\n\t\t\tif (!fallthroughCheck || fallthroughCheck()) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdispatchIndex++;\n\t\t\tvar body = cases[dispatchIndex][1];\n\t\t\twhile (!body) {\n\t\t\t\tdispatchIndex++;\n\t\t\t\tbody = cases[dispatchIndex][1];\n\t\t\t}\n\t\t\tresult = body();\n\t\t\tif (result && result.then) {\n\t\t\t\tresult.then(_resumeAfterBody).then(void 0, reject);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\t_settle(pact, 1, result);\n\t}\n}\n\n// Asynchronously call a function and pass the result to explicitly passed continuations\nexport function _call(body, then, direct) {\n\tif (direct) {\n\t\treturn then ? then(body()) : body();\n\t}\n\ttry {\n\t\tvar result = Promise.resolve(body());\n\t\treturn then ? result.then(then) : result;\n\t} catch (e) {\n\t\treturn Promise.reject(e);\n\t}\n}\n\n// Asynchronously call a function and swallow the result\nexport function _callIgnored(body, direct) {\n\treturn _call(body, _empty, direct);\n}\n\n// Asynchronously call a function and pass the result to explicitly passed continuations\nexport function _invoke(body, then) {\n\tvar result = body();\n\tif (result && result.then) {\n\t\treturn result.then(then);\n\t}\n\treturn then(result);\n}\n\n// Asynchronously call a function and swallow the result\nexport function _invokeIgnored(body) {\n\tvar result = body();\n\tif (result && result.then) {\n\t\treturn result.then(_empty);\n\t}\n}\n\n// Asynchronously call a function and send errors to recovery continuation\nexport function _catch(body, recover) {\n\ttry {\n\t\tvar result = body();\n\t} catch(e) {\n\t\treturn recover(e);\n\t}\n\tif (result && result.then) {\n\t\treturn result.then(void 0, recover);\n\t}\n\treturn result;\n}\n\n// Asynchronously await a promise and pass the result to a finally continuation\nexport function _finallyRethrows(body, finalizer) {\n\ttry {\n\t\tvar result = body();\n\t} catch (e) {\n\t\treturn finalizer(true, e);\n\t}\n\tif (result && result.then) {\n\t\treturn result.then(finalizer.bind(null, false), finalizer.bind(null, true));\n\t}\n\treturn finalizer(false, result);\n}\n\n// Asynchronously await a promise and invoke a finally continuation that always overrides the result\nexport function _finally(body, finalizer) {\n\ttry {\n\t\tvar result = body();\n\t} catch (e) {\n\t\treturn finalizer();\n\t}\n\tif (result && result.then) {\n\t\treturn result.then(finalizer, finalizer);\n\t}\n\treturn finalizer();\n}\n\n// Rethrow or return a value from a finally continuation\nexport function _rethrow(thrown, value) {\n\tif (thrown)\n\t\tthrow value;\n\treturn value;\n}\n\n// Empty function to implement break and other control flow that ignores asynchronous results\nexport function _empty() {\n}\n\n// Sentinel value for early returns in generators \nexport const _earlyReturn = /*#__PURE__*/ {};\n\n// Asynchronously call a function and send errors to recovery continuation, skipping early returns\nexport function _catchInGenerator(body, recover) {\n\treturn _catch(body, function(e) {\n\t\tif (e === _earlyReturn) {\n\t\t\tthrow e;\n\t\t}\n\t\treturn recover(e);\n\t});\n}\n\n// Asynchronous generator class; accepts the entrypoint of the generator, to which it passes itself when the generator should start\nexport const _AsyncGenerator = /*#__PURE__*/(function() {\n\tfunction _AsyncGenerator(entry) {\n\t\tthis._entry = entry;\n\t\tthis._pact = null;\n\t\tthis._resolve = null;\n\t\tthis._return = null;\n\t\tthis._promise = null;\n\t}\n\n\tfunction _wrapReturnedValue(value) {\n\t\treturn { value: value, done: true };\n\t}\n\tfunction _wrapYieldedValue(value) {\n\t\treturn { value: value, done: false };\n\t}\n\n\t_AsyncGenerator.prototype._yield = function(value) {\n\t\t// Yield the value to the pending next call\n\t\tthis._resolve(value && value.then ? value.then(_wrapYieldedValue) : _wrapYieldedValue(value));\n\t\t// Return a pact for an upcoming next/return/throw call\n\t\treturn this._pact = new _Pact();\n\t};\n\t_AsyncGenerator.prototype.next = function(value) {\n\t\t// Advance the generator, starting it if it has yet to be started\n\t\tconst _this = this;\n\t\treturn _this._promise = new Promise(function (resolve) {\n\t\t\tconst _pact = _this._pact;\n\t\t\tif (_pact === null) {\n\t\t\t\tconst _entry = _this._entry;\n\t\t\t\tif (_entry === null) {\n\t\t\t\t\t// Generator is started, but not awaiting a yield expression\n\t\t\t\t\t// Abandon the next call!\n\t\t\t\t\treturn resolve(_this._promise);\n\t\t\t\t}\n\t\t\t\t// Start the generator\n\t\t\t\t_this._entry = null;\n\t\t\t\t_this._resolve = resolve;\n\t\t\t\tfunction returnValue(value) {\n\t\t\t\t\t_this._resolve(value && value.then ? value.then(_wrapReturnedValue) : _wrapReturnedValue(value));\n\t\t\t\t\t_this._pact = null;\n\t\t\t\t\t_this._resolve = null;\n\t\t\t\t}\n\t\t\t\tvar result = _entry(_this);\n\t\t\t\tif (result && result.then) {\n\t\t\t\t\tresult.then(returnValue, function(error) {\n\t\t\t\t\t\tif (error === _earlyReturn) {\n\t\t\t\t\t\t\treturnValue(_this._return);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tconst pact = new _Pact();\n\t\t\t\t\t\t\t_this._resolve(pact);\n\t\t\t\t\t\t\t_this._pact = null;\n\t\t\t\t\t\t\t_this._resolve = null;\n\t\t\t\t\t\t\t_resolve(pact, 2, error);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\treturnValue(result);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// Generator is started and a yield expression is pending, settle it\n\t\t\t\t_this._pact = null;\n\t\t\t\t_this._resolve = resolve;\n\t\t\t\t_settle(_pact, 1, value);\n\t\t\t}\n\t\t});\n\t};\n\t_AsyncGenerator.prototype.return = function(value) {\n\t\t// Early return from the generator if started, otherwise abandons the generator\n\t\tconst _this = this;\n\t\treturn _this._promise = new Promise(function (resolve) {\n\t\t\tconst _pact = _this._pact;\n\t\t\tif (_pact === null) {\n\t\t\t\tif (_this._entry === null) {\n\t\t\t\t\t// Generator is started, but not awaiting a yield expression\n\t\t\t\t\t// Abandon the return call!\n\t\t\t\t\treturn resolve(_this._promise);\n\t\t\t\t}\n\t\t\t\t// Generator is not started, abandon it and return the specified value\n\t\t\t\t_this._entry = null;\n\t\t\t\treturn resolve(value && value.then ? value.then(_wrapReturnedValue) : _wrapReturnedValue(value));\n\t\t\t}\n\t\t\t// Settle the yield expression with a rejected \"early return\" value\n\t\t\t_this._return = value;\n\t\t\t_this._resolve = resolve;\n\t\t\t_this._pact = null;\n\t\t\t_settle(_pact, 2, _earlyReturn);\n\t\t});\n\t};\n\t_AsyncGenerator.prototype.throw = function(error) {\n\t\t// Inject an exception into the pending yield expression\n\t\tconst _this = this;\n\t\treturn _this._promise = new Promise(function (resolve, reject) {\n\t\t\tconst _pact = _this._pact;\n\t\t\tif (_pact === null) {\n\t\t\t\tif (_this._entry === null) {\n\t\t\t\t\t// Generator is started, but not awaiting a yield expression\n\t\t\t\t\t// Abandon the throw call!\n\t\t\t\t\treturn resolve(_this._promise);\n\t\t\t\t}\n\t\t\t\t// Generator is not started, abandon it and return a rejected Promise containing the error\n\t\t\t\t_this._entry = null;\n\t\t\t\treturn reject(error);\n\t\t\t}\n\t\t\t// Settle the yield expression with the value as a rejection\n\t\t\t_this._resolve = resolve;\n\t\t\t_this._pact = null;\n\t\t\t_settle(_pact, 2, error);\n\t\t});\n\t};\n\n\t_AsyncGenerator.prototype[_asyncIteratorSymbol] = function() {\n\t\treturn this;\n\t};\n\t\n\treturn _AsyncGenerator;\n})();\n","import path from 'path';\nimport fs from 'fs';\nimport findRoot from 'find-root';\nimport {getDocument, queries} from 'pptr-testing-library';\nimport {configureToMatchImageSnapshot} from 'jest-image-snapshot';\n\nimport type {Page, ElementHandle, ScreenshotOptions, Browser, ClickOptions, Viewport} from 'puppeteer';\nimport type {getQueriesForElement} from 'pptr-testing-library';\n\nexport const globalBrowser: Browser = (global as any).browser;\nexport const globalPage: Page = (global as any).page;\n\nconst isCi = process.argv.includes('--ci') || process.env.CI;\nconst isUsingDockerizedChromium = isCi || new URL(globalBrowser.wsEndpoint()).port === '9223';\n\nexport const serverHostName = ((): string => {\n if (isCi) {\n return 'localhost';\n }\n\n if (isUsingDockerizedChromium) {\n return process.platform === 'linux' ? '172.17.0.1' : 'host.docker.internal';\n }\n\n return 'localhost';\n})();\n\nconst rootDir = findRoot(process.cwd());\nconst pkg = JSON.parse(fs.readFileSync(path.join(rootDir, 'package.json'), 'utf-8'));\nconst projectConfig = pkg.acceptanceTests ?? {};\nconst server = (isCi ? projectConfig.ciServer : projectConfig.devServer) ?? projectConfig.server;\n\nexport const serverPort = server?.port;\n\nconst toMatchImageSnapshot = configureToMatchImageSnapshot({\n failureThreshold: 0,\n failureThresholdType: 'percent',\n});\n\nlet calledToMatchImageSnapshotOutsideDocker = false;\n\nconst localToMatchImageSnapshot = () => {\n calledToMatchImageSnapshotOutsideDocker = true;\n // let the expectation pass, then fail in afterEach. This way we allow developers to debug screenshot tests in local\n // but don't allow them to save screenshots taken outside the dockerized chromium\n return {\n message: () => '',\n pass: true,\n };\n};\n\nexpect.extend({\n toMatchImageSnapshot: isUsingDockerizedChromium ? toMatchImageSnapshot : localToMatchImageSnapshot,\n});\n\nafterEach(() => {\n if (calledToMatchImageSnapshotOutsideDocker) {\n const error = new Error(\n `Calling .toMatchImageSnapshot() is not allowed outside dockerized browser. Please, run your screenshot test in headless mode.`\n );\n error.stack = (error.stack || '').split('\\n')[0];\n throw error;\n }\n});\n\ntype WaitForPaintEndOptions = {\n maxWait?: number;\n fullPage?: boolean;\n};\n\nconst waitForPaintEnd = async (\n element: ElementHandle | Page,\n {maxWait = 10000, fullPage = true}: WaitForPaintEndOptions = {}\n) => {\n const STEP_TIME = 250;\n const t0 = Date.now();\n\n let buf1 = (await element.screenshot({fullPage})) as Buffer;\n await new Promise((r) => setTimeout(r, STEP_TIME));\n let buf2 = (await element.screenshot({fullPage})) as Buffer;\n\n // buffers are different if compare != 0\n while (buf1.compare(buf2)) {\n if (Date.now() - t0 > maxWait) {\n throw Error('Paint end timeout');\n }\n buf1 = buf2;\n await new Promise((r) => setTimeout(r, STEP_TIME));\n buf2 = (await element.screenshot({fullPage})) as Buffer;\n }\n};\n\nexport interface PageApi extends Omit<Page, 'click' | 'type' | 'select'> {\n clear: (selector: ElementHandle) => Promise<void>;\n // These are overridden:\n type: (selector: ElementHandle, text: string, options?: {delay: number}) => Promise<void>;\n click: (selector: ElementHandle, options?: ClickOptions) => Promise<void>;\n select: (selector: ElementHandle, ...values: string[]) => Promise<string[]>;\n}\n\ninterface OpenPageCommonConfig {\n userAgent?: string;\n viewport?: Viewport;\n isDarkMode?: boolean;\n}\n\ninterface OpenPageUrlConfig extends OpenPageCommonConfig {\n url: string;\n}\n\ninterface OpenPagePathConfig extends OpenPageCommonConfig {\n url?: undefined;\n\n path?: string;\n port?: number;\n protocol?: string;\n hostname?: string;\n}\n\ntype OpenPageConfig = OpenPageUrlConfig | OpenPagePathConfig;\n\nexport const openPage = async ({\n userAgent,\n isDarkMode,\n viewport,\n ...urlConfig\n}: OpenPageConfig): Promise<PageApi> => {\n const url = ((): string => {\n if (urlConfig.url !== undefined) {\n return urlConfig.url;\n }\n\n const {path = '/', port = serverPort, protocol = 'http', hostname = serverHostName} = urlConfig;\n\n if (!port) {\n const error = new Error(\n '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'\n );\n // Error.captureStackTrace(error, openPage);\n throw error;\n }\n\n return `${protocol}://${hostname}:${port}${path}`;\n })();\n\n const currentUserAgent = userAgent || (await globalBrowser.userAgent());\n const page = globalPage;\n\n await page.bringToFront();\n if (viewport) {\n await page.setViewport(viewport);\n }\n await page.setUserAgent(`${currentUserAgent} acceptance-test`);\n await page.emulateMediaFeatures([{name: 'prefers-color-scheme', value: isDarkMode ? 'dark' : 'light'}]);\n try {\n await page.goto(url);\n } catch (e) {\n if ((e as Error).message.includes('net::ERR_CONNECTION_REFUSED')) {\n const connectionError = new Error(`Could not connect to ${url}. Is the server running?`);\n Error.captureStackTrace(connectionError, openPage);\n throw connectionError;\n } else {\n throw e;\n }\n }\n await page.waitForFunction('document.fonts.status === \"loaded\"');\n\n const api: PageApi = Object.create(page);\n\n api.type = async (elementHandle, text, options) => elementHandle.type(text, options);\n api.click = async (elementHandle, options) => elementHandle.click(options);\n api.select = async (elementHandle, ...values) => elementHandle.select(...values);\n\n api.screenshot = async (options?: ScreenshotOptions) => {\n await page.waitForNetworkIdle();\n await waitForPaintEnd(page);\n return page.screenshot(options);\n };\n\n api.clear = async (elementHandle) => {\n await elementHandle.click({clickCount: 3});\n await elementHandle.press('Delete');\n };\n\n return api;\n};\n\nconst buildQueryMethods = (): ReturnType<typeof getQueriesForElement> => {\n const boundQueries: any = {};\n for (const [queryName, queryFn] of Object.entries(queries)) {\n boundQueries[queryName] = async (...args: any) => {\n const doc = await getDocument(globalPage);\n const queryArgs = [...args];\n if (queryName.startsWith('findBy')) {\n queryArgs.push({timeout: 10000});\n }\n const elementHandle = await queryFn(doc, ...queryArgs);\n\n const newElementHandle = Object.create(elementHandle);\n\n newElementHandle.screenshot = async (options: ScreenshotOptions) => {\n await globalPage.waitForNetworkIdle();\n await waitForPaintEnd(elementHandle, {fullPage: false});\n return elementHandle.screenshot(options);\n };\n\n return newElementHandle;\n };\n }\n return boundQueries;\n};\n\nexport const screen = buildQueryMethods();\n\nexport type {ElementHandle, Viewport} from 'puppeteer';\n\nafterEach(async () => {\n try {\n // clear tab, this way we clear the DOM and stop js execution or pending requests\n await globalPage.goto('about:blank');\n } catch (e) {\n // ignore, at this point page might be destroyed\n }\n});\n"],"names":["_Pact","prototype","then","onFulfilled","onRejected","result","state","s","callback","_settle","v","e","o","_this","value","pact","bind","observer","_isSettledPact","thenable","_iteratorSymbol","Symbol","iterator","_asyncIteratorSymbol","asyncIterator","_for","test","update","body","stage","shouldContinue","updateValue","reject","_resumeAfterTest","_resumeAfterBody","_resumeAfterUpdate","_catch","recover","globalBrowser","global","browser","globalPage","page","isCi","process","argv","includes","env","CI","isUsingDockerizedChromium","URL","wsEndpoint","port","serverHostName","platform","rootDir","findRoot","cwd","pkg","JSON","parse","fs","readFileSync","path","join","projectConfig","acceptanceTests","server","ciServer","devServer","serverPort","toMatchImageSnapshot","configureToMatchImageSnapshot","failureThreshold","failureThresholdType","calledToMatchImageSnapshotOutsideDocker","localToMatchImageSnapshot","message","pass","expect","extend","afterEach","error","Error","stack","split","waitForPaintEnd","element","maxWait","fullPage","STEP_TIME","t0","Date","now","screenshot","buf1","Promise","r","setTimeout","buf2","compare","openPage","userAgent","isDarkMode","viewport","urlConfig","currentUserAgent","bringToFront","setUserAgent","emulateMediaFeatures","name","waitForFunction","api","Object","create","type","elementHandle","text","options","click","select","values","waitForNetworkIdle","clear","clickCount","press","url","connectionError","captureStackTrace","setViewport","undefined","protocol","hostname","buildQueryMethods","boundQueries","queryName","queryFn","args","getDocument","doc","queryArgs","startsWith","push","timeout","newElementHandle","entries","queries","screen"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AACO,IAAMA,KAAK,gBAAiB,YAAW;AAC7C,WAASA,KAAT,GAAiB;;AACjBA,EAAAA,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qCAA4D;AAAA;AAmB3D;;AACD,SAAOZ,YAAP;AACH,CAvBD;;AAyBA,IAAaa,MAAM,gBAAGd,iBAAiB,EAAhC;AAIPpD,SAAS;AAAA;oCACD;AACA;AADA,6BAEMxC,UAAU,QAAV,CAAgB,aAAhB,CAFN;AAGH;;;AAGJ,GAPQ;AAAA;AAAA;AAAA,EAAT;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Page, ElementHandle, Browser, ClickOptions } from 'puppeteer';
|
|
1
|
+
import type { Page, ElementHandle, Browser, ClickOptions, Viewport } from 'puppeteer';
|
|
2
2
|
export declare const globalBrowser: Browser;
|
|
3
3
|
export declare const globalPage: Page;
|
|
4
4
|
export declare const serverHostName: string;
|
|
@@ -13,6 +13,7 @@ export interface PageApi extends Omit<Page, 'click' | 'type' | 'select'> {
|
|
|
13
13
|
}
|
|
14
14
|
interface OpenPageCommonConfig {
|
|
15
15
|
userAgent?: string;
|
|
16
|
+
viewport?: Viewport;
|
|
16
17
|
isDarkMode?: boolean;
|
|
17
18
|
}
|
|
18
19
|
interface OpenPageUrlConfig extends OpenPageCommonConfig {
|
|
@@ -26,6 +27,6 @@ interface OpenPagePathConfig extends OpenPageCommonConfig {
|
|
|
26
27
|
hostname?: string;
|
|
27
28
|
}
|
|
28
29
|
declare type OpenPageConfig = OpenPageUrlConfig | OpenPagePathConfig;
|
|
29
|
-
export declare const openPage: ({ userAgent, isDarkMode, ...urlConfig }: OpenPageConfig) => Promise<PageApi>;
|
|
30
|
+
export declare const openPage: ({ userAgent, isDarkMode, viewport, ...urlConfig }: OpenPageConfig) => Promise<PageApi>;
|
|
30
31
|
export declare const screen: import("pptr-testing-library/dist/typedefs").IQueryUtils & import("pptr-testing-library/dist/typedefs").IScopedQueryUtils;
|
|
31
|
-
export type { ElementHandle } from 'puppeteer';
|
|
32
|
+
export type { ElementHandle, Viewport } from 'puppeteer';
|
package/jest-puppeteer-config.js
CHANGED
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@telefonica/acceptance-testing",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.2-beta2",
|
|
4
4
|
"author": "Telefonica",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"module": "dist/acceptance-testing.esm.js",
|
|
7
7
|
"main": "dist/index.js",
|
|
8
8
|
"typings": "dist/index.d.ts",
|
|
9
9
|
"bin": {
|
|
10
|
-
"test-acceptance": "./bin/test-acceptance"
|
|
10
|
+
"test-acceptance": "./bin/test-acceptance.js"
|
|
11
11
|
},
|
|
12
12
|
"files": [
|
|
13
13
|
"dist",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"jest-puppeteer-config.js"
|
|
17
17
|
],
|
|
18
18
|
"engines": {
|
|
19
|
-
"node": ">=
|
|
19
|
+
"node": ">=12"
|
|
20
20
|
},
|
|
21
21
|
"scripts": {
|
|
22
22
|
"start": "tsdx watch",
|