Skip to content

Commit fdab96c

Browse files
committed
fix(aws): defer Android app launch until open
1 parent eefe37b commit fdab96c

2 files changed

Lines changed: 17 additions & 5 deletions

File tree

packages/provider-webdriver/src/aws-device-farm.test.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,18 @@ test('a session that reaches RUNNING is handed on and not stopped', async () =>
126126
assert.deepEqual(client.stopped, []);
127127
});
128128

129+
test('an Android session defers app launch until the open command', async () => {
130+
const client = fakeClient({
131+
status: 'RUNNING',
132+
endpoints: { appium: 'https://appium.example/wd/hub' },
133+
});
134+
const prepare = createAwsDeviceFarmPrepareSession(baseOptions(client));
135+
136+
const prepared = await prepare({ lease: makeLease(), base: baseSession() });
137+
138+
assert.equal(prepared.webdriverCapabilities['appium:autoLaunch'], false);
139+
});
140+
129141
function fakeClient(
130142
session: Partial<AwsDeviceFarmRemoteAccessSession>,
131143
onPoll?: () => void,

packages/provider-webdriver/src/aws-device-farm.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -239,16 +239,16 @@ export function createAwsDeviceFarmPrepareSession(
239239
typeof options.webdriverCapabilities === 'function'
240240
? options.webdriverCapabilities(lease)
241241
: (options.webdriverCapabilities ?? {});
242+
const awsDefaults = options.platform === 'android' ? { 'appium:autoLaunch': false } : {};
242243
return {
243244
...base,
244245
endpoint,
245246
platform: options.platform,
246247
deviceName,
247-
webdriverCapabilities: buildCloudWebDriverBaseCapabilities(
248-
options.platform,
249-
deviceName,
250-
configured,
251-
),
248+
webdriverCapabilities: buildCloudWebDriverBaseCapabilities(options.platform, deviceName, {
249+
...awsDefaults,
250+
...configured,
251+
}),
252252
cleanup: async () => {
253253
await options.client.stopRemoteAccessSession(running.arn);
254254
return { awsDeviceFarmSessionArn: running.arn };

0 commit comments

Comments
 (0)