Skip to content

Commit ebf8639

Browse files
authored
Fix appium-helper's client code to run with Appium v2.0+ properly (#317)
* fix(appium-helper): update server base path * fix(appium-helper): update capabilities to use required vendor prefix * fix(appium-helper): update readme to mention appium driver installation
1 parent 8543424 commit ebf8639

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

packages/plugins/appium-helper/AppiumDriver.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,17 +69,17 @@ export class AppiumDriver {
6969
const capabilities = {
7070
platformName: "Android",
7171
"appium:automationName": "UiAutomator2",
72-
appPackage,
72+
"appium:appPackage": appPackage,
7373
// See https://github.com/appium/appium/blob/1e30207ec4e413c64396420fbb0388392e88cc54/docs/en/writing-running-appium/other/reset-strategies.md
7474
"appium:noReset": true,
75-
autoLaunch: false,
76-
appActivity,
77-
newCommandTimeout: TEN_MINUTES,
75+
"appium:autoLaunch": false,
76+
"appium:appActivity": appActivity,
77+
"appium:newCommandTimeout": TEN_MINUTES,
7878
...clientCapabilities,
7979
};
8080

8181
const client = await webdriver.remote({
82-
path: "/wd/hub",
82+
path: "/",
8383
port: 4723,
8484
logLevel: "warn",
8585
capabilities,

packages/plugins/appium-helper/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,16 @@ import { AppiumDriver } from "@bam.tech/appium-helper";
3535
test("e2e", async () => {
3636
const driver = await AppiumDriver.create({
3737
// `npx @perf-profiler/profiler getCurrentApp` will display info for the current app
38-
appPackage: com.example,
39-
appActivity: com.example.MainActivity,
38+
appPackage: "com.example",
39+
appActivity: "com.example.MainActivity",
4040
});
4141

4242
driver.startApp();
4343
await driver.findElementByText("Welcome");
4444
});
4545
```
4646

47-
3. Run the appium server `npx appium` in a terminal
47+
3. Run the appium server `npx appium` in a terminal. If you just installed Appium, you may need to install a driver, e.g., by running `npx appium driver install uiautomator2`.
4848
4. Run your test file in a separate terminal `yarn jest appium.test.ts`
4949

5050
### API

0 commit comments

Comments
 (0)