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 🙏

© 2026 – Pkg Stats / Ryan Hefner

tgdevice

v0.1.3

Published

TestGrid Appium/WebdriverIO integration helpers for mobile devices

Readme

tgdevice

Helpers for running Appium/WebdriverIO tests against a TestGrid Appium hub for mobile device automation (Android/iOS).

Install

npm install tgdevice
# For WebdriverIO integration (optional)
npm install webdriverio @wdio/cli

The package automatically builds on install and will print setup instructions.

Quick Start

  1. Set your TestGrid Appium endpoint (place in .env, shell profile, or CI secrets):

    APPIUM_REMOTE_URL=http://your-grid-host/appium_XXXXX/wd/hub
    TESTGRID_USER_TOKEN=...
    TESTGRID_UDID=...
    TESTGRID_PLATFORM_NAME=android         # or ios
    TESTGRID_PLATFORM_VERSION=12
    TESTGRID_DEVICE_NAME="Galaxy Note10"
    TESTGRID_AUTOMATION_NAME=UiAutomator2  # or XCUITest for iOS
    TESTGRID_SYSTEM_PORT=4002
    TESTGRID_UIAUTOMATOR2_TIMEOUT=90000

    Supplying APPIUM_REMOTE_URL automatically flips the helpers into remote mode.

  2. Use in your tests:

    import { TestGridDevice, withTestGridDevice } from 'tgdevice';
    
    // Manual lifecycle
    const device = await TestGridDevice.connect();
    console.log('Session:', device.getSessionId());
       
    // Access WebdriverIO driver if installed
    if (device.driver) {
      await device.driver.$('~button').click();
    }
       
    await device.dispose();
    
    // Or use the convenience helper
    await withTestGridDevice(async (device) => {
      if (device.driver) {
        const element = await device.driver.$('~button');
        await element.click();
      }
    });
  3. For WebdriverIO projects, copy sample-wdio.config.js (or .ts) from node_modules/tgdevice/ to your project root and rename to wdio.conf.js (or .ts).

Environment Variables

| Variable | Purpose | Default | | --- | --- | --- | | APPIUM_REMOTE_URL | TestGrid Appium Hub URL | Required for remote | | TESTGRID_USER_TOKEN | TestGrid auth token | Required | | TESTGRID_UDID | Device identifier | Required | | TESTGRID_PLATFORM_NAME | android or ios | android | | TESTGRID_PLATFORM_VERSION | OS version | 12 | | TESTGRID_DEVICE_NAME | Device model name | Galaxy Note10 | | TESTGRID_AUTOMATION_NAME | UiAutomator2 or XCUITest | UiAutomator2 | | TESTGRID_SYSTEM_PORT | Appium system port | 4002 | | TESTGRID_UIAUTOMATOR2_TIMEOUT | Launch timeout (ms) | 90000 | | DEBUG_TESTGRID | Set to 1 for verbose logging | Optional |

If APPIUM_REMOTE_URL is unset or blank, the library defaults to local Appium execution.

API

TestGridDevice

  • TestGridDevice.connect(options?): Creates a new device session on the TestGrid Appium hub
  • device.getSessionId(): Returns the Appium session ID
  • device.getCapabilities(): Returns the session capabilities
  • device.driver: WebdriverIO browser instance (if webdriverio is installed)
  • device.dispose(): Closes the session

Helpers

  • withTestGridDevice(callback, options?): Convenience wrapper that handles session lifecycle
  • resolveTestGridDeviceConfig(): Returns current configuration based on environment
  • createTestGridDeviceSession(config): Low-level session creation
  • deleteTestGridDeviceSession(config, sessionId): Low-level session deletion

Development

This repository uses npm workspaces:

npm install
npm run build --workspace=tgdevice

To publish a new version:

cd packages/tgdevice
npm version patch    # or minor/major
npm publish --access public

Support

Issues and feature requests: open a ticket or contact the TestGrid team.