@telefonica/acceptance-testing 2.23.2 → 3.0.0-beta1
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/__tests__/utils.test.d.ts +1 -0
- package/dist/acceptance-testing.cjs.development.js +274 -184
- 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 +274 -184
- package/dist/acceptance-testing.esm.js.map +1 -1
- package/dist/coverage.d.ts +8 -8
- package/dist/index.d.ts +93 -91
- package/dist/utils.d.ts +4 -4
- package/docker-compose.yaml +1 -3
- package/jest-puppeteer-config.js +7 -5
- package/package.json +13 -13
|
@@ -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,8 +456,7 @@ var matchPath = function matchPath(spiedPath, currentPath) {
|
|
|
456
456
|
return pattern.test(normalizedCurrentPath);
|
|
457
457
|
};
|
|
458
458
|
|
|
459
|
-
var _excluded = ["
|
|
460
|
-
_excluded2 = ["userAgent", "isDarkMode", "viewport", "cookies"];
|
|
459
|
+
var _excluded = ["userAgent", "isDarkMode", "viewport", "cookies"];
|
|
461
460
|
var _pkg$acceptanceTests, _ref, _projectConfig$covera;
|
|
462
461
|
var LINUX_DOCKER_HOST_IP = '172.17.0.1';
|
|
463
462
|
var getGlobalBrowser = function getGlobalBrowser() {
|
|
@@ -628,18 +627,15 @@ var waitForPaintEnd = /*#__PURE__*/function () {
|
|
|
628
627
|
return _ref3.apply(this, arguments);
|
|
629
628
|
};
|
|
630
629
|
}();
|
|
631
|
-
var normalizeSreenshotOptions = function normalizeSreenshotOptions(
|
|
632
|
-
|
|
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
|
-
});
|
|
630
|
+
var normalizeSreenshotOptions = function normalizeSreenshotOptions(options) {
|
|
631
|
+
return options;
|
|
642
632
|
};
|
|
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
|
+
// };
|
|
643
639
|
// Puppeteer already calls scrollIntoViewIfNeeded before clicking an element. But it doesn't work in all situations
|
|
644
640
|
// For example, when there is a fixed footer in the page and the element to click is under it, the browser won't scroll
|
|
645
641
|
// because the element is already in the viewport (the ifNeeded part is important here). By forcing the scroll to the
|
|
@@ -652,144 +648,238 @@ var scrollIntoView = function scrollIntoView(el) {
|
|
|
652
648
|
});
|
|
653
649
|
};
|
|
654
650
|
var getPageApi = function getPageApi(page) {
|
|
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
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
651
|
+
return {
|
|
652
|
+
type: function () {
|
|
653
|
+
var _type = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(elementHandle, text, options) {
|
|
654
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
655
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
656
|
+
case 0:
|
|
657
|
+
_context2.next = 2;
|
|
658
|
+
return scrollIntoView(elementHandle);
|
|
659
|
+
case 2:
|
|
660
|
+
return _context2.abrupt("return", elementHandle.type(text, options));
|
|
661
|
+
case 3:
|
|
662
|
+
case "end":
|
|
663
|
+
return _context2.stop();
|
|
664
|
+
}
|
|
665
|
+
}, _callee2);
|
|
666
|
+
}));
|
|
667
|
+
function type(_x3, _x4, _x5) {
|
|
668
|
+
return _type.apply(this, arguments);
|
|
669
|
+
}
|
|
670
|
+
return type;
|
|
671
|
+
}(),
|
|
672
|
+
click: function () {
|
|
673
|
+
var _click = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(elementHandle, options) {
|
|
674
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
675
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
676
|
+
case 0:
|
|
677
|
+
_context3.next = 2;
|
|
678
|
+
return scrollIntoView(elementHandle);
|
|
679
|
+
case 2:
|
|
680
|
+
return _context3.abrupt("return", elementHandle.click(options));
|
|
681
|
+
case 3:
|
|
682
|
+
case "end":
|
|
683
|
+
return _context3.stop();
|
|
684
|
+
}
|
|
685
|
+
}, _callee3);
|
|
686
|
+
}));
|
|
687
|
+
function click(_x6, _x7) {
|
|
688
|
+
return _click.apply(this, arguments);
|
|
689
|
+
}
|
|
690
|
+
return click;
|
|
691
|
+
}(),
|
|
692
|
+
select: function () {
|
|
693
|
+
var _select = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(elementHandle) {
|
|
694
|
+
var _len,
|
|
695
|
+
values,
|
|
696
|
+
_key,
|
|
697
|
+
_args4 = arguments;
|
|
698
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
699
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
700
|
+
case 0:
|
|
701
|
+
_context4.next = 2;
|
|
702
|
+
return scrollIntoView(elementHandle);
|
|
703
|
+
case 2:
|
|
704
|
+
for (_len = _args4.length, values = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
705
|
+
values[_key - 1] = _args4[_key];
|
|
706
|
+
}
|
|
707
|
+
return _context4.abrupt("return", elementHandle.select.apply(elementHandle, values));
|
|
708
|
+
case 4:
|
|
709
|
+
case "end":
|
|
710
|
+
return _context4.stop();
|
|
711
|
+
}
|
|
712
|
+
}, _callee4);
|
|
713
|
+
}));
|
|
714
|
+
function select(_x8) {
|
|
715
|
+
return _select.apply(this, arguments);
|
|
716
|
+
}
|
|
717
|
+
return select;
|
|
718
|
+
}(),
|
|
719
|
+
screenshot: function () {
|
|
720
|
+
var _screenshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(options) {
|
|
721
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
722
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
723
|
+
case 0:
|
|
724
|
+
if (options != null && options.skipNetworkWait) {
|
|
725
|
+
_context5.next = 3;
|
|
726
|
+
break;
|
|
727
|
+
}
|
|
726
728
|
_context5.next = 3;
|
|
727
|
-
|
|
728
|
-
|
|
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
|
-
return
|
|
766
|
-
}
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
}
|
|
777
|
-
};
|
|
778
|
-
},
|
|
729
|
+
return page.waitForNetworkIdle();
|
|
730
|
+
case 3:
|
|
731
|
+
_context5.next = 5;
|
|
732
|
+
return waitForPaintEnd(page, options);
|
|
733
|
+
case 5:
|
|
734
|
+
return _context5.abrupt("return", page.screenshot(normalizeSreenshotOptions(options)));
|
|
735
|
+
case 6:
|
|
736
|
+
case "end":
|
|
737
|
+
return _context5.stop();
|
|
738
|
+
}
|
|
739
|
+
}, _callee5);
|
|
740
|
+
}));
|
|
741
|
+
function screenshot(_x9) {
|
|
742
|
+
return _screenshot.apply(this, arguments);
|
|
743
|
+
}
|
|
744
|
+
return screenshot;
|
|
745
|
+
}(),
|
|
746
|
+
clear: function () {
|
|
747
|
+
var _clear = _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
|
+
function clear(_x10) {
|
|
765
|
+
return _clear.apply(this, arguments);
|
|
766
|
+
}
|
|
767
|
+
return clear;
|
|
768
|
+
}(),
|
|
769
|
+
// For some reason, puppeteer browserContext.overridePermissions doesn't work with newer chrome versions.
|
|
770
|
+
// This workaround polyfills the browser geolocation api to return the mocked position
|
|
771
|
+
setGeolocation: function setGeolocation(position) {
|
|
772
|
+
return page.evaluate(function (position) {
|
|
773
|
+
window.navigator.geolocation.getCurrentPosition = function (callback) {
|
|
774
|
+
// @ts-expect-error - puppeteer's setGeoLocation does not expect a timestamp to be passed
|
|
775
|
+
callback({
|
|
776
|
+
coords: position
|
|
777
|
+
});
|
|
778
|
+
};
|
|
779
|
+
}, position);
|
|
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
|
|
779
870
|
};
|
|
780
|
-
return api;
|
|
781
871
|
};
|
|
782
872
|
var needsRequestInterception = false;
|
|
783
873
|
var requestHandlers = [];
|
|
784
874
|
var requestInterceptor = function requestInterceptor(req) {
|
|
785
875
|
var _requestHandlers$find;
|
|
786
|
-
var
|
|
787
|
-
var matcher =
|
|
876
|
+
var _ref5 = (_requestHandlers$find = requestHandlers.find(function (_ref6) {
|
|
877
|
+
var matcher = _ref6.matcher;
|
|
788
878
|
return matcher(req);
|
|
789
879
|
})) != null ? _requestHandlers$find : {
|
|
790
880
|
handler: null
|
|
791
881
|
},
|
|
792
|
-
handler =
|
|
882
|
+
handler = _ref5.handler;
|
|
793
883
|
if (!handler) {
|
|
794
884
|
req["continue"]();
|
|
795
885
|
return;
|
|
@@ -806,12 +896,12 @@ var interceptRequest = function interceptRequest(matcher) {
|
|
|
806
896
|
});
|
|
807
897
|
return spy;
|
|
808
898
|
};
|
|
809
|
-
var createApiEndpointMock = function createApiEndpointMock(
|
|
810
|
-
var
|
|
811
|
-
var
|
|
812
|
-
origin =
|
|
813
|
-
baseUrl =
|
|
814
|
-
var originRegExp = globToRegExp((
|
|
899
|
+
var createApiEndpointMock = function createApiEndpointMock(_temp2) {
|
|
900
|
+
var _ref8;
|
|
901
|
+
var _ref7 = _temp2 === void 0 ? {} : _temp2,
|
|
902
|
+
origin = _ref7.origin,
|
|
903
|
+
baseUrl = _ref7.baseUrl;
|
|
904
|
+
var originRegExp = globToRegExp((_ref8 = origin != null ? origin : baseUrl) != null ? _ref8 : '*');
|
|
815
905
|
interceptRequest(function (req) {
|
|
816
906
|
var _URL = new URL(req.url()),
|
|
817
907
|
origin = _URL.origin;
|
|
@@ -859,12 +949,12 @@ var createApiEndpointMock = function createApiEndpointMock(_temp3) {
|
|
|
859
949
|
};
|
|
860
950
|
};
|
|
861
951
|
var openPage = /*#__PURE__*/function () {
|
|
862
|
-
var
|
|
952
|
+
var _ref10 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(_ref9) {
|
|
863
953
|
var userAgent, isDarkMode, viewport, cookies, urlConfig, url, currentUserAgent, page, connectionError;
|
|
864
954
|
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
865
955
|
while (1) switch (_context7.prev = _context7.next) {
|
|
866
956
|
case 0:
|
|
867
|
-
userAgent =
|
|
957
|
+
userAgent = _ref9.userAgent, isDarkMode = _ref9.isDarkMode, viewport = _ref9.viewport, cookies = _ref9.cookies, urlConfig = /*#__PURE__*/_objectWithoutPropertiesLoose(_ref9, _excluded);
|
|
868
958
|
url = function () {
|
|
869
959
|
if (urlConfig.url !== undefined) {
|
|
870
960
|
return urlConfig.url;
|
|
@@ -975,13 +1065,13 @@ var openPage = /*#__PURE__*/function () {
|
|
|
975
1065
|
}, _callee7, null, [[27, 32]]);
|
|
976
1066
|
}));
|
|
977
1067
|
return function openPage(_x11) {
|
|
978
|
-
return
|
|
1068
|
+
return _ref10.apply(this, arguments);
|
|
979
1069
|
};
|
|
980
1070
|
}();
|
|
981
|
-
var buildQueryMethods = function buildQueryMethods(
|
|
982
|
-
var
|
|
983
|
-
page =
|
|
984
|
-
element =
|
|
1071
|
+
var buildQueryMethods = function buildQueryMethods(_temp3) {
|
|
1072
|
+
var _ref11 = _temp3 === void 0 ? {} : _temp3,
|
|
1073
|
+
page = _ref11.page,
|
|
1074
|
+
element = _ref11.element;
|
|
985
1075
|
var boundQueries = {};
|
|
986
1076
|
var _loop = function _loop() {
|
|
987
1077
|
var _Object$entries$_i = _Object$entries[_i],
|
|
@@ -1026,7 +1116,7 @@ var buildQueryMethods = function buildQueryMethods(_temp4) {
|
|
|
1026
1116
|
elementHandle = _context12.sent;
|
|
1027
1117
|
newElementHandle = Object.create(elementHandle);
|
|
1028
1118
|
newElementHandle.screenshot = /*#__PURE__*/function () {
|
|
1029
|
-
var
|
|
1119
|
+
var _ref13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(options) {
|
|
1030
1120
|
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
1031
1121
|
while (1) switch (_context8.prev = _context8.next) {
|
|
1032
1122
|
case 0:
|
|
@@ -1050,11 +1140,11 @@ var buildQueryMethods = function buildQueryMethods(_temp4) {
|
|
|
1050
1140
|
}, _callee8);
|
|
1051
1141
|
}));
|
|
1052
1142
|
return function (_x12) {
|
|
1053
|
-
return
|
|
1143
|
+
return _ref13.apply(this, arguments);
|
|
1054
1144
|
};
|
|
1055
1145
|
}();
|
|
1056
1146
|
newElementHandle.click = /*#__PURE__*/function () {
|
|
1057
|
-
var
|
|
1147
|
+
var _ref14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(options) {
|
|
1058
1148
|
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
1059
1149
|
while (1) switch (_context9.prev = _context9.next) {
|
|
1060
1150
|
case 0:
|
|
@@ -1069,11 +1159,11 @@ var buildQueryMethods = function buildQueryMethods(_temp4) {
|
|
|
1069
1159
|
}, _callee9);
|
|
1070
1160
|
}));
|
|
1071
1161
|
return function (_x13) {
|
|
1072
|
-
return
|
|
1162
|
+
return _ref14.apply(this, arguments);
|
|
1073
1163
|
};
|
|
1074
1164
|
}();
|
|
1075
1165
|
newElementHandle.type = /*#__PURE__*/function () {
|
|
1076
|
-
var
|
|
1166
|
+
var _ref15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(text, options) {
|
|
1077
1167
|
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
1078
1168
|
while (1) switch (_context10.prev = _context10.next) {
|
|
1079
1169
|
case 0:
|
|
@@ -1088,7 +1178,7 @@ var buildQueryMethods = function buildQueryMethods(_temp4) {
|
|
|
1088
1178
|
}, _callee10);
|
|
1089
1179
|
}));
|
|
1090
1180
|
return function (_x14, _x15) {
|
|
1091
|
-
return
|
|
1181
|
+
return _ref15.apply(this, arguments);
|
|
1092
1182
|
};
|
|
1093
1183
|
}();
|
|
1094
1184
|
newElementHandle.select = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
|
|
@@ -1175,14 +1265,14 @@ afterEach( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().ma
|
|
|
1175
1265
|
}
|
|
1176
1266
|
}, _callee14, null, [[2, 11]]);
|
|
1177
1267
|
})));
|
|
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.
|
|
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.
|
|
1186
1276
|
*/
|
|
1187
1277
|
var prepareFile = function prepareFile(filepath) {
|
|
1188
1278
|
var isLocal = !isCi;
|
|
@@ -1190,7 +1280,7 @@ var prepareFile = function prepareFile(filepath) {
|
|
|
1190
1280
|
var usesDocker = isLocal && isHeadless;
|
|
1191
1281
|
var dockerComposeFile = path.join(__dirname, '..', 'docker-compose.yaml');
|
|
1192
1282
|
if (usesDocker) {
|
|
1193
|
-
var containerId = execSync("docker
|
|
1283
|
+
var containerId = execSync("docker compose -f " + dockerComposeFile + " ps -q").toString().trim();
|
|
1194
1284
|
if (!containerId) {
|
|
1195
1285
|
throw Error('acceptance-testing container not found');
|
|
1196
1286
|
}
|
|
@@ -1202,8 +1292,8 @@ var prepareFile = function prepareFile(filepath) {
|
|
|
1202
1292
|
return filepath;
|
|
1203
1293
|
}
|
|
1204
1294
|
};
|
|
1205
|
-
/**
|
|
1206
|
-
* A convenience method to defer an expectation
|
|
1295
|
+
/**
|
|
1296
|
+
* A convenience method to defer an expectation
|
|
1207
1297
|
*/
|
|
1208
1298
|
var wait = function wait(expectation, timeout, interval) {
|
|
1209
1299
|
if (timeout === void 0) {
|
|
@@ -1249,7 +1339,7 @@ var waitForElementToBeRemoved = function waitForElementToBeRemoved(element, time
|
|
|
1249
1339
|
}
|
|
1250
1340
|
var startStack = new Error().stack;
|
|
1251
1341
|
var wait = /*#__PURE__*/function () {
|
|
1252
|
-
var
|
|
1342
|
+
var _ref19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
|
|
1253
1343
|
var t0, box;
|
|
1254
1344
|
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
1255
1345
|
while (1) switch (_context15.prev = _context15.next) {
|
|
@@ -1286,7 +1376,7 @@ var waitForElementToBeRemoved = function waitForElementToBeRemoved(element, time
|
|
|
1286
1376
|
}, _callee15);
|
|
1287
1377
|
}));
|
|
1288
1378
|
return function wait() {
|
|
1289
|
-
return
|
|
1379
|
+
return _ref19.apply(this, arguments);
|
|
1290
1380
|
};
|
|
1291
1381
|
}();
|
|
1292
1382
|
return wait()["catch"](function (error) {
|