You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add the plugin as a `devDependency` to your project:
12
15
13
-
`$ npm install --save-devappium`
16
+
`$ npm install -D nativescript-dev-appium`
14
17
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:
16
19
17
20
`$ npm install -g appium`
18
21
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" ]`
|`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
+
## <aname='usage'></a>Usage
20
56
21
57
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.
When installed, the plugin creates `e2e` folder containing sample test file and configuration folder `config` where your custom capabilities reside.
50
86
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
95
131
"app": ""
96
132
97
133
},
98
-
"sim.iPhone7.iOS110": {
134
+
"sim.iPhone8.iOS110": {
99
135
"browserName": "",
100
136
"platformName": "iOS",
101
-
"platformVersion": "10.0",
102
-
"deviceName": "iPhone 7 110",
137
+
"platformVersion": "11.0",
138
+
"deviceName": "iPhone 8 110",
103
139
"app": ""
104
140
105
141
}
@@ -118,25 +154,40 @@ As you can see, the `app` property can be left an empty string which will force
118
154
|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|
119
155
|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|
120
156
|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 |
0 commit comments