Detox Recorder stuck from the get-go
freak4pc opened this issue · comments
More info, here's my .detoxrc.json
:
{
"testRunner": "jest",
"runnerConfig": "e2e/config.json",
"configurations": {
"ios.sim.debug": {
"binaryPath": "ios/build/Build/Products/Debug-iphonesimulator/Gett.app",
"build": "xcodebuild -workspace Gett.xcworkspace -scheme Gett -configuration Debug -sdk iphonesimulator -derivedDataPath ios/build",
"type": "ios.simulator",
"device": {
"type": "iPhone 11"
}
}
}
}
Running detox build
and detox test
works.
$> detox --version
17.1.0
Hey
Have you installed applesimutils?
Yes, otherwise detox build
wouldn't work.
$> applesimutils --version
applesimutils version 0.7.8
I wonder what it’s doing. I’ll pepper it with some logs and will release a new version so we have better understanding. Will you be willing to run and post the log output?
Yeah of course. As long as nothing proprietary pops up :)
Nope, it’ll be a specific log for the CLI tool.
Just released 1.0.116
Before running the same command you are using, run in a second terminal:
log stream --level debug --style compact --predicate "subsystem=='DetoxRecorder'"
Post the result here.
Thanks
Nothing on npm, should I just install it directly from source?
Ah, I had the npm publish
commented out in the script 🤦♂️
1.0.118
This is how far I'm getting
Filtering the log data using "subsystem == "DetoxRecorder""
Timestamp Ty Process[PID:TID]
2020-07-06 00:51:55.272 Db DetoxRecorderCLI[60950:13a39e] [DetoxRecorder:CLI] Parsing arguments
2020-07-06 00:51:55.273 Db DetoxRecorderCLI[60950:13a39e] [DetoxRecorder:CLI] Attempting to discover Detox config file
2020-07-06 00:51:55.275 Db DetoxRecorderCLI[60950:13a39e] [DetoxRecorder:CLI] Using “.detoxrc.json” config file
2020-07-06 00:51:55.275 Db DetoxRecorderCLI[60950:13a39e] [DetoxRecorder:CLI] Launching /usr/local/bin/applesimutils with arguments: ["--list", "--byType", "iPhone 11"] environment: [:]
2020-07-06 00:51:56.050 Db DetoxRecorderCLI[60950:13a39e] [DetoxRecorder:CLI] Launching /usr/local/bin/applesimutils with arguments: ["--list", "--byId", "F1A45E40-B26F-4C58-A4A2-F5FF63554317"] environment: [:]
2020-07-06 00:51:56.538 Db DetoxRecorderCLI[60950:13a39e] [DetoxRecorder:CLI] Launching /usr/bin/which with arguments: ["xcrun"] environment: [:]
2020-07-06 00:51:56.606 Db DetoxRecorderCLI[60950:13a39e] [DetoxRecorder:CLI] Launching /usr/bin/xcrun with arguments: ["simctl", "install", "F1A45E40-B26F-4C58-A4A2-F5FF63554317", "ios/build/Build/Products/Debug-iphonesimulator/Gett.app"] environment: [:]
2020-07-06 00:51:57.383 Db DetoxRecorderCLI[60950:13a39e] [DetoxRecorder:CLI] Launching /usr/bin/xcrun with arguments: ["simctl", "get_app_container", "F1A45E40-B26F-4C58-A4A2-F5FF63554317", "com.gett.Gett"] environment: [:]
2020-07-06 00:51:57.685 Db DetoxRecorderCLI[60950:13a39e] [DetoxRecorder:CLI] Launching /usr/bin/nm with arguments: ["-U", "/Users/freak4pc/Library/Developer/CoreSimulator/Devices/F1A45E40-B26F-4C58-A4A2-F5FF63554317/data/Containers/Bundle/Application/416977EA-3934-4ABA-8C4E-EE20FF30C8EA/Gett.app/Gett"] environment: [:]
Hm, interesting. I use nm -U
and otool -L
to check if the Recorder iOS framework is already linked in the binary (statically or dynamically). Why would that stop. Perhaps you have many symbols and it’s very slow? I might just remove this part of the code.
If you run
nm -U /Users/freak4pc/Library/Developer/CoreSimulator/Devices/F1A45E40-B26F-4C58-A4A2-F5FF63554317/data/Containers/Bundle/Application/416977EA-3934-4ABA-8C4E-EE20FF30C8EA/Gett.app/Gett
How long does it take to finish?
Very quickly
time nm -U /Users/freak4pc/Library/Developer/CoreSimulator/Devices/F1A45E40-B26F-4C58-A4A2-F5FF63554317/data/Containers/Bundle/Application/416977EA-3934-4ABA-8C4E-EE20FF30C8EA/Gett.app/Gett
nm -U 0.25s user 0.27s system 81% cpu 0.638 total
Perhaps I’m using NSTask incorrectly then. :(
I’ll disable this functionality for now and assume that the framework should be injected. These checks were added for internal needs, but we don’t yet have this usecase internally.
To be honest, I actually don't have it injected. There's nowhere in the instructions that mentions we need to inject any dylib, unless I missed it ? 🤷
The CLI does the injecting for you.
These tests were meant, if you had injected the framework on your own, skip it in CLI. But normal usage is you don’t inject anything, and the CLI does the magic for you with DYLD_INSERT_LIBRARIES.
Please try now with 119.
Could be related to the issue:
https://stackoverflow.com/questions/55275078/objective-c-nstask-buffer-limitation
It seemed to open it with the recorder bar, I'll confirm tomorrow, have to run out for today. Thanks for your help Leo!
Thank you for trying and assisting!
I’ve released new version with a possible fix. If you can, please try it. Thank you
I installed the "detox-recorder": "^1.0.120"
version but I'm having the same issue on iOS 13.3
and React native 0.62.2
@LeoNatan It doesn't get stuck now but it doesn't "do anything"
If I have the simulator already open it does open the app with the recorder bar but I'm not seeing it recording any of the things I'm doing into the destination file (even though I do see the hit areas when I'm touching them)
@freak4pc So you see visualizations, but don’t see anything in the file?
Could be a permission issue. I run my Mac with SIP disabled. Perhaps in normal runtime, the simulator doesn’t have access to your desktop?
Is there anything in the text file at all?
@smakosh What are you seeing? Please run the log command above and post the output. Thanks
@freak4pc So you see visualizations, but don’t see anything in the file?
Correct. I don’t see visualizations for everything (for examples swipes or pans) but most taps so show visuals.
Could be a permission issue. I run my Mac with SIP disabled. Perhaps in normal runtime, the simulator doesn’t have access to your desktop?
Is there anything in the text file at all?
The text file isn’t there at all. It should work even with SIP, AFAICT. I’ll try a sandbox folder instead but I don’t think that should be it.
Swipes aren’t currently supported.
Pans are only supported for scroll views currently.
I’ll add more logging, this time in the framework, and we’ll see what’s up.
log stream --level debug --style compact --predicate "subsystem=='DetoxRecorder’"
❯ log stream --level debug --style compact --predicate "subsystem=='DetoxRecorder’"
log: Bad predicate (Unable to parse the format string "subsystem=='DetoxRecorder’"): subsystem=='DetoxRecorder’
Interesting. I’ve added error presentation to the user in case the test file cannot be written to. So it should have alerted you.
Nothing gets logged
@freak4pc I’ve released a version with more logs, this time on the simulator.
xcrun simctl spawn booted log stream --level debug --style compact --predicate "subsystem=='DetoxRecorder'"
@freak4pc I’ve released a version with more logs, this time on the simulator.
xcrun simctl spawn booted log stream --level debug --style compact --predicate "subsystem=='DetoxRecorder'"
I'm still not seeing any logs
@smakosh What command are you executing to start recording?
Not seeing any log output from
log stream --level debug --style compact --predicate "subsystem=='DetoxRecorder'"
doesn't make sense.
Try updating your detox-cli
using:
npm install -g detox-cli
detox-cli
Done and I'm still seeing the same output as on the video
success Installed "detox-cli@17.1.0" with binaries:
- detox
✨ Done in 3.35s.
What if you run directly like so:
node_modules/detox-recorder/DetoxRecorderCLI --help
Do you get anything? If you get output, use that as the command instead of detox recorder
.
What if you run directly like so:
node_modules/detox-recorder/DetoxRecorderCLI --help
Do you get anything? If you get output, use that as the command instead of
detox recorder
.
Thank you! this made it work
Hmm, so there is a problem with CLI somehow.
I'm seeing logs now on my terminal but the test file doesn't get generated
@smakosh Please run the following command:
xcrun simctl spawn booted log stream --level debug --style compact --predicate "subsystem=='DetoxRecorder'"
and past here pls. Thanks
@smakosh Please run the following command:
xcrun simctl spawn booted log stream --level debug --style compact --predicate "subsystem=='DetoxRecorder'"
and past here pls. Thanks
❯ xcrun simctl spawn booted log stream --level debug --style compact --predicate "subsystem=='DetoxRecorder'"
Error from getpwuid_r: 0 (Undefined error: 0)
Filtering the log data using "subsystem == "DetoxRecorder""
The following one logs this
❯ log stream --level debug --style compact --predicate "subsystem=='DetoxRecorder'"
Filtering the log data using "subsystem == "DetoxRecorder""
Timestamp Ty Process[PID:TID]
2020-07-07 19:33:25.434 Db DetoxRecorderCLI[47599:1613fa] [DetoxRecorder:CLI] Parsing arguments
2020-07-07 19:33:25.435 Db DetoxRecorderCLI[47599:1613fa] [DetoxRecorder:CLI] Launching /bin/zsh with arguments: ["-l", "-c", "which applesimutils"] environment: [:]
2020-07-07 19:33:25.611 Db DetoxRecorderCLI[47599:1613fa] [DetoxRecorder:CLI] Launching /usr/local/bin/applesimutils with arguments: ["--list", "--booted"] environment: [:]
2020-07-07 19:33:25.918 Db DetoxRecorderCLI[47599:1613fa] [DetoxRecorder:CLI] Launching /bin/zsh with arguments: ["-l", "-c", "which xcrun"] environment: [:]
2020-07-07 19:33:26.048 Db DetoxRecorderCLI[47599:1613fa] [DetoxRecorder:CLI] Launching /usr/bin/xcrun with arguments: ["simctl", "get_app_container", "2D329387-1B2B-4A0F-8687-2A28F6318639", "...."] environment: [:]
2020-07-07 19:33:26.130 Db DetoxRecorderCLI[47599:1613fa] [DetoxRecorder:CLI] Launching /usr/bin/nm with arguments: ["-U", "/Users/smakosh/Library/Developer/CoreSimulator/Devices/2D329387-1B2B-4A0F-8687-2A28F6318639/data/Containers/Bundle/Application/B0CF9F2D-4D22-414A-AC9C-2ECF206CB1FC/.....app/...."] environment: [:]
2020-07-07 19:33:26.354 Db DetoxRecorderCLI[47599:1613fa] [DetoxRecorder:CLI] Launching /usr/bin/otool with arguments: ["-L", "/Users/smakosh/Library/Developer/CoreSimulator/Devices/2D329387-1B2B-4A0F-8687-2A28F6318639/data/Containers/Bundle/Application/B0CF9F2D-4D22-414A-AC9C-2ECF206CB1FC/.....app/...."] environment: [:]
2020-07-07 19:33:26.542 Db DetoxRecorderCLI[47599:1613fa] [DetoxRecorder:CLI] App binary requires framework injection: true
2020-07-07 19:33:26.543 Db DetoxRecorderCLI[47599:1613fa] [DetoxRecorder:CLI] Launching /usr/bin/xcrun with arguments: ["simctl", "terminate", "2D329387-1B2B-4A0F-8687-2A28F6318639", "...."] environment: [:]
2020-07-07 19:33:26.620 Db DetoxRecorderCLI[47599:1613fa] [DetoxRecorder:CLI] Launching /usr/bin/xcrun with arguments: ["simctl", "launch", "2D329387-1B2B-4A0F-8687-2A28F6318639", "....", "-DTXRecStartRecording", "1", "-DTXRecTestOutputPath", "~/Desktop/..../project/packages/mobile/artifacts/test.js", "-DTXRecTestName", "My Recorded Test"] environment: ["SIMCTL_CHILD_DYLD_INSERT_LIBRARIES": "/Users/smakosh/Desktop/..../project/packages/mobile/node_modules/detox-recorder/DetoxRecorder.framework/DetoxRecorder"]
Closing this issue in favor of #3, which provided valuable information on file opening error. The original error was solved anyway.
@freak4pc @smakosh 1.0.143 is out with a change to how the test file is written. Please test and let me know if your issue has been resolved.
Getting a weird issue
$ node_modules/detox-recorder/DetoxRecorderCLI recorder --bundleId '....' --simulatorId booted -o '~/Desktop/..../project/packages/mobile/e2e/test.js' --testName 'My Recorded Test' --record
Unable to open output test file for writing: The folder “test.js” doesn’t exist. See “detox recorder --help” for usage.
I reproduced. It's the tilde in the path. If you use the full path as a workaround, it will work. I will fix this in the CLI and release a version.
Yup that works!
I encountered few more issues but they are unrelated to this, I'll open them tomorrow with a detailed description
1.0.145 out with tilde fix.
1.0.144 out with tilde fix.
It doesn't write tests anymore with the latest release