appium-desktop-driver 1.2.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/LICENSE +202 -0
- package/README.md +609 -0
- package/ROADMAP.md +175 -0
- package/build/lib/commands/actions.d.ts +12 -0
- package/build/lib/commands/actions.d.ts.map +1 -0
- package/build/lib/commands/actions.js +242 -0
- package/build/lib/commands/actions.js.map +1 -0
- package/build/lib/commands/app.d.ts +18 -0
- package/build/lib/commands/app.d.ts.map +1 -0
- package/build/lib/commands/app.js +280 -0
- package/build/lib/commands/app.js.map +1 -0
- package/build/lib/commands/device.d.ts +11 -0
- package/build/lib/commands/device.d.ts.map +1 -0
- package/build/lib/commands/device.js +236 -0
- package/build/lib/commands/device.js.map +1 -0
- package/build/lib/commands/element.d.ts +16 -0
- package/build/lib/commands/element.d.ts.map +1 -0
- package/build/lib/commands/element.js +233 -0
- package/build/lib/commands/element.js.map +1 -0
- package/build/lib/commands/extension.d.ts +124 -0
- package/build/lib/commands/extension.d.ts.map +1 -0
- package/build/lib/commands/extension.js +715 -0
- package/build/lib/commands/extension.js.map +1 -0
- package/build/lib/commands/functions.d.ts +3 -0
- package/build/lib/commands/functions.d.ts.map +1 -0
- package/build/lib/commands/functions.js +194 -0
- package/build/lib/commands/functions.js.map +1 -0
- package/build/lib/commands/index.d.ts +178 -0
- package/build/lib/commands/index.d.ts.map +1 -0
- package/build/lib/commands/index.js +54 -0
- package/build/lib/commands/index.js.map +1 -0
- package/build/lib/commands/powershell.d.ts +6 -0
- package/build/lib/commands/powershell.d.ts.map +1 -0
- package/build/lib/commands/powershell.js +202 -0
- package/build/lib/commands/powershell.js.map +1 -0
- package/build/lib/commands/screen-recorder.d.ts +40 -0
- package/build/lib/commands/screen-recorder.d.ts.map +1 -0
- package/build/lib/commands/screen-recorder.js +183 -0
- package/build/lib/commands/screen-recorder.js.map +1 -0
- package/build/lib/commands/system.d.ts +4 -0
- package/build/lib/commands/system.d.ts.map +1 -0
- package/build/lib/commands/system.js +8 -0
- package/build/lib/commands/system.js.map +1 -0
- package/build/lib/constants.d.ts +3 -0
- package/build/lib/constants.d.ts.map +1 -0
- package/build/lib/constants.js +6 -0
- package/build/lib/constants.js.map +1 -0
- package/build/lib/constraints.d.ts +58 -0
- package/build/lib/constraints.d.ts.map +1 -0
- package/build/lib/constraints.js +60 -0
- package/build/lib/constraints.js.map +1 -0
- package/build/lib/driver.d.ts +36 -0
- package/build/lib/driver.d.ts.map +1 -0
- package/build/lib/driver.js +209 -0
- package/build/lib/driver.js.map +1 -0
- package/build/lib/enums.d.ts +89 -0
- package/build/lib/enums.d.ts.map +1 -0
- package/build/lib/enums.js +83 -0
- package/build/lib/enums.js.map +1 -0
- package/build/lib/mcp/appium-manager.d.ts +8 -0
- package/build/lib/mcp/appium-manager.d.ts.map +1 -0
- package/build/lib/mcp/appium-manager.js +160 -0
- package/build/lib/mcp/appium-manager.js.map +1 -0
- package/build/lib/mcp/config.d.ts +7 -0
- package/build/lib/mcp/config.d.ts.map +1 -0
- package/build/lib/mcp/config.js +14 -0
- package/build/lib/mcp/config.js.map +1 -0
- package/build/lib/mcp/constants.d.ts +3 -0
- package/build/lib/mcp/constants.d.ts.map +1 -0
- package/build/lib/mcp/constants.js +6 -0
- package/build/lib/mcp/constants.js.map +1 -0
- package/build/lib/mcp/errors.d.ts +2 -0
- package/build/lib/mcp/errors.d.ts.map +1 -0
- package/build/lib/mcp/errors.js +10 -0
- package/build/lib/mcp/errors.js.map +1 -0
- package/build/lib/mcp/index.d.ts +3 -0
- package/build/lib/mcp/index.d.ts.map +1 -0
- package/build/lib/mcp/index.js +113 -0
- package/build/lib/mcp/index.js.map +1 -0
- package/build/lib/mcp/session.d.ts +24 -0
- package/build/lib/mcp/session.d.ts.map +1 -0
- package/build/lib/mcp/session.js +77 -0
- package/build/lib/mcp/session.js.map +1 -0
- package/build/lib/mcp/tools/advanced.d.ts +4 -0
- package/build/lib/mcp/tools/advanced.d.ts.map +1 -0
- package/build/lib/mcp/tools/advanced.js +119 -0
- package/build/lib/mcp/tools/advanced.js.map +1 -0
- package/build/lib/mcp/tools/app.d.ts +4 -0
- package/build/lib/mcp/tools/app.d.ts.map +1 -0
- package/build/lib/mcp/tools/app.js +64 -0
- package/build/lib/mcp/tools/app.js.map +1 -0
- package/build/lib/mcp/tools/clipboard.d.ts +4 -0
- package/build/lib/mcp/tools/clipboard.d.ts.map +1 -0
- package/build/lib/mcp/tools/clipboard.js +41 -0
- package/build/lib/mcp/tools/clipboard.js.map +1 -0
- package/build/lib/mcp/tools/find.d.ts +4 -0
- package/build/lib/mcp/tools/find.d.ts.map +1 -0
- package/build/lib/mcp/tools/find.js +119 -0
- package/build/lib/mcp/tools/find.js.map +1 -0
- package/build/lib/mcp/tools/index.d.ts +4 -0
- package/build/lib/mcp/tools/index.d.ts.map +1 -0
- package/build/lib/mcp/tools/index.js +24 -0
- package/build/lib/mcp/tools/index.js.map +1 -0
- package/build/lib/mcp/tools/inspect.d.ts +4 -0
- package/build/lib/mcp/tools/inspect.d.ts.map +1 -0
- package/build/lib/mcp/tools/inspect.js +106 -0
- package/build/lib/mcp/tools/inspect.js.map +1 -0
- package/build/lib/mcp/tools/interact.d.ts +4 -0
- package/build/lib/mcp/tools/interact.d.ts.map +1 -0
- package/build/lib/mcp/tools/interact.js +121 -0
- package/build/lib/mcp/tools/interact.js.map +1 -0
- package/build/lib/mcp/tools/patterns.d.ts +4 -0
- package/build/lib/mcp/tools/patterns.d.ts.map +1 -0
- package/build/lib/mcp/tools/patterns.js +136 -0
- package/build/lib/mcp/tools/patterns.js.map +1 -0
- package/build/lib/mcp/tools/session.d.ts +4 -0
- package/build/lib/mcp/tools/session.d.ts.map +1 -0
- package/build/lib/mcp/tools/session.js +55 -0
- package/build/lib/mcp/tools/session.js.map +1 -0
- package/build/lib/mcp/tools/window.d.ts +4 -0
- package/build/lib/mcp/tools/window.d.ts.map +1 -0
- package/build/lib/mcp/tools/window.js +134 -0
- package/build/lib/mcp/tools/window.js.map +1 -0
- package/build/lib/powershell/common.d.ts +39 -0
- package/build/lib/powershell/common.d.ts.map +1 -0
- package/build/lib/powershell/common.js +121 -0
- package/build/lib/powershell/common.js.map +1 -0
- package/build/lib/powershell/conditions.d.ts +24 -0
- package/build/lib/powershell/conditions.d.ts.map +1 -0
- package/build/lib/powershell/conditions.js +131 -0
- package/build/lib/powershell/conditions.js.map +1 -0
- package/build/lib/powershell/converter.d.ts +3 -0
- package/build/lib/powershell/converter.d.ts.map +1 -0
- package/build/lib/powershell/converter.js +273 -0
- package/build/lib/powershell/converter.js.map +1 -0
- package/build/lib/powershell/core.d.ts +8 -0
- package/build/lib/powershell/core.d.ts.map +1 -0
- package/build/lib/powershell/core.js +30 -0
- package/build/lib/powershell/core.js.map +1 -0
- package/build/lib/powershell/elements.d.ts +70 -0
- package/build/lib/powershell/elements.d.ts.map +1 -0
- package/build/lib/powershell/elements.js +523 -0
- package/build/lib/powershell/elements.js.map +1 -0
- package/build/lib/powershell/index.d.ts +8 -0
- package/build/lib/powershell/index.d.ts.map +1 -0
- package/build/lib/powershell/index.js +24 -0
- package/build/lib/powershell/index.js.map +1 -0
- package/build/lib/powershell/regex.d.ts +19 -0
- package/build/lib/powershell/regex.d.ts.map +1 -0
- package/build/lib/powershell/regex.js +68 -0
- package/build/lib/powershell/regex.js.map +1 -0
- package/build/lib/powershell/types.d.ts +155 -0
- package/build/lib/powershell/types.d.ts.map +1 -0
- package/build/lib/powershell/types.js +141 -0
- package/build/lib/powershell/types.js.map +1 -0
- package/build/lib/util.d.ts +17 -0
- package/build/lib/util.d.ts.map +1 -0
- package/build/lib/util.js +76 -0
- package/build/lib/util.js.map +1 -0
- package/build/lib/winapi/types/index.d.ts +8 -0
- package/build/lib/winapi/types/index.d.ts.map +1 -0
- package/build/lib/winapi/types/index.js +24 -0
- package/build/lib/winapi/types/index.js.map +1 -0
- package/build/lib/winapi/types/input.d.ts +11 -0
- package/build/lib/winapi/types/input.d.ts.map +1 -0
- package/build/lib/winapi/types/input.js +12 -0
- package/build/lib/winapi/types/input.js.map +1 -0
- package/build/lib/winapi/types/keyeventf.d.ts +13 -0
- package/build/lib/winapi/types/keyeventf.d.ts.map +1 -0
- package/build/lib/winapi/types/keyeventf.js +14 -0
- package/build/lib/winapi/types/keyeventf.js.map +1 -0
- package/build/lib/winapi/types/mouseeventf.d.ts +34 -0
- package/build/lib/winapi/types/mouseeventf.d.ts.map +1 -0
- package/build/lib/winapi/types/mouseeventf.js +37 -0
- package/build/lib/winapi/types/mouseeventf.js.map +1 -0
- package/build/lib/winapi/types/scancode.d.ts +95 -0
- package/build/lib/winapi/types/scancode.d.ts.map +1 -0
- package/build/lib/winapi/types/scancode.js +96 -0
- package/build/lib/winapi/types/scancode.js.map +1 -0
- package/build/lib/winapi/types/systemmetric.d.ts +214 -0
- package/build/lib/winapi/types/systemmetric.d.ts.map +1 -0
- package/build/lib/winapi/types/systemmetric.js +215 -0
- package/build/lib/winapi/types/systemmetric.js.map +1 -0
- package/build/lib/winapi/types/virtualkey.d.ts +353 -0
- package/build/lib/winapi/types/virtualkey.d.ts.map +1 -0
- package/build/lib/winapi/types/virtualkey.js +354 -0
- package/build/lib/winapi/types/virtualkey.js.map +1 -0
- package/build/lib/winapi/types/xmousebutton.d.ts +7 -0
- package/build/lib/winapi/types/xmousebutton.d.ts.map +1 -0
- package/build/lib/winapi/types/xmousebutton.js +8 -0
- package/build/lib/winapi/types/xmousebutton.js.map +1 -0
- package/build/lib/winapi/user32.d.ts +56 -0
- package/build/lib/winapi/user32.d.ts.map +1 -0
- package/build/lib/winapi/user32.js +592 -0
- package/build/lib/winapi/user32.js.map +1 -0
- package/build/lib/xpath/core.d.ts +8 -0
- package/build/lib/xpath/core.d.ts.map +1 -0
- package/build/lib/xpath/core.js +593 -0
- package/build/lib/xpath/core.js.map +1 -0
- package/build/lib/xpath/functions.d.ts +4 -0
- package/build/lib/xpath/functions.d.ts.map +1 -0
- package/build/lib/xpath/functions.js +271 -0
- package/build/lib/xpath/functions.js.map +1 -0
- package/build/lib/xpath/index.d.ts +3 -0
- package/build/lib/xpath/index.d.ts.map +1 -0
- package/build/lib/xpath/index.js +19 -0
- package/build/lib/xpath/index.js.map +1 -0
- package/package.json +71 -0
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.startPowerShellSession = startPowerShellSession;
|
|
4
|
+
exports.sendIsolatedPowerShellCommand = sendIsolatedPowerShellCommand;
|
|
5
|
+
exports.sendPowerShellCommand = sendPowerShellCommand;
|
|
6
|
+
exports.terminatePowerShellSession = terminatePowerShellSession;
|
|
7
|
+
const node_child_process_1 = require("node:child_process");
|
|
8
|
+
const base_driver_1 = require("@appium/base-driver");
|
|
9
|
+
const functions_1 = require("./functions");
|
|
10
|
+
const SET_UTF8_ENCODING = /* ps1 */ `$OutputEncoding = [Console]::OutputEncoding = [Text.Encoding]::UTF8`;
|
|
11
|
+
const ADD_NECESSARY_ASSEMBLIES = /* ps1 */ `Add-Type -AssemblyName UIAutomationClient; Add-Type -AssemblyName System.Drawing; Add-Type -AssemblyName PresentationCore; Add-Type -AssemblyName System.Windows.Forms`;
|
|
12
|
+
const USE_UI_AUTOMATION_CLIENT = /* ps1 */ `using namespace System.Windows.Automation`;
|
|
13
|
+
const INIT_CACHE_REQUEST = /* ps1 */ `($cacheRequest = New-Object System.Windows.Automation.CacheRequest).TreeFilter = [AndCondition]::new([Automation]::ControlViewCondition, [NotCondition]::new([PropertyCondition]::new([AutomationElement]::FrameworkIdProperty, 'Chrome'))); $cacheRequest.Push()`;
|
|
14
|
+
const INIT_ROOT_ELEMENT = /* ps1 */ `$rootElement = [AutomationElement]::RootElement`;
|
|
15
|
+
const NULL_ROOT_ELEMENT = /* ps1 */ `$rootElement = $null`;
|
|
16
|
+
const INIT_ELEMENT_TABLE = /* ps1 */ `$elementTable = New-Object System.Collections.Generic.Dictionary[[string]\`,[AutomationElement]]`;
|
|
17
|
+
async function startPowerShellSession() {
|
|
18
|
+
const spawnEnv = this.caps.appEnvironment
|
|
19
|
+
? { ...process.env, ...this.caps.appEnvironment }
|
|
20
|
+
: process.env;
|
|
21
|
+
if (this.caps.appEnvironment) {
|
|
22
|
+
const keys = Object.keys(this.caps.appEnvironment);
|
|
23
|
+
this.log.info(`Applying appEnvironment variables to PowerShell session: ${keys.join(', ')}`);
|
|
24
|
+
}
|
|
25
|
+
const powerShell = (0, node_child_process_1.spawn)('powershell.exe', ['-NoExit', '-Command', '-'], { env: spawnEnv });
|
|
26
|
+
powerShell.stdout.setEncoding('utf8');
|
|
27
|
+
powerShell.stderr.setEncoding('utf8');
|
|
28
|
+
powerShell.stdout.on('data', (chunk) => {
|
|
29
|
+
this.powerShellStdOut += chunk.toString();
|
|
30
|
+
});
|
|
31
|
+
powerShell.stderr.on('data', (chunk) => {
|
|
32
|
+
this.powerShellStdErr += chunk.toString();
|
|
33
|
+
});
|
|
34
|
+
this.powerShell = powerShell;
|
|
35
|
+
if (this.caps.appWorkingDir) {
|
|
36
|
+
const envVarsSet = new Set();
|
|
37
|
+
const matches = this.caps.appWorkingDir.matchAll(/%([^%]+)%/g);
|
|
38
|
+
for (const match of matches) {
|
|
39
|
+
envVarsSet.add(match[1]);
|
|
40
|
+
}
|
|
41
|
+
const envVars = Array.from(envVarsSet);
|
|
42
|
+
for (const envVar of envVars) {
|
|
43
|
+
this.caps.appWorkingDir = this.caps.appWorkingDir.replaceAll(`%${envVar}%`, spawnEnv[envVar.toUpperCase()] ?? '');
|
|
44
|
+
}
|
|
45
|
+
this.sendPowerShellCommand(`Set-Location -Path '${this.caps.appWorkingDir}'`);
|
|
46
|
+
}
|
|
47
|
+
await this.sendPowerShellCommand(SET_UTF8_ENCODING);
|
|
48
|
+
await this.sendPowerShellCommand(ADD_NECESSARY_ASSEMBLIES);
|
|
49
|
+
await this.sendPowerShellCommand(USE_UI_AUTOMATION_CLIENT);
|
|
50
|
+
await this.sendPowerShellCommand(INIT_CACHE_REQUEST);
|
|
51
|
+
await this.sendPowerShellCommand(INIT_ELEMENT_TABLE);
|
|
52
|
+
// initialize functions
|
|
53
|
+
await this.sendPowerShellCommand(functions_1.PAGE_SOURCE);
|
|
54
|
+
await this.sendPowerShellCommand(functions_1.FIND_CHILDREN_RECURSIVELY);
|
|
55
|
+
if ((!this.caps.app && !this.caps.appTopLevelWindow) || (!this.caps.app || this.caps.app.toLowerCase() === 'none')) {
|
|
56
|
+
this.log.info(`No app or top-level window specified in capabilities. Setting root element to null.`);
|
|
57
|
+
await this.sendPowerShellCommand(NULL_ROOT_ELEMENT);
|
|
58
|
+
}
|
|
59
|
+
if (this.caps.app && this.caps.app.toLowerCase() === 'root') {
|
|
60
|
+
this.log.info(`'root' specified as app in capabilities. Setting root element to desktop root.`);
|
|
61
|
+
await this.sendPowerShellCommand(INIT_ROOT_ELEMENT);
|
|
62
|
+
}
|
|
63
|
+
if (this.caps.app && this.caps.app.toLowerCase() !== 'none' && this.caps.app.toLowerCase() !== 'root') {
|
|
64
|
+
this.log.info(`Application path specified in capabilities: ${this.caps.app}`);
|
|
65
|
+
const envVarsSet = new Set();
|
|
66
|
+
const matches = this.caps.app.matchAll(/%([^%]+)%/g);
|
|
67
|
+
for (const match of matches) {
|
|
68
|
+
envVarsSet.add(match[1]);
|
|
69
|
+
}
|
|
70
|
+
const envVars = Array.from(envVarsSet);
|
|
71
|
+
this.log.info(`Detected the following environment variables in app path: ${envVars.map((envVar) => `%${envVar}%`).join(', ')}`);
|
|
72
|
+
for (const envVar of envVars) {
|
|
73
|
+
this.caps.app = this.caps.app.replaceAll(`%${envVar}%`, spawnEnv[envVar.toUpperCase()] ?? '');
|
|
74
|
+
}
|
|
75
|
+
await this.changeRootElement(this.caps.app);
|
|
76
|
+
}
|
|
77
|
+
if (this.caps.appTopLevelWindow) {
|
|
78
|
+
const nativeWindowHandle = Number(this.caps.appTopLevelWindow);
|
|
79
|
+
if (isNaN(nativeWindowHandle)) {
|
|
80
|
+
throw new base_driver_1.errors.InvalidArgumentError(`Invalid capabilities. Capability 'appTopLevelWindow' is not a valid native window handle.`);
|
|
81
|
+
}
|
|
82
|
+
await this.changeRootElement(nativeWindowHandle);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
async function sendIsolatedPowerShellCommand(command) {
|
|
86
|
+
const magicNumber = 0xF2EE;
|
|
87
|
+
const spawnEnv = this.caps.appEnvironment
|
|
88
|
+
? { ...process.env, ...this.caps.appEnvironment }
|
|
89
|
+
: process.env;
|
|
90
|
+
const powerShell = (0, node_child_process_1.spawn)('powershell.exe', ['-NoExit', '-Command', '-'], { env: spawnEnv });
|
|
91
|
+
try {
|
|
92
|
+
powerShell.stdout.setEncoding('utf8');
|
|
93
|
+
let localStdOut = '';
|
|
94
|
+
let localStdErr = '';
|
|
95
|
+
powerShell.stdout.on('data', (chunk) => {
|
|
96
|
+
localStdOut += chunk.toString();
|
|
97
|
+
});
|
|
98
|
+
powerShell.stderr.on('data', (chunk) => {
|
|
99
|
+
localStdErr += chunk.toString();
|
|
100
|
+
});
|
|
101
|
+
const result = await new Promise((resolve, reject) => {
|
|
102
|
+
localStdOut = '';
|
|
103
|
+
localStdErr = '';
|
|
104
|
+
powerShell.stdin.write(`${SET_UTF8_ENCODING}\n`);
|
|
105
|
+
if (this.caps.appWorkingDir) {
|
|
106
|
+
const envVarsSet = new Set();
|
|
107
|
+
const matches = this.caps.appWorkingDir.matchAll(/%([^%]+)%/g);
|
|
108
|
+
for (const match of matches) {
|
|
109
|
+
envVarsSet.add(match[1]);
|
|
110
|
+
}
|
|
111
|
+
const envVars = Array.from(envVarsSet);
|
|
112
|
+
for (const envVar of envVars) {
|
|
113
|
+
this.caps.appWorkingDir = this.caps.appWorkingDir.replaceAll(`%${envVar}%`, spawnEnv[envVar.toUpperCase()] ?? '');
|
|
114
|
+
}
|
|
115
|
+
powerShell.stdin.write(`Set-Location -Path '${this.caps.appWorkingDir}'\n`);
|
|
116
|
+
}
|
|
117
|
+
powerShell.stdin.write(`${command}\n`);
|
|
118
|
+
powerShell.stdin.write(/* ps1 */ `Write-Output $([char]0x${magicNumber.toString(16)})\n`);
|
|
119
|
+
const onData = (chunk) => {
|
|
120
|
+
const magicChar = String.fromCharCode(magicNumber);
|
|
121
|
+
if (chunk.toString().includes(magicChar)) {
|
|
122
|
+
powerShell.stdout.off('data', onData);
|
|
123
|
+
if (localStdErr) {
|
|
124
|
+
reject(new base_driver_1.errors.UnknownError(localStdErr));
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
resolve(localStdOut.replace(`${magicChar}`, '').trim());
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
powerShell.stdout.on('data', onData);
|
|
132
|
+
});
|
|
133
|
+
// commented out for now to avoid cluttering the logs with long command outputs
|
|
134
|
+
// this.log.debug(`PowerShell command executed:\n${command}\n\nCommand output below:\n${result}\n --------`);
|
|
135
|
+
return result;
|
|
136
|
+
}
|
|
137
|
+
finally {
|
|
138
|
+
// Ensure the isolated PowerShell process is terminated
|
|
139
|
+
try {
|
|
140
|
+
powerShell.kill();
|
|
141
|
+
}
|
|
142
|
+
catch (e) {
|
|
143
|
+
this.log.warn(`Failed to terminate isolated PowerShell process: ${e}`);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
async function sendPowerShellCommand(command) {
|
|
148
|
+
const magicNumber = 0xF2EE;
|
|
149
|
+
if (!this.powerShell) {
|
|
150
|
+
this.log.warn('PowerShell session not running. It was either closed or has crashed. Attempting to start a new session...');
|
|
151
|
+
await this.startPowerShellSession();
|
|
152
|
+
}
|
|
153
|
+
const result = await new Promise((resolve, reject) => {
|
|
154
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
155
|
+
const powerShell = this.powerShell;
|
|
156
|
+
this.powerShellStdOut = '';
|
|
157
|
+
this.powerShellStdErr = '';
|
|
158
|
+
powerShell.stdin.write(`${command}\n`);
|
|
159
|
+
powerShell.stdin.write(/* ps1 */ `Write-Output $([char]0x${magicNumber.toString(16)})\n`);
|
|
160
|
+
const onData = ((chunk) => {
|
|
161
|
+
const magicChar = String.fromCharCode(magicNumber);
|
|
162
|
+
if (chunk.toString().includes(magicChar)) {
|
|
163
|
+
powerShell.stdout.off('data', onData);
|
|
164
|
+
if (this.powerShellStdErr) {
|
|
165
|
+
reject(new base_driver_1.errors.UnknownError(this.powerShellStdErr));
|
|
166
|
+
}
|
|
167
|
+
else {
|
|
168
|
+
resolve(this.powerShellStdOut.replace(`${magicChar}`, '').trim());
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}).bind(this);
|
|
172
|
+
powerShell.stdout.on('data', onData);
|
|
173
|
+
});
|
|
174
|
+
// commented out for now to avoid cluttering the logs with long command outputs
|
|
175
|
+
// this.log.debug(`PowerShell command executed:\n${command}\n\nCommand output below:\n${result}\n --------`);
|
|
176
|
+
return result;
|
|
177
|
+
}
|
|
178
|
+
async function terminatePowerShellSession() {
|
|
179
|
+
if (!this.powerShell) {
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
if (this.powerShell.exitCode !== null) {
|
|
183
|
+
this.log.debug(`PowerShell session already terminated.`);
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
this.log.debug(`Terminating PowerShell session...`);
|
|
187
|
+
const waitForClose = new Promise((resolve, reject) => {
|
|
188
|
+
if (!this.powerShell) {
|
|
189
|
+
resolve();
|
|
190
|
+
}
|
|
191
|
+
this.powerShell?.once('close', () => {
|
|
192
|
+
resolve();
|
|
193
|
+
});
|
|
194
|
+
this.powerShell?.once('error', (err) => {
|
|
195
|
+
reject(err);
|
|
196
|
+
});
|
|
197
|
+
});
|
|
198
|
+
this.powerShell.kill();
|
|
199
|
+
await waitForClose;
|
|
200
|
+
this.log.debug(`PowerShell session terminated successfully.`);
|
|
201
|
+
}
|
|
202
|
+
//# sourceMappingURL=powershell.js.map
|
|
@@ -0,0 +1 @@
|
|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UAAU,EAAE,CAAC;YACnB,OAAO,EAAE,CAAC;QACd,CAAC;QAED,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,OAAO,EAAE,GAAG,EAAE;YAChC,OAAO,EAAE,CAAC;QACd,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC,GAAU,EAAE,EAAE;YAC1C,MAAM,CAAC,GAAG,CAAC,CAAC;QAChB,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAGH,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC;IACvB,MAAM,YAAY,CAAC;IACnB,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,6CAA6C,CAAC,CAAC;AAClE,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { AppiumLogger } from '@appium/types';
|
|
2
|
+
export declare const DEFAULT_EXT = "mp4";
|
|
3
|
+
export interface ScreenRecorderOptions {
|
|
4
|
+
fps?: number;
|
|
5
|
+
timeLimit?: number;
|
|
6
|
+
preset?: string;
|
|
7
|
+
captureCursor?: boolean;
|
|
8
|
+
captureClicks?: boolean;
|
|
9
|
+
audioInput?: string;
|
|
10
|
+
videoFilter?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface UploadOptions {
|
|
13
|
+
remotePath?: string;
|
|
14
|
+
user?: string;
|
|
15
|
+
pass?: string;
|
|
16
|
+
method?: string;
|
|
17
|
+
headers?: Record<string, string>;
|
|
18
|
+
fileFieldName?: string;
|
|
19
|
+
formFields?: Array<[string, string]> | Record<string, string>;
|
|
20
|
+
}
|
|
21
|
+
export declare function uploadRecordedMedia(localFile: string, remotePath?: string, uploadOptions?: Omit<UploadOptions, 'remotePath'>): Promise<string>;
|
|
22
|
+
export declare class ScreenRecorder {
|
|
23
|
+
private log;
|
|
24
|
+
private _videoPath;
|
|
25
|
+
private _process;
|
|
26
|
+
private _fps;
|
|
27
|
+
private _audioInput?;
|
|
28
|
+
private _captureCursor;
|
|
29
|
+
private _captureClicks;
|
|
30
|
+
private _preset;
|
|
31
|
+
private _videoFilter?;
|
|
32
|
+
private _timeLimit;
|
|
33
|
+
constructor(videoPath: string, log: AppiumLogger, opts?: ScreenRecorderOptions);
|
|
34
|
+
getVideoPath(): Promise<string>;
|
|
35
|
+
isRunning(): boolean;
|
|
36
|
+
_enforceTermination(): Promise<string>;
|
|
37
|
+
start(): Promise<void>;
|
|
38
|
+
stop(force?: boolean): Promise<string>;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=screen-recorder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"screen-recorder.d.ts","sourceRoot":"","sources":["../../../lib/commands/screen-recorder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAUlD,eAAO,MAAM,WAAW,QAAQ,CAAC;AAIjC,MAAM,WAAW,qBAAqB;IAClC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,aAAa;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACjE;AAkBD,wBAAsB,mBAAmB,CACrC,SAAS,EAAE,MAAM,EACjB,UAAU,CAAC,EAAE,MAAM,EACnB,aAAa,GAAE,IAAI,CAAC,aAAa,EAAE,YAAY,CAAM,GACtD,OAAO,CAAC,MAAM,CAAC,CAgBjB;AAED,qBAAa,cAAc;IACvB,OAAO,CAAC,GAAG,CAAe;IAC1B,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,QAAQ,CAA2B;IAC3C,OAAO,CAAC,IAAI,CAAS;IACrB,OAAO,CAAC,WAAW,CAAC,CAAS;IAC7B,OAAO,CAAC,cAAc,CAAU;IAChC,OAAO,CAAC,cAAc,CAAU;IAChC,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,YAAY,CAAC,CAAS;IAC9B,OAAO,CAAC,UAAU,CAAS;gBAEf,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,YAAY,EAAE,IAAI,GAAE,qBAA0B;IAY5E,YAAY,IAAI,OAAO,CAAC,MAAM,CAAC;IAarC,SAAS,IAAI,OAAO;IAId,mBAAmB,IAAI,OAAO,CAAC,MAAM,CAAC;IAetC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAuEtB,IAAI,CAAC,KAAK,UAAQ,GAAG,OAAO,CAAC,MAAM,CAAC;CA6B7C"}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ScreenRecorder = exports.DEFAULT_EXT = void 0;
|
|
4
|
+
exports.uploadRecordedMedia = uploadRecordedMedia;
|
|
5
|
+
const support_1 = require("appium/support");
|
|
6
|
+
const asyncbox_1 = require("asyncbox");
|
|
7
|
+
const teen_process_1 = require("teen_process");
|
|
8
|
+
const util_1 = require("../util");
|
|
9
|
+
const RETRY_PAUSE = 300;
|
|
10
|
+
const RETRY_TIMEOUT = 5000;
|
|
11
|
+
const DEFAULT_TIME_LIMIT = 60 * 10; // 10 minutes
|
|
12
|
+
const PROCESS_SHUTDOWN_TIMEOUT = 10 * 1000;
|
|
13
|
+
exports.DEFAULT_EXT = 'mp4';
|
|
14
|
+
const DEFAULT_FPS = 15;
|
|
15
|
+
const DEFAULT_PRESET = 'veryfast';
|
|
16
|
+
async function requireFfmpegPath() {
|
|
17
|
+
const bundled = (0, util_1.getBundledFfmpegPath)();
|
|
18
|
+
if (bundled) {
|
|
19
|
+
return bundled;
|
|
20
|
+
}
|
|
21
|
+
const ffmpegBinary = `ffmpeg${support_1.system.isWindows() ? '.exe' : ''}`;
|
|
22
|
+
try {
|
|
23
|
+
return await support_1.fs.which(ffmpegBinary);
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
throw new Error(`${ffmpegBinary} has not been found in PATH and the bundled ffmpeg is missing. ` +
|
|
27
|
+
'Please reinstall the driver or install ffmpeg manually.');
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
async function uploadRecordedMedia(localFile, remotePath, uploadOptions = {}) {
|
|
31
|
+
if (!remotePath) {
|
|
32
|
+
return (await support_1.util.toInMemoryBase64(localFile)).toString();
|
|
33
|
+
}
|
|
34
|
+
const { user, pass, method, headers, fileFieldName, formFields } = uploadOptions;
|
|
35
|
+
const options = {
|
|
36
|
+
method: method ?? 'PUT',
|
|
37
|
+
headers,
|
|
38
|
+
fileFieldName,
|
|
39
|
+
formFields,
|
|
40
|
+
};
|
|
41
|
+
if (user && pass) {
|
|
42
|
+
options.auth = { user, pass };
|
|
43
|
+
}
|
|
44
|
+
await support_1.net.uploadFile(localFile, remotePath, options);
|
|
45
|
+
return '';
|
|
46
|
+
}
|
|
47
|
+
class ScreenRecorder {
|
|
48
|
+
log;
|
|
49
|
+
_videoPath;
|
|
50
|
+
_process = null;
|
|
51
|
+
_fps;
|
|
52
|
+
_audioInput;
|
|
53
|
+
_captureCursor;
|
|
54
|
+
_captureClicks;
|
|
55
|
+
_preset;
|
|
56
|
+
_videoFilter;
|
|
57
|
+
_timeLimit;
|
|
58
|
+
constructor(videoPath, log, opts = {}) {
|
|
59
|
+
this.log = log;
|
|
60
|
+
this._videoPath = videoPath;
|
|
61
|
+
this._fps = opts.fps && opts.fps > 0 ? opts.fps : DEFAULT_FPS;
|
|
62
|
+
this._audioInput = opts.audioInput;
|
|
63
|
+
this._captureCursor = opts.captureCursor ?? false;
|
|
64
|
+
this._captureClicks = opts.captureClicks ?? false;
|
|
65
|
+
this._preset = opts.preset ?? DEFAULT_PRESET;
|
|
66
|
+
this._videoFilter = opts.videoFilter;
|
|
67
|
+
this._timeLimit = opts.timeLimit && opts.timeLimit > 0 ? opts.timeLimit : DEFAULT_TIME_LIMIT;
|
|
68
|
+
}
|
|
69
|
+
async getVideoPath() {
|
|
70
|
+
if (!(await support_1.fs.exists(this._videoPath))) {
|
|
71
|
+
return '';
|
|
72
|
+
}
|
|
73
|
+
const stat = await support_1.fs.stat(this._videoPath);
|
|
74
|
+
if (!stat.isFile()) {
|
|
75
|
+
throw new Error(`The video path '${this._videoPath}' does not point to a regular file and will not be deleted`);
|
|
76
|
+
}
|
|
77
|
+
return this._videoPath;
|
|
78
|
+
}
|
|
79
|
+
isRunning() {
|
|
80
|
+
return !!this._process?.isRunning;
|
|
81
|
+
}
|
|
82
|
+
async _enforceTermination() {
|
|
83
|
+
if (this._process && this.isRunning()) {
|
|
84
|
+
this.log.debug('Force-stopping the currently running video recording');
|
|
85
|
+
try {
|
|
86
|
+
await this._process.stop('SIGKILL');
|
|
87
|
+
}
|
|
88
|
+
catch { }
|
|
89
|
+
}
|
|
90
|
+
this._process = null;
|
|
91
|
+
const videoPath = await this.getVideoPath();
|
|
92
|
+
if (videoPath) {
|
|
93
|
+
await support_1.fs.rimraf(videoPath);
|
|
94
|
+
}
|
|
95
|
+
return '';
|
|
96
|
+
}
|
|
97
|
+
async start() {
|
|
98
|
+
const ffmpegPath = await requireFfmpegPath();
|
|
99
|
+
const args = [
|
|
100
|
+
'-loglevel', 'error',
|
|
101
|
+
'-t', String(this._timeLimit),
|
|
102
|
+
'-f', 'gdigrab',
|
|
103
|
+
...(this._captureCursor ? ['-capture_cursor', '1'] : []),
|
|
104
|
+
...(this._captureClicks ? ['-capture_mouse_clicks', '1'] : []),
|
|
105
|
+
'-framerate', String(this._fps),
|
|
106
|
+
'-i', 'desktop',
|
|
107
|
+
...(this._audioInput ? ['-f', 'dshow', '-i', `audio=${this._audioInput}`] : []),
|
|
108
|
+
'-vcodec', 'libx264',
|
|
109
|
+
'-preset', this._preset,
|
|
110
|
+
'-tune', 'zerolatency',
|
|
111
|
+
'-pix_fmt', 'yuv420p',
|
|
112
|
+
'-movflags', '+faststart',
|
|
113
|
+
'-fflags', 'nobuffer',
|
|
114
|
+
'-vf', 'pad=ceil(iw/2)*2:ceil(ih/2)*2',
|
|
115
|
+
...(this._videoFilter ? ['-filter:v', this._videoFilter] : []),
|
|
116
|
+
this._videoPath,
|
|
117
|
+
];
|
|
118
|
+
this._process = new teen_process_1.SubProcess(ffmpegPath, args, { windowsHide: true });
|
|
119
|
+
this.log.debug(`Starting ffmpeg: ${support_1.util.quote([ffmpegPath, ...args])}`);
|
|
120
|
+
this._process.on('output', (stdout, stderr) => {
|
|
121
|
+
const out = stdout || stderr;
|
|
122
|
+
if (out?.trim()) {
|
|
123
|
+
this.log.debug(`[ffmpeg] ${out}`);
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
this._process.once('exit', async (code, signal) => {
|
|
127
|
+
this._process = null;
|
|
128
|
+
if (code === 0) {
|
|
129
|
+
this.log.debug('Screen recording exited without errors');
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
await this._enforceTermination();
|
|
133
|
+
this.log.warn(`Screen recording exited with error code ${code}, signal ${signal}`);
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
await this._process.start(0);
|
|
137
|
+
try {
|
|
138
|
+
await (0, asyncbox_1.waitForCondition)(async () => {
|
|
139
|
+
if (await this.getVideoPath()) {
|
|
140
|
+
return true;
|
|
141
|
+
}
|
|
142
|
+
if (!this._process) {
|
|
143
|
+
throw new Error('ffmpeg process died unexpectedly');
|
|
144
|
+
}
|
|
145
|
+
return false;
|
|
146
|
+
}, { waitMs: RETRY_TIMEOUT, intervalMs: RETRY_PAUSE });
|
|
147
|
+
}
|
|
148
|
+
catch {
|
|
149
|
+
await this._enforceTermination();
|
|
150
|
+
throw new Error(`The expected screen record file '${this._videoPath}' does not exist. ` +
|
|
151
|
+
'Check the server log for more details');
|
|
152
|
+
}
|
|
153
|
+
this.log.info(`The video recording has started. Will timeout in ${support_1.util.pluralize('second', this._timeLimit, true)}`);
|
|
154
|
+
}
|
|
155
|
+
async stop(force = false) {
|
|
156
|
+
if (force) {
|
|
157
|
+
return await this._enforceTermination();
|
|
158
|
+
}
|
|
159
|
+
if (!this.isRunning()) {
|
|
160
|
+
this.log.debug('Screen recording is not running. Returning the recent result');
|
|
161
|
+
return await this.getVideoPath();
|
|
162
|
+
}
|
|
163
|
+
return new Promise((resolve, reject) => {
|
|
164
|
+
const timer = setTimeout(async () => {
|
|
165
|
+
await this._enforceTermination();
|
|
166
|
+
reject(new Error(`Screen recording has failed to exit after ${PROCESS_SHUTDOWN_TIMEOUT}ms`));
|
|
167
|
+
}, PROCESS_SHUTDOWN_TIMEOUT);
|
|
168
|
+
this._process?.once('exit', async (code, signal) => {
|
|
169
|
+
clearTimeout(timer);
|
|
170
|
+
if (code === 0) {
|
|
171
|
+
resolve(await this.getVideoPath());
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
reject(new Error(`Screen recording exited with error code ${code}, signal ${signal}`));
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
this._process?.proc?.stdin?.write('q');
|
|
178
|
+
this._process?.proc?.stdin?.end();
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
exports.ScreenRecorder = ScreenRecorder;
|
|
183
|
+
//# sourceMappingURL=screen-recorder.js.map
|
|
@@ -0,0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AC;YAEH,IAAI,CAAC,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;YACvC,IAAI,CAAC,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC;QACtC,CAAC,CAAC,CAAC;IACP,CAAC;CACJ;AA5JD,wCA4JC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"system.d.ts","sourceRoot":"","sources":["../../../lib/commands/system.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAG9C,wBAAgB,cAAc,CAAC,IAAI,EAAE,iBAAiB,GAAG,WAAW,CAEnE"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getOrientation = getOrientation;
|
|
4
|
+
const user32_1 = require("../winapi/user32");
|
|
5
|
+
function getOrientation() {
|
|
6
|
+
return (0, user32_1.getDisplayOrientation)();
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=system.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"system.js","sourceRoot":"","sources":["../../../lib/commands/system.ts"],"names":[],"mappings":";;AAIA,wCAEC;AAJD,6CAAyD;AAEzD,SAAgB,cAAc;IAC1B,OAAO,IAAA,8BAAqB,GAAE,CAAC;AACnC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../lib/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,mBAAmB,gBAAgB,CAAC;AACjD,eAAO,MAAM,iBAAiB,cAAc,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MODIFY_FS_FEATURE = exports.POWER_SHELL_FEATURE = void 0;
|
|
4
|
+
exports.POWER_SHELL_FEATURE = 'power_shell';
|
|
5
|
+
exports.MODIFY_FS_FEATURE = 'modify_fs';
|
|
6
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../lib/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,mBAAmB,GAAG,aAAa,CAAC;AACpC,QAAA,iBAAiB,GAAG,WAAW,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
export declare const UI_AUTOMATION_DRIVER_CONSTRAINTS: {
|
|
2
|
+
readonly platformName: {
|
|
3
|
+
readonly isString: true;
|
|
4
|
+
readonly inclusionCaseInsensitive: readonly ["Windows"];
|
|
5
|
+
readonly presence: true;
|
|
6
|
+
};
|
|
7
|
+
readonly smoothPointerMove: {
|
|
8
|
+
readonly isString: true;
|
|
9
|
+
};
|
|
10
|
+
readonly delayBeforeClick: {
|
|
11
|
+
readonly isNumber: true;
|
|
12
|
+
};
|
|
13
|
+
readonly delayAfterClick: {
|
|
14
|
+
readonly isNumber: true;
|
|
15
|
+
};
|
|
16
|
+
readonly appTopLevelWindow: {
|
|
17
|
+
readonly isString: true;
|
|
18
|
+
};
|
|
19
|
+
readonly shouldCloseApp: {
|
|
20
|
+
readonly isBoolean: true;
|
|
21
|
+
};
|
|
22
|
+
readonly appArguments: {
|
|
23
|
+
readonly isString: true;
|
|
24
|
+
};
|
|
25
|
+
readonly appWorkingDir: {
|
|
26
|
+
readonly isString: true;
|
|
27
|
+
};
|
|
28
|
+
readonly prerun: {
|
|
29
|
+
readonly isObject: true;
|
|
30
|
+
};
|
|
31
|
+
readonly postrun: {
|
|
32
|
+
readonly isObject: true;
|
|
33
|
+
};
|
|
34
|
+
readonly isolatedScriptExecution: {
|
|
35
|
+
readonly isBoolean: true;
|
|
36
|
+
};
|
|
37
|
+
readonly appEnvironment: {
|
|
38
|
+
readonly isObject: true;
|
|
39
|
+
};
|
|
40
|
+
readonly 'ms:waitForAppLaunch': {
|
|
41
|
+
readonly isNumber: true;
|
|
42
|
+
};
|
|
43
|
+
readonly 'ms:forcequit': {
|
|
44
|
+
readonly isBoolean: true;
|
|
45
|
+
};
|
|
46
|
+
readonly returnAllWindowHandles: {
|
|
47
|
+
readonly isBoolean: true;
|
|
48
|
+
};
|
|
49
|
+
readonly 'ms:windowSwitchRetries': {
|
|
50
|
+
readonly isNumber: true;
|
|
51
|
+
};
|
|
52
|
+
readonly 'ms:windowSwitchInterval': {
|
|
53
|
+
readonly isNumber: true;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
export default UI_AUTOMATION_DRIVER_CONSTRAINTS;
|
|
57
|
+
export type NovaWindowsDriverConstraints = typeof UI_AUTOMATION_DRIVER_CONSTRAINTS;
|
|
58
|
+
//# sourceMappingURL=constraints.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constraints.d.ts","sourceRoot":"","sources":["../../lib/constraints.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,gCAAgC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsDb,CAAC;AAEjC,eAAe,gCAAgC,CAAC;AAEhD,MAAM,MAAM,4BAA4B,GAAG,OAAO,gCAAgC,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UI_AUTOMATION_DRIVER_CONSTRAINTS = void 0;
|
|
4
|
+
exports.UI_AUTOMATION_DRIVER_CONSTRAINTS = {
|
|
5
|
+
platformName: {
|
|
6
|
+
isString: true,
|
|
7
|
+
inclusionCaseInsensitive: ['Windows'],
|
|
8
|
+
presence: true,
|
|
9
|
+
},
|
|
10
|
+
smoothPointerMove: {
|
|
11
|
+
isString: true,
|
|
12
|
+
},
|
|
13
|
+
delayBeforeClick: {
|
|
14
|
+
isNumber: true,
|
|
15
|
+
},
|
|
16
|
+
delayAfterClick: {
|
|
17
|
+
isNumber: true,
|
|
18
|
+
},
|
|
19
|
+
appTopLevelWindow: {
|
|
20
|
+
isString: true,
|
|
21
|
+
},
|
|
22
|
+
shouldCloseApp: {
|
|
23
|
+
isBoolean: true,
|
|
24
|
+
},
|
|
25
|
+
appArguments: {
|
|
26
|
+
isString: true,
|
|
27
|
+
},
|
|
28
|
+
appWorkingDir: {
|
|
29
|
+
isString: true,
|
|
30
|
+
},
|
|
31
|
+
prerun: {
|
|
32
|
+
isObject: true,
|
|
33
|
+
},
|
|
34
|
+
postrun: {
|
|
35
|
+
isObject: true,
|
|
36
|
+
},
|
|
37
|
+
isolatedScriptExecution: {
|
|
38
|
+
isBoolean: true,
|
|
39
|
+
},
|
|
40
|
+
appEnvironment: {
|
|
41
|
+
isObject: true,
|
|
42
|
+
},
|
|
43
|
+
'ms:waitForAppLaunch': {
|
|
44
|
+
isNumber: true,
|
|
45
|
+
},
|
|
46
|
+
'ms:forcequit': {
|
|
47
|
+
isBoolean: true,
|
|
48
|
+
},
|
|
49
|
+
returnAllWindowHandles: {
|
|
50
|
+
isBoolean: true,
|
|
51
|
+
},
|
|
52
|
+
'ms:windowSwitchRetries': {
|
|
53
|
+
isNumber: true,
|
|
54
|
+
},
|
|
55
|
+
'ms:windowSwitchInterval': {
|
|
56
|
+
isNumber: true,
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
exports.default = exports.UI_AUTOMATION_DRIVER_CONSTRAINTS;
|
|
60
|
+
//# sourceMappingURL=constraints.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constraints.js","sourceRoot":"","sources":["../../lib/constraints.ts"],"names":[],"mappings":";;;AAEa,QAAA,gCAAgC,GAAG;IAC5C,YAAY,EAAE;QACV,QAAQ,EAAE,IAAI;QACd,wBAAwB,EAAE,CAAC,SAAS,CAAC;QACrC,QAAQ,EAAE,IAAI;KACjB;IACD,iBAAiB,EAAE;QACf,QAAQ,EAAE,IAAI;KACjB;IACD,gBAAgB,EAAE;QACd,QAAQ,EAAE,IAAI;KACjB;IACD,eAAe,EAAE;QACb,QAAQ,EAAE,IAAI;KACjB;IACD,iBAAiB,EAAE;QACf,QAAQ,EAAE,IAAI;KACjB;IACD,cAAc,EAAE;QACZ,SAAS,EAAE,IAAI;KAClB;IACD,YAAY,EAAE;QACV,QAAQ,EAAE,IAAI;KACjB;IACD,aAAa,EAAE;QACX,QAAQ,EAAE,IAAI;KACjB;IACD,MAAM,EAAE;QACJ,QAAQ,EAAE,IAAI;KACjB;IACD,OAAO,EAAE;QACL,QAAQ,EAAE,IAAI;KACjB;IACD,uBAAuB,EAAE;QACrB,SAAS,EAAE,IAAI;KAClB;IACD,cAAc,EAAE;QACZ,QAAQ,EAAE,IAAI;KACjB;IACD,qBAAqB,EAAE;QACnB,QAAQ,EAAE,IAAI;KACjB;IACD,cAAc,EAAE;QACZ,SAAS,EAAE,IAAI;KAClB;IACD,sBAAsB,EAAE;QACpB,SAAS,EAAE,IAAI;KAClB;IACD,wBAAwB,EAAE;QACtB,QAAQ,EAAE,IAAI;KACjB;IACD,yBAAyB,EAAE;QACvB,QAAQ,EAAE,IAAI;KACjB;CAC2B,CAAC;AAEjC,kBAAe,wCAAgC,CAAC"}
|