Skip to content

Commit

Permalink
pipe language through to xcrun launch
Browse files Browse the repository at this point in the history
  • Loading branch information
Luis Naranjo committed Jul 20, 2018
1 parent 1109f52 commit 797a3dd
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
10 changes: 6 additions & 4 deletions detox/src/devices/AppleSimUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,12 @@ class AppleSimUtils {
}
}

async launch(udid, bundleId, launchArgs) {
async launch(udid, bundleId, launchArgs, language) {
const frameworkPath = await environment.getFrameworkPath();
const logsInfo = new LogsInfo(udid);
const args = this._joinLaunchArgs(launchArgs);

const result = await this._launchMagically(frameworkPath, logsInfo, udid, bundleId, args);
const result = await this._launchMagically(frameworkPath, logsInfo, udid, bundleId, args, language);
return this._parseLaunchId(result);
}

Expand Down Expand Up @@ -243,17 +243,19 @@ class AppleSimUtils {
return _.map(launchArgs, (v, k) => `${k} ${v}`).join(' ').trim();
}

async _launchMagically(frameworkPath, logsInfo, udid, bundleId, args) {
async _launchMagically(frameworkPath, logsInfo, udid, bundleId, args, language) {
const statusLogs = {
trying: `Launching ${bundleId}...`,
successful: `${bundleId} launched. The stdout and stderr logs were recreated, you can watch them with:\n` +
` tail -F ${logsInfo.absJoined}`
};

const languageFlag = !!language ? `-AppleLanguages "(${language})" ` : '';

const launchBin = `/bin/cat /dev/null >${logsInfo.absStdout} 2>${logsInfo.absStderr} && ` +
`SIMCTL_CHILD_DYLD_INSERT_LIBRARIES="${frameworkPath}/Detox" ` +
`/usr/bin/xcrun simctl launch --stdout=${logsInfo.simStdout} --stderr=${logsInfo.simStderr} ` +
`${udid} ${bundleId} --args ${args}`;
`${udid} ${bundleId} ${languageFlag}--args ${args}`;

return await exec.execWithRetriesAndLogs(launchBin, undefined, statusLogs, 1);
}
Expand Down
2 changes: 1 addition & 1 deletion detox/src/devices/Device.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ class Device {
}
}

const processId = await this.deviceDriver.launch(this._deviceId, _bundleId, this._prepareLaunchArgs(baseLaunchArgs));
const processId = await this.deviceDriver.launch(this._deviceId, _bundleId, this._prepareLaunchArgs(baseLaunchArgs), params.language);
this._processes[_bundleId] = processId;

await this.deviceDriver.waitUntilReady();
Expand Down
4 changes: 2 additions & 2 deletions detox/src/devices/SimulatorDriver.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ class SimulatorDriver extends IosDriver {
await this._applesimutils.uninstall(deviceId, bundleId);
}

async launch(deviceId, bundleId, launchArgs) {
return await this._applesimutils.launch(deviceId, bundleId, launchArgs);
async launch(deviceId, bundleId, launchArgs, language) {
return await this._applesimutils.launch(deviceId, bundleId, launchArgs, language);
}

async terminate(deviceId, bundleId) {
Expand Down

0 comments on commit 797a3dd

Please sign in to comment.