@telefonica/acceptance-testing 3.0.0-beta9 → 3.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 +27 -0
- package/dist/acceptance-testing.cjs.development.js +185 -275
- 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 +185 -275
- package/dist/acceptance-testing.esm.js.map +1 -1
- package/dist/coverage.d.ts +8 -8
- package/dist/index.d.ts +91 -93
- package/dist/utils.d.ts +4 -4
- package/docker-compose.yaml +1 -1
- package/jest-puppeteer-config.js +24 -37
- package/package.json +13 -14
- package/dist/__tests__/utils.test.d.ts +0 -1
|
@@ -374,13 +374,13 @@ var getRootPath = function getRootPath() {
|
|
|
374
374
|
}
|
|
375
375
|
return rootPath;
|
|
376
376
|
};
|
|
377
|
-
/**
|
|
378
|
-
* We want to clear coverage files from previous runs, but at this point it is not easy because each
|
|
379
|
-
* worker runs a different instance of this script, so we can't just clear the coverage folder at
|
|
380
|
-
* the beginning of the test run.
|
|
381
|
-
*
|
|
382
|
-
* The solution is to remove the coverage folder when the stored ppid (parent process id) is
|
|
383
|
-
* different from the current one
|
|
377
|
+
/**
|
|
378
|
+
* We want to clear coverage files from previous runs, but at this point it is not easy because each
|
|
379
|
+
* worker runs a different instance of this script, so we can't just clear the coverage folder at
|
|
380
|
+
* the beginning of the test run.
|
|
381
|
+
*
|
|
382
|
+
* The solution is to remove the coverage folder when the stored ppid (parent process id) is
|
|
383
|
+
* different from the current one
|
|
384
384
|
*/
|
|
385
385
|
var prepareCoverageReportPath = function prepareCoverageReportPath(_ref) {
|
|
386
386
|
var coveragePath = _ref.coveragePath;
|
|
@@ -400,9 +400,9 @@ var prepareCoverageReportPath = function prepareCoverageReportPath(_ref) {
|
|
|
400
400
|
fs.writeFileSync(ppidFile, ppid);
|
|
401
401
|
}
|
|
402
402
|
};
|
|
403
|
-
/**
|
|
404
|
-
* Asumes the code was instrumented with istanbul and the coverage report stored in `window.__coverage__`.
|
|
405
|
-
* If not, this function does nothing.
|
|
403
|
+
/**
|
|
404
|
+
* Asumes the code was instrumented with istanbul and the coverage report stored in `window.__coverage__`.
|
|
405
|
+
* If not, this function does nothing.
|
|
406
406
|
*/
|
|
407
407
|
var collectCoverageIfAvailable = /*#__PURE__*/function () {
|
|
408
408
|
var _ref3 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref2) {
|
|
@@ -447,8 +447,8 @@ var collectCoverageIfAvailable = /*#__PURE__*/function () {
|
|
|
447
447
|
};
|
|
448
448
|
}();
|
|
449
449
|
|
|
450
|
-
/**
|
|
451
|
-
* Returns true if the current path matches the spied path, including parameters
|
|
450
|
+
/**
|
|
451
|
+
* Returns true if the current path matches the spied path, including parameters
|
|
452
452
|
*/
|
|
453
453
|
var matchPath = function matchPath(spiedPath, currentPath) {
|
|
454
454
|
var normalizedCurrentPath = path.normalize(currentPath);
|
|
@@ -456,7 +456,8 @@ var matchPath = function matchPath(spiedPath, currentPath) {
|
|
|
456
456
|
return pattern.test(normalizedCurrentPath);
|
|
457
457
|
};
|
|
458
458
|
|
|
459
|
-
var _excluded = ["
|
|
459
|
+
var _excluded = ["captureBeyondViewport"],
|
|
460
|
+
_excluded2 = ["userAgent", "isDarkMode", "viewport", "cookies"];
|
|
460
461
|
var _pkg$acceptanceTests, _ref, _projectConfig$covera;
|
|
461
462
|
var LINUX_DOCKER_HOST_IP = '172.17.0.1';
|
|
462
463
|
var getGlobalBrowser = function getGlobalBrowser() {
|
|
@@ -466,7 +467,7 @@ var getGlobalPage$1 = function getGlobalPage() {
|
|
|
466
467
|
return global.page;
|
|
467
468
|
};
|
|
468
469
|
var isCi = /*#__PURE__*/process.argv.includes('--ci') || process.env.CI;
|
|
469
|
-
var isUsingDockerizedChromium =
|
|
470
|
+
var isUsingDockerizedChromium = isCi || /*#__PURE__*/new URL( /*#__PURE__*/getGlobalBrowser().wsEndpoint()).port === '9223';
|
|
470
471
|
/** Check if running inside WSL */
|
|
471
472
|
var isWsl = function isWsl() {
|
|
472
473
|
if (process.platform !== 'linux') {
|
|
@@ -537,7 +538,7 @@ var toMatchImageSnapshot = /*#__PURE__*/configureToMatchImageSnapshot({
|
|
|
537
538
|
failureThresholdType: 'percent',
|
|
538
539
|
customSnapshotIdentifier: function customSnapshotIdentifier(_ref2) {
|
|
539
540
|
var defaultIdentifier = _ref2.defaultIdentifier;
|
|
540
|
-
return defaultIdentifier
|
|
541
|
+
return defaultIdentifier;
|
|
541
542
|
}
|
|
542
543
|
});
|
|
543
544
|
var calledToMatchImageSnapshotOutsideDocker = false;
|
|
@@ -627,15 +628,18 @@ var waitForPaintEnd = /*#__PURE__*/function () {
|
|
|
627
628
|
return _ref3.apply(this, arguments);
|
|
628
629
|
};
|
|
629
630
|
}();
|
|
630
|
-
var normalizeSreenshotOptions = function normalizeSreenshotOptions(
|
|
631
|
-
|
|
631
|
+
var normalizeSreenshotOptions = function normalizeSreenshotOptions(_temp2) {
|
|
632
|
+
var _ref5 = _temp2 === void 0 ? {} : _temp2,
|
|
633
|
+
_ref5$captureBeyondVi = _ref5.captureBeyondViewport,
|
|
634
|
+
captureBeyondViewport = _ref5$captureBeyondVi === void 0 ? false : _ref5$captureBeyondVi,
|
|
635
|
+
options = _objectWithoutPropertiesLoose(_ref5, _excluded);
|
|
636
|
+
// Puppeter default for captureBeyondViewport is true, but we think false is a better default.
|
|
637
|
+
// When this is true, the fixed elements (like fixed footers) are relative to the original page
|
|
638
|
+
// viewport, not to the full page, so those elements look weird in fullPage screenshots.
|
|
639
|
+
return _extends({}, options, {
|
|
640
|
+
captureBeyondViewport: captureBeyondViewport
|
|
641
|
+
});
|
|
632
642
|
};
|
|
633
|
-
// const normalizeSreenshotOptions = ({captureBeyondViewport = false, ...options}: ScreenshotOptions = {}) => {
|
|
634
|
-
// // Puppeter default for captureBeyondViewport is true, but we think false is a better default.
|
|
635
|
-
// // When this is true, the fixed elements (like fixed footers) are relative to the original page
|
|
636
|
-
// // viewport, not to the full page, so those elements look weird in fullPage screenshots.
|
|
637
|
-
// return {...options, captureBeyondViewport};
|
|
638
|
-
// };
|
|
639
643
|
// Puppeteer already calls scrollIntoViewIfNeeded before clicking an element. But it doesn't work in all situations
|
|
640
644
|
// For example, when there is a fixed footer in the page and the element to click is under it, the browser won't scroll
|
|
641
645
|
// because the element is already in the viewport (the ifNeeded part is important here). By forcing the scroll to the
|
|
@@ -648,238 +652,144 @@ var scrollIntoView = function scrollIntoView(el) {
|
|
|
648
652
|
});
|
|
649
653
|
};
|
|
650
654
|
var getPageApi = function getPageApi(page) {
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
while (1) switch (_context5.prev = _context5.next) {
|
|
723
|
-
case 0:
|
|
724
|
-
if (options != null && options.skipNetworkWait) {
|
|
725
|
-
_context5.next = 3;
|
|
726
|
-
break;
|
|
727
|
-
}
|
|
655
|
+
var api = Object.create(page);
|
|
656
|
+
api.type = /*#__PURE__*/function () {
|
|
657
|
+
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(elementHandle, text, options) {
|
|
658
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
659
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
660
|
+
case 0:
|
|
661
|
+
_context2.next = 2;
|
|
662
|
+
return scrollIntoView(elementHandle);
|
|
663
|
+
case 2:
|
|
664
|
+
return _context2.abrupt("return", elementHandle.type(text, options));
|
|
665
|
+
case 3:
|
|
666
|
+
case "end":
|
|
667
|
+
return _context2.stop();
|
|
668
|
+
}
|
|
669
|
+
}, _callee2);
|
|
670
|
+
}));
|
|
671
|
+
return function (_x3, _x4, _x5) {
|
|
672
|
+
return _ref6.apply(this, arguments);
|
|
673
|
+
};
|
|
674
|
+
}();
|
|
675
|
+
api.click = /*#__PURE__*/function () {
|
|
676
|
+
var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(elementHandle, options) {
|
|
677
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
678
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
679
|
+
case 0:
|
|
680
|
+
_context3.next = 2;
|
|
681
|
+
return scrollIntoView(elementHandle);
|
|
682
|
+
case 2:
|
|
683
|
+
return _context3.abrupt("return", elementHandle.click(options));
|
|
684
|
+
case 3:
|
|
685
|
+
case "end":
|
|
686
|
+
return _context3.stop();
|
|
687
|
+
}
|
|
688
|
+
}, _callee3);
|
|
689
|
+
}));
|
|
690
|
+
return function (_x6, _x7) {
|
|
691
|
+
return _ref7.apply(this, arguments);
|
|
692
|
+
};
|
|
693
|
+
}();
|
|
694
|
+
api.select = /*#__PURE__*/function () {
|
|
695
|
+
var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(elementHandle) {
|
|
696
|
+
var _len,
|
|
697
|
+
values,
|
|
698
|
+
_key,
|
|
699
|
+
_args4 = arguments;
|
|
700
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
701
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
702
|
+
case 0:
|
|
703
|
+
_context4.next = 2;
|
|
704
|
+
return scrollIntoView(elementHandle);
|
|
705
|
+
case 2:
|
|
706
|
+
for (_len = _args4.length, values = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
707
|
+
values[_key - 1] = _args4[_key];
|
|
708
|
+
}
|
|
709
|
+
return _context4.abrupt("return", elementHandle.select.apply(elementHandle, values));
|
|
710
|
+
case 4:
|
|
711
|
+
case "end":
|
|
712
|
+
return _context4.stop();
|
|
713
|
+
}
|
|
714
|
+
}, _callee4);
|
|
715
|
+
}));
|
|
716
|
+
return function (_x8) {
|
|
717
|
+
return _ref8.apply(this, arguments);
|
|
718
|
+
};
|
|
719
|
+
}();
|
|
720
|
+
api.screenshot = /*#__PURE__*/function () {
|
|
721
|
+
var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(options) {
|
|
722
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
723
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
724
|
+
case 0:
|
|
725
|
+
if (options != null && options.skipNetworkWait) {
|
|
728
726
|
_context5.next = 3;
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
return
|
|
768
|
-
}
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
};
|
|
779
|
-
}
|
|
780
|
-
},
|
|
781
|
-
$: page.$.bind(page),
|
|
782
|
-
$$: page.$$.bind(page),
|
|
783
|
-
$$eval: page.$$eval.bind(page),
|
|
784
|
-
$eval: page.$eval.bind(page),
|
|
785
|
-
accessibility: page.accessibility,
|
|
786
|
-
addScriptTag: page.addScriptTag.bind(page),
|
|
787
|
-
addStyleTag: page.addStyleTag.bind(page),
|
|
788
|
-
authenticate: page.authenticate.bind(page),
|
|
789
|
-
bringToFront: page.bringToFront.bind(page),
|
|
790
|
-
browser: page.browser.bind(page),
|
|
791
|
-
browserContext: page.browserContext.bind(page),
|
|
792
|
-
close: page.close.bind(page),
|
|
793
|
-
content: page.content,
|
|
794
|
-
cookies: page.cookies.bind(page),
|
|
795
|
-
coverage: page.coverage,
|
|
796
|
-
createCDPSession: page.createCDPSession.bind(page),
|
|
797
|
-
createPDFStream: page.createPDFStream.bind(page),
|
|
798
|
-
deleteCookie: page.deleteCookie.bind(page),
|
|
799
|
-
emit: page.emit.bind(page),
|
|
800
|
-
emulate: page.emulate.bind(page),
|
|
801
|
-
emulateCPUThrottling: page.emulateCPUThrottling.bind(page),
|
|
802
|
-
emulateIdleState: page.emulateIdleState.bind(page),
|
|
803
|
-
emulateMediaFeatures: page.emulateMediaFeatures.bind(page),
|
|
804
|
-
emulateMediaType: page.emulateMediaType.bind(page),
|
|
805
|
-
emulateNetworkConditions: page.emulateNetworkConditions.bind(page),
|
|
806
|
-
emulateTimezone: page.emulateTimezone.bind(page),
|
|
807
|
-
emulateVisionDeficiency: page.emulateVisionDeficiency.bind(page),
|
|
808
|
-
evaluate: page.evaluate.bind(page),
|
|
809
|
-
evaluateHandle: page.evaluateHandle.bind(page),
|
|
810
|
-
evaluateOnNewDocument: page.evaluateOnNewDocument.bind(page),
|
|
811
|
-
exposeFunction: page.exposeFunction.bind(page),
|
|
812
|
-
focus: page.focus.bind(page),
|
|
813
|
-
frames: page.frames.bind(page),
|
|
814
|
-
getDefaultTimeout: page.getDefaultTimeout.bind(page),
|
|
815
|
-
goBack: page.goBack.bind(page),
|
|
816
|
-
goForward: page.goForward.bind(page),
|
|
817
|
-
"goto": page["goto"].bind(page),
|
|
818
|
-
hover: page.hover.bind(page),
|
|
819
|
-
isClosed: page.isClosed.bind(page),
|
|
820
|
-
isDragInterceptionEnabled: page.isDragInterceptionEnabled.bind(page),
|
|
821
|
-
isJavaScriptEnabled: page.isJavaScriptEnabled.bind(page),
|
|
822
|
-
isServiceWorkerBypassed: page.isServiceWorkerBypassed.bind(page),
|
|
823
|
-
keyboard: page.keyboard,
|
|
824
|
-
listenerCount: page.listenerCount.bind(page),
|
|
825
|
-
locator: page.locator.bind(page),
|
|
826
|
-
mainFrame: page.mainFrame.bind(page),
|
|
827
|
-
metrics: page.metrics.bind(page),
|
|
828
|
-
mouse: page.mouse,
|
|
829
|
-
off: page.off.bind(page),
|
|
830
|
-
on: page.on.bind(page),
|
|
831
|
-
once: page.once.bind(page),
|
|
832
|
-
pdf: page.pdf,
|
|
833
|
-
queryObjects: page.queryObjects.bind(page),
|
|
834
|
-
reload: page.reload.bind(page),
|
|
835
|
-
removeAllListeners: page.removeAllListeners.bind(page),
|
|
836
|
-
removeExposedFunction: page.removeExposedFunction.bind(page),
|
|
837
|
-
removeScriptToEvaluateOnNewDocument: page.removeScriptToEvaluateOnNewDocument.bind(page),
|
|
838
|
-
screencast: page.screencast,
|
|
839
|
-
setBypassCSP: page.setBypassCSP.bind(page),
|
|
840
|
-
setBypassServiceWorker: page.setBypassServiceWorker.bind(page),
|
|
841
|
-
setCacheEnabled: page.setCacheEnabled.bind(page),
|
|
842
|
-
setContent: page.setContent.bind(page),
|
|
843
|
-
setCookie: page.setCookie.bind(page),
|
|
844
|
-
setDefaultNavigationTimeout: page.setDefaultNavigationTimeout.bind(page),
|
|
845
|
-
setDefaultTimeout: page.setDefaultTimeout.bind(page),
|
|
846
|
-
setDragInterception: page.setDragInterception.bind(page),
|
|
847
|
-
setExtraHTTPHeaders: page.setExtraHTTPHeaders.bind(page),
|
|
848
|
-
setJavaScriptEnabled: page.setJavaScriptEnabled.bind(page),
|
|
849
|
-
setOfflineMode: page.setOfflineMode.bind(page),
|
|
850
|
-
setRequestInterception: page.setRequestInterception.bind(page),
|
|
851
|
-
setUserAgent: page.setUserAgent.bind(page),
|
|
852
|
-
setViewport: page.setViewport.bind(page),
|
|
853
|
-
tap: page.tap.bind(page),
|
|
854
|
-
target: page.target.bind(page),
|
|
855
|
-
title: page.title,
|
|
856
|
-
touchscreen: page.touchscreen,
|
|
857
|
-
tracing: page.tracing,
|
|
858
|
-
url: page.url,
|
|
859
|
-
viewport: page.viewport,
|
|
860
|
-
waitForDevicePrompt: page.waitForDevicePrompt.bind(page),
|
|
861
|
-
waitForFileChooser: page.waitForFileChooser.bind(page),
|
|
862
|
-
waitForFrame: page.waitForFrame.bind(page),
|
|
863
|
-
waitForFunction: page.waitForFunction.bind(page),
|
|
864
|
-
waitForNavigation: page.waitForNavigation.bind(page),
|
|
865
|
-
waitForNetworkIdle: page.waitForNetworkIdle.bind(page),
|
|
866
|
-
waitForRequest: page.waitForRequest.bind(page),
|
|
867
|
-
waitForResponse: page.waitForResponse.bind(page),
|
|
868
|
-
waitForSelector: page.waitForSelector.bind(page),
|
|
869
|
-
workers: page.workers
|
|
727
|
+
break;
|
|
728
|
+
}
|
|
729
|
+
_context5.next = 3;
|
|
730
|
+
return page.waitForNetworkIdle();
|
|
731
|
+
case 3:
|
|
732
|
+
_context5.next = 5;
|
|
733
|
+
return waitForPaintEnd(page, options);
|
|
734
|
+
case 5:
|
|
735
|
+
return _context5.abrupt("return", page.screenshot(normalizeSreenshotOptions(options)));
|
|
736
|
+
case 6:
|
|
737
|
+
case "end":
|
|
738
|
+
return _context5.stop();
|
|
739
|
+
}
|
|
740
|
+
}, _callee5);
|
|
741
|
+
}));
|
|
742
|
+
return function (_x9) {
|
|
743
|
+
return _ref9.apply(this, arguments);
|
|
744
|
+
};
|
|
745
|
+
}();
|
|
746
|
+
api.clear = /*#__PURE__*/function () {
|
|
747
|
+
var _ref10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(elementHandle) {
|
|
748
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
749
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
750
|
+
case 0:
|
|
751
|
+
_context6.next = 2;
|
|
752
|
+
return elementHandle.click({
|
|
753
|
+
clickCount: 3
|
|
754
|
+
});
|
|
755
|
+
case 2:
|
|
756
|
+
_context6.next = 4;
|
|
757
|
+
return elementHandle.press('Delete');
|
|
758
|
+
case 4:
|
|
759
|
+
case "end":
|
|
760
|
+
return _context6.stop();
|
|
761
|
+
}
|
|
762
|
+
}, _callee6);
|
|
763
|
+
}));
|
|
764
|
+
return function (_x10) {
|
|
765
|
+
return _ref10.apply(this, arguments);
|
|
766
|
+
};
|
|
767
|
+
}();
|
|
768
|
+
// For some reason, puppeteer browserContext.overridePermissions doesn't work with newer chrome versions.
|
|
769
|
+
// This workaround polyfills the browser geolocation api to return the mocked position
|
|
770
|
+
api.setGeolocation = function (position) {
|
|
771
|
+
return page.evaluate(function (position) {
|
|
772
|
+
window.navigator.geolocation.getCurrentPosition = function (callback) {
|
|
773
|
+
// @ts-expect-error - puppeteer's setGeoLocation does not expect a timestamp to be passed
|
|
774
|
+
callback({
|
|
775
|
+
coords: position
|
|
776
|
+
});
|
|
777
|
+
};
|
|
778
|
+
}, position);
|
|
870
779
|
};
|
|
780
|
+
return api;
|
|
871
781
|
};
|
|
872
782
|
var needsRequestInterception = false;
|
|
873
783
|
var requestHandlers = [];
|
|
874
784
|
var requestInterceptor = function requestInterceptor(req) {
|
|
875
785
|
var _requestHandlers$find;
|
|
876
|
-
var
|
|
877
|
-
var matcher =
|
|
786
|
+
var _ref11 = (_requestHandlers$find = requestHandlers.find(function (_ref12) {
|
|
787
|
+
var matcher = _ref12.matcher;
|
|
878
788
|
return matcher(req);
|
|
879
789
|
})) != null ? _requestHandlers$find : {
|
|
880
790
|
handler: null
|
|
881
791
|
},
|
|
882
|
-
handler =
|
|
792
|
+
handler = _ref11.handler;
|
|
883
793
|
if (!handler) {
|
|
884
794
|
req["continue"]();
|
|
885
795
|
return;
|
|
@@ -896,12 +806,12 @@ var interceptRequest = function interceptRequest(matcher) {
|
|
|
896
806
|
});
|
|
897
807
|
return spy;
|
|
898
808
|
};
|
|
899
|
-
var createApiEndpointMock = function createApiEndpointMock(
|
|
900
|
-
var
|
|
901
|
-
var
|
|
902
|
-
origin =
|
|
903
|
-
baseUrl =
|
|
904
|
-
var originRegExp = globToRegExp((
|
|
809
|
+
var createApiEndpointMock = function createApiEndpointMock(_temp3) {
|
|
810
|
+
var _ref14;
|
|
811
|
+
var _ref13 = _temp3 === void 0 ? {} : _temp3,
|
|
812
|
+
origin = _ref13.origin,
|
|
813
|
+
baseUrl = _ref13.baseUrl;
|
|
814
|
+
var originRegExp = globToRegExp((_ref14 = origin != null ? origin : baseUrl) != null ? _ref14 : '*');
|
|
905
815
|
interceptRequest(function (req) {
|
|
906
816
|
var _URL = new URL(req.url()),
|
|
907
817
|
origin = _URL.origin;
|
|
@@ -949,12 +859,12 @@ var createApiEndpointMock = function createApiEndpointMock(_temp2) {
|
|
|
949
859
|
};
|
|
950
860
|
};
|
|
951
861
|
var openPage = /*#__PURE__*/function () {
|
|
952
|
-
var
|
|
862
|
+
var _ref16 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(_ref15) {
|
|
953
863
|
var userAgent, isDarkMode, viewport, cookies, urlConfig, url, currentUserAgent, page, connectionError;
|
|
954
864
|
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
955
865
|
while (1) switch (_context7.prev = _context7.next) {
|
|
956
866
|
case 0:
|
|
957
|
-
userAgent =
|
|
867
|
+
userAgent = _ref15.userAgent, isDarkMode = _ref15.isDarkMode, viewport = _ref15.viewport, cookies = _ref15.cookies, urlConfig = /*#__PURE__*/_objectWithoutPropertiesLoose(_ref15, _excluded2);
|
|
958
868
|
url = function () {
|
|
959
869
|
if (urlConfig.url !== undefined) {
|
|
960
870
|
return urlConfig.url;
|
|
@@ -1065,13 +975,13 @@ var openPage = /*#__PURE__*/function () {
|
|
|
1065
975
|
}, _callee7, null, [[27, 32]]);
|
|
1066
976
|
}));
|
|
1067
977
|
return function openPage(_x11) {
|
|
1068
|
-
return
|
|
978
|
+
return _ref16.apply(this, arguments);
|
|
1069
979
|
};
|
|
1070
980
|
}();
|
|
1071
|
-
var buildQueryMethods = function buildQueryMethods(
|
|
1072
|
-
var
|
|
1073
|
-
page =
|
|
1074
|
-
element =
|
|
981
|
+
var buildQueryMethods = function buildQueryMethods(_temp4) {
|
|
982
|
+
var _ref17 = _temp4 === void 0 ? {} : _temp4,
|
|
983
|
+
page = _ref17.page,
|
|
984
|
+
element = _ref17.element;
|
|
1075
985
|
var boundQueries = {};
|
|
1076
986
|
var _loop = function _loop() {
|
|
1077
987
|
var _Object$entries$_i = _Object$entries[_i],
|
|
@@ -1116,7 +1026,7 @@ var buildQueryMethods = function buildQueryMethods(_temp3) {
|
|
|
1116
1026
|
elementHandle = _context12.sent;
|
|
1117
1027
|
newElementHandle = Object.create(elementHandle);
|
|
1118
1028
|
newElementHandle.screenshot = /*#__PURE__*/function () {
|
|
1119
|
-
var
|
|
1029
|
+
var _ref19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(options) {
|
|
1120
1030
|
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
1121
1031
|
while (1) switch (_context8.prev = _context8.next) {
|
|
1122
1032
|
case 0:
|
|
@@ -1140,11 +1050,11 @@ var buildQueryMethods = function buildQueryMethods(_temp3) {
|
|
|
1140
1050
|
}, _callee8);
|
|
1141
1051
|
}));
|
|
1142
1052
|
return function (_x12) {
|
|
1143
|
-
return
|
|
1053
|
+
return _ref19.apply(this, arguments);
|
|
1144
1054
|
};
|
|
1145
1055
|
}();
|
|
1146
1056
|
newElementHandle.click = /*#__PURE__*/function () {
|
|
1147
|
-
var
|
|
1057
|
+
var _ref20 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(options) {
|
|
1148
1058
|
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
1149
1059
|
while (1) switch (_context9.prev = _context9.next) {
|
|
1150
1060
|
case 0:
|
|
@@ -1159,11 +1069,11 @@ var buildQueryMethods = function buildQueryMethods(_temp3) {
|
|
|
1159
1069
|
}, _callee9);
|
|
1160
1070
|
}));
|
|
1161
1071
|
return function (_x13) {
|
|
1162
|
-
return
|
|
1072
|
+
return _ref20.apply(this, arguments);
|
|
1163
1073
|
};
|
|
1164
1074
|
}();
|
|
1165
1075
|
newElementHandle.type = /*#__PURE__*/function () {
|
|
1166
|
-
var
|
|
1076
|
+
var _ref21 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(text, options) {
|
|
1167
1077
|
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
1168
1078
|
while (1) switch (_context10.prev = _context10.next) {
|
|
1169
1079
|
case 0:
|
|
@@ -1178,7 +1088,7 @@ var buildQueryMethods = function buildQueryMethods(_temp3) {
|
|
|
1178
1088
|
}, _callee10);
|
|
1179
1089
|
}));
|
|
1180
1090
|
return function (_x14, _x15) {
|
|
1181
|
-
return
|
|
1091
|
+
return _ref21.apply(this, arguments);
|
|
1182
1092
|
};
|
|
1183
1093
|
}();
|
|
1184
1094
|
newElementHandle.select = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
|
|
@@ -1265,14 +1175,14 @@ afterEach( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().ma
|
|
|
1265
1175
|
}
|
|
1266
1176
|
}, _callee14, null, [[2, 11]]);
|
|
1267
1177
|
})));
|
|
1268
|
-
/**
|
|
1269
|
-
* Returns a new path to the file that can be used by chromium in acceptance tests
|
|
1270
|
-
*
|
|
1271
|
-
* To be able to use `element.uploadFile()` in a dockerized chromium, the file must exist in the
|
|
1272
|
-
* host and the docker, and both sides must use the same path.
|
|
1273
|
-
*
|
|
1274
|
-
* To workaround this bug or limitation, this function prepares the file by copying it to /tmp in
|
|
1275
|
-
* the host and the container.
|
|
1178
|
+
/**
|
|
1179
|
+
* Returns a new path to the file that can be used by chromium in acceptance tests
|
|
1180
|
+
*
|
|
1181
|
+
* To be able to use `element.uploadFile()` in a dockerized chromium, the file must exist in the
|
|
1182
|
+
* host and the docker, and both sides must use the same path.
|
|
1183
|
+
*
|
|
1184
|
+
* To workaround this bug or limitation, this function prepares the file by copying it to /tmp in
|
|
1185
|
+
* the host and the container.
|
|
1276
1186
|
*/
|
|
1277
1187
|
var prepareFile = function prepareFile(filepath) {
|
|
1278
1188
|
var isLocal = !isCi;
|
|
@@ -1292,8 +1202,8 @@ var prepareFile = function prepareFile(filepath) {
|
|
|
1292
1202
|
return filepath;
|
|
1293
1203
|
}
|
|
1294
1204
|
};
|
|
1295
|
-
/**
|
|
1296
|
-
* A convenience method to defer an expectation
|
|
1205
|
+
/**
|
|
1206
|
+
* A convenience method to defer an expectation
|
|
1297
1207
|
*/
|
|
1298
1208
|
var wait = function wait(expectation, timeout, interval) {
|
|
1299
1209
|
if (timeout === void 0) {
|
|
@@ -1339,7 +1249,7 @@ var waitForElementToBeRemoved = function waitForElementToBeRemoved(element, time
|
|
|
1339
1249
|
}
|
|
1340
1250
|
var startStack = new Error().stack;
|
|
1341
1251
|
var wait = /*#__PURE__*/function () {
|
|
1342
|
-
var
|
|
1252
|
+
var _ref25 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
|
|
1343
1253
|
var t0, box;
|
|
1344
1254
|
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
1345
1255
|
while (1) switch (_context15.prev = _context15.next) {
|
|
@@ -1376,7 +1286,7 @@ var waitForElementToBeRemoved = function waitForElementToBeRemoved(element, time
|
|
|
1376
1286
|
}, _callee15);
|
|
1377
1287
|
}));
|
|
1378
1288
|
return function wait() {
|
|
1379
|
-
return
|
|
1289
|
+
return _ref25.apply(this, arguments);
|
|
1380
1290
|
};
|
|
1381
1291
|
}();
|
|
1382
1292
|
return wait()["catch"](function (error) {
|