Skip to content
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
2 changes: 1 addition & 1 deletion docs/helpers/Appium.md
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ let settings = await I.grabSettings();

Returns **[Promise][6]<[string][5]>** Appium: support Android and iOS

### \_switchToContext
### switchToContext

Switch to the specified context.

Expand Down
12 changes: 6 additions & 6 deletions lib/helper/Appium.js
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ class Appium extends Webdriver {
if (context.web) return this.switchToWeb(context.web);
if (context.webview) return this.switchToWeb(context.webview);
}
return this._switchToContext(context);
return this.switchToContext(context);
}

_withinEnd() {
Expand Down Expand Up @@ -834,7 +834,7 @@ class Appium extends Webdriver {
*
* @param {*} context the context to switch to
*/
async _switchToContext(context) {
async switchToContext(context) {
return this.browser.switchContext(context);
}

Expand All @@ -858,11 +858,11 @@ class Appium extends Webdriver {
this.isWeb = true;
this.defaultContext = 'body';

if (context) return this._switchToContext(context);
if (context) return this.switchToContext(context);
const contexts = await this.grabAllContexts();
this.debugSection('Contexts', contexts.toString());
for (const idx in contexts) {
if (contexts[idx].match(/^WEBVIEW/)) return this._switchToContext(contexts[idx]);
if (contexts[idx].match(/^WEBVIEW/)) return this.switchToContext(contexts[idx]);
}

throw new Error('No WEBVIEW could be guessed, please specify one in params');
Expand All @@ -885,8 +885,8 @@ class Appium extends Webdriver {
this.isWeb = false;
this.defaultContext = '//*';

if (context) return this._switchToContext(context);
return this._switchToContext('NATIVE_APP');
if (context) return this.switchToContext(context);
return this.switchToContext('NATIVE_APP');
}

/**
Expand Down
4 changes: 2 additions & 2 deletions test/helper/AppiumV2_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,12 +171,12 @@ describe('Appium', function () {
});
});

describe('app context and activity: #_switchToContext, #switchToWeb, #switchToNative', () => {
describe('app context and activity: #switchToContext, #switchToWeb, #switchToNative', () => {
it('should switch context', async () => {
await app.resetApp();
await app.waitForElement('~buttonStartWebviewCD', smallWait);
await app.click('~buttonStartWebviewCD');
await app._switchToContext('WEBVIEW_io.selendroid.testapp');
await app.switchToContext('WEBVIEW_io.selendroid.testapp');
const val = await app.grabContext();
return assert.equal(val, 'WEBVIEW_io.selendroid.testapp');
});
Expand Down
4 changes: 2 additions & 2 deletions test/helper/Appium_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,12 +168,12 @@ describe('Appium', function () {
});
});

describe('app context and activity: #_switchToContext, #switchToWeb, #switchToNative', () => {
describe('app context and activity: #switchToContext, #switchToWeb, #switchToNative', () => {
it('should switch context', async () => {
await app.resetApp();
await app.waitForElement('~buttonStartWebviewCD', smallWait);
await app.click('~buttonStartWebviewCD');
await app._switchToContext('WEBVIEW_io.selendroid.testapp');
await app.switchToContext('WEBVIEW_io.selendroid.testapp');
const val = await app.grabContext();
return assert.equal(val, 'WEBVIEW_io.selendroid.testapp');
});
Expand Down
2 changes: 1 addition & 1 deletion typings/tests/helpers/Appium.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ appium.grabCurrentActivity(); // $ExpectType Promise<string>
appium.grabNetworkConnection(); // $ExpectType Promise<{}>
appium.grabOrientation(); // $ExpectType Promise<string>
appium.grabSettings(); // $ExpectType Promise<string>
appium._switchToContext(str); // $ExpectType void
appium.switchToContext(str); // $ExpectType void
appium.switchToWeb(); // $ExpectType Promise<void>
appium.switchToNative(); // $ExpectType Promise<void>
appium.switchToNative(str); // $ExpectType Promise<void>
Expand Down
2 changes: 1 addition & 1 deletion typings/tests/helpers/AppiumTs.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ appium.grabCurrentActivity(); // $ExpectType Promise<string>
appium.grabNetworkConnection(); // $ExpectType Promise<{}>
appium.grabOrientation(); // $ExpectType Promise<string>
appium.grabSettings(); // $ExpectType Promise<string>
appium._switchToContext(str); // $ExpectType Promise<any>
appium.switchToContext(str); // $ExpectType Promise<any>
appium.switchToWeb(); // $ExpectType Promise<void>
appium.switchToNative(); // $ExpectType Promise<void>
appium.switchToNative(str); // $ExpectType Promise<void>
Expand Down