Registry / testing / detox-getprops

detox-getprops

JSON →
library0.1.2jsnpmunverified

Detox-getprops (v0.1.2) is a utility for Detox that enables fetching text and properties from React Native elements on both iOS and Android, overcoming the limitation of Detox's 'getAttributes' which is iOS-only. It uses a hack involving forced test failure messages to extract element properties. The package is stable but simple, with no recent updates. Alternatives include Detox's built-in getAttributes (iOS only) and the future resolution of Detox issue #2083. It is intended for use in Detox E2E test suites.

npm install detox-getprops
INSTALL
IMPORT
SIG · DETOX-GETPROPS
D
detox-getprops
testingjavascriptv0.1.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

getText
import { getText } from 'detox-getprops'
const { getText } = require('detox-getprops')
Package is ESM-compatible but also supports CJS require. Use ESM for modern projects.
getProps
import { getProps } from 'detox-getprops'
const { getProps } = require('detox-getprops')
Same as getText – both exports work with require and import.
default import
import detoxGetprops from 'detox-getprops'
const detoxGetprops = require('detox-getprops')
Default import is not supported – package only exports named functions.

Demonstrates getting text from a Text element and getting all props from an element, using async/await.

import { getText } from 'detox-getprops'; import { device, element, by, expect } from 'detox'; describe('Example', () => { beforeAll(async () => { await device.launchApp(); }); it('should show text', async () => { const text = await getText(element(by.id('heading'))); expect(text).toEqual('Step One'); }); it('should show props', async () => { const props = await getProps(element(by.id('heading'))); expect(props.type).toBeDefined(); expect(props.text).toEqual('Step One'); }); });
Debug
Known issues
gotchaThis is a hack that searches for text NOT present, catches the error and parses it. This is fragile and may break with Detox updates.
fix
Use only as a temporary workaround until Detox #2083 is resolved.
affects: >=0.0.1
deprecatedgetText on non-<Text> elements is platform-dependent and may return undefined on Android.
fix
Use getProps instead for non-<Text> elements.
affects: >=0.0.1
gotchagetProps returns platform-dependent properties. Only 'type', 'device', and 'text' are common across platforms.
fix
Do not rely on platform-specific properties in cross-platform tests.
affects: >=0.0.1
breakingThe package may stop working entirely once Detox #2083 is resolved because the underlying hack relies on an internal behavior that might change.
fix
Monitor https://github.com/wix/Detox/issues/2083 and migrate to official solution when available.
affects: >=0.0.1
gotchaUsing require('detox-getprops') import may fail in ESM-only projects if not transpiled.
fix
Use ES import syntax: import { getText } from 'detox-getprops'.
affects: >=0.0.1
Errors
Common errors & fixes
Cannot find module 'detox-getprops'
Package not installed or wrong import path.
fix
npm install --save-dev detox-getprops
detox is not defined
Detox peer dependency not installed or not properly configured.
fix
npm install --save-dev detox, and ensure Detox is initialized in test.
getText is not a function
Wrong import style (e.g., default import).
fix
Use named import: import { getText } from 'detox-getprops'
TypeError: Cannot read property 'substring' of undefined
Parsing of error message failed – likely due to Detox version incompatibility.
fix
Update Detox to a supported version or check if the hack still works.
Upgrade
Version history
0.1.2latest on npm
Audit
Dependencies
detoxrequiredpeer dependency – requires Detox runtime for element matching
Agent activity
6 hits · last 30 days
node
6
Resources
detox-getprops — npm install detox-getprops · libregistry