Skip to content

Commit 8af792d

Browse files
committed
Update README for android setup.
1 parent 790dabc commit 8af792d

File tree

1 file changed

+81
-1
lines changed

1 file changed

+81
-1
lines changed

README.md

Lines changed: 81 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,81 @@
1-
# @nightwatch/mobile-helper
1+
# @nightwatch/mobile-helper
2+
3+
## Setup for mobile-web testing
4+
5+
### Android
6+
7+
1. From your [Nightwatch](https://nightwatch.org) project's root dir, run:
8+
9+
```sh
10+
npx @nightwatch/mobile-helper android
11+
```
12+
2. Answer a few questions related to your requirements:
13+
3. It will verify if all the requirements are being met.
14+
4. If all requirements are not being met, it will ask whether to download and setup those requirements:
15+
5. Voila :tada: Your setup is now complete. (If something fails, follow the instructions and re-run the command.)
16+
6. Add the following env configuration to your `nightwatch.conf.js` or `nightwatch.json` file:
17+
```js
18+
"test_settings": {
19+
// other envs above this line
20+
'android.chrome': {
21+
desiredCapabilities: {
22+
browserName: 'chrome',
23+
'goog:chromeOptions': {
24+
w3c: true,
25+
args: [
26+
//'--no-sandbox',
27+
//'--ignore-certificate-errors',
28+
//'--allow-insecure-localhost',
29+
//'--headless'
30+
],
31+
androidPackage: 'com.android.chrome',
32+
// add the device serial to run tests on, if multiple devices are online
33+
// Run command: `$ANDROID_HOME/platform-tools/adb devices`
34+
// androidDeviceSerial: ''
35+
},
36+
},
37+
38+
webdriver: {
39+
start_process: true,
40+
server_path: 'chromedriver-mobile/chromedriver',
41+
cli_args: [
42+
// --verbose
43+
]
44+
}
45+
},
46+
47+
'android.firefox': {
48+
desiredCapabilities: {
49+
browserName: 'firefox',
50+
acceptInsecureCerts: true,
51+
'moz:firefoxOptions': {
52+
args: [
53+
// '-headless',
54+
// '-verbose'
55+
],
56+
androidPackage: 'org.mozilla.firefox',
57+
// add the device serial to run tests on, if multiple devices are online
58+
// Run command: `$ANDROID_HOME/platform-tools/adb devices`
59+
// androidDeviceSerial: 'ZD2222W62Y'
60+
}
61+
},
62+
webdriver: {
63+
start_process: true,
64+
server_path: '',
65+
cli_args: [
66+
// very verbose geckodriver logs
67+
// '-vv'
68+
]
69+
}
70+
},
71+
}
72+
```
73+
7. If testing on real-device, make sure latest version of Chrome/Firefox browsers are installed. Otherwise install them from Google Play Store.
74+
8. If testing on emulator, make sure `chromedriver-mobile/chromedriver` is present in your Nightwatch project's root dir. Otherwise, re-run the command in first step.
75+
9. Run your nightwatch tests on Android mobile browsers:
76+
```sh
77+
# for firefox
78+
npx nightwatch --env android.firefox
79+
# for chrome
80+
npx nightwatch --env android.chrome
81+
```

0 commit comments

Comments
 (0)