Skip to content

Commit 9a9fb3c

Browse files
SvetoslavTsenovVasil Chimev
authored andcommitted
docs: update README.md (#64)
* chore: readme * docs: update README.md * docs: typos in README.md
1 parent aac5798 commit 9a9fb3c

File tree

3 files changed

+70
-22
lines changed

3 files changed

+70
-22
lines changed

README.md

Lines changed: 69 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,57 @@
22

33
A package to help with writing and executing e2e [Appium](http://appium.io) tests.
44

5-
## <a name='usage'></a>Usage
5+
## <a name='requirements'></a>Requirments
66

7-
Install it with:
7+
The `nativescript-dev-appium` plugin requires:
8+
* latest version of [Appium](https://github.com/appium/appium/releases)
9+
* latest version of [Xcode](https://developer.apple.com/library/content/releasenotes/DeveloperTools/RN-Xcode/Chapters/Introduction.html)
10+
* [Android SDK Tools](https://developer.android.com/studio/releases/sdk-tools.html) version greater than 25.3.0
811

9-
`$ npm install --save-dev nativescript-dev-appium`
12+
## <a name='setup'></a>Set Up
1013

11-
Install Appium locally:
14+
Add the plugin as a `devDependency` to your project:
1215

13-
`$ npm install --save-dev appium`
16+
`$ npm install -D nativescript-dev-appium`
1417

15-
Or install appium globally (to avoid installing it for every app):
18+
Then install [Appium](https://www.npmjs.com/package/appium) - we recommend a global installation to avoid adding it to every project you would like to test:
1619

1720
`$ npm install -g appium`
1821

19-
After installation, you should have a sample test below the `e2e` directory which you can rename of your choice. However, if you rename the folder you will have to specify it using `--testfolder someFolderName` option.
22+
After completion of the installation, if your project has a dependency to *TypeScript*, the plugin should have added an `e2e` folder containing predefined configs and samples.
23+
24+
### Structure
25+
26+
my-app
27+
├── app
28+
├── e2e
29+
├── configs
30+
├── appium.capabilities.json
31+
├── mocha.opts
32+
├── sample.e2e-test.ts
33+
├── setup.ts
34+
├── tsconfig.json
35+
├── ...
36+
├── package.json
37+
├── tsconfig.json
38+
39+
> Note - To avoid any incompatibilities between the source of `e2e` tests and the source of the application, we recommend to exclude the `e2e` folder from the application's `tsconfig.json` file: `exclude": [ "e2e" ]`
40+
41+
### Files Preview
42+
43+
|File |Purpose|
44+
|:-------------------------------:|:-------------------:|
45+
|`config/appium.capabilities.json`|Contains predefined configurations for test execution.|
46+
|`config/mocha.opts` |A default mocha configuration file. |
47+
|`sample.e2e-test.ts` |Contains a predefined ready-to-execute sample tests of the default [*hello-world*](https://github.com/NativeScript/template-hello-world-ts) template.|
48+
|`setup.ts` |Defines the `before` and `after` test execution hooks responsible to start and stop the [Appium](http://appium.io/) server.|
49+
|`tsconfig.json` |TypeScript compiler configuration file for the `e2e` tests.|
50+
51+
> Note - The folders below are related to the image comparison feature:
52+
> * `e2e/reports` - this folder is created during test execution and stores the actual images from comparison
53+
> * `e2e/resources` - this folder aims to store the expected images for comparison
54+
55+
## <a name='usage'></a>Usage
2056

2157
Before running the tests you will have to build your app for the platform on test or both. Navigate to your demo app folder from where you will execute the commands that follow.
2258

@@ -39,12 +75,12 @@ $ npm run e2e -- --runType android25
3975
or
4076

4177
```
42-
$ npm run e2e -- --runType sim.iPhone7.iOS110
78+
$ npm run e2e -- --runType sim.iPhone8.iOS110
4379
```
4480

4581
Generated tests are standard [Mocha](http://mochajs.org) tests.
4682

47-
## <a name='customCapabilities'></a>Custom Appium capabilities
83+
## <a name='customCapabilities'></a>Custom Appium Capabilities
4884

4985
When installed, the plugin creates `e2e` folder containing sample test file and configuration folder `config` where your custom capabilities reside.
5086
The existence of such capabilities is a runner's requirement which comes from [Appium](https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/caps.md). Additional locations where the runner will search for the config file are:
@@ -95,11 +131,11 @@ Notice that once custom capabilities are provided you will be able to pick any o
95131
"app": ""
96132
97133
},
98-
"sim.iPhone7.iOS110": {
134+
"sim.iPhone8.iOS110": {
99135
"browserName": "",
100136
"platformName": "iOS",
101-
"platformVersion": "10.0",
102-
"deviceName": "iPhone 7 110",
137+
"platformVersion": "11.0",
138+
"deviceName": "iPhone 8 110",
103139
"app": ""
104140
105141
}
@@ -118,25 +154,40 @@ As you can see, the `app` property can be left an empty string which will force
118154
|appPath| Provide location of the app package to be tested. This will overwrite all provided capabilities for app| Possible values are:<br/> - app build package name (in case `--sauceLab` option is set it will prepend `sauce-storage:` in front of the app name so app has to be [uploaded to Sauce Labs](https://wiki.saucelabs.com/display/DOCS/Uploading+Mobile+Applications+to+Sauce+Storage+for+Testing) before execution starts)<br/> - path e.g. `platforms/android/build/outputs/apk/demo.apk`.<br/> Example: --appPath demo-debug.apk|
119155
|sauceLab| Enable tests execution in [Sauce Labs](https://saucelabs.com/). As a prerequisite you will have to define `SAUCE_USER` and `SAUCE_KEY` as [environment variable](https://wiki.saucelabs.com/display/DOCS/Best+Practice%3A+Use+Environment+Variables+for+Authentication+Credentials)| e.g. --sauceLab|
120156
|capsLocation| Change the location where `appium.capabilities.json` config file can be. It should be relative to the root directory | e.g. --capsLocation /e2e-tests|
157+
|port| Appium server port|
158+
|storage| Specify remote image storage |
159+
|ignoreDeviceController| Setting this option you will use default appium device controller which is recommended when tests are executed on cloud based solutions |
121160

122161
Examples:
123162

124163
```
125-
$ npm run e2e --runType android25 --sauceLab --appLocation demo.apk --capsLocation "/e2e-tests/config"
126-
164+
$ npm run e2e -- --runType android25 --sauceLab --appLocation demo.apk --capsLocation "/e2e-tests/config"
127165
```
128166

167+
## Features
168+
169+
1. Compare images. Block out areas to ignore in comparison.
170+
2. Find elements findElementByText, findElementsByXPath, findElementByAccessibilityId etc...
171+
3. Gesture support: swipe, scroll, drag, scrollTo
172+
4. Action support: tap, click, doubleTap, hold,
173+
5. Element characteristics: location, exists, size, isDisplayed
174+
6. Find strategies: waitForExist, waitForExistNot
175+
7. Direct access to webdriver and webdriverio
176+
129177
## Troubleshooting
130178

131179
Use the `--verbose` option to get error details:
132180

133181
```
134-
$ npm run appium --runType=android --verbose
182+
$ npm run e2e -- --runType android25 --verbose
135183
```
136184

137-
## Missing features
185+
## Common Problems
186+
187+
1. Missing installed appium
188+
2. Missleading appPath or capabilities location. Please make sure that the path to the app or capabilities location is correct.
138189

139-
1. Faster developer turnaround when working on an app. Find a way to use livesync and kick off Appium tests for the app that's on the device already.
140190

191+
## Missing Features
141192

142-
## Br
193+
1. Faster developer turnaround when working on an app. Find a way to use livesync and kick off Appium tests for the app that's on the device already.
File renamed without changes.

postinstall.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,7 @@ function updatePackageJsonDependencies(packageJson, isTypeScriptProject) {
114114
}
115115
}
116116

117-
// uncomment after npm is fixed
118-
//configureDevDependencies(packageJson);
119-
console.warn("WARNING: nativescript-dev-appium no longer installs Appium as a local dependency!");
120-
console.info("Add appium as a local dependency (see README) or we'll attempt to run it from PATH.");
117+
// configureDevDependencies(packageJson);
121118
writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2));
122119
}
123120

0 commit comments

Comments
 (0)