vonovak
vonovak

Reputation: 1597

How to get the currently active configuration in a detox test

In the docs it is described how to add multiple detox configs to package.json

When I run the tests with detox --configuration someconfig, how do I find out the someconfig parameter in my tests (in someTestSuite.spec.js)?

Use case: in a test I want to set username and password textinputs based on the config, eg.

await getUNameTextInput().typeText('someUsernameBasedOnConfig');

Thanks.

Upvotes: 1

Views: 1171

Answers (1)

Rotemmiz
Rotemmiz

Reputation: 7973

There's a non official way of accessing the configuration name, and it may change in the future:

const argparse = require('detox/src/utils/argparse');
const configurationName = argparse.getArgValue('configuration');

Upvotes: 2

Related Questions