Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/blueberryapps/automation-selectors
accessibilityLabel and testID selectors for Android and iOS devices.
https://github.com/blueberryapps/automation-selectors
Last synced: about 6 hours ago
JSON representation
accessibilityLabel and testID selectors for Android and iOS devices.
- Host: GitHub
- URL: https://github.com/blueberryapps/automation-selectors
- Owner: blueberryapps
- License: gpl-3.0
- Created: 2019-02-18T12:21:03.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-04T02:09:15.000Z (almost 2 years ago)
- Last Synced: 2024-10-31T14:30:51.628Z (8 days ago)
- Language: TypeScript
- Homepage:
- Size: 270 KB
- Stars: 0
- Watchers: 7
- Forks: 0
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Automation selectors for Web and Mobile Apps
A mini-package for iOS (testID), Android (accessibilityLabel) and web (data-test) property assignment based on environment & Platform.
## Installation
### Install automation-selectors with NPM or yarn
1. Add automation-selectors as a devDependency:
```bash
npm install --save-dev automation-selectors
``````bash
yarn add -D automation-selectors
```2. In your project create a module and pass in all the necessary props.
RN Example:```js
import { Platform } from "react-native";
import { qaID } from "automation-selectors";export const selector = (selectorValue?: string) => {
if (process.env.NODE_ENV !== "production") {
return qaID(selectorValue || "", Platform.OS);
}
};
```
Web Example:```js
import { qaID } from "automation-selectors";export const selector = (selectorValue?: string) => {
if (process.env.NODE_ENV !== "production") {
return qaID(selectorValue || "", 'web');
}
};
```3. Invoke selectors in components:
```js
import { selector } from 'path/to/module';
...
...
};
```4. At this point your `selector` becomes a testID, accessibilityLabel or data-test based on OS.