Skip to content

Commit

Permalink
Reset context to NATIVE_APP instead of null
Browse files Browse the repository at this point in the history
  • Loading branch information
imurchie committed Feb 1, 2018
1 parent 09ea940 commit 1601620
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions lib/commands/general.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import androidHelpers from '../android-helpers';
import { util } from 'appium-support';
import B from 'bluebird';
import log from '../logger';
import { NATIVE_WIN } from '../webview-helpers';


let commands = {}, helpers = {}, extensions = {};
Expand Down Expand Up @@ -206,7 +207,7 @@ commands.startActivity = async function (appPackage, appActivity,
commands.reset = async function () {
await androidHelpers.resetApp(this.adb, Object.assign({}, this.opts, {fastReset: true}));
// reset context since we don't know what kind on context we will end up after app launch.
this.curContext = null;
this.curContext = NATIVE_WIN;

return await this.startAUT();
};
Expand Down Expand Up @@ -236,7 +237,7 @@ commands.setUrl = async function (uri) {
commands.closeApp = async function () {
await this.adb.forceStop(this.opts.appPackage);
// reset context since we don't know what kind on context we will end up after app launch.
this.curContext = null;
this.curContext = NATIVE_WIN;
};

commands.getDisplayDensity = async function () {
Expand Down
2 changes: 1 addition & 1 deletion test/unit/commands/general-specs.js
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ describe('General', function () {
await driver.reset().should.eventually.be.equal('aut');
helpers.resetApp.calledWith(driver.adb).should.be.true;
driver.startAUT.calledOnce.should.be.true;
expect(driver.curContext).to.be.null;
expect(driver.curContext).to.eql('NATIVE_APP');
});
});
describe('startAUT', function () {
Expand Down

0 comments on commit 1601620

Please sign in to comment.