Skip to content

Commit ded917b

Browse files
authored
feat: adding appArguments option (#26)
1 parent 317f598 commit ded917b

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

lib/commands/app.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ export async function changeRootElement(this: NovaWindowsDriver, pathOrNativeWin
136136

137137
const path = pathOrNativeWindowHandle;
138138
if (path.includes('!') && path.includes('_') && !(path.includes('/') || path.includes('\\'))) {
139-
await this.sendPowerShellCommand(/* ps1 */ `Start-Process 'explorer.exe' 'shell:AppsFolder\\${path}'`);
139+
await this.sendPowerShellCommand(/* ps1 */ `Start-Process 'explorer.exe' 'shell:AppsFolder\\${path}'${this.caps.appArguments ? ` -ArgumentList '${this.caps.appArguments}'` : ''}`);
140140
await sleep(500); // TODO: make a setting for the initial wait time
141141
for (let i = 1; i <= 20; i++) {
142142
const result = await this.sendPowerShellCommand(/* ps1 */ `(Get-Process -Name 'ApplicationFrameHost').Id`);
@@ -154,7 +154,7 @@ export async function changeRootElement(this: NovaWindowsDriver, pathOrNativeWin
154154
}
155155
} else {
156156
const normalizedPath = normalize(path);
157-
await this.sendPowerShellCommand(/* ps1 */ `Start-Process '${normalizedPath}'`);
157+
await this.sendPowerShellCommand(/* ps1 */ `Start-Process '${normalizedPath}'${this.caps.appArguments ? ` -ArgumentList '${this.caps.appArguments}'` : ''}`);
158158
await sleep(500); // TODO: make a setting for the initial wait time
159159
for (let i = 1; i <= 20; i++) {
160160
try {

lib/constraints.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ export const UI_AUTOMATION_DRIVER_CONSTRAINTS = {
2121
shouldCloseApp: {
2222
isBoolean: true,
2323
},
24+
appArguments: {
25+
isString: true
26+
},
2427
} as const satisfies Constraints;
2528

2629
export default UI_AUTOMATION_DRIVER_CONSTRAINTS;

0 commit comments

Comments
 (0)