@telefonica/acceptance-testing 3.0.0 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +45 -8
- package/dist/acceptance-testing.cjs.development.js +203 -87
- 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 +203 -87
- package/dist/acceptance-testing.esm.js.map +1 -1
- package/dist/coverage.d.ts +9 -2
- package/dist/utils.d.ts +4 -0
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -251,26 +251,63 @@ await elementHandle.uploadFile(prepareFile('/path/to/file'));
|
|
|
251
251
|
|
|
252
252
|
## Collecting coverage
|
|
253
253
|
|
|
254
|
-
|
|
255
|
-
if available.
|
|
254
|
+
Set the `COLLECT_ACCEPTANCE_COVERAGE` environment variable to enable coverage collection.
|
|
256
255
|
|
|
257
|
-
|
|
258
|
-
[babel-plugin-istanbul](https://github.com/istanbuljs/babel-plugin-istanbul)
|
|
256
|
+
The code must be instrumented with [nyc](https://github.com/istanbuljs/nyc/blob/main/docs/instrument.md),
|
|
257
|
+
[babel-plugin-istanbul](https://github.com/istanbuljs/babel-plugin-istanbul) or any
|
|
258
|
+
[istanbul](https://github.com/istanbuljs/istanbuljs) compatible tool.
|
|
259
259
|
|
|
260
|
-
|
|
261
|
-
|
|
260
|
+
### Frontend coverage information
|
|
261
|
+
|
|
262
|
+
After each test the coverage information will be collected by reading the `window.__coverage__` object from
|
|
263
|
+
the opened page.
|
|
264
|
+
|
|
265
|
+
### Backend coverage information
|
|
266
|
+
|
|
267
|
+
To collect coverage from your backend, you must create an endpoint that serves the coverage information and
|
|
268
|
+
specify it the `coverageUrls` property in your config. The library will make a `GET` request to each URL and
|
|
269
|
+
save the report from the response as a `json` file. The default value is `[]`.
|
|
270
|
+
|
|
271
|
+
The backend coverage will be collected after all the tests in the suite have run.
|
|
272
|
+
|
|
273
|
+
The response must be a JSON with the following structure: `{coverage: data}`.
|
|
274
|
+
|
|
275
|
+
Example route in NextJS to serve coverage information:
|
|
276
|
+
|
|
277
|
+
```ts
|
|
278
|
+
import {NextResponse} from 'next/server';
|
|
279
|
+
|
|
280
|
+
export const GET = (): NextResponse => {
|
|
281
|
+
const coverage = (globalThis as any).__coverage__;
|
|
282
|
+
if (coverage) {
|
|
283
|
+
return NextResponse.json({coverage});
|
|
284
|
+
}
|
|
285
|
+
return NextResponse.json({error: 'Not found'}, {status: 404});
|
|
286
|
+
};
|
|
287
|
+
|
|
288
|
+
export const dynamic = 'force-dynamic';
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
### Configuration
|
|
292
|
+
|
|
293
|
+
The coverage information will be saved as `json` files. To change the destination folder, set the
|
|
294
|
+
`coveragePath` property in your config. The default value is `reports/coverage-acceptance`. The `json` files
|
|
295
|
+
will be stored inside `<coveragePath>/.nyc_output`.
|
|
262
296
|
|
|
263
297
|
Example config:
|
|
264
298
|
|
|
265
299
|
```json
|
|
266
300
|
{
|
|
267
301
|
"acceptanceTests": {
|
|
268
|
-
"coveragePath": "coverage/acceptance"
|
|
302
|
+
"coveragePath": "coverage/acceptance",
|
|
303
|
+
"coverageUrls": ["http://localhost:3000/api/coverage"]
|
|
269
304
|
}
|
|
270
305
|
}
|
|
271
306
|
```
|
|
272
307
|
|
|
273
|
-
|
|
308
|
+
### Generate coverage reports
|
|
309
|
+
|
|
310
|
+
After running the tests, you can use a tool like `nyc` to generate the coverage reports.
|
|
274
311
|
|
|
275
312
|
## Troubleshooting
|
|
276
313
|
|
|
@@ -11,6 +11,7 @@ var pptrTestingLibrary = require('pptr-testing-library');
|
|
|
11
11
|
var jestImageSnapshot = require('jest-image-snapshot');
|
|
12
12
|
var globToRegExp = _interopDefault(require('glob-to-regexp'));
|
|
13
13
|
var child_process = require('child_process');
|
|
14
|
+
var istanbul = _interopDefault(require('istanbul-lib-coverage'));
|
|
14
15
|
|
|
15
16
|
function _regeneratorRuntime() {
|
|
16
17
|
_regeneratorRuntime = function () {
|
|
@@ -370,6 +371,27 @@ function _objectWithoutPropertiesLoose(source, excluded) {
|
|
|
370
371
|
return target;
|
|
371
372
|
}
|
|
372
373
|
|
|
374
|
+
/**
|
|
375
|
+
* Debug function that logs to the console if the DEBUG_ACCEPTANCE_TESTING environment variable is set
|
|
376
|
+
*/
|
|
377
|
+
var debug = function debug() {
|
|
378
|
+
if (process.env.DEBUG_ACCEPTANCE_TESTING) {
|
|
379
|
+
var _console;
|
|
380
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
381
|
+
args[_key] = arguments[_key];
|
|
382
|
+
}
|
|
383
|
+
(_console = console).debug.apply(_console, ['[acceptance-testing]'].concat(args));
|
|
384
|
+
}
|
|
385
|
+
};
|
|
386
|
+
/**
|
|
387
|
+
* Returns true if the current path matches the spied path, including parameters
|
|
388
|
+
*/
|
|
389
|
+
var matchPath = function matchPath(spiedPath, currentPath) {
|
|
390
|
+
var normalizedCurrentPath = path.normalize(currentPath);
|
|
391
|
+
var pattern = globToRegExp(spiedPath);
|
|
392
|
+
return pattern.test(normalizedCurrentPath);
|
|
393
|
+
};
|
|
394
|
+
|
|
373
395
|
var getGlobalPage = function getGlobalPage() {
|
|
374
396
|
return global.page;
|
|
375
397
|
};
|
|
@@ -391,80 +413,148 @@ var getRootPath = function getRootPath() {
|
|
|
391
413
|
var prepareCoverageReportPath = function prepareCoverageReportPath(_ref) {
|
|
392
414
|
var coveragePath = _ref.coveragePath;
|
|
393
415
|
var ppidFile = path.join(coveragePath, '.ppid');
|
|
416
|
+
var nycOutputPath = path.join(coveragePath, '.nyc_output');
|
|
394
417
|
var ppid = process.ppid.toString();
|
|
395
418
|
if (!fs.existsSync(ppidFile) || fs.readFileSync(ppidFile, 'utf-8') !== ppid) {
|
|
396
419
|
// the condition is just to make sure we don't remove files outside the repo
|
|
397
420
|
if (getRootPath() === process.cwd() && path.normalize(coveragePath).startsWith(process.cwd())) {
|
|
398
|
-
fs.rmSync(
|
|
421
|
+
fs.rmSync(nycOutputPath, {
|
|
399
422
|
recursive: true,
|
|
400
423
|
force: true
|
|
401
424
|
});
|
|
402
425
|
}
|
|
403
|
-
fs.mkdirSync(
|
|
426
|
+
fs.mkdirSync(nycOutputPath, {
|
|
404
427
|
recursive: true
|
|
405
428
|
});
|
|
406
429
|
fs.writeFileSync(ppidFile, ppid);
|
|
407
430
|
}
|
|
408
431
|
};
|
|
432
|
+
var workerId = process.env.JEST_WORKER_ID || '0';
|
|
433
|
+
/**
|
|
434
|
+
* Writes the coverage reports into single files, one per each coverage object (path). This makes it easier to merge them.
|
|
435
|
+
* The `workerId` from jest is used to avoid race conditions when multiple workers are running in parallel.
|
|
436
|
+
*/
|
|
437
|
+
var writeCombinedCoverage = function writeCombinedCoverage(nycOutputPath, coverage) {
|
|
438
|
+
Object.values(coverage).forEach(function (value) {
|
|
439
|
+
if (value && value.path && value.hash) {
|
|
440
|
+
var _currentCoverage;
|
|
441
|
+
var filename = path.join(nycOutputPath, value.hash + "-" + workerId + ".json");
|
|
442
|
+
var currentCoverage = (_currentCoverage = {}, _currentCoverage[value.path] = value, _currentCoverage);
|
|
443
|
+
var previousCoverage = fs.existsSync(filename) ? JSON.parse(fs.readFileSync(filename, 'utf8')) : {};
|
|
444
|
+
var mergedCoverage = istanbul.createCoverageMap(previousCoverage);
|
|
445
|
+
mergedCoverage.merge(currentCoverage);
|
|
446
|
+
debug('Writing merged coverage:', value.path, value.hash);
|
|
447
|
+
fs.writeFileSync(filename, JSON.stringify(mergedCoverage.toJSON(), null, 2));
|
|
448
|
+
} else {
|
|
449
|
+
debug('Skip write coverage. Missing path or hash:', value);
|
|
450
|
+
}
|
|
451
|
+
});
|
|
452
|
+
};
|
|
409
453
|
/**
|
|
410
|
-
*
|
|
454
|
+
* Assumes the code was instrumented with istanbul/nyc and the coverage report stored in `window.__coverage__`.
|
|
411
455
|
* If not, this function does nothing.
|
|
412
456
|
*/
|
|
413
|
-
var
|
|
457
|
+
var collectFrontendCoverage = /*#__PURE__*/function () {
|
|
414
458
|
var _ref3 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref2) {
|
|
415
|
-
var coveragePath,
|
|
459
|
+
var coveragePath, nycOutputPath, coverage;
|
|
416
460
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
417
461
|
while (1) switch (_context.prev = _context.next) {
|
|
418
462
|
case 0:
|
|
419
463
|
coveragePath = _ref2.coveragePath;
|
|
420
|
-
|
|
464
|
+
nycOutputPath = path.join(coveragePath, '.nyc_output');
|
|
465
|
+
_context.next = 4;
|
|
421
466
|
return getGlobalPage().evaluate(function () {
|
|
422
467
|
return window.__coverage__;
|
|
423
468
|
});
|
|
424
|
-
case
|
|
469
|
+
case 4:
|
|
425
470
|
coverage = _context.sent;
|
|
426
471
|
if (coverage) {
|
|
427
|
-
_context.next =
|
|
472
|
+
_context.next = 8;
|
|
428
473
|
break;
|
|
429
474
|
}
|
|
475
|
+
debug('Skipping coverage collection. No coverage found.');
|
|
430
476
|
return _context.abrupt("return");
|
|
431
|
-
case
|
|
477
|
+
case 8:
|
|
478
|
+
debug('Frontend coverage found');
|
|
432
479
|
prepareCoverageReportPath({
|
|
433
480
|
coveragePath: coveragePath
|
|
434
481
|
});
|
|
435
|
-
nycOutputPath = path.join(coveragePath, '.nyc_output');
|
|
436
482
|
fs.mkdirSync(nycOutputPath, {
|
|
437
483
|
recursive: true
|
|
438
484
|
});
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
var _JSON$stringify;
|
|
442
|
-
fs.writeFileSync(path.join(nycOutputPath, cov.hash + '.json'), JSON.stringify((_JSON$stringify = {}, _JSON$stringify[cov.path] = cov, _JSON$stringify)));
|
|
443
|
-
}
|
|
444
|
-
});
|
|
445
|
-
case 10:
|
|
485
|
+
writeCombinedCoverage(nycOutputPath, coverage);
|
|
486
|
+
case 12:
|
|
446
487
|
case "end":
|
|
447
488
|
return _context.stop();
|
|
448
489
|
}
|
|
449
490
|
}, _callee);
|
|
450
491
|
}));
|
|
451
|
-
return function
|
|
492
|
+
return function collectFrontendCoverage(_x) {
|
|
452
493
|
return _ref3.apply(this, arguments);
|
|
453
494
|
};
|
|
454
495
|
}();
|
|
455
|
-
|
|
496
|
+
var writeCoverage = function writeCoverage(nycOutputPath, nameSuffix, coverage) {
|
|
497
|
+
Object.values(coverage).forEach(function (value) {
|
|
498
|
+
if (value && value.path && value.hash) {
|
|
499
|
+
var _JSON$stringify;
|
|
500
|
+
var filename = path.join(nycOutputPath, "" + value.hash + nameSuffix + ".json");
|
|
501
|
+
debug('Writing coverage:', value.path, value.hash);
|
|
502
|
+
fs.writeFileSync(filename, JSON.stringify((_JSON$stringify = {}, _JSON$stringify[value.path] = value, _JSON$stringify), null, 2));
|
|
503
|
+
} else {
|
|
504
|
+
debug('Skip write coverage. Missing path or hash:', value);
|
|
505
|
+
}
|
|
506
|
+
});
|
|
507
|
+
};
|
|
456
508
|
/**
|
|
457
|
-
*
|
|
509
|
+
* Collects backend coverage reports from the provided URLs and stores them in the coverage folder
|
|
458
510
|
*/
|
|
459
|
-
var
|
|
460
|
-
var
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
511
|
+
var collectBackendCoverage = /*#__PURE__*/function () {
|
|
512
|
+
var _ref5 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref4) {
|
|
513
|
+
var coveragePath, coverageUrls, nycOutputPath, serverReports;
|
|
514
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
515
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
516
|
+
case 0:
|
|
517
|
+
coveragePath = _ref4.coveragePath, coverageUrls = _ref4.coverageUrls;
|
|
518
|
+
nycOutputPath = path.join(coveragePath, '.nyc_output');
|
|
519
|
+
debug('Collecting backend coverage reports', coverageUrls);
|
|
520
|
+
_context2.next = 5;
|
|
521
|
+
return Promise.all(coverageUrls.map(function (url) {
|
|
522
|
+
return fetch(url).then(function (res) {
|
|
523
|
+
var _res$headers$get;
|
|
524
|
+
if (res.ok && res.status === 200 && (_res$headers$get = res.headers.get('content-type')) != null && _res$headers$get.includes('application/json')) {
|
|
525
|
+
return res.json();
|
|
526
|
+
}
|
|
527
|
+
debug('Error fetching coverage report:', {
|
|
528
|
+
url: url,
|
|
529
|
+
status: res.status
|
|
530
|
+
});
|
|
531
|
+
return null;
|
|
532
|
+
})["catch"](function () {
|
|
533
|
+
debug('Error fetching coverage report:', {
|
|
534
|
+
url: url
|
|
535
|
+
});
|
|
536
|
+
return null;
|
|
537
|
+
});
|
|
538
|
+
}));
|
|
539
|
+
case 5:
|
|
540
|
+
serverReports = _context2.sent;
|
|
541
|
+
serverReports.forEach(function (report, index) {
|
|
542
|
+
writeCoverage(nycOutputPath, "-backend" + index, report.coverage);
|
|
543
|
+
});
|
|
544
|
+
case 7:
|
|
545
|
+
case "end":
|
|
546
|
+
return _context2.stop();
|
|
547
|
+
}
|
|
548
|
+
}, _callee2);
|
|
549
|
+
}));
|
|
550
|
+
return function collectBackendCoverage(_x2) {
|
|
551
|
+
return _ref5.apply(this, arguments);
|
|
552
|
+
};
|
|
553
|
+
}();
|
|
464
554
|
|
|
465
555
|
var _excluded = ["captureBeyondViewport"],
|
|
466
556
|
_excluded2 = ["userAgent", "isDarkMode", "viewport", "cookies"];
|
|
467
|
-
var _pkg$acceptanceTests, _ref, _projectConfig$covera;
|
|
557
|
+
var _pkg$acceptanceTests, _ref, _projectConfig$covera, _projectConfig$covera2;
|
|
468
558
|
var LINUX_DOCKER_HOST_IP = '172.17.0.1';
|
|
469
559
|
var getGlobalBrowser = function getGlobalBrowser() {
|
|
470
560
|
return global.browser;
|
|
@@ -536,8 +626,10 @@ var serverHostName = /*#__PURE__*/function () {
|
|
|
536
626
|
var rootDir = /*#__PURE__*/findRoot( /*#__PURE__*/process.cwd());
|
|
537
627
|
var pkg = /*#__PURE__*/JSON.parse( /*#__PURE__*/fs.readFileSync( /*#__PURE__*/path.join(rootDir, 'package.json'), 'utf-8'));
|
|
538
628
|
var projectConfig = (_pkg$acceptanceTests = pkg.acceptanceTests) != null ? _pkg$acceptanceTests : {};
|
|
629
|
+
debug('Project config:', projectConfig);
|
|
539
630
|
var server = (_ref = isCi ? projectConfig.ciServer : projectConfig.devServer) != null ? _ref : projectConfig.server;
|
|
540
631
|
var coveragePath = /*#__PURE__*/path.join(rootDir, (_projectConfig$covera = projectConfig.coveragePath) != null ? _projectConfig$covera : 'reports/coverage-acceptance');
|
|
632
|
+
var coverageUrls = (_projectConfig$covera2 = projectConfig.coverageUrls) != null ? _projectConfig$covera2 : [];
|
|
541
633
|
var serverPort = server == null ? void 0 : server.port;
|
|
542
634
|
var toMatchImageSnapshot = /*#__PURE__*/jestImageSnapshot.configureToMatchImageSnapshot({
|
|
543
635
|
failureThreshold: 0,
|
|
@@ -889,45 +981,46 @@ var openPage = /*#__PURE__*/function () {
|
|
|
889
981
|
}
|
|
890
982
|
return protocol + "://" + hostname + ":" + port + path;
|
|
891
983
|
}();
|
|
984
|
+
debug('Opening page:', url);
|
|
892
985
|
_context7.t0 = userAgent;
|
|
893
986
|
if (_context7.t0) {
|
|
894
|
-
_context7.next =
|
|
987
|
+
_context7.next = 8;
|
|
895
988
|
break;
|
|
896
989
|
}
|
|
897
|
-
_context7.next =
|
|
990
|
+
_context7.next = 7;
|
|
898
991
|
return getGlobalBrowser().userAgent();
|
|
899
|
-
case 6:
|
|
900
|
-
_context7.t0 = _context7.sent;
|
|
901
992
|
case 7:
|
|
993
|
+
_context7.t0 = _context7.sent;
|
|
994
|
+
case 8:
|
|
902
995
|
currentUserAgent = _context7.t0;
|
|
903
996
|
page = getGlobalPage$1();
|
|
904
|
-
_context7.next =
|
|
997
|
+
_context7.next = 12;
|
|
905
998
|
return page.bringToFront();
|
|
906
|
-
case
|
|
999
|
+
case 12:
|
|
907
1000
|
if (!viewport) {
|
|
908
|
-
_context7.next =
|
|
1001
|
+
_context7.next = 15;
|
|
909
1002
|
break;
|
|
910
1003
|
}
|
|
911
|
-
_context7.next =
|
|
1004
|
+
_context7.next = 15;
|
|
912
1005
|
return page.setViewport(viewport);
|
|
913
|
-
case
|
|
1006
|
+
case 15:
|
|
914
1007
|
if (!cookies) {
|
|
915
|
-
_context7.next =
|
|
1008
|
+
_context7.next = 18;
|
|
916
1009
|
break;
|
|
917
1010
|
}
|
|
918
|
-
_context7.next =
|
|
1011
|
+
_context7.next = 18;
|
|
919
1012
|
return page.setCookie.apply(page, cookies);
|
|
920
|
-
case
|
|
921
|
-
_context7.next =
|
|
1013
|
+
case 18:
|
|
1014
|
+
_context7.next = 20;
|
|
922
1015
|
return page.setUserAgent(currentUserAgent + " acceptance-test");
|
|
923
|
-
case
|
|
924
|
-
_context7.next =
|
|
1016
|
+
case 20:
|
|
1017
|
+
_context7.next = 22;
|
|
925
1018
|
return page.emulateMediaFeatures([{
|
|
926
1019
|
name: 'prefers-color-scheme',
|
|
927
1020
|
value: isDarkMode ? 'dark' : 'light'
|
|
928
1021
|
}]);
|
|
929
|
-
case
|
|
930
|
-
_context7.next =
|
|
1022
|
+
case 22:
|
|
1023
|
+
_context7.next = 24;
|
|
931
1024
|
return page.evaluateOnNewDocument(function (viewport) {
|
|
932
1025
|
var _viewport$safeAreaIns;
|
|
933
1026
|
var overriddenSafeAreaInsets = !viewport ? [] : Object.keys((_viewport$safeAreaIns = viewport == null ? void 0 : viewport.safeAreaInset) != null ? _viewport$safeAreaIns : {}).map(function (key) {
|
|
@@ -941,44 +1034,44 @@ var openPage = /*#__PURE__*/function () {
|
|
|
941
1034
|
document.head.appendChild(style);
|
|
942
1035
|
});
|
|
943
1036
|
}, viewport);
|
|
944
|
-
case
|
|
1037
|
+
case 24:
|
|
945
1038
|
if (!needsRequestInterception) {
|
|
946
|
-
_context7.next =
|
|
1039
|
+
_context7.next = 28;
|
|
947
1040
|
break;
|
|
948
1041
|
}
|
|
949
|
-
_context7.next =
|
|
1042
|
+
_context7.next = 27;
|
|
950
1043
|
return page.setRequestInterception(true);
|
|
951
|
-
case 26:
|
|
952
|
-
page.on('request', requestInterceptor);
|
|
953
1044
|
case 27:
|
|
954
|
-
|
|
955
|
-
|
|
1045
|
+
page.on('request', requestInterceptor);
|
|
1046
|
+
case 28:
|
|
1047
|
+
_context7.prev = 28;
|
|
1048
|
+
_context7.next = 31;
|
|
956
1049
|
return page["goto"](url);
|
|
957
|
-
case
|
|
958
|
-
_context7.next =
|
|
1050
|
+
case 31:
|
|
1051
|
+
_context7.next = 42;
|
|
959
1052
|
break;
|
|
960
|
-
case
|
|
961
|
-
_context7.prev =
|
|
962
|
-
_context7.t1 = _context7["catch"](
|
|
1053
|
+
case 33:
|
|
1054
|
+
_context7.prev = 33;
|
|
1055
|
+
_context7.t1 = _context7["catch"](28);
|
|
963
1056
|
if (!_context7.t1.message.includes('net::ERR_CONNECTION_REFUSED')) {
|
|
964
|
-
_context7.next =
|
|
1057
|
+
_context7.next = 41;
|
|
965
1058
|
break;
|
|
966
1059
|
}
|
|
967
1060
|
connectionError = new Error("Could not connect to " + url + ". Is the server running?");
|
|
968
1061
|
Error.captureStackTrace(connectionError, openPage);
|
|
969
1062
|
throw connectionError;
|
|
970
|
-
case 40:
|
|
971
|
-
throw _context7.t1;
|
|
972
1063
|
case 41:
|
|
973
|
-
_context7.
|
|
1064
|
+
throw _context7.t1;
|
|
1065
|
+
case 42:
|
|
1066
|
+
_context7.next = 44;
|
|
974
1067
|
return page.waitForFunction('document.fonts.status === "loaded"');
|
|
975
|
-
case 43:
|
|
976
|
-
return _context7.abrupt("return", getPageApi(page));
|
|
977
1068
|
case 44:
|
|
1069
|
+
return _context7.abrupt("return", getPageApi(page));
|
|
1070
|
+
case 45:
|
|
978
1071
|
case "end":
|
|
979
1072
|
return _context7.stop();
|
|
980
1073
|
}
|
|
981
|
-
}, _callee7, null, [[
|
|
1074
|
+
}, _callee7, null, [[28, 33]]);
|
|
982
1075
|
}));
|
|
983
1076
|
return function openPage(_x11) {
|
|
984
1077
|
return _ref16.apply(this, arguments);
|
|
@@ -1156,30 +1249,53 @@ afterEach( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().ma
|
|
|
1156
1249
|
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
1157
1250
|
while (1) switch (_context14.prev = _context14.next) {
|
|
1158
1251
|
case 0:
|
|
1159
|
-
|
|
1160
|
-
|
|
1252
|
+
if (!process.env.COLLECT_ACCEPTANCE_COVERAGE) {
|
|
1253
|
+
_context14.next = 3;
|
|
1254
|
+
break;
|
|
1255
|
+
}
|
|
1256
|
+
_context14.next = 3;
|
|
1257
|
+
return collectFrontendCoverage({
|
|
1161
1258
|
coveragePath: coveragePath
|
|
1162
1259
|
});
|
|
1163
|
-
case
|
|
1164
|
-
_context14.prev =
|
|
1260
|
+
case 3:
|
|
1261
|
+
_context14.prev = 3;
|
|
1165
1262
|
page = getGlobalPage$1();
|
|
1166
1263
|
requestHandlers = [];
|
|
1167
1264
|
needsRequestInterception = false;
|
|
1168
1265
|
page.off('request', requestInterceptor);
|
|
1169
1266
|
// clear tab, this way we clear the DOM and stop js execution or pending requests
|
|
1170
|
-
_context14.next =
|
|
1267
|
+
_context14.next = 10;
|
|
1171
1268
|
return page["goto"]('about:blank');
|
|
1172
|
-
case
|
|
1173
|
-
_context14.next =
|
|
1269
|
+
case 10:
|
|
1270
|
+
_context14.next = 14;
|
|
1174
1271
|
break;
|
|
1175
|
-
case
|
|
1176
|
-
_context14.prev =
|
|
1177
|
-
_context14.t0 = _context14["catch"](
|
|
1178
|
-
case
|
|
1272
|
+
case 12:
|
|
1273
|
+
_context14.prev = 12;
|
|
1274
|
+
_context14.t0 = _context14["catch"](3);
|
|
1275
|
+
case 14:
|
|
1179
1276
|
case "end":
|
|
1180
1277
|
return _context14.stop();
|
|
1181
1278
|
}
|
|
1182
|
-
}, _callee14, null, [[
|
|
1279
|
+
}, _callee14, null, [[3, 12]]);
|
|
1280
|
+
})));
|
|
1281
|
+
afterAll( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
|
|
1282
|
+
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
1283
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
1284
|
+
case 0:
|
|
1285
|
+
if (!process.env.COLLECT_ACCEPTANCE_COVERAGE) {
|
|
1286
|
+
_context15.next = 3;
|
|
1287
|
+
break;
|
|
1288
|
+
}
|
|
1289
|
+
_context15.next = 3;
|
|
1290
|
+
return collectBackendCoverage({
|
|
1291
|
+
coveragePath: coveragePath,
|
|
1292
|
+
coverageUrls: coverageUrls
|
|
1293
|
+
});
|
|
1294
|
+
case 3:
|
|
1295
|
+
case "end":
|
|
1296
|
+
return _context15.stop();
|
|
1297
|
+
}
|
|
1298
|
+
}, _callee15);
|
|
1183
1299
|
})));
|
|
1184
1300
|
/**
|
|
1185
1301
|
* Returns a new path to the file that can be used by chromium in acceptance tests
|
|
@@ -1255,44 +1371,44 @@ var waitForElementToBeRemoved = function waitForElementToBeRemoved(element, time
|
|
|
1255
1371
|
}
|
|
1256
1372
|
var startStack = new Error().stack;
|
|
1257
1373
|
var wait = /*#__PURE__*/function () {
|
|
1258
|
-
var
|
|
1374
|
+
var _ref26 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
|
|
1259
1375
|
var t0, box;
|
|
1260
|
-
return _regeneratorRuntime().wrap(function
|
|
1261
|
-
while (1) switch (
|
|
1376
|
+
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
1377
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
1262
1378
|
case 0:
|
|
1263
1379
|
t0 = Date.now();
|
|
1264
1380
|
case 1:
|
|
1265
1381
|
if (!(Date.now() - t0 < timeout)) {
|
|
1266
|
-
|
|
1382
|
+
_context16.next = 11;
|
|
1267
1383
|
break;
|
|
1268
1384
|
}
|
|
1269
|
-
|
|
1385
|
+
_context16.next = 4;
|
|
1270
1386
|
return element.boundingBox();
|
|
1271
1387
|
case 4:
|
|
1272
|
-
box =
|
|
1388
|
+
box = _context16.sent;
|
|
1273
1389
|
if (box) {
|
|
1274
|
-
|
|
1390
|
+
_context16.next = 7;
|
|
1275
1391
|
break;
|
|
1276
1392
|
}
|
|
1277
|
-
return
|
|
1393
|
+
return _context16.abrupt("return");
|
|
1278
1394
|
case 7:
|
|
1279
|
-
|
|
1395
|
+
_context16.next = 9;
|
|
1280
1396
|
return new Promise(function (resolve) {
|
|
1281
1397
|
return setTimeout(resolve, interval);
|
|
1282
1398
|
});
|
|
1283
1399
|
case 9:
|
|
1284
|
-
|
|
1400
|
+
_context16.next = 1;
|
|
1285
1401
|
break;
|
|
1286
1402
|
case 11:
|
|
1287
1403
|
throw new Error('Element not removed');
|
|
1288
1404
|
case 12:
|
|
1289
1405
|
case "end":
|
|
1290
|
-
return
|
|
1406
|
+
return _context16.stop();
|
|
1291
1407
|
}
|
|
1292
|
-
},
|
|
1408
|
+
}, _callee16);
|
|
1293
1409
|
}));
|
|
1294
1410
|
return function wait() {
|
|
1295
|
-
return
|
|
1411
|
+
return _ref26.apply(this, arguments);
|
|
1296
1412
|
};
|
|
1297
1413
|
}();
|
|
1298
1414
|
return wait()["catch"](function (error) {
|