nx/docs/generated/packages/detox.json

293 lines
15 KiB
JSON

{
"githubRoot": "https://github.com/nrwl/nx/blob/master",
"name": "detox",
"packageName": "@nrwl/detox",
"description": "The Nx Plugin for Detox contains executors and generators for allowing your workspace to use the powerful Detox integration testing capabilities.",
"root": "/packages/detox",
"source": "/packages/detox/src",
"documentation": [
{
"id": "overview",
"name": "Overview",
"path": "/packages/detox",
"file": "shared/detox-plugin",
"content": "Detox is gray box end-to-end testing and automation library for mobile apps. It has a lot of great features:\n\n- Cross Platform\n- Runs on Devices\n- Automatically Synchronized\n- Test Runner Independent\n- Debuggable\n\n## Setting Up Detox\n\n### Install applesimutils (Mac only)\n\n[applesimutils](https://github.com/wix/AppleSimulatorUtils) is a collection of utils for Apple simulators.\n\n```sh\nbrew tap wix/brew\nbrew install applesimutils\n```\n\n### Install Jest Globally\n\n```sh\nnpm install -g jest\n```\n\n### Generating Applications\n\nBy default, when creating a mobile application, Nx will use Detox to create the e2e tests project.\n\n```bash\nnx g @nrwl/react-native:app frontend\n```\n\n### Creating a Detox E2E project for an existing project\n\nYou can create a new Detox E2E project for an existing mobile project.\n\nIf the `@nrwl/detox` package is not installed, install the version that matches your `@nrwl/workspace` version.\n\n{% tabs %}\n{%tab label=\"npm\"%}\n\n```sh\n# npm\nnpm install --save-dev @nrwl/detox\n```\n\n{% /tab %}\n{%tab label=\"yarn\"%}\n\n```sh\n# yarn\nyarn add --dev @nrwl/detox\n```\n\n{% /tab %}\n{% /tabs %}\n\nNext, generate an E2E project based on an existing project.\n\n```sh\nnx g @nrwl/detox:app your-app-name-e2e --project=your-app-name\n```\n\nReplace `your-app-name` with the app's name as defined in your `tsconfig.base.json` file or the `name` property of your `package.json`.\n\nIn addition, you need to follow [instructions at Detox](https://github.com/wix/Detox/blob/master/docs/Introduction.Android.md) to do manual setup for Android files.\n\n## Using Detox\n\n### Testing Applications\n\n- Run `nx test-ios frontend-e2e` to build the iOS app and execute e2e tests with Detox for iOS (Mac only)\n- Run `nx test-android frontend-e2e` to build the Android app and execute e2e tests with Detox for Android\n\nYou can run below commands:\n\n- `nx build-ios frontend-e2e`: build the iOS app (Mac only)\n- `nx build-android frontend-e2e`: build the Android app\n\n### Testing against Prod Build\n\nYou can run your e2e test against a production build:\n\n- `nx test-ios frontend-e2e --prod`: to build the iOS app and execute e2e tests with Detox for iOS with Release configuration (Mac only)\n- `nx test-android frontend-e2e`: rto build the Android app and execute e2e tests with Detox for Android with release build type\n- `nx build-ios frontend-e2e --prod`: build the iOS app using Release configuration (Mac only)\n- `nx build-android frontend-e2e --prod`: build the Android app using release build type\n\n## Configuration\n\n### Using .detoxrc.json\n\nIf you need to fine tune your Detox setup, you can do so by modifying `.detoxrc.json` in the e2e project.\n\n#### Change Testing Simulator/Emulator\n\nFor iOS, in terminal, run `xcrun simctl list` to view a list of simulators on your Mac. To open your active simulator, `run open -a simulator`. In `frontend-e2e/.detoxrc.json`, you could change the simulator under `devices.simulator.device`.\n\nFor Android, in terminal, run `emulator -list-avds` to view a list of emulators installed. To open your emulator, run `emulator -avd <your emulator name>`. In `frontend-e2e/.detoxrc.json`, you could change the simulator under `devices.emulator.device`.\n\nIn addition, to override the device name specified in a configuration, you could use `--device-name` option: `nx test-ios <app-name-e2e> --device-name \"iPhone 11\"`. The `device-name` property provides you the ability to test an application run on specific device.\n\n```bash\nnx test-ios frontend-e2e --device-name \"iPhone 11\"\nnx test-android frontend-e2e --device-name \"Pixel_4a_API_30\"\n```\n"
}
],
"generators": [
{
"name": "init",
"factory": "./src/generators/init/init#detoxInitGenerator",
"schema": {
"$schema": "http://json-schema.org/schema",
"title": "Add Detox Schematics",
"description": "Add Detox Schematics.",
"type": "object",
"properties": {
"skipFormat": {
"description": "Skip formatting files.",
"type": "boolean",
"default": false
}
},
"required": [],
"presets": []
},
"description": "Initialize the `@nrwl/detox` plugin.",
"hidden": true,
"implementation": "/packages/detox/src/generators/init/init#detoxInitGenerator.ts",
"aliases": [],
"path": "/packages/detox/src/generators/init/schema.json"
},
{
"name": "application",
"factory": "./src/generators/application/application#detoxApplicationGenerator",
"schema": {
"$schema": "http://json-schema.org/schema",
"title": "Create Detox Configuration for the workspace",
"description": "Create Detox Configuration for the workspace.",
"type": "object",
"properties": {
"project": {
"type": "string",
"description": "The name of the frontend project to test.",
"$default": { "$source": "projectName" },
"x-prompt": "What is the name of the frontend project to test?"
},
"name": {
"type": "string",
"description": "Name of the E2E Project.",
"$default": { "$source": "argv", "index": 0 },
"x-prompt": "What name would you like to use for the E2E project?"
},
"framework": {
"type": "string",
"description": "App framework to test",
"enum": ["react-native", "expo"],
"x-prompt": "What app framework should detox test?"
},
"directory": {
"type": "string",
"description": "A directory where the project is placed."
},
"linter": {
"description": "The tool to use for running lint checks.",
"type": "string",
"enum": ["eslint", "none"],
"default": "eslint"
},
"js": {
"description": "Generate JavaScript files rather than TypeScript files.",
"type": "boolean",
"default": false
},
"skipFormat": {
"description": "Skip formatting files.",
"type": "boolean",
"default": false
},
"setParserOptionsProject": {
"type": "boolean",
"description": "Whether or not to configure the ESLint `parserOptions.project` option. We do not do this by default for lint performance reasons.",
"default": false
}
},
"required": ["name", "project", "framework"],
"presets": []
},
"aliases": ["app"],
"x-type": "application",
"description": "Create a Detox application.",
"implementation": "/packages/detox/src/generators/application/application#detoxApplicationGenerator.ts",
"hidden": false,
"path": "/packages/detox/src/generators/application/schema.json"
}
],
"executors": [
{
"name": "build",
"implementation": "/packages/detox/src/executors/build/build.impl.ts",
"schema": {
"title": "Run detox build",
"description": "Run detox build options.",
"type": "object",
"cli": "nx",
"properties": {
"detoxConfiguration": {
"type": "string",
"description": "Select a device configuration from your defined configurations, if not supplied, and there's only one configuration, detox will default to it.",
"alias": "C"
},
"configPath": {
"type": "string",
"description": "Specify Detox config file path. If not supplied, detox searches for `.detoxrc[.js]` or `detox` section in `package.json`.",
"alias": "cp",
"x-completion-type": "file",
"x-completion-glob": ".detoxrc?(.js)"
}
},
"required": [],
"presets": []
},
"description": "Run the command defined in build property of the specified configuration.",
"aliases": [],
"hidden": false,
"path": "/packages/detox/src/executors/build/schema.json"
},
{
"name": "test",
"implementation": "/packages/detox/src/executors/test/test.impl.ts",
"schema": {
"title": "Run detox test",
"description": "Run detox test options.",
"type": "object",
"cli": "nx",
"presets": [
{
"name": "Run tests",
"keys": ["detoxConfiguration", "loglevel", "reuse"]
}
],
"properties": {
"detoxConfiguration": {
"type": "string",
"description": "Select a device configuration from your defined configurations, if not supplied, and there's only one configuration, detox will default to it.",
"alias": "C",
"examples": [
"ios.sim.debug",
"ios.sim.release",
"android.emu.debug",
"android.emu.release"
]
},
"buildTarget": {
"type": "string",
"description": "Target which builds the application."
},
"configPath": {
"type": "string",
"description": "Specify Detox config file path. If not supplied, detox searches for `.detoxrc[.js]` or `detox` section in package.json.",
"alias": "cp",
"x-completion-type": "file",
"x-completion-glob": ".detoxrc?(.js)"
},
"runnerConfig": {
"type": "string",
"description": "Test runner config file, defaults to `e2e/mocha.opts` for mocha and `e2e/config.json` for Jest.",
"alias": "o"
},
"deviceName": {
"type": "string",
"description": "Override the device name specified in a configuration. Useful for running a single build configuration on multiple devices.",
"alias": "n"
},
"loglevel": {
"type": "string",
"enum": ["fatal", "error", "warn", "info", "verbose", "trace"],
"description": "Log level: `fatal`, `error`, `warn`, `info`, `verbose`, `trace`.",
"alias": "l"
},
"debugSynchronization": {
"type": "boolean",
"description": "Customize how long an action/expectation can take to complete before Detox starts querying the app why it is busy. By default, the app status will be printed if the action takes more than 10s to complete.",
"alias": "d"
},
"artifactsLocation": {
"type": "string",
"description": "Artifacts (logs, screenshots, etc) root directory.",
"alias": "a"
},
"recordLogs": {
"type": "string",
"enum": ["failing", "all", "none"],
"description": "Save logs during each test to artifacts directory. Pass `failing` to save logs of failing tests only."
},
"takeScreenshots": {
"type": "string",
"enum": ["manual", "failing", "all", "none"],
"description": "Save screenshots before and after each test to artifacts directory. Pass `failing` to save screenshots of failing tests only. "
},
"recordVideos": {
"type": "string",
"enum": ["failing", "all", "none"],
"description": "Save screen recordings of each test to artifacts directory. Pass `failing` to save recordings of failing tests only."
},
"recordPerformance": {
"type": "string",
"enum": ["all", "none"],
"description": "[iOS Only] Save Detox Instruments performance recordings of each test to artifacts directory."
},
"recordTimeline": {
"type": "string",
"enum": ["all", "none"],
"description": "[Jest Only] Record tests and events timeline, for visual display on the `chrome://tracing` tool."
},
"captureViewHierarchy": {
"type": "string",
"enum": ["enabled", "disabled"],
"description": "[iOS Only] Capture `*.uihierarchy` snapshots on view action errors and `device.captureViewHierarchy()` calls."
},
"retries": {
"type": "number",
"description": "[Jest Circus Only] Re-spawn the test runner for individual failing suite files until they pass, or `<N>` times at least."
},
"reuse": {
"type": "boolean",
"description": "Reuse existing installed app (do not delete + reinstall) for a faster run.",
"default": true
},
"cleanup": {
"type": "boolean",
"description": "Shutdown simulator when test is over, useful for CI scripts, to make sure detox exists cleanly with no residue"
},
"workers": {
"type": "number",
"description": "Specifies number of workers the test runner should spawn, requires a test runner with parallel execution support (Detox CLI currently supports Jest)."
},
"jestReportSpecs": {
"type": "boolean",
"description": "[Jest Only] Whether to output logs per each running spec, in real-time. By default, disabled with multiple workers."
},
"headless": {
"type": "boolean",
"description": "Android Only] Launch Emulator in headless mode. Useful when running on CI."
},
"gpu": {
"type": "boolean",
"description": "[Android Only] Launch Emulator with the specific `-gpu [gpu mode]` parameter."
},
"deviceLaunchArgs": {
"type": "string",
"description": "A list of passthrough-arguments to use when (if) devices (Android emulator / iOS simulator) are launched by Detox."
},
"appLaunchArgs": {
"type": "number",
"description": "Custom arguments to pass (through) onto the app every time it is launched."
},
"noColor": {
"type": "boolean",
"description": "Disable colors in log output"
},
"useCustomLogger": {
"type": "boolean",
"description": "Use Detox' custom console-logging implementation, for logging Detox (non-device) logs. Disabling will fallback to Node.js / test-runner's implementation (e.g. Jest / Mocha)."
},
"forceAdbInstall": {
"type": "boolean",
"description": "Due to problems with the adb install command on Android, Detox resorts to a different scheme for install APK's. Setting true will disable that and force usage of `adb install`, instead."
},
"inspectBrk": {
"type": "boolean",
"description": "Uses node's `--inspect-brk` flag to let users debug the jest/mocha test runner"
}
},
"required": ["detoxConfiguration"]
},
"description": "Initiating your detox test suite.",
"aliases": [],
"hidden": false,
"path": "/packages/detox/src/executors/test/schema.json"
}
]
}