@checkly/playwright-core 1.41.23 → 1.41.25
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/lib/cli/driver.js +1 -9
- package/lib/cli/program.js +3 -11
- package/lib/client/channelOwner.js +1 -1
- package/lib/client/clientHelper.js +1 -5
- package/lib/client/connection.js +1 -1
- package/lib/client/consoleMessage.js +1 -1
- package/lib/client/electron.js +0 -3
- package/lib/client/events.js +0 -1
- package/lib/client/frame.js +1 -2
- package/lib/client/harRouter.js +1 -7
- package/lib/client/page.js +6 -25
- package/lib/common/debugLogger.js +0 -1
- package/lib/common/socksProxy.js +1 -1
- package/lib/generated/consoleApiSource.js +1 -1
- package/lib/generated/injectedScriptSource.js +1 -1
- package/lib/generated/recorderSource.js +1 -1
- package/lib/outofprocess.js +1 -1
- package/lib/protocol/validator.js +29 -46
- package/lib/remote/playwrightConnection.js +1 -1
- package/lib/remote/playwrightServer.js +166 -72
- package/lib/server/android/android.js +1 -1
- package/lib/server/browserType.js +2 -2
- package/lib/server/chromium/chromium.js +4 -5
- package/lib/server/chromium/crConnection.js +1 -1
- package/lib/server/chromium/crPage.js +2 -45
- package/lib/server/console.js +3 -1
- package/lib/server/debugController.js +3 -0
- package/lib/server/deviceDescriptorsSource.json +50 -50
- package/lib/server/dispatchers/browserContextDispatcher.js +2 -3
- package/lib/server/dispatchers/dispatcher.js +10 -9
- package/lib/server/dispatchers/electronDispatcher.js +0 -13
- package/lib/server/dispatchers/frameDispatcher.js +6 -0
- package/lib/server/dispatchers/pageDispatcher.js +10 -14
- package/lib/server/dom.js +167 -130
- package/lib/server/electron/electron.js +12 -38
- package/lib/server/electron/loader.js +2 -4
- package/lib/server/firefox/ffAccessibility.js +1 -2
- package/lib/server/firefox/ffConnection.js +1 -1
- package/lib/server/firefox/ffPage.js +1 -1
- package/lib/server/frames.js +20 -39
- package/lib/server/helper.js +1 -1
- package/lib/server/page.js +5 -49
- package/lib/server/pipeTransport.js +1 -1
- package/lib/server/playwright.js +1 -1
- package/lib/server/progress.js +11 -3
- package/lib/server/recorder/csharp.js +1 -1
- package/lib/server/recorder.js +1 -1
- package/lib/server/registry/browserFetcher.js +1 -1
- package/lib/server/registry/dependencies.js +4 -5
- package/lib/server/registry/index.js +30 -48
- package/lib/server/registry/nativeDeps.js +94 -0
- package/lib/server/trace/recorder/snapshotter.js +1 -1
- package/lib/server/trace/recorder/tracing.js +2 -5
- package/lib/server/trace/viewer/traceViewer.js +1 -1
- package/lib/server/transport.js +2 -4
- package/lib/server/webkit/wkConnection.js +1 -1
- package/lib/server/webkit/wkPage.js +2 -2
- package/lib/utils/comparators.js +4 -4
- package/lib/utils/fileUtils.js +0 -4
- package/lib/utils/hostPlatform.js +1 -1
- package/lib/utils/index.js +0 -11
- package/lib/utils/isomorphic/locatorParser.js +4 -6
- package/lib/utils/network.js +0 -33
- package/lib/utils/processLauncher.js +0 -7
- package/lib/vite/htmlReport/index.html +11 -11
- package/lib/vite/traceViewer/assets/codeMirrorModule-2mdjgmqe.js +24 -0
- package/lib/vite/traceViewer/assets/codeMirrorModule-GJA8DRmd.js +24 -0
- package/lib/vite/traceViewer/assets/wsPort-93o0i57c.js +69 -0
- package/lib/vite/traceViewer/assets/wsPort-qI0zJPR7.js +69 -0
- package/lib/vite/traceViewer/index.LR1HufLs.js +2 -0
- package/lib/vite/traceViewer/index.Ox-CymYJ.js +2 -0
- package/lib/vite/traceViewer/index.html +3 -3
- package/lib/vite/traceViewer/sw.bundle.js +4 -4
- package/lib/vite/traceViewer/uiMode.YGPXSUMv.js +10 -0
- package/lib/vite/traceViewer/uiMode.YYFJGvtV.js +10 -0
- package/lib/vite/traceViewer/uiMode.html +3 -3
- package/package.json +1 -1
package/lib/server/frames.js
CHANGED
|
@@ -15,7 +15,7 @@ var _browserContext = require("./browserContext");
|
|
|
15
15
|
var _progress = require("./progress");
|
|
16
16
|
var _utils = require("../utils");
|
|
17
17
|
var _manualPromise = require("../utils/manualPromise");
|
|
18
|
-
var _debugLogger = require("../
|
|
18
|
+
var _debugLogger = require("../common/debugLogger");
|
|
19
19
|
var _instrumentation = require("./instrumentation");
|
|
20
20
|
var _protocolError = require("./protocolError");
|
|
21
21
|
var _selectorParser = require("../utils/isomorphic/selectorParser");
|
|
@@ -930,10 +930,9 @@ class Frame extends _instrumentation.SdkObject {
|
|
|
930
930
|
// Retry upon all other errors.
|
|
931
931
|
return false;
|
|
932
932
|
}
|
|
933
|
-
async _retryWithProgressIfNotConnected(progress, selector, strict,
|
|
933
|
+
async _retryWithProgressIfNotConnected(progress, selector, strict, action) {
|
|
934
934
|
progress.log(`waiting for ${this._asLocator(selector)}`);
|
|
935
935
|
return this.retryWithProgressAndTimeouts(progress, [0, 20, 50, 100, 100, 500], async continuePolling => {
|
|
936
|
-
if (performLocatorHandlersCheckpoint) await this._page.performLocatorHandlersCheckpoint(progress);
|
|
937
936
|
const resolved = await this.selectors.resolveInjectedForSelector(selector, {
|
|
938
937
|
strict
|
|
939
938
|
});
|
|
@@ -986,7 +985,7 @@ class Frame extends _instrumentation.SdkObject {
|
|
|
986
985
|
});
|
|
987
986
|
}
|
|
988
987
|
async rafrafTimeoutScreenshotElementWithProgress(progress, selector, timeout, options) {
|
|
989
|
-
return await this._retryWithProgressIfNotConnected(progress, selector, true /* strict */,
|
|
988
|
+
return await this._retryWithProgressIfNotConnected(progress, selector, true /* strict */, async handle => {
|
|
990
989
|
await handle._frame.rafrafTimeout(timeout);
|
|
991
990
|
return await this._page._screenshotter.screenshotElement(progress, handle, options);
|
|
992
991
|
});
|
|
@@ -994,19 +993,19 @@ class Frame extends _instrumentation.SdkObject {
|
|
|
994
993
|
async click(metadata, selector, options) {
|
|
995
994
|
const controller = new _progress.ProgressController(metadata, this);
|
|
996
995
|
return controller.run(async progress => {
|
|
997
|
-
return dom.assertDone(await this._retryWithProgressIfNotConnected(progress, selector, options.strict,
|
|
996
|
+
return dom.assertDone(await this._retryWithProgressIfNotConnected(progress, selector, options.strict, handle => handle._click(progress, options)));
|
|
998
997
|
}, this._page._timeoutSettings.timeout(options));
|
|
999
998
|
}
|
|
1000
999
|
async dblclick(metadata, selector, options = {}) {
|
|
1001
1000
|
const controller = new _progress.ProgressController(metadata, this);
|
|
1002
1001
|
return controller.run(async progress => {
|
|
1003
|
-
return dom.assertDone(await this._retryWithProgressIfNotConnected(progress, selector, options.strict,
|
|
1002
|
+
return dom.assertDone(await this._retryWithProgressIfNotConnected(progress, selector, options.strict, handle => handle._dblclick(progress, options)));
|
|
1004
1003
|
}, this._page._timeoutSettings.timeout(options));
|
|
1005
1004
|
}
|
|
1006
1005
|
async dragAndDrop(metadata, source, target, options = {}) {
|
|
1007
1006
|
const controller = new _progress.ProgressController(metadata, this);
|
|
1008
1007
|
await controller.run(async progress => {
|
|
1009
|
-
dom.assertDone(await this._retryWithProgressIfNotConnected(progress, source, options.strict,
|
|
1008
|
+
dom.assertDone(await this._retryWithProgressIfNotConnected(progress, source, options.strict, async handle => {
|
|
1010
1009
|
return handle._retryPointerAction(progress, 'move and down', false, async point => {
|
|
1011
1010
|
await this._page.mouse.move(point.x, point.y);
|
|
1012
1011
|
await this._page.mouse.down();
|
|
@@ -1016,8 +1015,7 @@ class Frame extends _instrumentation.SdkObject {
|
|
|
1016
1015
|
timeout: progress.timeUntilDeadline()
|
|
1017
1016
|
});
|
|
1018
1017
|
}));
|
|
1019
|
-
|
|
1020
|
-
dom.assertDone(await this._retryWithProgressIfNotConnected(progress, target, options.strict, false /* performLocatorHandlersCheckpoint */, async handle => {
|
|
1018
|
+
dom.assertDone(await this._retryWithProgressIfNotConnected(progress, target, options.strict, async handle => {
|
|
1021
1019
|
return handle._retryPointerAction(progress, 'move and up', false, async point => {
|
|
1022
1020
|
await this._page.mouse.move(point.x, point.y);
|
|
1023
1021
|
await this._page.mouse.up();
|
|
@@ -1033,25 +1031,25 @@ class Frame extends _instrumentation.SdkObject {
|
|
|
1033
1031
|
if (!this._page._browserContext._options.hasTouch) throw new Error('The page does not support tap. Use hasTouch context option to enable touch support.');
|
|
1034
1032
|
const controller = new _progress.ProgressController(metadata, this);
|
|
1035
1033
|
return controller.run(async progress => {
|
|
1036
|
-
return dom.assertDone(await this._retryWithProgressIfNotConnected(progress, selector, options.strict,
|
|
1034
|
+
return dom.assertDone(await this._retryWithProgressIfNotConnected(progress, selector, options.strict, handle => handle._tap(progress, options)));
|
|
1037
1035
|
}, this._page._timeoutSettings.timeout(options));
|
|
1038
1036
|
}
|
|
1039
1037
|
async fill(metadata, selector, value, options) {
|
|
1040
1038
|
const controller = new _progress.ProgressController(metadata, this);
|
|
1041
1039
|
return controller.run(async progress => {
|
|
1042
|
-
return dom.assertDone(await this._retryWithProgressIfNotConnected(progress, selector, options.strict,
|
|
1040
|
+
return dom.assertDone(await this._retryWithProgressIfNotConnected(progress, selector, options.strict, handle => handle._fill(progress, value, options)));
|
|
1043
1041
|
}, this._page._timeoutSettings.timeout(options));
|
|
1044
1042
|
}
|
|
1045
1043
|
async focus(metadata, selector, options = {}) {
|
|
1046
1044
|
const controller = new _progress.ProgressController(metadata, this);
|
|
1047
1045
|
await controller.run(async progress => {
|
|
1048
|
-
dom.assertDone(await this._retryWithProgressIfNotConnected(progress, selector, options.strict,
|
|
1046
|
+
dom.assertDone(await this._retryWithProgressIfNotConnected(progress, selector, options.strict, handle => handle._focus(progress)));
|
|
1049
1047
|
}, this._page._timeoutSettings.timeout(options));
|
|
1050
1048
|
}
|
|
1051
1049
|
async blur(metadata, selector, options = {}) {
|
|
1052
1050
|
const controller = new _progress.ProgressController(metadata, this);
|
|
1053
1051
|
await controller.run(async progress => {
|
|
1054
|
-
dom.assertDone(await this._retryWithProgressIfNotConnected(progress, selector, options.strict,
|
|
1052
|
+
dom.assertDone(await this._retryWithProgressIfNotConnected(progress, selector, options.strict, handle => handle._blur(progress)));
|
|
1055
1053
|
}, this._page._timeoutSettings.timeout(options));
|
|
1056
1054
|
}
|
|
1057
1055
|
async textContent(metadata, selector, options = {}, scope) {
|
|
@@ -1110,11 +1108,6 @@ class Frame extends _instrumentation.SdkObject {
|
|
|
1110
1108
|
const controller = new _progress.ProgressController(metadata, this);
|
|
1111
1109
|
return controller.run(async progress => {
|
|
1112
1110
|
progress.log(` checking visibility of ${this._asLocator(selector)}`);
|
|
1113
|
-
return await this.isVisibleInternal(selector, options, scope);
|
|
1114
|
-
}, this._page._timeoutSettings.timeout({}));
|
|
1115
|
-
}
|
|
1116
|
-
async isVisibleInternal(selector, options = {}, scope) {
|
|
1117
|
-
try {
|
|
1118
1111
|
const resolved = await this.selectors.resolveInjectedForSelector(selector, options, scope);
|
|
1119
1112
|
if (!resolved) return false;
|
|
1120
1113
|
return await resolved.injected.evaluate((injected, {
|
|
@@ -1128,10 +1121,10 @@ class Frame extends _instrumentation.SdkObject {
|
|
|
1128
1121
|
info: resolved.info,
|
|
1129
1122
|
root: resolved.frame === this ? scope : undefined
|
|
1130
1123
|
});
|
|
1131
|
-
} catch
|
|
1124
|
+
}, this._page._timeoutSettings.timeout({})).catch(e => {
|
|
1132
1125
|
if (js.isJavaScriptErrorInEvaluate(e) || (0, _selectorParser.isInvalidSelectorError)(e) || (0, _protocolError.isSessionClosedError)(e)) throw e;
|
|
1133
1126
|
return false;
|
|
1134
|
-
}
|
|
1127
|
+
});
|
|
1135
1128
|
}
|
|
1136
1129
|
async isHidden(metadata, selector, options = {}, scope) {
|
|
1137
1130
|
return !(await this.isVisible(metadata, selector, options, scope));
|
|
@@ -1151,44 +1144,44 @@ class Frame extends _instrumentation.SdkObject {
|
|
|
1151
1144
|
async hover(metadata, selector, options = {}) {
|
|
1152
1145
|
const controller = new _progress.ProgressController(metadata, this);
|
|
1153
1146
|
return controller.run(async progress => {
|
|
1154
|
-
return dom.assertDone(await this._retryWithProgressIfNotConnected(progress, selector, options.strict,
|
|
1147
|
+
return dom.assertDone(await this._retryWithProgressIfNotConnected(progress, selector, options.strict, handle => handle._hover(progress, options)));
|
|
1155
1148
|
}, this._page._timeoutSettings.timeout(options));
|
|
1156
1149
|
}
|
|
1157
1150
|
async selectOption(metadata, selector, elements, values, options = {}) {
|
|
1158
1151
|
const controller = new _progress.ProgressController(metadata, this);
|
|
1159
1152
|
return controller.run(async progress => {
|
|
1160
|
-
return await this._retryWithProgressIfNotConnected(progress, selector, options.strict,
|
|
1153
|
+
return await this._retryWithProgressIfNotConnected(progress, selector, options.strict, handle => handle._selectOption(progress, elements, values, options));
|
|
1161
1154
|
}, this._page._timeoutSettings.timeout(options));
|
|
1162
1155
|
}
|
|
1163
1156
|
async setInputFiles(metadata, selector, params) {
|
|
1164
1157
|
const inputFileItems = await (0, _fileUploadUtils.prepareFilesForUpload)(this, params);
|
|
1165
1158
|
const controller = new _progress.ProgressController(metadata, this);
|
|
1166
1159
|
return controller.run(async progress => {
|
|
1167
|
-
return dom.assertDone(await this._retryWithProgressIfNotConnected(progress, selector, params.strict,
|
|
1160
|
+
return dom.assertDone(await this._retryWithProgressIfNotConnected(progress, selector, params.strict, handle => handle._setInputFiles(progress, inputFileItems, params)));
|
|
1168
1161
|
}, this._page._timeoutSettings.timeout(params));
|
|
1169
1162
|
}
|
|
1170
1163
|
async type(metadata, selector, text, options = {}) {
|
|
1171
1164
|
const controller = new _progress.ProgressController(metadata, this);
|
|
1172
1165
|
return controller.run(async progress => {
|
|
1173
|
-
return dom.assertDone(await this._retryWithProgressIfNotConnected(progress, selector, options.strict,
|
|
1166
|
+
return dom.assertDone(await this._retryWithProgressIfNotConnected(progress, selector, options.strict, handle => handle._type(progress, text, options)));
|
|
1174
1167
|
}, this._page._timeoutSettings.timeout(options));
|
|
1175
1168
|
}
|
|
1176
1169
|
async press(metadata, selector, key, options = {}) {
|
|
1177
1170
|
const controller = new _progress.ProgressController(metadata, this);
|
|
1178
1171
|
return controller.run(async progress => {
|
|
1179
|
-
return dom.assertDone(await this._retryWithProgressIfNotConnected(progress, selector, options.strict,
|
|
1172
|
+
return dom.assertDone(await this._retryWithProgressIfNotConnected(progress, selector, options.strict, handle => handle._press(progress, key, options)));
|
|
1180
1173
|
}, this._page._timeoutSettings.timeout(options));
|
|
1181
1174
|
}
|
|
1182
1175
|
async check(metadata, selector, options = {}) {
|
|
1183
1176
|
const controller = new _progress.ProgressController(metadata, this);
|
|
1184
1177
|
return controller.run(async progress => {
|
|
1185
|
-
return dom.assertDone(await this._retryWithProgressIfNotConnected(progress, selector, options.strict,
|
|
1178
|
+
return dom.assertDone(await this._retryWithProgressIfNotConnected(progress, selector, options.strict, handle => handle._setChecked(progress, true, options)));
|
|
1186
1179
|
}, this._page._timeoutSettings.timeout(options));
|
|
1187
1180
|
}
|
|
1188
1181
|
async uncheck(metadata, selector, options = {}) {
|
|
1189
1182
|
const controller = new _progress.ProgressController(metadata, this);
|
|
1190
1183
|
return controller.run(async progress => {
|
|
1191
|
-
return dom.assertDone(await this._retryWithProgressIfNotConnected(progress, selector, options.strict,
|
|
1184
|
+
return dom.assertDone(await this._retryWithProgressIfNotConnected(progress, selector, options.strict, handle => handle._setChecked(progress, false, options)));
|
|
1192
1185
|
}, this._page._timeoutSettings.timeout(options));
|
|
1193
1186
|
}
|
|
1194
1187
|
async waitForTimeout(metadata, timeout) {
|
|
@@ -1198,17 +1191,6 @@ class Frame extends _instrumentation.SdkObject {
|
|
|
1198
1191
|
});
|
|
1199
1192
|
}
|
|
1200
1193
|
async expect(metadata, selector, options) {
|
|
1201
|
-
const result = await this._expectImpl(metadata, selector, options);
|
|
1202
|
-
// Library mode special case for the expect errors which are return values, not exceptions.
|
|
1203
|
-
if (result.matches === options.isNot) metadata.error = {
|
|
1204
|
-
error: {
|
|
1205
|
-
name: 'Expect',
|
|
1206
|
-
message: 'Expect failed'
|
|
1207
|
-
}
|
|
1208
|
-
};
|
|
1209
|
-
return result;
|
|
1210
|
-
}
|
|
1211
|
-
async _expectImpl(metadata, selector, options) {
|
|
1212
1194
|
let timeout = this._page._timeoutSettings.timeout(options);
|
|
1213
1195
|
const start = timeout > 0 ? (0, _utils.monotonicTime)() : 0;
|
|
1214
1196
|
const lastIntermediateResult = {
|
|
@@ -1237,7 +1219,6 @@ class Frame extends _instrumentation.SdkObject {
|
|
|
1237
1219
|
}
|
|
1238
1220
|
return await this.retryWithProgressAndTimeouts(progress, [100, 250, 500, 1000], async continuePolling => {
|
|
1239
1221
|
var _info$world;
|
|
1240
|
-
await this._page.performLocatorHandlersCheckpoint(progress);
|
|
1241
1222
|
const selectorInFrame = await this.selectors.resolveFrameForSelector(selector, {
|
|
1242
1223
|
strict: true
|
|
1243
1224
|
});
|
package/lib/server/helper.js
CHANGED
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.helper = void 0;
|
|
7
|
-
var _debugLogger = require("../
|
|
7
|
+
var _debugLogger = require("../common/debugLogger");
|
|
8
8
|
var _eventsHelper = require("../utils/eventsHelper");
|
|
9
9
|
/**
|
|
10
10
|
* Copyright 2017 Google Inc. All rights reserved.
|
package/lib/server/page.js
CHANGED
|
@@ -17,13 +17,12 @@ var _fileChooser = require("./fileChooser");
|
|
|
17
17
|
var _progress = require("./progress");
|
|
18
18
|
var _utils = require("../utils");
|
|
19
19
|
var _manualPromise = require("../utils/manualPromise");
|
|
20
|
-
var _debugLogger = require("../
|
|
20
|
+
var _debugLogger = require("../common/debugLogger");
|
|
21
21
|
var _comparators = require("../utils/comparators");
|
|
22
22
|
var _instrumentation = require("./instrumentation");
|
|
23
23
|
var _selectorParser = require("../utils/isomorphic/selectorParser");
|
|
24
24
|
var _utilityScriptSerializers = require("./isomorphic/utilityScriptSerializers");
|
|
25
25
|
var _errors = require("./errors");
|
|
26
|
-
var _locatorGenerators = require("../utils/isomorphic/locatorGenerators");
|
|
27
26
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
28
27
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
29
28
|
/**
|
|
@@ -77,9 +76,6 @@ class Page extends _instrumentation.SdkObject {
|
|
|
77
76
|
this._video = null;
|
|
78
77
|
this._opener = void 0;
|
|
79
78
|
this._isServerSideOnly = false;
|
|
80
|
-
this._locatorHandlers = new Map();
|
|
81
|
-
this._lastLocatorHandlerUid = 0;
|
|
82
|
-
this._locatorHandlerRunningCounter = 0;
|
|
83
79
|
// Aiming at 25 fps by default - each frame is 40ms, but we give some slack with 35ms.
|
|
84
80
|
// When throttling for tracing, 200ms between frames, except for 10 frames around the action.
|
|
85
81
|
this._frameThrottler = new FrameThrottler(10, 35, 200);
|
|
@@ -143,7 +139,6 @@ class Page extends _instrumentation.SdkObject {
|
|
|
143
139
|
async resetForReuse(metadata) {
|
|
144
140
|
this.setDefaultNavigationTimeout(undefined);
|
|
145
141
|
this.setDefaultTimeout(undefined);
|
|
146
|
-
this._locatorHandlers.clear();
|
|
147
142
|
await this._removeExposedBindings();
|
|
148
143
|
await this._removeInitScripts();
|
|
149
144
|
await this.setClientRequestInterceptor(undefined);
|
|
@@ -287,43 +282,6 @@ class Page extends _instrumentation.SdkObject {
|
|
|
287
282
|
return response;
|
|
288
283
|
}), this._timeoutSettings.navigationTimeout(options));
|
|
289
284
|
}
|
|
290
|
-
registerLocatorHandler(selector) {
|
|
291
|
-
const uid = ++this._lastLocatorHandlerUid;
|
|
292
|
-
this._locatorHandlers.set(uid, {
|
|
293
|
-
selector
|
|
294
|
-
});
|
|
295
|
-
return uid;
|
|
296
|
-
}
|
|
297
|
-
resolveLocatorHandler(uid) {
|
|
298
|
-
const handler = this._locatorHandlers.get(uid);
|
|
299
|
-
if (handler) {
|
|
300
|
-
var _handler$resolved;
|
|
301
|
-
(_handler$resolved = handler.resolved) === null || _handler$resolved === void 0 || _handler$resolved.resolve();
|
|
302
|
-
handler.resolved = undefined;
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
async performLocatorHandlersCheckpoint(progress) {
|
|
306
|
-
// Do not run locator handlers from inside locator handler callbacks to avoid deadlocks.
|
|
307
|
-
if (this._locatorHandlerRunningCounter) return;
|
|
308
|
-
for (const [uid, handler] of this._locatorHandlers) {
|
|
309
|
-
if (!handler.resolved) {
|
|
310
|
-
if (await this.mainFrame().isVisibleInternal(handler.selector, {
|
|
311
|
-
strict: true
|
|
312
|
-
})) {
|
|
313
|
-
handler.resolved = new _manualPromise.ManualPromise();
|
|
314
|
-
this.emit(Page.Events.LocatorHandlerTriggered, uid);
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
if (handler.resolved) {
|
|
318
|
-
++this._locatorHandlerRunningCounter;
|
|
319
|
-
progress.log(` found ${(0, _locatorGenerators.asLocator)(this.attribution.playwright.options.sdkLanguage, handler.selector)}, intercepting action to run the handler`);
|
|
320
|
-
await this.openScope.race(handler.resolved).finally(() => --this._locatorHandlerRunningCounter);
|
|
321
|
-
// Avoid side-effects after long-running operation.
|
|
322
|
-
progress.throwIfAborted();
|
|
323
|
-
progress.log(` interception handler has finished, continuing`);
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
285
|
async emulateMedia(options) {
|
|
328
286
|
if (options.media !== undefined) this._emulatedMedia.media = options.media;
|
|
329
287
|
if (options.colorScheme !== undefined) this._emulatedMedia.colorScheme = options.colorScheme;
|
|
@@ -389,11 +347,10 @@ class Page extends _instrumentation.SdkObject {
|
|
|
389
347
|
async expectScreenshot(metadata, options = {}) {
|
|
390
348
|
const locator = options.locator;
|
|
391
349
|
const rafrafScreenshot = locator ? async (progress, timeout) => {
|
|
392
|
-
return await locator.frame.rafrafTimeoutScreenshotElementWithProgress(progress, locator.selector, timeout, options || {});
|
|
350
|
+
return await locator.frame.rafrafTimeoutScreenshotElementWithProgress(progress, locator.selector, timeout, options.screenshotOptions || {});
|
|
393
351
|
} : async (progress, timeout) => {
|
|
394
|
-
await this.performLocatorHandlersCheckpoint(progress);
|
|
395
352
|
await this.mainFrame().rafrafTimeout(timeout);
|
|
396
|
-
return await this._screenshotter.screenshotPage(progress, options || {});
|
|
353
|
+
return await this._screenshotter.screenshotPage(progress, options.screenshotOptions || {});
|
|
397
354
|
};
|
|
398
355
|
const comparator = (0, _comparators.getComparator)('image/png');
|
|
399
356
|
const controller = new _progress.ProgressController(metadata, this);
|
|
@@ -401,7 +358,7 @@ class Page extends _instrumentation.SdkObject {
|
|
|
401
358
|
errorMessage: '"not" matcher requires expected result'
|
|
402
359
|
};
|
|
403
360
|
try {
|
|
404
|
-
const format = (0, _screenshotter.validateScreenshotOptions)(options || {});
|
|
361
|
+
const format = (0, _screenshotter.validateScreenshotOptions)(options.screenshotOptions || {});
|
|
405
362
|
if (format !== 'png') throw new Error('Only PNG screenshots are supported');
|
|
406
363
|
} catch (error) {
|
|
407
364
|
return {
|
|
@@ -410,7 +367,7 @@ class Page extends _instrumentation.SdkObject {
|
|
|
410
367
|
}
|
|
411
368
|
let intermediateResult = undefined;
|
|
412
369
|
const areEqualScreenshots = (actual, expected, previous) => {
|
|
413
|
-
const comparatorResult = actual && expected ? comparator(actual, expected, options) : undefined;
|
|
370
|
+
const comparatorResult = actual && expected ? comparator(actual, expected, options.comparatorOptions) : undefined;
|
|
414
371
|
if (comparatorResult !== undefined && !!comparatorResult === !!options.isNot) return true;
|
|
415
372
|
if (comparatorResult) intermediateResult = {
|
|
416
373
|
errorMessage: comparatorResult.errorMessage,
|
|
@@ -563,7 +520,6 @@ Page.Events = {
|
|
|
563
520
|
FrameAttached: 'frameattached',
|
|
564
521
|
FrameDetached: 'framedetached',
|
|
565
522
|
InternalFrameNavigatedToNewDocument: 'internalframenavigatedtonewdocument',
|
|
566
|
-
LocatorHandlerTriggered: 'locatorhandlertriggered',
|
|
567
523
|
ScreencastFrame: 'screencastframe',
|
|
568
524
|
Video: 'video',
|
|
569
525
|
WebSocket: 'websocket',
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.PipeTransport = void 0;
|
|
7
7
|
var _utils = require("../utils");
|
|
8
|
-
var _debugLogger = require("../
|
|
8
|
+
var _debugLogger = require("../common/debugLogger");
|
|
9
9
|
/**
|
|
10
10
|
* Copyright 2018 Google Inc. All rights reserved.
|
|
11
11
|
* Modifications copyright (c) Microsoft Corporation.
|
package/lib/server/playwright.js
CHANGED
|
@@ -13,7 +13,7 @@ var _firefox = require("./firefox/firefox");
|
|
|
13
13
|
var _selectors = require("./selectors");
|
|
14
14
|
var _webkit = require("./webkit/webkit");
|
|
15
15
|
var _instrumentation = require("./instrumentation");
|
|
16
|
-
var _debugLogger = require("../
|
|
16
|
+
var _debugLogger = require("../common/debugLogger");
|
|
17
17
|
var _debugController = require("./debugController");
|
|
18
18
|
/**
|
|
19
19
|
* Copyright (c) Microsoft Corporation.
|
package/lib/server/progress.js
CHANGED
|
@@ -57,9 +57,17 @@ class ProgressController {
|
|
|
57
57
|
(_this$sdkObject$attri = this.sdkObject.attribution.context) === null || _this$sdkObject$attri === void 0 || _this$sdkObject$attri._activeProgressControllers.add(this);
|
|
58
58
|
const progress = {
|
|
59
59
|
log: message => {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
60
|
+
progress.logEntry({
|
|
61
|
+
message
|
|
62
|
+
});
|
|
63
|
+
},
|
|
64
|
+
logEntry: entry => {
|
|
65
|
+
if ('message' in entry) {
|
|
66
|
+
const message = entry.message;
|
|
67
|
+
if (this._state === 'running') this.metadata.log.push(message);
|
|
68
|
+
// Note: we might be sending logs after progress has finished, for example browser logs.
|
|
69
|
+
this.instrumentation.onCallLog(this.sdkObject, this.metadata, this._logName, message);
|
|
70
|
+
}
|
|
63
71
|
},
|
|
64
72
|
timeUntilDeadline: () => this._deadline ? this._deadline - (0, _utils.monotonicTime)() : 2147483647,
|
|
65
73
|
// 2^31-1 safe setTimeout in Node.
|
|
@@ -138,7 +138,7 @@ class CSharpLanguageGenerator {
|
|
|
138
138
|
return `await Expect(${subject}.${this._asLocator(action.selector)}).ToBeVisibleAsync();`;
|
|
139
139
|
case 'assertValue':
|
|
140
140
|
{
|
|
141
|
-
const assertion = action.value ? `ToHaveValueAsync(${quote(action.value)})` : `
|
|
141
|
+
const assertion = action.value ? `ToHaveValueAsync(${quote(action.value)})` : `ToBeEmpty()`;
|
|
142
142
|
return `await Expect(${subject}.${this._asLocator(action.selector)}).${assertion};`;
|
|
143
143
|
}
|
|
144
144
|
}
|
package/lib/server/recorder.js
CHANGED
|
@@ -690,7 +690,7 @@ async function findFrameSelector(frame) {
|
|
|
690
690
|
const utility = await parent._utilityContext();
|
|
691
691
|
const injected = await utility.injectedScript();
|
|
692
692
|
const selector = await injected.evaluate((injected, element) => {
|
|
693
|
-
return injected.
|
|
693
|
+
return injected.generateSelector(element, {
|
|
694
694
|
testIdAttributeName: '',
|
|
695
695
|
omitInternalEngines: true
|
|
696
696
|
});
|
|
@@ -10,7 +10,7 @@ var _os = _interopRequireDefault(require("os"));
|
|
|
10
10
|
var _path = _interopRequireDefault(require("path"));
|
|
11
11
|
var _child_process = _interopRequireDefault(require("child_process"));
|
|
12
12
|
var _fileUtils = require("../../utils/fileUtils");
|
|
13
|
-
var _debugLogger = require("../../
|
|
13
|
+
var _debugLogger = require("../../common/debugLogger");
|
|
14
14
|
var _manualPromise = require("../../utils/manualPromise");
|
|
15
15
|
var _utilsBundle = require("../../utilsBundle");
|
|
16
16
|
var _ = require(".");
|
|
@@ -166,7 +166,7 @@ async function validateDependenciesWindows(windowsExeAndDllDirectories) {
|
|
|
166
166
|
}
|
|
167
167
|
}
|
|
168
168
|
async function validateDependenciesLinux(sdkLanguage, linuxLddDirectories, dlOpenLibraries) {
|
|
169
|
-
var _deps$hostPlatform
|
|
169
|
+
var _deps$hostPlatform;
|
|
170
170
|
const directoryPaths = linuxLddDirectories;
|
|
171
171
|
const lddPaths = [];
|
|
172
172
|
for (const directoryPath of directoryPaths) lddPaths.push(...(await executablesOrSharedLibraries(directoryPath)));
|
|
@@ -192,7 +192,7 @@ async function validateDependenciesLinux(sdkLanguage, linuxLddDirectories, dlOpe
|
|
|
192
192
|
missingDeps.delete(missingDep);
|
|
193
193
|
}
|
|
194
194
|
}
|
|
195
|
-
const maybeSudo =
|
|
195
|
+
const maybeSudo = process.getuid() !== 0 && os.platform() !== 'win32' ? 'sudo ' : '';
|
|
196
196
|
const dockerInfo = readDockerVersionSync();
|
|
197
197
|
const errorLines = [`Host system is missing dependencies to run browsers.`];
|
|
198
198
|
// Ignore patch versions when comparing docker container version and Playwright version:
|
|
@@ -202,7 +202,7 @@ async function validateDependenciesLinux(sdkLanguage, linuxLddDirectories, dlOpe
|
|
|
202
202
|
// In this case, we know how to install dependencies in it.
|
|
203
203
|
const pwVersion = (0, _userAgent.getPlaywrightVersion)();
|
|
204
204
|
const requiredDockerImage = dockerInfo.dockerImageName.replace(dockerInfo.driverVersion, pwVersion);
|
|
205
|
-
errorLines.push(...[`This is most likely due to
|
|
205
|
+
errorLines.push(...[`This is most likely due to docker image version not matching Playwright version:`, `- Playwright: ${pwVersion}`, `- Docker: ${dockerInfo.driverVersion}`, ``, `Either:`, `- (recommended) use docker image "${requiredDockerImage}"`, `- (alternative 1) run the following command inside docker to install missing dependencies:`, ``, ` ${maybeSudo}${(0, _.buildPlaywrightCLICommand)(sdkLanguage, 'install-deps')}`, ``, `- (alternative 2) use apt inside docker:`, ``, ` ${maybeSudo}apt-get install ${[...missingPackages].join('\\\n ')}`, ``, `<3 Playwright Team`]);
|
|
206
206
|
} else if (missingPackages.size && !missingDeps.size) {
|
|
207
207
|
// Only known dependencies are missing for browsers.
|
|
208
208
|
// Suggest installation with a Playwright CLI.
|
|
@@ -301,8 +301,7 @@ function quoteProcessArgs(args) {
|
|
|
301
301
|
});
|
|
302
302
|
}
|
|
303
303
|
async function transformCommandsForRoot(commands) {
|
|
304
|
-
|
|
305
|
-
const isRoot = ((_process$getuid2 = (_process2 = process).getuid) === null || _process$getuid2 === void 0 ? void 0 : _process$getuid2.call(_process2)) === 0;
|
|
304
|
+
const isRoot = process.getuid() === 0;
|
|
306
305
|
if (isRoot) return {
|
|
307
306
|
command: 'sh',
|
|
308
307
|
args: ['-c', `${commands.join('&& ')}`],
|