JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2
  • Score
    100M100P100Q48661F
  • License MIT

accessibilityLabel and testID selectors for Android and iOS test automation

Package Exports

  • automation-selectors

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (automation-selectors) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Automation selectors for Mobile Apps

A mini-package for iOS (testID), Android (accessibilityLabel) and web (data-test) property assignment based on TEST_ENV & Platform.

Installation

Install automation-selectors with NPM and use with react-native projects

  1. Add automation-selectors as a devDependency:

    npm install --save-dev automation-selectors
    yarn add -D automation-selectors
  2. In your project create a module and pass in all the necessary props. Example:

    import { Platform } from 'react-native';
    import { qaID } from 'automation-selectors';
    import { TEST_ENV } from 'react-native-dotenv';
    
    export const selector = selectorValue => {
        return qaID(Platform.OS, TEST_ENV, selectorValue);
    };
  3. Invoke selectors in components:

    import { selector } from 'path/to/module';
    ...
    <View
        {...selector('VIEW_HOMEPAGE')}
    />
    ...
    };
  4. At this point your selector becomes a testID, accessibilityLabel or data-test based on which platform you are rendering it in.