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

iOS lock screen when App launch or reload #3967

Open
aaronpliu opened this issue Mar 3, 2023 · 25 comments
Open

iOS lock screen when App launch or reload #3967

aaronpliu opened this issue Mar 3, 2023 · 25 comments

Comments

@aaronpliu
Copy link

aaronpliu commented Mar 3, 2023

Description

The app build with RN bundle. When launch app or reload, the iPhone simulator will be locked.
From below log, it run to "Launching com.jumptech.autodev..." then stuck due to screen locked.

2023-03-03T16:18:27.321Z detox DEBUG: i child-process:EXEC_CMD applesimutils --byId C5DFA5C2-E3B3-4AEA-9FD9-08D08A4E15EA --bundle com.jumptech.autodev --restartSB --setPermissions location=always,photos=YES,microphone=YES,notifications=YES
2023-03-03T16:18:27.321Z detox DEBUG: i child-process:EXEC_TRY Trying to set permissions...
2023-03-03T16:18:28.253Z detox DEBUG: i child-process:EXEC_SUCCESS Permissions are set
2023-03-03T16:18:28.266Z detox DEBUG: i child-process:EXEC_CMD /usr/bin/xcrun simctl get_app_container C5DFA5C2-E3B3-4AEA-9FD9-08D08A4E15EA com.jumptech.autodev
2023-03-03T16:18:28.499Z detox DEBUG: i child-process:SPAWN_CMD /usr/bin/xcrun simctl spawn C5DFA5C2-E3B3-4AEA-9FD9-08D08A4E15EA log stream --level debug --style compact --predicate "processImagePath beginsWith \"/Users/Mac/Library/Developer/CoreSimulator/Devices/C5DFA5C2-E3B3-4AEA-9FD9-08D08A4E15EA/data/Containers/Bundle/Application/424072B9-13CE-43BD-BEE5-5B98E9AF60C0/AutoX.app\""
2023-03-03T16:18:28.549Z detox DEBUG: i child-process:EXEC_CMD SIMCTL_CHILD_GULGeneratedClassDisposeDisabled=YES SIMCTL_CHILD_DYLD_INSERT_LIBRARIES="/Users/Mac/Library/Detox/ios/37a921ad848a2c15da7c209dcd987654b9223ec0/Detox.framework/Detox" /usr/bin/xcrun simctl launch C5DFA5C2-E3B3-4AEA-9FD9-08D08A4E15EA com.jumptech.autodev --args -detoxServer ws://localhost:51274 -detoxSessionId 9ce300b8-98ad-ee3d-59c1-8691227fd758 -detoxURLBlacklistRegex '("https://clients3.google.com*")' -detoxEnableSynchronization 0 -detoxDisableHierarchyDump YES
2023-03-03T16:18:28.549Z detox DEBUG: i child-process:EXEC_TRY Launching com.jumptech.autodev...
2023-03-03T16:18:33.863Z detox DEBUG: i child-process:EXEC_CMD /usr/bin/xcrun simctl get_app_container C5DFA5C2-E3B3-4AEA-9FD9-08D08A4E15EA com.jumptech.autodev

Your environment

Detox version: 20.1.3
React Native version: 0.64.2
Node version: 16.13
Device model: iPhone 14 Pro
OS: 16.2
Test-runner (select one): jest / other

@stale
Copy link

stale bot commented Apr 6, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If you believe the issue is still relevant, please test on the latest Detox and report back.

Thank you for your contributions!

For more information on bots in this repository, read this discussion.

@stale stale bot added the 🏚 stale label Apr 6, 2023
@lodibrahim
Copy link

lodibrahim commented Apr 20, 2023

I'm also seeing this issue, any update on it?

@stale stale bot removed the 🏚 stale label Apr 20, 2023
@stale
Copy link

stale bot commented May 21, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If you believe the issue is still relevant, please test on the latest Detox and report back.

Thank you for your contributions!

For more information on bots in this repository, read this discussion.

@stale stale bot added the 🏚 stale label May 21, 2023
@aaronpliu
Copy link
Author

seems caused by accessibility inspector. locked screen phenomenon appeared only if inspector open or running. close inspector and restart your Mac it will be resumed. using devtool or xcode to inspect element instead

