{"id":15018527,"url":"https://github.com/nativescript/nativescript-dev-appium","last_synced_at":"2025-10-19T16:31:13.080Z","repository":{"id":45902240,"uuid":"58553304","full_name":"NativeScript/nativescript-dev-appium","owner":"NativeScript","description":"A package to help with writing and executing e2e Appium tests in NativeScript apps","archived":false,"fork":false,"pushed_at":"2021-03-08T15:57:46.000Z","size":995,"stargazers_count":70,"open_issues_count":27,"forks_count":27,"subscribers_count":22,"default_branch":"master","last_synced_at":"2024-10-29T15:51:55.288Z","etag":null,"topics":["appium","automation","automation-ui","e2e","nativescript","nativescript-dev-appium","testing"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/NativeScript.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-05-11T14:42:18.000Z","updated_at":"2024-05-30T15:47:24.000Z","dependencies_parsed_at":"2022-09-26T18:51:16.153Z","dependency_job_id":null,"html_url":"https://github.com/NativeScript/nativescript-dev-appium","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NativeScript%2Fnativescript-dev-appium","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NativeScript%2Fnativescript-dev-appium/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NativeScript%2Fnativescript-dev-appium/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NativeScript%2Fnativescript-dev-appium/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NativeScript","download_url":"https://codeload.github.com/NativeScript/nativescript-dev-appium/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237163255,"owners_count":19265240,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["appium","automation","automation-ui","e2e","nativescript","nativescript-dev-appium","testing"],"created_at":"2024-09-24T19:52:04.585Z","updated_at":"2025-10-19T16:31:07.716Z","avatar_url":"https://github.com/NativeScript.png","language":"TypeScript","readme":"# nativescript-dev-appium\n\nA package to help with writing and executing e2e [Appium](http://appium.io) tests.\n\n\u003c!-- TOC depthFrom:2 --\u003e\n\n- [Features](#features)\n- [Requirеments](#requirеments)\n- [Setup](#setup)\n    - [Structure](#structure)\n    - [Files Preview](#files-preview)\n- [Usage](#usage)\n- [Blogs](#blogs)\n- [Demos](#demos)\n- [Videos](#videos)\n- [Custom Appium Capabilities](#custom-appium-capabilities)\n- [Options](#options)\n- [Troubleshooting](#troubleshooting)\n- [Common Problems](#common-problems)\n- [Missing Features](#missing-features)\n- [Contribute](#contribute)\n- [Get Help](#get-help)\n\n\u003c!-- /TOC --\u003e\n\n## Features\n\n1. Cross-platform [locators](https://github.com/NativeScript/nativescript-dev-appium/blob/master/lib/locators.ts)\n1. Find strategies: *findElementByText*, *findElementByClassName*, *findElementByAccessibilityId*, *findElementByXPath*\n1. Actions: *tap*, *click*, *doubleTap*, *hold*\n1. Gestures: *scroll*, *scrollTo*, *swipe*, *drag*\n1. Cross-platform element abstraction with *exists*, *waitForExist*, *waitForNotExist*, *location*, *isDisplayed*, *size*, *text* properties\n1. Ability to turn on/off “Don’t keep activities” setting in the Developer options for Android\n1. Direct access to driver\n1. Typings\n1. Async/Await\n1. Open source cloud builds integration, i. e. [Sauce Labs](https://saucelabs.com/)\n1. Image comparison of: screen, rectangle; block out areas to ignore\n1. [WIP] Ability to verify animations/transitions through video/images; please refer to [frame-comparer](https://github.com/SvetoslavTsenov/frame-comparer)\n1. Mochawesome HTML report - including screenshots in report\n\n## Requirements\n\nThe `nativescript-dev-appium` plugin requires:\n* latest version of [Appium](https://github.com/appium/appium/releases)\n    * for correct functioning of the [XCUITest](https://github.com/appium/appium/blob/master/docs/en/drivers/ios-xcuitest.md) driver for iOS, additional libraries are required (see the [Setup](#setup) section)\n    * for correct functioning of the [mobile-devices-controller](https://github.com/NativeScript/mobile-devices-controller) for Android emulators, `telnet` is required (see the [Setup](#setup) section)\n* latest version of [Xcode](https://developer.apple.com/library/content/releasenotes/DeveloperTools/RN-Xcode/Chapters/Introduction.html)\n* [Android SDK Tools](https://developer.android.com/studio/releases/sdk-tools.html) version greater than 25.3.0\n\n## Setup\n\nAdd the plugin as a *devDependency* to your project:\n\n```shell\n$ npm install -D nativescript-dev-appium\n```\n\n\u003e 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.\n\nThen 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:\n\n```shell\n$ npm install -g appium\n```\n\nInstall external dependencies of [XCUITest](https://github.com/appium/appium-xcuitest-driver/blob/master/README.md#external-dependencies) driver for iOS via:\n\n* [Homebrew](https://brew.sh):\n\n```shell\n$ brew install carthage\n$ brew install libimobiledevice --HEAD\n$ brew install ideviceinstaller\n$ brew install ios-webkit-debug-proxy\n```\n\n* [NPM](https://www.npmjs.com/):\n\n```shell\n$ npm install -g ios-deploy\n```\n\n\u003e For detailed information on external dependencies, please, refer to the [XCUITest](https://github.com/appium/appium-xcuitest-driver/blob/master/README.md#external-dependencies) repository.\n\nFor correct functioning of the [mobile-devices-controller](https://github.com/NativeScript/mobile-devices-controller) for Android emulators, `telnet` is required to be available on your system.\n\nAs the `telnet` was removed from *macOS High Sierra*, it could be installed as follows:\n\n```shell\n$ brew install telnet\n```\n\n### Structure\n\n        my-app\n        ├── app\n        ├── e2e\n            ├── config\n                ├── appium.capabilities.json\n                ├── mocha.opts\n            ├── sample.e2e-test.ts\n            ├── setup.ts\n            ├── tsconfig.json\n        ├── ...\n        ├── package.json\n        ├── tsconfig.json\n\n\u003e To avoid any incompatibilities between the source of *e2e* tests (ES6) and the source of the application (ES5), we recommend to exclude the *e2e* folder from the application's *tsconfig.json* file: `exclude\": [ \"e2e\" ]`.\n\n### Files Preview\n\n|File                |Purpose|\n|:-----------------------------:|:-------------------:|\n|config/appium.capabilities.json|Contains predefined configurations for test execution.|\n|config/mocha.opts              |A default mocha configuration file.                   |\n|sample.e2e-test.ts             |Contains a predefined ready-to-execute sample tests of the default [hello-world-ts](https://github.com/NativeScript/template-hello-world-ts) template.|\n|setup.ts                       |Defines the `before` and `after` test execution hooks responsible to start and stop the [Appium](http://appium.io/) server.|\n|tsconfig.json                  |TypeScript compiler configuration file for the `e2e` tests.|\n\n\u003e Note - the folders below are related to the image comparison feature:\n\u003e * `e2e/reports` - this folder is created during test execution and stores the actual images from comparison\n\u003e * `e2e/resources` - this folder aims to store the expected images for comparison\n\n## Usage\n\nBefore 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.\n\n```shell\n$ tns build android\n```\n\nor\n\n```shell\n$ tns build ios\n```\n\nThe command that will run the tests should specify the targeted capabilities configuration using the `runType` option as shown below. This way a capabilities will be selected from the [capabilities](#custom-appium-capabilities) configuration file.\n\n```\n$ npm run e2e -- --runType android25\n```\n\nor\n\n```\n$ npm run e2e -- --runType sim.iPhone8.iOS110\n```\n\nor for local runs during development \n```\n$ npm run e2e android\n$ npm run e2e ios\n$ npm run e2e -- --device.name=/iPhone X/ --device.apiLevel=/12.1/\n```\n\nGenerated tests are standard [Mocha](http://mochajs.org) tests.\n\nNOTE: When using Jasmine instead of Mocha, additional npm params (like `runType`) must have an equal sign (=) instead of a space.\n```\nnpm run e2e -- --runType=sim.iPhoneX\n```\n\n## Blogs\n\n2018, March 6th: [Start Testing Your NativeScript Apps Properly](https://www.nativescript.org/blog/start-testing-your-nativescript-apps-properly)\n\n## Demos\n\nThe official demos of the [nativescript-dev-appium](https://github.com/NativeScript/nativescript-dev-appium#nativescript-dev-appium) plugin: [https://github.com/NativeScript/ns-dev-days-appium-plugin](https://github.com/NativeScript/ns-dev-days-appium-plugin).\n\nThese tests demonstrate:\n- [template-hello-world-ts/e2e](https://github.com/NativeScript/ns-dev-days-appium-plugin/blob/master/template-hello-world-ts/e2e/) - *nativescript-dev-appium* basics: configurations, find strategies, locators, actions.\n- [template-hello-world-ng/e2e](https://github.com/NativeScript/ns-dev-days-appium-plugin/blob/master/template-hello-world-ng/e2e/) - the page object pattern with *nativescript-dev-appium*.\n\n**Tests on NativeScript Continuous Integration**\n\n[NativeScript/e2e/modal-navigation](https://github.com/NativeScript/NativeScript/tree/master/e2e/modal-navigation) - use \"Don't keep activities\", run background (minimize/restore) app.\n\n[nativescript-angular/e2e/renderer](https://github.com/NativeScript/nativescript-angular/tree/master/e2e/renderer) - use basics: locators, find strategies, assertions.\n\n[nativescript-angular/e2e/router](https://github.com/NativeScript/nativescript-angular/tree/master/e2e/router) - use basics: locators, find strategies, assertions.\n\n[nativescript-dev-webpack/demo/AngularApp](https://github.com/NativeScript/nativescript-dev-webpack/tree/master/demo/AngularApp) - use data driven approach, compares element's images.\n\n[nativescript-dev-webpack/demo/JavaScriptApp](https://github.com/NativeScript/nativescript-dev-webpack/tree/master/demo/JavaScriptApp) - use data driven approach, compares element's images.\n\n[nativescript-dev-webpack/demo/TypeScriptApp](https://github.com/NativeScript/nativescript-dev-webpack/tree/master/demo/TypeScriptApp) - use data driven approach, compares element's images.\n\n## Videos\n\n2018 March 6th: [NativeScript Air 6 - UI Testing {N} apps with DevAppium](https://www.youtube.com/watch?v=Sn4hBaxOt88)\n\n2017 Sept 27th: [NativeScript testing with Appium](https://www.youtube.com/watch?v=Ns7boY6XNC0) @ [NativeScript Developer Day Europe 2017](https://www.nativescript.org/events/developer-day-europe-2017)\n\n2017 Sept 19th: [Introduction to Mobile UI Test Automation](https://www.youtube.com/watch?v=LjgIM4pvhsQ\n) @ [NativeScript Developer Day 2017](http://developerday.nativescript.org/)\n\n## Custom Appium Capabilities\n\nWhen installed, the plugin creates `e2e` folder containing sample test file and configuration folder `config` where your custom capabilities reside. \nThe 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:\n\n```\nmy-app\n├── app\n├── assets\n├── package.json\n.\n.\n.\n└── appium.capabilities.json\n```\n\nIf the file structure assembles plugin repo structure like for example [nativescript-plugin-seed](https://github.com/NativeScript/nativescript-plugin-seed) the suggested location is:\n\n```\nmy-plugin\n├── demo\n├── demo-angular\n├── src\n└── appium.capabilities.json\n```\nThus, the same configuration can be used by both apps without duplication of files.\n\nIf you wish to use another location of the capabilities file instead default ones, you can specify it with `--appiumCapsLocation` option. Remember that the path provided has to be relative to the root directory.\n\nNotice that once custom capabilities are provided you will be able to pick any of them using the `--runType` option (e.g. `--runType android25`). See sample content of `appium.capabilities.json` file below. For more details regarding the Appium Capabilities read [Appium documentation about Desired Capabilities](https://appium.io/docs/en/writing-running-appium/caps/):\n\n```\n{\n    \"android21\": {\n            \"browserName\": \"\",\n            \"platformName\": \"Android\",\n            \"platformVersion\": \"5.0\",\n            \"deviceName\": \"Android Emulator\",\n            \"noReset\": false,\n            \"app\": \"\"\n        \n    },\n    \"android25\": {\n            \"browserName\": \"\",\n            \"platformName\": \"Android\",\n            \"platformVersion\": \"7.0\",\n            \"deviceName\": \"Android Emulator\",\n            \"noReset\": false,\n            \"app\": \"\"\n        \n    },\n    \"sim.iPhone8.iOS110\": {\n            \"browserName\": \"\",\n            \"platformName\": \"iOS\",\n            \"platformVersion\": \"11.0\",\n            \"deviceName\": \"iPhone 8 110\",\n            \"app\": \"\"\n        \n    }\n}\n```\n\nAs you can see, the `app` property can be left an empty string which will force the plugin to search for an app package in `platforms` folder. However, this search functionality depends on `runType` option so if you think of using it add `android`, `device`, `sim` strings as part of your `runType` option which in fact is your capability key in the config file. E.g --runType android23, --runType sim.iPhone8.iOS110. Thus, the runner will manage to look in the right location in order to search for app package.\n\n**It is important to build your app in advance as explained in [Usage](#usage) section, because the runner expects to provide app package to it or such to exists in the search location.**\n\n**For faster testing when working on an app with livesync it would be better to use --devMode option or start a new session using --startSession option and run tests using --attachToDebug option and specify appium --port. Or simply start session with appium desktop application**\n\n## Options\n\n|Option| Description | Value |\n|---|---|---|\n|runType| Select the capabilities from your config file `appium.capabilities.json`| Consider using `android`, `device`, `sim` strings as part of your `runType` option if you haven't provided `app` capability. Thus, the runner will look for app package in the right location for the current run. \u003cbr/\u003e e.g. --runType ios-device10iPhone6|\n|appPath| Provide location of the app package to be tested. This will overwrite all provided capabilities for app| Possible values are:\u003cbr/\u003e - 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)\u003cbr/\u003e - path e.g. `platforms/android/build/outputs/apk/demo.apk`.\u003cbr/\u003e Example: --appPath demo-debug.apk|\n|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|\n|appiumCapsLocation| Change the location where `appium.capabilities.json` config file can be. It should be relative to the root directory | e.g. --appiumCapsLocation /e2e-tests|\n|port| Appium server port|\n|storage| Specify remote image storage |\n|ignoreDeviceController| Setting this option you will use default appium device controller which is recommended when tests are executed on cloud based solutions |\n|sessionId| In order to attach to already started session|Option --port is mandatory in this case. It will automatically set --devMode to true. Provides ability nativescript-dev-appium to be used with [appium desktop client](https://github.com/appium/appium-desktop/releases)|\n|attachToDebug| Same as sessionId but no need to provide session id.|Option --port is mandatory in this case. It will automatically resolve --sessionId. Provides ability nativescript-dev-appium to be used with [appium desktop client](https://github.com/appium/appium-desktop/releases)|\n|startSession|Start new appium server and initialize appium driver.|\n|cleanApp| Remove application from device on server quit.|\n\nExamples:\n\nLet say that we have a script in package.json like this \n\n```\n \"scripts\": {\n    \"e2e\": \"tsc -p e2e \u0026\u0026 mocha --opts ./config/mocha.opts --recursive e2e --appiumCapsLocation ./config/appium.capabilities.json\"\n }\n\n ```\n\nRun tests in sauceLab\n```\n$ npm run e2e -- --runType android25 --sauceLab --appPath demo.apk\n```\n\nRun tests locally\n```\n$ npm run e2e -- --runType android25\n```\n\nStarting new session will console log appium server port and session id\n```\n$ node ./node_modules/.bin/ns-appium --runType android23 --startSession --port 8300\n```\nRun tests with already started session. Specify session id and server port. Default value for server port is 8300\n```\n$ npm run e2e -- --sessionId e72daf17-8db6-4500-a0cf-59a66effd6b9 --port 8300 \n```\nor simply use --attachToDebug which will attached to first available session. This is not recommended when more than one session is available.\n```\n$ npm run e2e -- --attachToDebug --port 8300\n```\n\n## Troubleshooting\n\nUse the `--verbose` option to get error details:\n\n```\n$ npm run e2e -- --runType android25 --verbose\n```\n\n## Common Problems\n\n1. Missing installed appium\n2. Misleading appPath or capabilities location. Please make sure that the path to the app or capabilities location is correct.\n3. Misleading details for device specified in appium config\n\n## Contribute\nWe love PRs! Check out the [contributing guidelines](CONTRIBUTING.md). If you want to contribute, but you are not sure where to start - look for [issues labeled `help wanted`](https://github.com/NativeScript/nativescript-dev-appium/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22).\n\n## Get Help \nPlease, use [github issues](https://github.com/NativeScript/nativescript-dev-appium/issues) strictly for [reporting bugs](CONTRIBUTING.md#reporting-bugs) or [requesting features](CONTRIBUTING.md#requesting-features). For general questions and support, check out the [NativeScript community forum](https://discourse.nativescript.org/) or ask our experts in [NativeScript community Slack channel](http://developer.telerik.com/wp-login.php?action=slack-invitation).\n  \n![](https://ga-beacon.appspot.com/UA-111455-24/nativescript/nativescript-dev-appium?pixel) \n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnativescript%2Fnativescript-dev-appium","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnativescript%2Fnativescript-dev-appium","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnativescript%2Fnativescript-dev-appium/lists"}