@telefonica/acceptance-testing 4.0.0 → 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -1
- package/dist/acceptance-testing.cjs.development.js +198 -162
- 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 +198 -162
- package/dist/acceptance-testing.esm.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -200,7 +200,10 @@ test('example screenshot test', async () => {
|
|
|
200
200
|
});
|
|
201
201
|
```
|
|
202
202
|
|
|
203
|
-
`createApiEndpointMock` automatically mocks CORS response headers and preflight (`OPTIONS`) requests for
|
|
203
|
+
- `createApiEndpointMock` automatically mocks CORS response headers and preflight (`OPTIONS`) requests for
|
|
204
|
+
you.
|
|
205
|
+
- Both `interceptRequest` and `createApiEndpointMock` return a jest
|
|
206
|
+
[mock function](https://jestjs.io/docs/mock-function-api/#reference).
|
|
204
207
|
|
|
205
208
|
### Using globs
|
|
206
209
|
|
|
@@ -879,22 +879,41 @@ var getPageApi = function getPageApi(page) {
|
|
|
879
879
|
};
|
|
880
880
|
var needsRequestInterception = false;
|
|
881
881
|
var requestHandlers = [];
|
|
882
|
-
var requestInterceptor = function
|
|
883
|
-
var
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
882
|
+
var requestInterceptor = /*#__PURE__*/function () {
|
|
883
|
+
var _ref11 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(req) {
|
|
884
|
+
var _requestHandlers$find;
|
|
885
|
+
var _ref12, handler, response;
|
|
886
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
887
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
888
|
+
case 0:
|
|
889
|
+
_ref12 = (_requestHandlers$find = requestHandlers.find(function (_ref13) {
|
|
890
|
+
var matcher = _ref13.matcher;
|
|
891
|
+
return matcher(req);
|
|
892
|
+
})) != null ? _requestHandlers$find : {
|
|
893
|
+
handler: null
|
|
894
|
+
}, handler = _ref12.handler;
|
|
895
|
+
if (handler) {
|
|
896
|
+
_context7.next = 4;
|
|
897
|
+
break;
|
|
898
|
+
}
|
|
899
|
+
req["continue"]();
|
|
900
|
+
return _context7.abrupt("return");
|
|
901
|
+
case 4:
|
|
902
|
+
_context7.next = 6;
|
|
903
|
+
return handler(req);
|
|
904
|
+
case 6:
|
|
905
|
+
response = _context7.sent;
|
|
906
|
+
req.respond(response);
|
|
907
|
+
case 8:
|
|
908
|
+
case "end":
|
|
909
|
+
return _context7.stop();
|
|
910
|
+
}
|
|
911
|
+
}, _callee7);
|
|
912
|
+
}));
|
|
913
|
+
return function requestInterceptor(_x11) {
|
|
914
|
+
return _ref11.apply(this, arguments);
|
|
915
|
+
};
|
|
916
|
+
}();
|
|
898
917
|
var interceptRequest = function interceptRequest(matcher) {
|
|
899
918
|
needsRequestInterception = true;
|
|
900
919
|
var spy = jest.fn();
|
|
@@ -905,11 +924,11 @@ var interceptRequest = function interceptRequest(matcher) {
|
|
|
905
924
|
return spy;
|
|
906
925
|
};
|
|
907
926
|
var createApiEndpointMock = function createApiEndpointMock(_temp3) {
|
|
908
|
-
var
|
|
909
|
-
var
|
|
910
|
-
origin =
|
|
911
|
-
baseUrl =
|
|
912
|
-
var originRegExp = globToRegExp((
|
|
927
|
+
var _ref15;
|
|
928
|
+
var _ref14 = _temp3 === void 0 ? {} : _temp3,
|
|
929
|
+
origin = _ref14.origin,
|
|
930
|
+
baseUrl = _ref14.baseUrl;
|
|
931
|
+
var originRegExp = globToRegExp((_ref15 = origin != null ? origin : baseUrl) != null ? _ref15 : '*');
|
|
913
932
|
interceptRequest(function (req) {
|
|
914
933
|
var _URL = new URL(req.url()),
|
|
915
934
|
origin = _URL.origin;
|
|
@@ -938,31 +957,48 @@ var createApiEndpointMock = function createApiEndpointMock(_temp3) {
|
|
|
938
957
|
return req.method() === method && !!origin.match(originRegExp) && matchPath(spiedPath, pathWithParams);
|
|
939
958
|
};
|
|
940
959
|
var spy = jest.fn();
|
|
941
|
-
interceptRequest(matcher).mockImplementation(function (
|
|
942
|
-
var
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
960
|
+
interceptRequest(matcher).mockImplementation( /*#__PURE__*/function () {
|
|
961
|
+
var _ref16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(req) {
|
|
962
|
+
var _spyResult$status;
|
|
963
|
+
var spyResult, status, resBody;
|
|
964
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
965
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
966
|
+
case 0:
|
|
967
|
+
_context8.next = 2;
|
|
968
|
+
return spy(req);
|
|
969
|
+
case 2:
|
|
970
|
+
spyResult = _context8.sent;
|
|
971
|
+
status = (_spyResult$status = spyResult.status) != null ? _spyResult$status : 200;
|
|
972
|
+
resBody = spyResult.body || spyResult;
|
|
973
|
+
return _context8.abrupt("return", {
|
|
974
|
+
status: status,
|
|
975
|
+
headers: {
|
|
976
|
+
'Access-Control-Allow-Origin': '*'
|
|
977
|
+
},
|
|
978
|
+
contentType: 'application/json',
|
|
979
|
+
body: JSON.stringify(resBody)
|
|
980
|
+
});
|
|
981
|
+
case 6:
|
|
982
|
+
case "end":
|
|
983
|
+
return _context8.stop();
|
|
984
|
+
}
|
|
985
|
+
}, _callee8);
|
|
986
|
+
}));
|
|
987
|
+
return function (_x12) {
|
|
988
|
+
return _ref16.apply(this, arguments);
|
|
953
989
|
};
|
|
954
|
-
});
|
|
990
|
+
}());
|
|
955
991
|
return spy;
|
|
956
992
|
}
|
|
957
993
|
};
|
|
958
994
|
};
|
|
959
995
|
var openPage = /*#__PURE__*/function () {
|
|
960
|
-
var
|
|
996
|
+
var _ref18 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(_ref17) {
|
|
961
997
|
var userAgent, isDarkMode, viewport, cookies, urlConfig, url, currentUserAgent, page, connectionError;
|
|
962
|
-
return _regeneratorRuntime().wrap(function
|
|
963
|
-
while (1) switch (
|
|
998
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
999
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
964
1000
|
case 0:
|
|
965
|
-
userAgent =
|
|
1001
|
+
userAgent = _ref17.userAgent, isDarkMode = _ref17.isDarkMode, viewport = _ref17.viewport, cookies = _ref17.cookies, urlConfig = /*#__PURE__*/_objectWithoutPropertiesLoose(_ref17, _excluded2);
|
|
966
1002
|
url = function () {
|
|
967
1003
|
if (urlConfig.url !== undefined) {
|
|
968
1004
|
return urlConfig.url;
|
|
@@ -982,45 +1018,45 @@ var openPage = /*#__PURE__*/function () {
|
|
|
982
1018
|
return protocol + "://" + hostname + ":" + port + path;
|
|
983
1019
|
}();
|
|
984
1020
|
debug('Opening page:', url);
|
|
985
|
-
|
|
986
|
-
if (
|
|
987
|
-
|
|
1021
|
+
_context9.t0 = userAgent;
|
|
1022
|
+
if (_context9.t0) {
|
|
1023
|
+
_context9.next = 8;
|
|
988
1024
|
break;
|
|
989
1025
|
}
|
|
990
|
-
|
|
1026
|
+
_context9.next = 7;
|
|
991
1027
|
return getGlobalBrowser().userAgent();
|
|
992
1028
|
case 7:
|
|
993
|
-
|
|
1029
|
+
_context9.t0 = _context9.sent;
|
|
994
1030
|
case 8:
|
|
995
|
-
currentUserAgent =
|
|
1031
|
+
currentUserAgent = _context9.t0;
|
|
996
1032
|
page = getGlobalPage$1();
|
|
997
|
-
|
|
1033
|
+
_context9.next = 12;
|
|
998
1034
|
return page.bringToFront();
|
|
999
1035
|
case 12:
|
|
1000
1036
|
if (!viewport) {
|
|
1001
|
-
|
|
1037
|
+
_context9.next = 15;
|
|
1002
1038
|
break;
|
|
1003
1039
|
}
|
|
1004
|
-
|
|
1040
|
+
_context9.next = 15;
|
|
1005
1041
|
return page.setViewport(viewport);
|
|
1006
1042
|
case 15:
|
|
1007
1043
|
if (!cookies) {
|
|
1008
|
-
|
|
1044
|
+
_context9.next = 18;
|
|
1009
1045
|
break;
|
|
1010
1046
|
}
|
|
1011
|
-
|
|
1047
|
+
_context9.next = 18;
|
|
1012
1048
|
return page.setCookie.apply(page, cookies);
|
|
1013
1049
|
case 18:
|
|
1014
|
-
|
|
1050
|
+
_context9.next = 20;
|
|
1015
1051
|
return page.setUserAgent(currentUserAgent + " acceptance-test");
|
|
1016
1052
|
case 20:
|
|
1017
|
-
|
|
1053
|
+
_context9.next = 22;
|
|
1018
1054
|
return page.emulateMediaFeatures([{
|
|
1019
1055
|
name: 'prefers-color-scheme',
|
|
1020
1056
|
value: isDarkMode ? 'dark' : 'light'
|
|
1021
1057
|
}]);
|
|
1022
1058
|
case 22:
|
|
1023
|
-
|
|
1059
|
+
_context9.next = 24;
|
|
1024
1060
|
return page.evaluateOnNewDocument(function (viewport) {
|
|
1025
1061
|
var _viewport$safeAreaIns;
|
|
1026
1062
|
var overriddenSafeAreaInsets = !viewport ? [] : Object.keys((_viewport$safeAreaIns = viewport == null ? void 0 : viewport.safeAreaInset) != null ? _viewport$safeAreaIns : {}).map(function (key) {
|
|
@@ -1036,57 +1072,57 @@ var openPage = /*#__PURE__*/function () {
|
|
|
1036
1072
|
}, viewport);
|
|
1037
1073
|
case 24:
|
|
1038
1074
|
if (!needsRequestInterception) {
|
|
1039
|
-
|
|
1075
|
+
_context9.next = 28;
|
|
1040
1076
|
break;
|
|
1041
1077
|
}
|
|
1042
|
-
|
|
1078
|
+
_context9.next = 27;
|
|
1043
1079
|
return page.setRequestInterception(true);
|
|
1044
1080
|
case 27:
|
|
1045
1081
|
page.on('request', requestInterceptor);
|
|
1046
1082
|
case 28:
|
|
1047
|
-
|
|
1048
|
-
|
|
1083
|
+
_context9.prev = 28;
|
|
1084
|
+
_context9.next = 31;
|
|
1049
1085
|
return page["goto"](url);
|
|
1050
1086
|
case 31:
|
|
1051
|
-
|
|
1087
|
+
_context9.next = 42;
|
|
1052
1088
|
break;
|
|
1053
1089
|
case 33:
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
if (!
|
|
1057
|
-
|
|
1090
|
+
_context9.prev = 33;
|
|
1091
|
+
_context9.t1 = _context9["catch"](28);
|
|
1092
|
+
if (!_context9.t1.message.includes('net::ERR_CONNECTION_REFUSED')) {
|
|
1093
|
+
_context9.next = 41;
|
|
1058
1094
|
break;
|
|
1059
1095
|
}
|
|
1060
1096
|
connectionError = new Error("Could not connect to " + url + ". Is the server running?");
|
|
1061
1097
|
Error.captureStackTrace(connectionError, openPage);
|
|
1062
1098
|
throw connectionError;
|
|
1063
1099
|
case 41:
|
|
1064
|
-
throw
|
|
1100
|
+
throw _context9.t1;
|
|
1065
1101
|
case 42:
|
|
1066
|
-
|
|
1102
|
+
_context9.next = 44;
|
|
1067
1103
|
return page.waitForFunction('document.fonts.status === "loaded"');
|
|
1068
1104
|
case 44:
|
|
1069
|
-
return
|
|
1105
|
+
return _context9.abrupt("return", getPageApi(page));
|
|
1070
1106
|
case 45:
|
|
1071
1107
|
case "end":
|
|
1072
|
-
return
|
|
1108
|
+
return _context9.stop();
|
|
1073
1109
|
}
|
|
1074
|
-
},
|
|
1110
|
+
}, _callee9, null, [[28, 33]]);
|
|
1075
1111
|
}));
|
|
1076
|
-
return function openPage(
|
|
1077
|
-
return
|
|
1112
|
+
return function openPage(_x13) {
|
|
1113
|
+
return _ref18.apply(this, arguments);
|
|
1078
1114
|
};
|
|
1079
1115
|
}();
|
|
1080
1116
|
var buildQueryMethods = function buildQueryMethods(_temp4) {
|
|
1081
|
-
var
|
|
1082
|
-
page =
|
|
1083
|
-
element =
|
|
1117
|
+
var _ref19 = _temp4 === void 0 ? {} : _temp4,
|
|
1118
|
+
page = _ref19.page,
|
|
1119
|
+
element = _ref19.element;
|
|
1084
1120
|
var boundQueries = {};
|
|
1085
1121
|
var _loop = function _loop() {
|
|
1086
1122
|
var _Object$entries$_i = _Object$entries[_i],
|
|
1087
1123
|
queryName = _Object$entries$_i[0],
|
|
1088
1124
|
queryFn = _Object$entries$_i[1];
|
|
1089
|
-
boundQueries[queryName] = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1125
|
+
boundQueries[queryName] = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
|
|
1090
1126
|
var doc,
|
|
1091
1127
|
body,
|
|
1092
1128
|
_len2,
|
|
@@ -1095,20 +1131,20 @@ var buildQueryMethods = function buildQueryMethods(_temp4) {
|
|
|
1095
1131
|
queryArgs,
|
|
1096
1132
|
elementHandle,
|
|
1097
1133
|
newElementHandle,
|
|
1098
|
-
|
|
1099
|
-
return _regeneratorRuntime().wrap(function
|
|
1100
|
-
while (1) switch (
|
|
1134
|
+
_args14 = arguments;
|
|
1135
|
+
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
1136
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
1101
1137
|
case 0:
|
|
1102
|
-
|
|
1138
|
+
_context14.next = 2;
|
|
1103
1139
|
return pptrTestingLibrary.getDocument(page != null ? page : getGlobalPage$1());
|
|
1104
1140
|
case 2:
|
|
1105
|
-
doc =
|
|
1106
|
-
|
|
1141
|
+
doc = _context14.sent;
|
|
1142
|
+
_context14.next = 5;
|
|
1107
1143
|
return doc.$('body');
|
|
1108
1144
|
case 5:
|
|
1109
|
-
body =
|
|
1110
|
-
for (_len2 =
|
|
1111
|
-
args[_key2] =
|
|
1145
|
+
body = _context14.sent;
|
|
1146
|
+
for (_len2 = _args14.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
1147
|
+
args[_key2] = _args14[_key2];
|
|
1112
1148
|
}
|
|
1113
1149
|
queryArgs = [].concat(args);
|
|
1114
1150
|
if (queryName.startsWith('findBy')) {
|
|
@@ -1119,98 +1155,98 @@ var buildQueryMethods = function buildQueryMethods(_temp4) {
|
|
|
1119
1155
|
timeout: 10000
|
|
1120
1156
|
});
|
|
1121
1157
|
}
|
|
1122
|
-
|
|
1158
|
+
_context14.next = 11;
|
|
1123
1159
|
return queryFn.apply(void 0, [element != null ? element : body].concat(queryArgs));
|
|
1124
1160
|
case 11:
|
|
1125
|
-
elementHandle =
|
|
1161
|
+
elementHandle = _context14.sent;
|
|
1126
1162
|
newElementHandle = Object.create(elementHandle);
|
|
1127
1163
|
newElementHandle.screenshot = /*#__PURE__*/function () {
|
|
1128
|
-
var
|
|
1129
|
-
return _regeneratorRuntime().wrap(function
|
|
1130
|
-
while (1) switch (
|
|
1164
|
+
var _ref21 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(options) {
|
|
1165
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
1166
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
1131
1167
|
case 0:
|
|
1132
1168
|
if (options != null && options.skipNetworkWait) {
|
|
1133
|
-
|
|
1169
|
+
_context10.next = 3;
|
|
1134
1170
|
break;
|
|
1135
1171
|
}
|
|
1136
|
-
|
|
1172
|
+
_context10.next = 3;
|
|
1137
1173
|
return (page != null ? page : getGlobalPage$1()).waitForNetworkIdle();
|
|
1138
1174
|
case 3:
|
|
1139
|
-
|
|
1175
|
+
_context10.next = 5;
|
|
1140
1176
|
return waitForPaintEnd(elementHandle, _extends({}, options, {
|
|
1141
1177
|
fullPage: false
|
|
1142
1178
|
}));
|
|
1143
1179
|
case 5:
|
|
1144
|
-
return
|
|
1180
|
+
return _context10.abrupt("return", elementHandle.screenshot(normalizeSreenshotOptions(options)));
|
|
1145
1181
|
case 6:
|
|
1146
1182
|
case "end":
|
|
1147
|
-
return
|
|
1183
|
+
return _context10.stop();
|
|
1148
1184
|
}
|
|
1149
|
-
},
|
|
1185
|
+
}, _callee10);
|
|
1150
1186
|
}));
|
|
1151
|
-
return function (
|
|
1152
|
-
return
|
|
1187
|
+
return function (_x14) {
|
|
1188
|
+
return _ref21.apply(this, arguments);
|
|
1153
1189
|
};
|
|
1154
1190
|
}();
|
|
1155
1191
|
newElementHandle.click = /*#__PURE__*/function () {
|
|
1156
|
-
var
|
|
1157
|
-
return _regeneratorRuntime().wrap(function
|
|
1158
|
-
while (1) switch (
|
|
1192
|
+
var _ref22 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(options) {
|
|
1193
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
1194
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
1159
1195
|
case 0:
|
|
1160
|
-
|
|
1196
|
+
_context11.next = 2;
|
|
1161
1197
|
return scrollIntoView(elementHandle);
|
|
1162
1198
|
case 2:
|
|
1163
|
-
return
|
|
1199
|
+
return _context11.abrupt("return", elementHandle.click(options));
|
|
1164
1200
|
case 3:
|
|
1165
1201
|
case "end":
|
|
1166
|
-
return
|
|
1202
|
+
return _context11.stop();
|
|
1167
1203
|
}
|
|
1168
|
-
},
|
|
1204
|
+
}, _callee11);
|
|
1169
1205
|
}));
|
|
1170
|
-
return function (
|
|
1171
|
-
return
|
|
1206
|
+
return function (_x15) {
|
|
1207
|
+
return _ref22.apply(this, arguments);
|
|
1172
1208
|
};
|
|
1173
1209
|
}();
|
|
1174
1210
|
newElementHandle.type = /*#__PURE__*/function () {
|
|
1175
|
-
var
|
|
1176
|
-
return _regeneratorRuntime().wrap(function
|
|
1177
|
-
while (1) switch (
|
|
1211
|
+
var _ref23 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(text, options) {
|
|
1212
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
1213
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
1178
1214
|
case 0:
|
|
1179
|
-
|
|
1215
|
+
_context12.next = 2;
|
|
1180
1216
|
return scrollIntoView(elementHandle);
|
|
1181
1217
|
case 2:
|
|
1182
|
-
return
|
|
1218
|
+
return _context12.abrupt("return", elementHandle.type(text, options));
|
|
1183
1219
|
case 3:
|
|
1184
1220
|
case "end":
|
|
1185
|
-
return
|
|
1221
|
+
return _context12.stop();
|
|
1186
1222
|
}
|
|
1187
|
-
},
|
|
1223
|
+
}, _callee12);
|
|
1188
1224
|
}));
|
|
1189
|
-
return function (
|
|
1190
|
-
return
|
|
1225
|
+
return function (_x16, _x17) {
|
|
1226
|
+
return _ref23.apply(this, arguments);
|
|
1191
1227
|
};
|
|
1192
1228
|
}();
|
|
1193
|
-
newElementHandle.select = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1194
|
-
var
|
|
1195
|
-
return _regeneratorRuntime().wrap(function
|
|
1196
|
-
while (1) switch (
|
|
1229
|
+
newElementHandle.select = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
|
|
1230
|
+
var _args13 = arguments;
|
|
1231
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
1232
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
1197
1233
|
case 0:
|
|
1198
|
-
|
|
1234
|
+
_context13.next = 2;
|
|
1199
1235
|
return scrollIntoView(elementHandle);
|
|
1200
1236
|
case 2:
|
|
1201
|
-
return
|
|
1237
|
+
return _context13.abrupt("return", elementHandle.select.apply(elementHandle, _args13));
|
|
1202
1238
|
case 3:
|
|
1203
1239
|
case "end":
|
|
1204
|
-
return
|
|
1240
|
+
return _context13.stop();
|
|
1205
1241
|
}
|
|
1206
|
-
},
|
|
1242
|
+
}, _callee13);
|
|
1207
1243
|
}));
|
|
1208
|
-
return
|
|
1244
|
+
return _context14.abrupt("return", newElementHandle);
|
|
1209
1245
|
case 18:
|
|
1210
1246
|
case "end":
|
|
1211
|
-
return
|
|
1247
|
+
return _context14.stop();
|
|
1212
1248
|
}
|
|
1213
|
-
},
|
|
1249
|
+
}, _callee14);
|
|
1214
1250
|
}));
|
|
1215
1251
|
};
|
|
1216
1252
|
for (var _i = 0, _Object$entries = Object.entries(pptrTestingLibrary.queries); _i < _Object$entries.length; _i++) {
|
|
@@ -1229,73 +1265,73 @@ var within = function within(element) {
|
|
|
1229
1265
|
element: element
|
|
1230
1266
|
});
|
|
1231
1267
|
};
|
|
1232
|
-
beforeEach( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1233
|
-
return _regeneratorRuntime().wrap(function
|
|
1234
|
-
while (1) switch (
|
|
1268
|
+
beforeEach( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
|
|
1269
|
+
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
1270
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
1235
1271
|
case 0:
|
|
1236
|
-
|
|
1272
|
+
_context15.next = 2;
|
|
1237
1273
|
return getGlobalPage$1().setRequestInterception(false);
|
|
1238
1274
|
case 2:
|
|
1239
|
-
|
|
1275
|
+
_context15.next = 4;
|
|
1240
1276
|
return global.jestPuppeteer.resetPage();
|
|
1241
1277
|
case 4:
|
|
1242
1278
|
case "end":
|
|
1243
|
-
return
|
|
1279
|
+
return _context15.stop();
|
|
1244
1280
|
}
|
|
1245
|
-
},
|
|
1281
|
+
}, _callee15);
|
|
1246
1282
|
})));
|
|
1247
|
-
afterEach( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1283
|
+
afterEach( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
|
|
1248
1284
|
var page;
|
|
1249
|
-
return _regeneratorRuntime().wrap(function
|
|
1250
|
-
while (1) switch (
|
|
1285
|
+
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
1286
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
1251
1287
|
case 0:
|
|
1252
1288
|
if (!process.env.COLLECT_ACCEPTANCE_COVERAGE) {
|
|
1253
|
-
|
|
1289
|
+
_context16.next = 3;
|
|
1254
1290
|
break;
|
|
1255
1291
|
}
|
|
1256
|
-
|
|
1292
|
+
_context16.next = 3;
|
|
1257
1293
|
return collectFrontendCoverage({
|
|
1258
1294
|
coveragePath: coveragePath
|
|
1259
1295
|
});
|
|
1260
1296
|
case 3:
|
|
1261
|
-
|
|
1297
|
+
_context16.prev = 3;
|
|
1262
1298
|
page = getGlobalPage$1();
|
|
1263
1299
|
requestHandlers = [];
|
|
1264
1300
|
needsRequestInterception = false;
|
|
1265
1301
|
page.off('request', requestInterceptor);
|
|
1266
1302
|
// clear tab, this way we clear the DOM and stop js execution or pending requests
|
|
1267
|
-
|
|
1303
|
+
_context16.next = 10;
|
|
1268
1304
|
return page["goto"]('about:blank');
|
|
1269
1305
|
case 10:
|
|
1270
|
-
|
|
1306
|
+
_context16.next = 14;
|
|
1271
1307
|
break;
|
|
1272
1308
|
case 12:
|
|
1273
|
-
|
|
1274
|
-
|
|
1309
|
+
_context16.prev = 12;
|
|
1310
|
+
_context16.t0 = _context16["catch"](3);
|
|
1275
1311
|
case 14:
|
|
1276
1312
|
case "end":
|
|
1277
|
-
return
|
|
1313
|
+
return _context16.stop();
|
|
1278
1314
|
}
|
|
1279
|
-
},
|
|
1315
|
+
}, _callee16, null, [[3, 12]]);
|
|
1280
1316
|
})));
|
|
1281
|
-
afterAll( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1282
|
-
return _regeneratorRuntime().wrap(function
|
|
1283
|
-
while (1) switch (
|
|
1317
|
+
afterAll( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
|
|
1318
|
+
return _regeneratorRuntime().wrap(function _callee17$(_context17) {
|
|
1319
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
1284
1320
|
case 0:
|
|
1285
1321
|
if (!process.env.COLLECT_ACCEPTANCE_COVERAGE) {
|
|
1286
|
-
|
|
1322
|
+
_context17.next = 3;
|
|
1287
1323
|
break;
|
|
1288
1324
|
}
|
|
1289
|
-
|
|
1325
|
+
_context17.next = 3;
|
|
1290
1326
|
return collectBackendCoverage({
|
|
1291
1327
|
coveragePath: coveragePath,
|
|
1292
1328
|
coverageUrls: coverageUrls
|
|
1293
1329
|
});
|
|
1294
1330
|
case 3:
|
|
1295
1331
|
case "end":
|
|
1296
|
-
return
|
|
1332
|
+
return _context17.stop();
|
|
1297
1333
|
}
|
|
1298
|
-
},
|
|
1334
|
+
}, _callee17);
|
|
1299
1335
|
})));
|
|
1300
1336
|
/**
|
|
1301
1337
|
* Returns a new path to the file that can be used by chromium in acceptance tests
|
|
@@ -1371,44 +1407,44 @@ var waitForElementToBeRemoved = function waitForElementToBeRemoved(element, time
|
|
|
1371
1407
|
}
|
|
1372
1408
|
var startStack = new Error().stack;
|
|
1373
1409
|
var wait = /*#__PURE__*/function () {
|
|
1374
|
-
var
|
|
1410
|
+
var _ref28 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
|
|
1375
1411
|
var t0, box;
|
|
1376
|
-
return _regeneratorRuntime().wrap(function
|
|
1377
|
-
while (1) switch (
|
|
1412
|
+
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
1413
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
1378
1414
|
case 0:
|
|
1379
1415
|
t0 = Date.now();
|
|
1380
1416
|
case 1:
|
|
1381
1417
|
if (!(Date.now() - t0 < timeout)) {
|
|
1382
|
-
|
|
1418
|
+
_context18.next = 11;
|
|
1383
1419
|
break;
|
|
1384
1420
|
}
|
|
1385
|
-
|
|
1421
|
+
_context18.next = 4;
|
|
1386
1422
|
return element.boundingBox();
|
|
1387
1423
|
case 4:
|
|
1388
|
-
box =
|
|
1424
|
+
box = _context18.sent;
|
|
1389
1425
|
if (box) {
|
|
1390
|
-
|
|
1426
|
+
_context18.next = 7;
|
|
1391
1427
|
break;
|
|
1392
1428
|
}
|
|
1393
|
-
return
|
|
1429
|
+
return _context18.abrupt("return");
|
|
1394
1430
|
case 7:
|
|
1395
|
-
|
|
1431
|
+
_context18.next = 9;
|
|
1396
1432
|
return new Promise(function (resolve) {
|
|
1397
1433
|
return setTimeout(resolve, interval);
|
|
1398
1434
|
});
|
|
1399
1435
|
case 9:
|
|
1400
|
-
|
|
1436
|
+
_context18.next = 1;
|
|
1401
1437
|
break;
|
|
1402
1438
|
case 11:
|
|
1403
1439
|
throw new Error('Element not removed');
|
|
1404
1440
|
case 12:
|
|
1405
1441
|
case "end":
|
|
1406
|
-
return
|
|
1442
|
+
return _context18.stop();
|
|
1407
1443
|
}
|
|
1408
|
-
},
|
|
1444
|
+
}, _callee18);
|
|
1409
1445
|
}));
|
|
1410
1446
|
return function wait() {
|
|
1411
|
-
return
|
|
1447
|
+
return _ref28.apply(this, arguments);
|
|
1412
1448
|
};
|
|
1413
1449
|
}();
|
|
1414
1450
|
return wait()["catch"](function (error) {
|