@stale stale bot removed 🏚 stale labels May 21, 2023
@d4vidi
Copy link
Collaborator

d4vidi commented May 29, 2023

seems caused by accessibility inspector. locked screen phenomenon appeared only if inspector open or running. close inspector and restart your Mac it will be resumed. using devtool or xcode to inspect element instead

@aaronpliu Interesting. Thanks for sharing. Please close the issue if that has resolved things for you.

@aaronpliu
Copy link
Author

closed as an alternative way to bypass it. it's still worthing investigating.

@d4vidi
Copy link
Collaborator

d4vidi commented May 29, 2023

Please report back with further insights.

@IvayloMetodiev
Copy link

up

1 similar comment
@scyrych
Copy link

scyrych commented Aug 19, 2023

up

@angelica-snowit
Copy link

I see this problem as well. It seems to happen randomly.

@zhouzh1
Copy link
Contributor

zhouzh1 commented Dec 20, 2023

I'm also facing this weird issue..., is there any more suggestions? @d4vidi

@s-chand
Copy link

s-chand commented Dec 28, 2023

experiencing this and its causing flakiness

@noomorph
Copy link
Collaborator

@asafkorem may I ask you to look here once again?

@micahdasMA
Copy link

I'm also experiencing this

@MetodievIvaylo
Copy link

MetodievIvaylo commented Jan 30, 2024

It is happening in my project as well. When I run tests in GitHub CI, with 3 workers, 2 are fine but the third simulator is locked.

@Seraphiyra
Copy link

I sporadically see this on my nightly CI builds. Not super frequent. Once in a blue moon thing that I haven't been able to find any pattern to.

The machine it is run off of is restarted once per week. It seems irrelevant if it has recently been rebooted (litrally logged in and started a run) or a run midweek, we see might see this happen.

@aaronpliu
Copy link
Author

it appears to lock screen from time to time in my current test scripts with Detox v20.16.0 as well

@avitretiak
Copy link

avitretiak commented Feb 22, 2024

I am seeing this too on Detox v20.18.1, xCode 15.3, running scripts locally on iOS simulator

@avitretiak
Copy link

Adding to this, could the culprit possibly be --restartSB?

Noticed detox instructs applesimutils to respring iOS when setting permissions (not the case for simctl based permissions), and in my case, this seems to be causing the lockscreen to pop-up.

Removing the respring by patching detox seems to have worked to remediate this so far, but there's probably a reason why we are respringing, haven't found any differences in functionality so far however.

For reference:
/src/devices/common/drivers/ios/tools/AppleSimUtils.js

   async setPermissionWithAppleSimUtils(udid, bundleId, service, value) {
     const options = {
-      args: `--byId ${udid} --bundle ${bundleId} --restartSB --setPermissions ${service}=${value}`,
+      args: `--byId ${udid} --bundle ${bundleId} --setPermissions ${service}=${value}`,
       statusLogs: {
         trying: `Trying to set permissions with AppleSimUtils: ${service}=${value}...`,
         successful: `${service} permissions are set`

@didyk
Copy link

didyk commented Jul 1, 2024

the same issue, @avitretiak's patch doesn't help

@MadSandwich
Copy link

up

@ball-hayden
Copy link
Contributor

We managed to avoid this by removing permissions: { notifications: 'YES' }.

Worth noting that because of the way Detox injects notifications, this permission isn't required to send notifications to the app from Detox.

@ball-hayden
Copy link
Contributor

My guess is that this is related to setting permissions with AppleSimUtils, so any permissions that require AppleSimUtils could have the same effect.

@asafkorem
Copy link
Contributor

asafkorem commented Aug 15, 2024

@ball-hayden If that's the situation (with notification permissions via applesimutils), you can work around it (for now) by using our system APIs. Just tap the "Allow" button on the permissions dialog to enable push notifications if necessary. If anyone encounters this issue with the latest Xcode and Detox, please let me know, best if you'll provide a minimal reproduction—I'd be happy to look into it together.

@ball-hayden
Copy link
Contributor

Thanks @asafkorem.

We're not seeing issues at all, now, having removed the permissions request - we don't need it since Detox is bypassing that anyway.

If someone else is seeing this with other permissions, perhaps they can try out @asafkorem's suggestion?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests