Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enforce Simulator shutdown if resetOnSessionStartOnly is set to false #950

Merged
merged 2 commits into from
May 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion lib/driver.js
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,9 @@ class XCUITestDriver extends BaseDriver {
}

if (this.opts.resetOnSessionStartOnly === false) {
await this.runReset();
await this.runReset(Object.assign({}, this.opts, {
enforceSimulatorShutdown: true,
}));
}

if (this.isSimulator() && !this.opts.noReset && !!this.opts.device) {
Expand Down
6 changes: 3 additions & 3 deletions lib/simulator-management.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,14 @@ async function runSimulatorReset (device, opts) {
// Terminate the app under test if it is still running on Simulator
// Termination is not needed if Simulator is not running
if (await device.isRunning()) {
if (device.xcodeVersion.major >= 8) {
if (opts.enforceSimulatorShutdown) {
await shutdownSimulator(device);
} else {
try {
await terminate(device.udid, opts.bundleId);
} catch (err) {
log.warn(`Reset: failed to terminate Simulator application with id "${opts.bundleId}"`);
}
} else {
await shutdownSimulator(device);
}
}
if (opts.app) {
Expand Down