Skip to content

Commit

Permalink
fix: update build-wda script to a regular file
Browse files Browse the repository at this point in the history
We can't rely on directory hierarchies to find the script within WDA.
Also, it turns out that what we wanted out of this script was different anyway.
  • Loading branch information
jlipps committed Aug 11, 2021
1 parent 969ef69 commit eed79b8
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
30 changes: 30 additions & 0 deletions lib/build-wda.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { WebDriverAgent } from 'appium-webdriveragent';
import { translateDeviceName, getAndCheckXcodeVersion, getAndCheckIosSdkVersion } from './utils';
import { getExistingSim } from './simulator-management';
import { asyncify } from 'asyncbox';

const DEFAULT_SIM_NAME = 'iPhone 12';

// TODO: allow passing in all the various build params as CLI args
async function build () {
const xcodeVersion = await getAndCheckXcodeVersion();
const iosVersion = await getAndCheckIosSdkVersion();
const deviceName = translateDeviceName(iosVersion, DEFAULT_SIM_NAME);
const device = await getExistingSim({
platformVersion: iosVersion,
deviceName
});
const wda = new WebDriverAgent(xcodeVersion, {
iosSdkVersion: iosVersion,
platformVersion: iosVersion,
showXcodeLog: true,
device,
});
await wda.xcodebuild.start(true);
}

if (require.main === module) {
asyncify(build);
}

export default build;
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
],
"mainClass": "XCUITestDriver",
"scripts": {
"build-wda": "./node_modules/appium-webdriveragent/Scripts/build-webdriveragent.js"
"build-wda": "./build/lib/build-wda.js"
}
},
"main": "./build/index.js",
Expand Down

0 comments on commit eed79b8

Please sign in to comment.