@mablhq/mabl-cli 1.21.1 → 1.21.6
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/browserLauncher/playwrightBrowserLauncher/playwrightBrowser.js +4 -3
- package/browserLauncher/playwrightBrowserLauncher/playwrightBrowserLauncher.js +1 -1
- package/browserLauncher/playwrightBrowserLauncher/playwrightPage.js +5 -0
- package/commands/tests/testsUtil.js +6 -3
- package/execution/index.js +1 -1
- package/mablscriptFind/index.js +1 -1
- package/package.json +1 -1
- package/resources/mablFind.js +1 -1
- package/util/asyncUtil.js +10 -1
|
@@ -35,11 +35,12 @@ const path_1 = __importDefault(require("path"));
|
|
|
35
35
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
36
36
|
const runnerType_1 = require("../runnerType");
|
|
37
37
|
class PlaywrightBrowser extends events_1.default {
|
|
38
|
-
constructor(defaultContext, downloadDirectory, browserWSEndpoint) {
|
|
38
|
+
constructor(defaultContext, downloadDirectory, browserWSEndpoint, disableFocusEmulation) {
|
|
39
39
|
super();
|
|
40
40
|
this.defaultContext = defaultContext;
|
|
41
41
|
this.downloadDirectory = downloadDirectory;
|
|
42
42
|
this.browserWSEndpoint = browserWSEndpoint;
|
|
43
|
+
this.disableFocusEmulation = disableFocusEmulation;
|
|
43
44
|
this.playwrightPages = new Map();
|
|
44
45
|
const contextImpl = playwright._toImpl(defaultContext);
|
|
45
46
|
this.browser = contextImpl._browser;
|
|
@@ -54,8 +55,8 @@ class PlaywrightBrowser extends events_1.default {
|
|
|
54
55
|
fs_extra_1.default.mkdirSync(path_1.default.join(this.downloadDirectory));
|
|
55
56
|
}
|
|
56
57
|
}
|
|
57
|
-
static async create(defaultContext, downloadDirectory, browserWSEndpoint) {
|
|
58
|
-
const browser = new PlaywrightBrowser(defaultContext, downloadDirectory, browserWSEndpoint);
|
|
58
|
+
static async create(defaultContext, downloadDirectory, browserWSEndpoint, disableFocusEmulation) {
|
|
59
|
+
const browser = new PlaywrightBrowser(defaultContext, downloadDirectory, browserWSEndpoint, disableFocusEmulation);
|
|
59
60
|
await browser.setDownloadBehavior();
|
|
60
61
|
return browser;
|
|
61
62
|
}
|
|
@@ -36,7 +36,7 @@ class PlaywrightBrowserLauncher {
|
|
|
36
36
|
userAgent: options.userAgent,
|
|
37
37
|
viewport,
|
|
38
38
|
});
|
|
39
|
-
return playwrightBrowser_1.PlaywrightBrowser.create(defaultContext, options.downloadPath, '');
|
|
39
|
+
return playwrightBrowser_1.PlaywrightBrowser.create(defaultContext, options.downloadPath, '', options.disableFocusEmulation);
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
exports.PlaywrightBrowserLauncher = PlaywrightBrowserLauncher;
|
|
@@ -72,6 +72,11 @@ class PlaywrightPage extends events_1.default {
|
|
|
72
72
|
async waitForInitialization() {
|
|
73
73
|
this.openerPage = await (0, utils_1.mapIfNotNull)(await this.page.opener(), (page) => this.browser.getOrCreatePage(page));
|
|
74
74
|
this.fallbackCdpSession = await this.createFallbackCdpSession();
|
|
75
|
+
if (this.browser.disableFocusEmulation) {
|
|
76
|
+
await this.makeCdpCall('Emulation.setFocusEmulationEnabled', {
|
|
77
|
+
enabled: false,
|
|
78
|
+
});
|
|
79
|
+
}
|
|
75
80
|
}
|
|
76
81
|
on(event, listener) {
|
|
77
82
|
this.wireEvents(event);
|
|
@@ -138,12 +138,13 @@ async function createBrowserWithAuthedExtension(accessToken, browserWidth, brows
|
|
|
138
138
|
}
|
|
139
139
|
exports.createBrowserWithAuthedExtension = createBrowserWithAuthedExtension;
|
|
140
140
|
async function launchBrowserInstance(chromePath, launchArgs, userDataDir, headless, credentials, options) {
|
|
141
|
-
const { bypassContentSecurityPolicy, defaultDeviceDescriptor, extraHttpHeaders, ignoreDefaultArgs, runnerType, loggerFunc, userAgent, } = options || {};
|
|
141
|
+
const { bypassContentSecurityPolicy, defaultDeviceDescriptor, disableFocusEmulation, extraHttpHeaders, ignoreDefaultArgs, runnerType, loggerFunc, userAgent, } = options || {};
|
|
142
142
|
let browser;
|
|
143
143
|
try {
|
|
144
144
|
browser = await maybeLaunchBrowser(chromePath, launchArgs, userDataDir, headless, credentials, {
|
|
145
145
|
bypassContentSecurityPolicy,
|
|
146
146
|
defaultDeviceDescriptor,
|
|
147
|
+
disableFocusEmulation,
|
|
147
148
|
extraHttpHeaders,
|
|
148
149
|
ignoreDefaultArgs,
|
|
149
150
|
runnerType,
|
|
@@ -171,10 +172,11 @@ async function launchBrowserInstance(chromePath, launchArgs, userDataDir, headle
|
|
|
171
172
|
return browser;
|
|
172
173
|
}
|
|
173
174
|
function maybeLaunchBrowser(chromePath, launchArgs, userDataDir, headless, credentials, options) {
|
|
174
|
-
const { bypassContentSecurityPolicy, defaultDeviceDescriptor, extraHttpHeaders, ignoreDefaultArgs, runnerType, loggerFunc, userAgent, } = options || {};
|
|
175
|
+
const { bypassContentSecurityPolicy, defaultDeviceDescriptor, disableFocusEmulation, extraHttpHeaders, ignoreDefaultArgs, runnerType, loggerFunc, userAgent, } = options || {};
|
|
175
176
|
return browserLauncher_1.BrowserLauncherFactory.createRunner(runnerType, loggerFunc).launch({
|
|
176
177
|
bypassContentSecurityPolicy,
|
|
177
178
|
defaultDeviceDescriptor,
|
|
179
|
+
disableFocusEmulation,
|
|
178
180
|
executablePath: chromePath,
|
|
179
181
|
extraHttpHeaders,
|
|
180
182
|
headless,
|
|
@@ -208,7 +210,7 @@ function removeTempBrowserPreferencesDirectory(tempDirPath) {
|
|
|
208
210
|
}
|
|
209
211
|
}
|
|
210
212
|
async function createBrowser(browserWidth, browserHeight, headless, containerTesting, tempBrowserPreferencesDirectory, options) {
|
|
211
|
-
const { bypassContentSecurityPolicy, credentials, browserPath, disableIsolation, extraHttpHeaders, ignoreCertificateErrors, emulationConfig, enableExtensions, runnerType, loggerFunc, resourcesDirectoryOverride, userAgent, } = options || {};
|
|
213
|
+
const { bypassContentSecurityPolicy, credentials, browserPath, disableFocusEmulation, disableIsolation, extraHttpHeaders, ignoreCertificateErrors, emulationConfig, enableExtensions, runnerType, loggerFunc, resourcesDirectoryOverride, userAgent, } = options || {};
|
|
212
214
|
const chromePath = browserPath !== null && browserPath !== void 0 ? browserPath : (await findChrome());
|
|
213
215
|
if (!chromePath.length) {
|
|
214
216
|
messaging_1.mablEventEmitter.log(chalk.yellow('Could not find a local install of Chrome to use, please ensure you have it installed and try again'));
|
|
@@ -234,6 +236,7 @@ async function createBrowser(browserWidth, browserHeight, headless, containerTes
|
|
|
234
236
|
const maybeBrowser = await launchBrowserInstance(chromePath, launchArgs, tempBrowserPreferencesDirectory, headless, credentials, {
|
|
235
237
|
bypassContentSecurityPolicy,
|
|
236
238
|
defaultDeviceDescriptor,
|
|
239
|
+
disableFocusEmulation,
|
|
237
240
|
extraHttpHeaders,
|
|
238
241
|
ignoreDefaultArgs,
|
|
239
242
|
runnerType,
|