Skip to content

Commit 7149941

Browse files
feat: use newCommandTimeoutSec for manual device control (#1672)
BREAKING CHANGE: Following changes are added - Added authentication module with user and team management - Enhanced automation runs with access key authentication - Improved device and server management capabilities - Database schema changes that may result in loss of existing data
1 parent 0fa7bf1 commit 7149941

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

src/device-utils.ts

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,9 +187,6 @@ export async function allocateDeviceForSession(
187187
await blockDevice(device.udid, device.host);
188188
log.info(`📱 Blocking device ${device.udid} at host ${device.host} for new session`);
189189

190-
// FIXME: convert this into a return value
191-
await updateCapabilityForDevice(capability, device, { liveVideo });
192-
193190
// update newCommandTimeout for the device.
194191
// This is required so it won't get unblocked by prematurely.
195192
let newCommandTimeout = firstMatch['appium:newCommandTimeout'];
@@ -198,6 +195,12 @@ export async function allocateDeviceForSession(
198195
}
199196
await updatedAllocatedDevice(device, { newCommandTimeout });
200197

198+
// FIXME: convert this into a return value
199+
await updateCapabilityForDevice(capability, device, {
200+
liveVideo,
201+
newCommandTimeout: newCommandTimeout,
202+
});
203+
201204
return device;
202205
} else {
203206
throw new Error(`No device found for filters: ${JSON.stringify(filters)}`);
@@ -213,13 +216,22 @@ export async function allocateDeviceForSession(
213216
export async function updateCapabilityForDevice(
214217
capability: any,
215218
device: IDevice,
216-
options: { liveVideo: boolean },
219+
options: { liveVideo: boolean; newCommandTimeout?: number },
217220
) {
218221
const mergedCapabilites = Object.assign(
219222
{},
220223
capability.alwaysMatch,
221224
capability.firstMatch[0] || {},
222225
);
226+
227+
if (!mergedCapabilites['appium:newCommandTimeout'] && options.newCommandTimeout) {
228+
try {
229+
capability.firstMatch[0]['appium:newCommandTimeout'] = options.newCommandTimeout;
230+
} catch (err) {
231+
capability.alwaysMatch['appium:newCommandTimeout'] = options.newCommandTimeout;
232+
}
233+
}
234+
223235
if (!device.hasOwnProperty('cloud')) {
224236
if (mergedCapabilites['appium:automationName']?.toLowerCase() === 'flutterintegration') {
225237
capability.firstMatch[0]['appium:flutterSystemPort'] = await getPort();

src/modules

0 commit comments

Comments
 (0)