@intuned/runtime-dev 1.3.25-sm.0 → 1.3.27-dev1
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/CHANGELOG.md +3 -2
- package/dist/common/intunedJson.js +1 -1
- package/dist/common/launchBrowser.d.ts +2 -0
- package/dist/common/launchBrowser.js +20 -12
- package/dist/common/playwrightContext.d.ts +2 -0
- package/dist/common/playwrightContext.js +9 -4
- package/dist/common/runApi/index.js +2 -0
- package/dist/vendor/runtime-interface.js +4 -2
- package/package.json +1 -1
- package/template.tsconfig.json +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
# UNRELEASED
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
# 1.3.26
|
|
4
|
+
|
|
5
|
+
- change default browser dimensions
|
|
5
6
|
|
|
6
7
|
# 1.3.11
|
|
7
8
|
|
|
@@ -22,11 +22,13 @@ export type LaunchChromiumStandaloneOptions = {
|
|
|
22
22
|
appModeInitialUrl?: string;
|
|
23
23
|
executablePath?: string;
|
|
24
24
|
ignoreHttpErrors?: boolean;
|
|
25
|
+
profileTemplatePath?: string;
|
|
25
26
|
timeout?: number;
|
|
26
27
|
};
|
|
27
28
|
export type LaunchChromiumCdpOptions = {
|
|
28
29
|
cdpAddress: string;
|
|
29
30
|
cdpTargetId?: string;
|
|
31
|
+
profileTemplatePath?: string;
|
|
30
32
|
timeout?: number;
|
|
31
33
|
};
|
|
32
34
|
export declare function launchChromium(options: LaunchChromiumStandaloneOptions): Promise<LaunchBrowserResult>;
|
|
@@ -34,23 +34,30 @@ function getMacKeychainBypassArgs() {
|
|
|
34
34
|
}
|
|
35
35
|
return ["--use-mock-keychain", "--password-store=basic"];
|
|
36
36
|
}
|
|
37
|
-
|
|
37
|
+
const DEFAULT_USER_PREFERENCES = {
|
|
38
|
+
plugins: {
|
|
39
|
+
always_open_pdf_externally: true
|
|
40
|
+
},
|
|
41
|
+
credentials_enable_service: false,
|
|
42
|
+
profile: {
|
|
43
|
+
password_manager_enabled: false
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
async function createUserDirWithPreferences(profileTemplatePath) {
|
|
38
47
|
const playwrightTempDir = await (0, _fsExtra.mkdtemp)("/tmp/pw-");
|
|
39
48
|
const userDir = (0, _path.join)(playwrightTempDir, "userdir");
|
|
49
|
+
if (profileTemplatePath && (await fs.pathExists(profileTemplatePath))) {
|
|
50
|
+
await fs.copy(profileTemplatePath, userDir, {
|
|
51
|
+
overwrite: true,
|
|
52
|
+
errorOnExist: false
|
|
53
|
+
});
|
|
54
|
+
return userDir;
|
|
55
|
+
}
|
|
40
56
|
const defaultDir = (0, _path.join)(userDir, "Default");
|
|
41
57
|
await (0, _fsExtra.mkdir)(defaultDir, {
|
|
42
58
|
recursive: true
|
|
43
59
|
});
|
|
44
|
-
|
|
45
|
-
plugins: {
|
|
46
|
-
always_open_pdf_externally: true
|
|
47
|
-
},
|
|
48
|
-
credentials_enable_service: false,
|
|
49
|
-
profile: {
|
|
50
|
-
password_manager_enabled: false
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
await (0, _fsExtra.writeFile)((0, _path.join)(defaultDir, "Preferences"), JSON.stringify(preferences));
|
|
60
|
+
await (0, _fsExtra.writeFile)((0, _path.join)(defaultDir, "Preferences"), JSON.stringify(DEFAULT_USER_PREFERENCES));
|
|
54
61
|
return userDir;
|
|
55
62
|
}
|
|
56
63
|
async function getIgnoreHttpErrorsFromConfig(cliOption) {
|
|
@@ -105,6 +112,7 @@ async function launchChromium(options) {
|
|
|
105
112
|
proxy,
|
|
106
113
|
downloadsPath,
|
|
107
114
|
ignoreHttpErrors: ignoreHttpErrorsParam,
|
|
115
|
+
profileTemplatePath,
|
|
108
116
|
timeout
|
|
109
117
|
} = options;
|
|
110
118
|
let {
|
|
@@ -119,7 +127,7 @@ async function launchChromium(options) {
|
|
|
119
127
|
if (stealthConfig.enabled) {
|
|
120
128
|
extraArgs.push("--stealth-mode");
|
|
121
129
|
}
|
|
122
|
-
const userDataDir = await createUserDirWithPreferences();
|
|
130
|
+
const userDataDir = await createUserDirWithPreferences(profileTemplatePath);
|
|
123
131
|
if ((0, _extensionsHelpers.isIntunedExtensionLoaded)()) {
|
|
124
132
|
const extensionsList = (0, _extensionsHelpers.buildExtensionsList)();
|
|
125
133
|
const extensions = extensionsList.join(",");
|
|
@@ -18,10 +18,12 @@ export declare function withPlaywrightContext<R>(options: {
|
|
|
18
18
|
headless: boolean;
|
|
19
19
|
downloadsPath: string;
|
|
20
20
|
ignoreHttpErrors?: boolean;
|
|
21
|
+
profileTemplatePath?: string;
|
|
21
22
|
} & WithPlaywrightContextParameters, fn: WithPlaywrightContextWrappedFunction<R>): Promise<Ok<R, any> | Err<any, RunAutomationError>>;
|
|
22
23
|
export declare function withPlaywrightContext<R>(options: {
|
|
23
24
|
cdpAddress: string;
|
|
24
25
|
cdpTargetId?: string;
|
|
26
|
+
profileTemplatePath?: string;
|
|
25
27
|
} & WithPlaywrightContextParameters, fn: WithPlaywrightContextWrappedFunction<R>): Promise<Ok<R, any> | Err<any, RunAutomationError>>;
|
|
26
28
|
export declare function loadSessionToContext({ context, session, }: {
|
|
27
29
|
context: playwright.BrowserContext;
|
|
@@ -21,6 +21,7 @@ async function withPlaywrightContext({
|
|
|
21
21
|
headless = true,
|
|
22
22
|
downloadsPath,
|
|
23
23
|
ignoreHttpErrors: cliIgnoreHttpErrors,
|
|
24
|
+
profileTemplatePath,
|
|
24
25
|
importFunction,
|
|
25
26
|
apiName,
|
|
26
27
|
apiParameters
|
|
@@ -43,7 +44,8 @@ async function withPlaywrightContext({
|
|
|
43
44
|
context
|
|
44
45
|
} = await (0, _launchBrowser.launchBrowser)({
|
|
45
46
|
cdpAddress,
|
|
46
|
-
cdpTargetId
|
|
47
|
+
cdpTargetId,
|
|
48
|
+
profileTemplatePath
|
|
47
49
|
}));
|
|
48
50
|
} else {
|
|
49
51
|
({
|
|
@@ -53,7 +55,8 @@ async function withPlaywrightContext({
|
|
|
53
55
|
proxy,
|
|
54
56
|
headless,
|
|
55
57
|
downloadsPath,
|
|
56
|
-
ignoreHttpErrors
|
|
58
|
+
ignoreHttpErrors,
|
|
59
|
+
profileTemplatePath
|
|
57
60
|
}));
|
|
58
61
|
}
|
|
59
62
|
return await fn(context, page);
|
|
@@ -66,7 +69,8 @@ async function withPlaywrightContext({
|
|
|
66
69
|
page
|
|
67
70
|
} = await (0, _launchBrowser.launchBrowser)({
|
|
68
71
|
cdpAddress,
|
|
69
|
-
cdpTargetId
|
|
72
|
+
cdpTargetId,
|
|
73
|
+
profileTemplatePath
|
|
70
74
|
}));
|
|
71
75
|
} else {
|
|
72
76
|
const port = await (0, _portfinder.getPort)({
|
|
@@ -80,7 +84,8 @@ async function withPlaywrightContext({
|
|
|
80
84
|
headless,
|
|
81
85
|
downloadsPath,
|
|
82
86
|
cdpPort: port,
|
|
83
|
-
ignoreHttpErrors
|
|
87
|
+
ignoreHttpErrors,
|
|
88
|
+
profileTemplatePath
|
|
84
89
|
}));
|
|
85
90
|
hookCdpUrl = (0, _launchBrowser.getLocalCdpAddress)(port);
|
|
86
91
|
}
|
|
@@ -148,6 +148,7 @@ async function runApi({
|
|
|
148
148
|
proxy: runOptions.proxy,
|
|
149
149
|
downloadsPath,
|
|
150
150
|
ignoreHttpErrors: runOptions.ignoreHttpErrors,
|
|
151
|
+
profileTemplatePath: runOptions.profileTemplatePath,
|
|
151
152
|
...playwrightContextParameters
|
|
152
153
|
}, runAutomationWithContext);
|
|
153
154
|
} finally {
|
|
@@ -157,6 +158,7 @@ async function runApi({
|
|
|
157
158
|
return await (0, _playwrightContext.withPlaywrightContext)({
|
|
158
159
|
cdpAddress: runOptions.cdpAddress,
|
|
159
160
|
cdpTargetId: runOptions.cdpTargetId,
|
|
161
|
+
profileTemplatePath: runOptions.profileTemplatePath,
|
|
160
162
|
...playwrightContextParameters
|
|
161
163
|
}, runAutomationWithContext);
|
|
162
164
|
}
|
|
@@ -226,12 +226,14 @@ var require_types = __commonJS({
|
|
|
226
226
|
environment: zod_1.default.literal("standalone"),
|
|
227
227
|
headless: zod_1.default.boolean().default(true),
|
|
228
228
|
proxy: exports2.runApiProxySchema.optional(),
|
|
229
|
-
ignoreHttpErrors: zod_1.default.boolean().optional()
|
|
229
|
+
ignoreHttpErrors: zod_1.default.boolean().optional(),
|
|
230
|
+
profileTemplatePath: zod_1.default.string().optional()
|
|
230
231
|
});
|
|
231
232
|
exports2.runApiCdpRunOptionsSchema = zod_1.default.object({
|
|
232
233
|
environment: zod_1.default.literal("cdp"),
|
|
233
234
|
cdpAddress: zod_1.default.string(),
|
|
234
|
-
cdpTargetId: zod_1.default.string().optional()
|
|
235
|
+
cdpTargetId: zod_1.default.string().optional(),
|
|
236
|
+
profileTemplatePath: zod_1.default.string().optional()
|
|
235
237
|
});
|
|
236
238
|
exports2.runApiRunOptionsSchema = zod_1.default.discriminatedUnion("environment", [
|
|
237
239
|
exports2.runApiStandaloneRunOptionsSchema,
|
package/package.json
CHANGED