Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detox 20 #3285

Merged
merged 167 commits into from
Nov 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
167 commits
Select commit Hold shift + click to select a range
fd8a0b2
chore: add .editorconfig
noomorph Apr 21, 2022
57adf8b
feat: set minimal Node requirement to 12+
noomorph Apr 9, 2022
1035293
feat: drop old Jest integrations
noomorph Apr 1, 2022
9d69e3b
feat(config): drop default "e2e" value for specs (#3289)
noomorph Apr 1, 2022
a298e8a
feat(config): drop skipLegacyWorkersInjection (#3286)
noomorph Apr 4, 2022
cdd423f
feat(android): boot read-only emulators by default
noomorph Apr 7, 2022
cfc8a82
feat(iOS): support --headless config (#3304)
asafkorem Apr 13, 2022
574b697
feat: drop Mocha support (#3310)
noomorph Apr 13, 2022
ea4a213
feat(android): remove deprecated native IdlePolicyConfig (#3332)
d4vidi Apr 14, 2022
37e1df1
chore: remove dead code
noomorph Apr 21, 2022
91e011f
chore: remove deprecated [userParams] arg from detox.init()
noomorph Apr 21, 2022
bea604a
feat: drop device.appLaunchArgs [options] argument (#3360)
noomorph Apr 27, 2022
92e4aaa
docs: update Xcode debugging guide (#3326)
noomorph Apr 13, 2022
5af13fe
feat: remove ios.none device type (#3361)
noomorph Apr 28, 2022
b814ba6
feat: undeprecate device.relaunchApp() (#3362)
noomorph Apr 28, 2022
23ab77b
feat(config): remove legacy dash-based props (#3371)
noomorph May 3, 2022
f19a05e
code: restore IosDriver per request (#3373)
noomorph May 3, 2022
b71f643
docs: clarify about test runners (#3372)
noomorph May 3, 2022
11860fe
feat(config): drop support for the all-in-one configuration format (#…
noomorph May 12, 2022
228599f
feat: drop jest<27.2.5 support (#3392)
noomorph May 16, 2022
66e8f6c
build: move jest-circus/ facade to jest/ (#3400)
noomorph May 17, 2022
2da0519
fix(ios): headless mode
noomorph Jul 11, 2022
8f783a7
Merge branch 'master' into next
noomorph Aug 10, 2022
03d08d7
Merge branch 'master' into next
noomorph Aug 12, 2022
6ff7c41
feat: new global lifecycle for Detox (#3333)
noomorph Sep 5, 2022
6145653
Merge branch 'master' into next
noomorph Sep 6, 2022
4b75f39
Publish 20.0.7-prerelease.0 [ci skip]
mobile1-internal Sep 6, 2022
4336270
Merge branch 'master' into next
noomorph Sep 7, 2022
38c17ee
fix(cli): forward env overrides anyway
noomorph Sep 7, 2022
0e1e2bc
Merge branch 'master' into next
noomorph Sep 7, 2022
2883592
feat(config): add testRunner.forwardEnv
noomorph Sep 7, 2022
205099a
Publish 20.0.8-prerelease.0 [ci skip]
mobile1-internal Sep 7, 2022
95c8e6f
feat(api): detoxInternals.tracing.createEventStream
noomorph Sep 8, 2022
47720e5
Merge branch 'master' into next
noomorph Sep 8, 2022
4e8d6dc
Publish 20.0.9-prerelease.0 [ci skip]
mobile1-internal Sep 8, 2022
f627b19
fix: improve detox init flow
noomorph Sep 14, 2022
2be9151
fix --retries behavior when environment setup fails
noomorph Sep 14, 2022
3116a18
Publish 20.0.10-prerelease.0 [ci skip]
mobile1-internal Sep 15, 2022
ac5029e
Merge branch 'master' into next
noomorph Sep 15, 2022
f7341b7
docs: fix broken markdown
noomorph Sep 15, 2022
19e5d60
docs: rework introduction
noomorph Sep 15, 2022
8080d69
docs: fix lint issues
noomorph Sep 16, 2022
ce2c849
docs: 20.x migration guide
noomorph Sep 17, 2022
cf3d3c4
docs: finish Genymotion guide
noomorph Sep 26, 2022
c56159d
feat(config): add reversePorts to app config (#3610)
noomorph Sep 26, 2022
c58dd01
docs: Configuration > Overview
noomorph Sep 27, 2022
450a0a2
docs: fix Debugging guide
noomorph Sep 27, 2022
1322554
docs: Configuration > Test runner
noomorph Sep 28, 2022
4900346
Merge branch 'master' into next
noomorph Sep 30, 2022
2fe0a83
docs: Genymotion SaaS fixes
noomorph Sep 30, 2022
bd5998c
Publish 20.0.11-prerelease.0 [ci skip]
mobile1-internal Sep 30, 2022
28469d4
fix(Android): pass `headless` config param to the AVD validator. (#3614)
paulrostorp Oct 2, 2022
a5d3e98
docs: update config/logger
noomorph Oct 3, 2022
34dfb24
docs(website): restructure the menu
noomorph Oct 4, 2022
cae3d68
docs(config): add TOC to other articles
noomorph Oct 4, 2022
b725042
feat(cli): add reset-lock-file command
noomorph Oct 5, 2022
6795e9d
docs: reorganize CLI section
noomorph Oct 5, 2022
5dd6915
docs: minor fixes
noomorph Oct 6, 2022
b3a3a34
docs(website): fix highlighting
noomorph Oct 6, 2022
46dc14f
docs(config): add testRunner.inspectBrk info
noomorph Oct 6, 2022
5359375
docs(api): cover logger API
noomorph Oct 6, 2022
716cf30
feat(jest): new listener events (#3626)
noomorph Oct 11, 2022
8184087
feat(jest): add more listener events
noomorph Oct 11, 2022
fb9a2ea
fix(ipc): race condition before broadcast received
noomorph Oct 11, 2022
29e28fa
fix(artifacts): missing beforeAllFailure.png
noomorph Oct 11, 2022
dc39363
feat(log): remove detox.log.jsonl
noomorph Oct 11, 2022
3cd7feb
Publish 20.0.12-prerelease.0 [ci skip]
mobile1-internal Oct 11, 2022
3942da5
docs: new guides (#3627)
evgeniyaglovatskaya Oct 14, 2022
88e51bb
ci(github): use Node 14.x
noomorph Oct 14, 2022
f962373
fix(config): make logger.overrideConsole boolean
noomorph Oct 14, 2022
6a4dfc3
fix(cli): print correct env var hint
noomorph Oct 17, 2022
f4768a8
fix(cli): bail --retry only for failed retried tests
noomorph Oct 17, 2022
7af82f6
fix(cli): --inspect-brk behavior
noomorph Oct 17, 2022
e825eec
Merge branch 'master' into next
noomorph Oct 18, 2022
ac2f015
test: fix test
noomorph Oct 18, 2022
bb17a0e
refactor(internals): drop unused methods
noomorph Oct 21, 2022
ba4af8e
fix(ipc): null state deserialization
noomorph Oct 25, 2022
ac088e1
docs(api): Internals API
noomorph Oct 19, 2022
8aed160
docs(blog): Detox 20
noomorph Oct 21, 2022
2cf1904
docs: feedback and fixes
noomorph Oct 27, 2022
7fef460
Publish 20.0.13-prerelease.0 [ci skip]
mobile1-internal Oct 27, 2022
e12f052
chore: self-review fixes
noomorph Oct 27, 2022
de647c8
.gitignore: add vscode IDE path.
moutro Oct 27, 2022
1bca061
website: add new image assets.
moutro Oct 27, 2022
aa2d51a
website(Showcase): add showcased projects icons.
moutro Oct 27, 2022
923d8c4
website(Showcase): add showcase cards data.
moutro Oct 27, 2022
abcc10f
website(Showcase): add CSS classes for the Showcase page.
moutro Oct 27, 2022
a0ae035
website(Showcase): add Card component.
moutro Oct 27, 2022
f63cc43
website(Showcase): add Showcase component.
moutro Oct 27, 2022
3c65bce
website(Showcase): add Showcase Hero component.
moutro Oct 27, 2022
dd1640e
website: add Showcase page.
moutro Oct 27, 2022
1c5a4bb
website(navbar): add Showcase page button.
moutro Oct 27, 2022
79e0739
website(footer): upgrade footer links and style.
moutro Oct 27, 2022
274bc0e
website: set color mode to dark mode as default.
moutro Oct 27, 2022
f808bd2
website(config): fix GitHub edit links.
moutro Oct 27, 2022
42b2ac6
website(config): fix styling.
moutro Oct 27, 2022
d10a680
website(Showcase): add app submission form link.
asafkorem Oct 28, 2022
697185f
website(Showcase): fix link closing tag.
asafkorem Oct 28, 2022
0e049e7
Merge pull request #3628 from wix/showcase
asafkorem Oct 28, 2022
d964cdd
website(showcase): remove wrong app from list.
asafkorem Oct 28, 2022
37f6f2d
website(showcase): add more Wix apps (Dine, Fit).
asafkorem Oct 28, 2022
28aa19e
Merge pull request #3653 from wix/website/showcase-apps
asafkorem Oct 28, 2022
8fa0ff4
fix(js): clean up the exposed globals
noomorph Oct 28, 2022
d9364d6
chore: code review fixes
noomorph Oct 27, 2022
5fbb431
website: fix Showcase Google Play links (#3657)
jasonbariwix Oct 30, 2022
f275e00
website(showcase): remove broken and redundant css param (border).
asafkorem Oct 31, 2022
f85f380
website(footer): fix GitHub footer icon (dark mode).
asafkorem Oct 31, 2022
6ba6da6
Merge pull request #3659 from asafkorem/feature/fix-footer
asafkorem Oct 31, 2022
ce50597
build: update minimum Node.js version to 14.5.x
noomorph Oct 31, 2022
38d899e
test(e2e-unhappy): simplify init timeout test
noomorph Nov 1, 2022
fe15589
website(showcase): make container left-padding same as the right-padd…
asafkorem Nov 2, 2022
3dd517b
Merge pull request #3661 from wix/feature/fix-showcase-margins
asafkorem Nov 2, 2022
9076f5d
chore: fix code review
noomorph Nov 2, 2022
57ca4c0
Merge branch 'master' into next
noomorph Nov 2, 2022
ef4c960
fix(types): add Jest typings
noomorph Nov 2, 2022
a7e4952
build: unite detox-react-native and -jest
noomorph Nov 2, 2022
b4cac16
docs: minor fixes
noomorph Nov 2, 2022
ae124a1
chore: code review and enable coverage again
noomorph Nov 2, 2022
f65eb77
chore: code review and enable coverage again
noomorph Nov 2, 2022
b1ecf10
docs: update Migration Guide
noomorph Nov 3, 2022
f835f28
.gitignore: add VSCode IDE path.
moutro Nov 3, 2022
474e58d
website(homepage): create custom banner component folder
moutro Nov 3, 2022
824ea37
website(homepage): remove comments and fix url paths
moutro Nov 3, 2022
a31aa91
website(homepage): update component function
moutro Nov 3, 2022
af09810
test(dependencies): lock `react-native-community/checkbox` version.
asafkorem Nov 3, 2022
8277031
website(homepage): redesign.
moutro Nov 3, 2022
0d40ca7
chore: safer deprecation notice
noomorph Nov 3, 2022
b74f875
Merge pull request #3640 from wix/homepage
asafkorem Nov 3, 2022
9117390
feat(cli): drop --device-launch-args arg (#3665)
noomorph Nov 4, 2022
a77b244
Merge branch 'master' into next
noomorph Nov 4, 2022
29f5a4c
chore: fix code review
noomorph Nov 4, 2022
449f25b
docs: fix wording
noomorph Nov 4, 2022
8873070
chore: code review fixes
noomorph Nov 4, 2022
eefbf11
chore: code review
noomorph Nov 4, 2022
5860579
chore: code review
noomorph Nov 4, 2022
b14fbd7
chore: code review
noomorph Nov 4, 2022
cee1b91
fix: improve Jest version validation
noomorph Nov 4, 2022
395ea54
test: fix tests
noomorph Nov 4, 2022
aa6082a
chore: code review
noomorph Nov 4, 2022
771cb3a
docs(android): fix android cmdline tools path.
asafkorem Nov 6, 2022
c2cc048
Merge pull request #3671 from wix/fix-next-android-cmdline-tools
asafkorem Nov 6, 2022
9a511d2
refactor: use CAF instead of manual cancellation
noomorph Nov 7, 2022
301a7e3
chore: code review
noomorph Nov 7, 2022
ed3999a
fix: session file cleanup
noomorph Nov 7, 2022
ee51eb8
chore: fix code review
noomorph Nov 7, 2022
8c015a0
chore: fix eval review comment
noomorph Nov 7, 2022
24954e8
chore: resurrect integration test snapshot
noomorph Nov 7, 2022
b054c5f
test: improve assertions for timeline
noomorph Nov 7, 2022
0b32abd
chore: verify logger
noomorph Nov 7, 2022
ad0434c
test: resurrect inspectBrk
noomorph Nov 7, 2022
7f95b5e
test: fix lint issue
noomorph Nov 7, 2022
d47ee50
website(showcase): add Detox user to showcase page (#3674)
jasonbariwix Nov 8, 2022
5cfa9c4
refactor: log finalization
noomorph Nov 8, 2022
9404719
fix(trace): TID generation
noomorph Nov 8, 2022
1d7a0a4
Merge branch 'master' into next
noomorph Nov 8, 2022
386b5ff
revert: device.relaunchApp() publicizing
noomorph Nov 8, 2022
e12a5de
chore: code review
noomorph Nov 8, 2022
e0adcb5
fix(internals): createEventStream API
noomorph Nov 8, 2022
7d74b8b
test: fix unit tests
noomorph Nov 8, 2022
40d0a32
Publish 20.0.14-prerelease.0 [ci skip]
mobile1-internal Nov 8, 2022
e383769
test: increase coverage
noomorph Nov 8, 2022
2104611
docs: update version
noomorph Nov 8, 2022
9c35c46
test: fix envUtils for Win32
noomorph Nov 8, 2022
83c034c
fix: logger and its unit test coverage (#3678)
noomorph Nov 10, 2022
22cadea
ci: fix integration tests on Windows
noomorph Nov 10, 2022
51219c3
docs(blog): add forgotten codename
noomorph Nov 10, 2022
7b3774b
ci: stabilize integration test
noomorph Nov 10, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
30 changes: 30 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
max_line_length = 120
tab_width = 4
trim_trailing_whitespace = true

[{*.ats,*.cts,*.mts,*.ts}]
indent_size = 2
tab_width = 2

[detox/index.d.ts]
indent_size = 4
tab_width = 4

[{*.cjs,*.js}]
indent_size = 2
tab_width = 2

[{*.md,*.mdx}]
indent_size = 2
tab_width = 2

[{*.har,*.jsb2,*.jsb3,*.json,.babelrc,.eslintrc,.prettierrc,.stylelintrc,bowerrc,jest.config}]
indent_size = 2
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/BUG_REPORT_ANDROID.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ body:
id: environment
attributes:
label: In what environment did this happen?
description: "Note: the test-runner is set in your detox configuration file (e.g. package.json, detox.config)."
description: "Note: the test runner is Jest by default, unless overridden via testRunner property in your detox configuration file (e.g. package.json, detox.config)."
value: "Detox version:
\nReact Native version:
\nNode version:
\nDevice model:
\nAndroid version:
\nTest-runner (select one): jest-circus / jest+jasmine / mocha / other"
\nTest-runner (select one): jest / other"
noomorph marked this conversation as resolved.
Show resolved Hide resolved
- type: textarea
id: detox-logs
attributes:
Expand Down
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/BUG_REPORT_IOS.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ body:
id: environment
attributes:
label: In what environment did this happen?
description: "Note: the test-runner is set in your detox configuration file (e.g. package.json, detox.config)."
description: "Note: the test runner is Jest by default, unless overridden via testRunner property in your detox configuration file (e.g. package.json, detox.config)."
value: "Detox version:
\nReact Native version:
\nNode version:
\nDevice model:
\niOS version:
\nmacOS version:
\nXcode version:
\nTest-runner (select one): jest-circus / jest+jasmine / mocha / other"
\nTest-runner (select one): jest / other"
- type: textarea
id: detox-logs
attributes:
Expand Down
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/BUG_REPORT_OTHER.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ body:
id: environment
attributes:
label: In what environment did this happen?
description: "Note: the test-runner is set in your detox configuration file (e.g. package.json, detox.config)."
description: "Note: the test runner is Jest by default, unless overridden via testRunner property in your detox configuration file (e.g. package.json, detox.config)."
value: "Detox version:
\nReact Native version:
\nNode version:
\nTest-runner (select one): jest-circus / jest+jasmine / mocha / other"
\nTest-runner (select one): jest / other"
- type: textarea
id: detox-logs
attributes:
Expand Down
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/HELP_WITH_USING_DETOX.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ body:
id: environment
attributes:
label: Your environment
description: "Note: the test-runner is set in your detox configuration file (e.g. package.json, detox.config)."
description: "Note: the test runner is set in your detox configuration file (e.g. package.json, detox.config)."
value: "Detox version:
\nReact Native version:
\nNode version:
\nDevice model:
\nOS:
\nTest-runner (select one): jest-circus / jest+jasmine / mocha / other"
\nTest-runner (select one): jest / other"
10 changes: 9 additions & 1 deletion .github/workflows/rapid-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,14 @@ jobs:
- name: Typings
run: npm test
working-directory: detox/test
- name: Unit tests
- name: Unit tests (Linux)
if: matrix.os == 'ubuntu-latest'
run: npm run unit
working-directory: detox
- name: Unit tests (Windows)
if: matrix.os == 'windows-latest'
run: npm run unit -- --coverageThreshold "{}"
working-directory: detox
- name: Integration tests
run: npm run integration
working-directory: detox/test
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,10 @@ jspm_packages

################
# JetBrains
# IDE
################
.idea
.vscode

## File-based project format:
*.iws
Expand Down
2 changes: 1 addition & 1 deletion .markdownlintrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"first-line-heading": { "level": 2 },
"first-line-heading": { "level": 1 },
"heading-style": { "style": "atx" },
"hr-style": { "style": "---" },
"ol-prefix": { "style": "one_or_ordered" },
Expand Down
1 change: 1 addition & 0 deletions .remarkignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ node_modules
Pods
/detox/ios
/detox/test/ios
/website
12 changes: 11 additions & 1 deletion .retext-spell.dic
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ C5
CLI
CMD
CocoaPods
CommonJS
Detox
Docusaurus
E2E/M
ES5
Genymotion
Expand Down Expand Up @@ -47,7 +49,10 @@ TLS
TeamCity
TypeScript
UDID/M
UUID/M
UI/M
UML/M
Vitest
WebDriver
Wix
XCTest
Expand All @@ -68,13 +73,14 @@ blob/M
blogpost/M
breakpoint/M
bundler
bunyan
cancelled
cheatsheet/M
codebase/M
config/M
config/M
customization/M
de
deallocate/M
debuggable
dedupe
destructure/M
Expand All @@ -99,6 +105,7 @@ lockfile/M
macOS
matcher/M
minification/M
minified
minSdkVersion
monorepo
multistep
Expand Down Expand Up @@ -129,6 +136,7 @@ repo/M
responder/M
roadmap/M
runtimes
se
snapshotting
subdirectories
subdirectory/M
Expand All @@ -149,7 +157,9 @@ unobfuscated
unregister/M
util/M
v12.x
v20
webhook/M
websocket/M
xcodebuild
xcpretty
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## Contributing to Detox
# Contributing to Detox

'So thrilled to know you want to contribute to Detox! 💙

For learning how to do so, please refer to our [contribution guide!](docs/Guide.Contributing.md).
For learning how to do so, please refer to our [contribution guide!](docs/guide/contributing.md).
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ High velocity native mobile development requires us to adopt continuous integrat

The most difficult part of automated testing on mobile is the tip of the testing pyramid - E2E. The core problem with E2E tests is flakiness - tests are usually not deterministic. We believe the only way to tackle flakiness head on is by moving from black box testing to gray box testing. That’s where Detox comes into play.

- **Cross Platform:** Write cross-platform tests in JavaScript. Currently supports iOS and Android.
- **Runs on Devices** (not yet supported on iOS): Gain confidence to ship by testing your app on a device/simulator just like a real user.
- **Cross Platform:** Write cross-platform end-to-end tests in JavaScript. Currently supports iOS and Android.
- **Debuggable:** Modern async-await API allows breakpoints in asynchronous tests to work as expected.
- **Automatically Synchronized:** Stops flakiness at the core by monitoring asynchronous operations in your app.
- **Made For CI:** Execute your E2E tests on CI platforms like Travis without grief.
- **Test Runner Independent:** Use Jest, Mocha, AVA, or any other JavaScript test runner you like (spoiler: we have our favorite).
- **Debuggable:** Modern `async`-`await` API allows breakpoints in asynchronous tests to work as expected.
- **Made For CI:** Execute your E2E tests on CI platforms like Travis CI, Circle CI or Jenkins without grief.
- **Runs on Devices:** Gain confidence to ship by testing your app on a device/simulator just like a real user (not yet supported on iOS).
- **Test Runner Agnostic:** Detox provides a set of APIs to use with any test runner without it. It comes with [Jest](https://jestjs.io) integration out of the box.

## Supported Versions

Expand All @@ -67,7 +67,7 @@ Detox is built from the ground up to support React Native projects as well as pu
The following React Native versions have been tested:

| iOS | Android |
|-----------------|---------------------------------------------------------------------------------------------------------------------------|
| --------------- | ------------------------------------------------------------------------------------------------------------------------- |
| 0.68.x - 0.69.7 | 0.68.x - 0.69.7 -<br/>Visibility edge-case: see this [RN issue](https://github.com/facebook/react-native/issues/23870) \* |

Future versions are most likely supported, but have not been tested yet. Please open issues if you find specific issues with newer React Native versions.
Expand Down
2 changes: 1 addition & 1 deletion detox/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Detox
# Detox

Graybox End-to-End Tests and Automation Library for Mobile

Expand Down
4 changes: 3 additions & 1 deletion detox/__tests__/setupJest.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
jest.mock('proper-lockfile');
jest.mock('signal-exit');
jest.mock('../src/logger/DetoxLogger');

const path = require('path');

Expand Down Expand Up @@ -36,5 +38,5 @@ function callCli(modulePath, cmd) {
});
}

// @ts-ignore
global.callCli = callCli;
global.IS_RUNNING_DETOX_UNIT_TESTS = true;
61 changes: 2 additions & 59 deletions detox/android/detox/src/full/java/com/wix/detox/Detox.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@
import com.wix.detox.config.DetoxConfig;
import com.wix.detox.espresso.UiControllerSpy;

import java.util.concurrent.TimeUnit;

import androidx.annotation.NonNull;
import androidx.test.espresso.IdlingPolicies;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.rule.ActivityTestRule;

Expand Down Expand Up @@ -77,28 +74,6 @@ public final class Detox {
private static final LaunchIntentsFactory sIntentsFactory = new LaunchIntentsFactory();
private static ActivityTestRule sActivityTestRule;

/**
* Specification of values to use for Espresso's {@link IdlingPolicies} timeouts.
* <br/>Overrides Espresso's defaults as they tend to be too short (e.g. when running a heavy-load app
* on suboptimal CI machines).
*
* @deprecated Use {@link com.wix.detox.config.DetoxConfig}.
*/
@Deprecated
public static class DetoxIdlePolicyConfig {
/** Directly binds to {@link IdlingPolicies#setMasterPolicyTimeout(long, TimeUnit)}. Applied in seconds. */
public Integer masterTimeoutSec = 120;
/** Directly binds to {@link IdlingPolicies#setIdlingResourceTimeout(long, TimeUnit)}. Applied in seconds. */
public Integer idleResourceTimeoutSec = 60;

private com.wix.detox.config.DetoxIdlePolicyConfig toNewConfig() {
com.wix.detox.config.DetoxIdlePolicyConfig newConfig = new com.wix.detox.config.DetoxIdlePolicyConfig();
newConfig.masterTimeoutSec = masterTimeoutSec;
newConfig.idleResourceTimeoutSec = idleResourceTimeoutSec;
return newConfig;
}
}

private Detox() {
}

Expand Down Expand Up @@ -128,20 +103,6 @@ public static void runTests(ActivityTestRule activityTestRule, DetoxConfig detox
runTests(activityTestRule, getAppContext(), detoxConfig);
}

/**
* Same as the default {@link #runTests(ActivityTestRule)} method, but allows for the explicit specification of
* a custom idle-policy configuration. Note: review {@link DetoxIdlePolicyConfig} for defaults.
*
* @param idlePolicyConfig The custom idle-policy configuration to pass in; Will be applied into Espresso via
* the {@link IdlingPolicies} API.
*
* @deprecated Use {@link #runTests(ActivityTestRule, DetoxConfig)}
*/
@Deprecated
public static void runTests(ActivityTestRule activityTestRule, DetoxIdlePolicyConfig idlePolicyConfig) {
runTests(activityTestRule, getAppContext(), idlePolicyConfig);
}

/**
* <p>
* Use this method only if you have a React Native application and it
Expand All @@ -161,24 +122,6 @@ public static void runTests(ActivityTestRule activityTestRule, @NonNull final Co
runTests(activityTestRule, context, new DetoxConfig());
}

/**
* Same as {@link #runTests(ActivityTestRule, Context)}, but allows for the explicit specification of
* a custom idle-policy configuration. Note: review {@link DetoxIdlePolicyConfig} for defaults.
*
*
* @param idlePolicyConfig The custom idle-policy configuration to pass in; Will be applied into Espresso via
* the {@link IdlingPolicies} API.
*
* @deprecated Use {@link #runTests(ActivityTestRule, Context, DetoxConfig)}
*/
@Deprecated
public static void runTests(ActivityTestRule activityTestRule, @NonNull final Context context, DetoxIdlePolicyConfig idlePolicyConfig) {
DetoxConfig config = new DetoxConfig();
config.idlePolicyConfig = idlePolicyConfig.toNewConfig();

runTests(activityTestRule, context, config);
}

/**
* Same as {@link #runTests(ActivityTestRule, Context)}, but allows for the explicit specification of
* various configurations. Note: review {@link DetoxConfig} for defaults.
Expand Down Expand Up @@ -214,7 +157,7 @@ public static void startActivityFromUrl(String url) {
}

public static void startActivityFromNotification(String dataFilePath) {
Bundle notificationData = new NotificationDataParser(dataFilePath).parseNotificationData();
Bundle notificationData = new NotificationDataParser(dataFilePath).toBundle();
Intent intent = sIntentsFactory.intentWithNotificationData(getAppContext(), notificationData, false);
launchActivitySync(intent);
}
Expand All @@ -225,7 +168,7 @@ private static Intent extractInitialIntent() {
if (sLaunchArgs.hasUrlOverride()) {
intent = sIntentsFactory.intentWithUrl(sLaunchArgs.getUrlOverride(), true);
} else if (sLaunchArgs.hasNotificationPath()) {
Bundle notificationData = new NotificationDataParser(sLaunchArgs.getNotificationPath()).parseNotificationData();
Bundle notificationData = new NotificationDataParser(sLaunchArgs.getNotificationPath()).toBundle();
intent = sIntentsFactory.intentWithNotificationData(getAppContext(), notificationData, true);
} else {
intent = sIntentsFactory.cleanIntent();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ import com.wix.detox.common.TextFileReader
import org.json.JSONObject

internal class NotificationDataParser(private val notificationPath: String) {
fun parseNotificationData(): Bundle {
val rawData = readNotificationData()
fun toBundle(): Bundle {
val rawData = readNotificationFromFile()
val json = JSONObject(rawData)
val payload = json.getJSONObject("payload")
return JsonConverter(payload).toBundle()
}

private fun readNotificationData()
private fun readNotificationFromFile()
= TextFileReader(notificationPath).read()
}
Loading