npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@detools/appium-helper

v1.0.0

Published

Appium Helper

Downloads

1

Readme

Appium Helper

npm version Build Status

Almost zero config helper to run tests with Appium

Installation

npm i @detools/appium-helper --save-dev

Usage

Usage: appium-helper [options]

Options:

  -V, --version                     output the version number
  -p, --platform [type]             platform name
  -g, --glob [path]                 glob path for tests files
  -a, --app [path]                  path to application file
  -H, --appium-host [host]          appium host
  -P, --appium-port [port]          appium port
  -D, --device-name [name]          device name
  -V, --platform-version [version]  platform version
  -A, --automation-name [name]      automation name
  -N, --no-reset                    no reset
  -F, --full-reset                  full reset
  -R, --rc-file [path]              path to rc file (default .appiumhelperrc)
  -r, --register [file...]          register
  --playground                      playground
  -h, --help                        output usage information

Minimal setup

  1. Create your first test suite:

    // ./__tests__/01_test_title.js
    
    import test from 'tape-async'
    import helper from '@detools/appium-helper'
    
    const { driver, idFromText } = helper
    
    test('Test if user can see title', async (t) => {
      const titleId = idFromText('Welcome to React Native!')
      await driver.waitForVisible(titleId, 60000)
      const title = await driver.getText(titleId)
      t.equal(title, 'Welcome to React Native!', 'Title is correct')
    })
  2. Run tests (in your package.json)

    {
      "scripts": {
        "test": "appium-helper --platform ios --glob ./__tests__/*_test_*.js --app ./example.app"
      }
    }

    Internally appium-helper will check if Appium process is running. After that will check if iPhone Simulator is running, if not — will start default iPhone 6 simulator with the latest avialable version of iOS.

Playground

You can run detools-appium-helprer in playgraund mode. This mode allows you to send command to appium via repl using javascript language and provides access to helper and driver instances.

To enter in this mode use --playground key:

appium-helper --platform ios --playground

Some useful special commands are supported by all repl:

  • .clear - resets the repl context to an empty object and clears any multi-line expression currently being input.
  • .save - save the current repl session to a file: > .save ./file/to/save.js
  • .load - load a file into the current repl session. > .load ./file/to/load.js Full commands list you can find here.

Pressed <ctrl>-C twice to exit.

Payground Example

playground

Differences in running tests for Android

Before run tests for Android you should start Android Emulator or connect your real device to your workstation. After that just check connected device via:

❯ adb devices
List of devices attached
emulator-5554	device

appium-helper will select first connected android emulator in list.

If you want to specify an ID of android emulator you should use --device-name key:

// package.json
{
  "scripts": {
    "test": "appium-helper --platform android --device-name emulator-5554"
  }
}

How to specify an iOS Simulator

If you want to specify an iOS Simulator you can pass --device-name only parameter. In that case appium-helper will select an iPhone Simulator with the latest available version of iOS.

If you want to specify an iOS version of Simulator you should pass --platform-version key too:

// package.json
{
  "scripts": {
    "test:ios": "appium-helper --platform ios --device-name 'iPhone 7 Plus' --platform-version '10.1'"
  }
}

.appiumhelperrc

You can keep some config in .appiumhelperrc by default.

{
  "testsGlob": "./__tests__/*_tests_*.js",
  "appiumHost": "0.0.0.0",
  "appiumPort": "4723"
}

You can define platform-specific config params:

{
  "ios": {
    "appPath": "./ios/build/Build/Products/Release-iphonesimulator/example.app",
    "noReset": true
  },
  "android": {
    "appPath": "./android/app/build/outputs/apk/app-release.apk"
  }
}

Also you can specify a path to ./path/to/your/own/.whateveryouwantnamerc:

appium-helper --rc-file ./__tests__/.testrc

API

Coming soon…

Demo

appium_helper

Tests

To run unit tests you can use npm test command.

License

MIT License

Copyright (c) 2016-present

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.