Skip to content

Commit

Permalink
refactor: use appium:otherApps instead of installApp
Browse files Browse the repository at this point in the history
Because the latter doesn't work on saucelabs with `storage:` specifier. See https://support.saucelabs.com/hc/en-us/requests/123037
  • Loading branch information
vaind committed Jul 18, 2022
1 parent 8552602 commit 104f178
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ updateConfig(config)
config.capabilities = [{
platformName: 'Android',
'appium:automationName': 'UIAutomator2',
'appium:autoLaunch': false,
}];

exports.config = config;
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,16 @@ config.services = config.services.concat([
]
]);

config.onPrepare = async (config, capabilities) => {
const appsUnderTest = config.customApps as AppInfo[]

capabilities[0]['appium:otherApps'] = []
for (const app of appsUnderTest) {
console.log(`Adding app ${app.name} from ${app.path} to 'appium:otherApps'`)
capabilities[0]['appium:otherApps'].push(app.path)
}

capabilities[0]['appium:otherApps'] = JSON.stringify(capabilities[0]['appium:otherApps'])
}

export default config;
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,11 @@ config.services = config.services.concat([['sauce']])
config.onPrepare = async (config, capabilities) => {
const appsUnderTest = config.customApps as AppInfo[]

capabilities[0]['appium:otherApps'] = []
for (const app of appsUnderTest) {
await uploadApp(sauceOptions, app)
const fileId = await uploadApp(sauceOptions, app)
console.log(`Adding app ${app.name} from ${app.path} to 'appium:otherApps' as 'storage:${fileId}'`)
capabilities[0]['appium:otherApps'].push(`storage:${fileId}`)
}
}

Expand Down
7 changes: 0 additions & 7 deletions performance-tests/appium/test/specs/startup.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,6 @@ describe('Apps', () => {
for (var j = 0; j < appsUnderTest.length; j++) {
const app = appsUnderTest[j]

if (isSauceLabs) {
app.path = 'storage:' + await findAppOnServer(driver.config.sauceOptions, app)
}

console.log(`Installing app ${app.name} from ${app.path}`)
await driver.installApp(app.path)

console.log(`Collecting startup times for app ${app.name}`)
for (var i = 0; i < runs; i++) {
// Note: sleeping before launching the app (instead of after), improves the speed of the first launch.
Expand Down

0 comments on commit 104f178

Please sign in to comment.