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

Bypass save password prompt #3761

Open
NatalieDinh opened this issue Dec 15, 2022 · 30 comments
Open

Bypass save password prompt #3761

NatalieDinh opened this issue Dec 15, 2022 · 30 comments
Assignees

Comments

@NatalieDinh
Copy link

Description

Hi,

I was wondering if there was a permission that we would be able to set to bypass the save password prompt, similarly to how we are able to bypass notifications/locations prompt.

Screen Shot 2022-12-15 at 3 52 52 PM

Your environment

Detox version: ^19.6.5,
React Native version: ^0.69.1,
Node version: v14.17.0
Device model: iPhone 13
OS: 15
Test-runner: jest

@stale
Copy link

stale bot commented Jan 15, 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.

@noomorph
Copy link
Collaborator

Asaf, please look 👀 @asafkorem

@stale
Copy link

stale bot commented Feb 5, 2023

The issue has been closed for inactivity.

@stale stale bot closed this as completed Feb 5, 2023
@angelica-snowit
Copy link

With the new XCode update my tests fails because of the password prompt. As already asked: there is a permission that we would be able to set to bypass the save password prompt?

@owens-ben
Copy link

owens-ben commented Apr 6, 2023

Having the same issue, Xcode 14.3.

@fossage
Copy link

fossage commented Apr 6, 2023

Also seeing the same thing after updating to Xcode 14.3. Our current workaround is just falling back to Xcode 14.2(you can get it via this link). If the problem persists and it doesn't seem easily fixable, we will likely set up some logic to log the test user in without actually using the password input if thats helpful for anyone else..

@owens-ben
Copy link

Rolled back to 14.2, not seeing the issue anymore.

@simonedif
Copy link

Having the same issue with Xcode 14.3. As already mentioned is there a way that we would able to set to bypass the save password prompt?

@JasonHiew
Copy link

JasonHiew commented Apr 25, 2023

Am new to Detox and also faced the same issue and would rather not downgrade Xcode to 14.2 bc of the fairly large download size and it not detecting my iPhone which has been updated to iOS 16.4.1 already.

Not sure if this helps in your case. I don't think this has been mentioned anywhere else.

I found a rather simple workaround. By backgrounding the app and opening it back, the "Save Password" prompt goes away.

Put this in the sign in test case:

await device.sendToHome();
await device.launchApp({ newInstance: false });

The whole thing should look like this (Maybe, I'm new to Detox and all code testing in general):

 it('should sign in', async () => {
    await element(by.text('SIGN IN')).tap();

    await element(by.id('email')).typeText('test@gmail.com');
    await element(by.id('password')).typeText('password');
    await element(by.text('SIGN IN')).tap();

    await device.sendToHome();
    await device.launchApp({ newInstance: false });

    await expect(element(by.text('Home screen'))).toBeVisible();
  });
});

@noomorph
Copy link
Collaborator

@asafkorem please answer

@noomorph noomorph reopened this Apr 25, 2023
@stale stale bot removed the 🏚 stale label Apr 25, 2023
@asafkorem
Copy link
Contributor

Hello @NatalieDinh, unfortunately, the save password prompt is a system dialog, so we are unable to provide a solution through Detox or AppleSimUtils. We recommend tracking this issue related to XCUITest integration: #3208. This upcoming solution for Detox iOS will allow for interaction with system dialogs, addressing cases like yours.

In the meantime, you can manually disable the Autofill feature for passwords on the iOS Simulator, which should alleviate the issue (https://stackoverflow.com/questions/55378639/strong-password-autofill-appears-in-ios-simulator):
Navigate to Simulator -> Settings -> Passwords, and toggle the AutoFill passwords option off by first turning it on and then turning it off.

@asafkorem
Copy link
Contributor

@JasonHiew this workaround is interesting, I wonder if it works for older/newer Xcode versions as well. How did you found it? I wonder if it's an iOS feature or bug.

@JasonHiew
Copy link

@asafkorem I found it by accident through trial and error while checking the docs since I couldn't find any solution without downgrading Xcode or modifying the existing form.

I think this workaround will work regardless of Xcode version. On older Xcode versions, as mentioned by others, doesn't have the prompt. As long as app doesn't background itself in the middle of the login process, I don't see why it wouldn't work.

It should instead depend on the way the "Save Password" prompt is handled by the iOS version. Can't guarantee that it'll work on all iOS versions. Have not tested it myself on other iOS versions, but it should work as long as the prompt behaves like this (closes after backgrounding the app).

@roryf
Copy link

roryf commented Apr 26, 2023

This seems like a major blocker for upgrading to 14.3 until #3208 is concluded, is there no way to programmatically disable AutoFill via simulator options or something?

@mdolinin
Copy link

mdolinin commented Apr 26, 2023

I have used this workaround using plutil -> https://stackoverflow.com/a/76105538
Example:

beforeAll(async () => {
    if (device.getPlatform() === 'ios') {
      // disable password autofill
      execSync(
        `plutil -replace restrictedBool.allowPasswordAutoFill.value -bool NO ~/Library/Developer/CoreSimulator/Devices/${device.id}/data/Containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles/Library/ConfigurationProfiles/UserSettings.plist`,
      );
      execSync(
        `plutil -replace restrictedBool.allowPasswordAutoFill.value -bool NO ~/Library/Developer/CoreSimulator/Devices/${device.id}/data/Library/UserConfigurationProfiles/EffectiveUserSettings.plist`,
      );
      execSync(
        `plutil -replace restrictedBool.allowPasswordAutoFill.value -bool NO ~/Library/Developer/CoreSimulator/Devices/${device.id}/data/Library/UserConfigurationProfiles/PublicInfo/PublicEffectiveUserSettings.plist`,
      );
    }
    await device.launchApp();
  });

Tested on Xcode 14.3 and iOS 16.4

@noomorph
Copy link
Collaborator

@asafkorem looks like it is interesting workaround too with plists.

Also, do I understand right that Detox 21.0.0 will solve this issue or not?

@andac-ozcan
Copy link

andac-ozcan commented Apr 27, 2023

@mdolinin's solution worked flawless on my side. I just had to add below:

const execSync = require('child_process').execSync;

@asafkorem
Copy link
Contributor

asafkorem commented Apr 27, 2023

@asafkorem looks like it is interesting workaround too with plists.

Also, do I understand right that Detox 21.0.0 will solve this issue or not?

You understand correctly, it will enable interactions with system dialogs.

The workaround looks interesting. I believe we can refer to this issue from the docs for the meanwhile..

@grgmo
Copy link

grgmo commented Apr 27, 2023

@mdolinin's workaround works for me only if I do the execSync part after await device.launchApp();

On checking those plist files for some reason putting execSync before await device.launchApp(); does not change the values, but putting it after gives me correct values

@JasonHiew's workaround also works

@stale
Copy link

stale bot commented Jun 10, 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 Jun 10, 2023
@risinglf
Copy link

Hello, any news about this?

@stale stale bot removed the 🏚 stale label Jun 12, 2023
@SandroMachado
Copy link

Facing the same issue.

@owens-ben
Copy link

Seeing the same issue in xcode 14.3.1

@stale
Copy link

stale bot commented Sep 16, 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 Sep 16, 2023
@angelica-snowit
Copy link

Still a valid request.

@stale stale bot removed the 🏚 stale label Sep 18, 2023
Copy link

stale bot commented Dec 15, 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 Dec 15, 2023
@mokagio
Copy link

mokagio commented Dec 15, 2023

I'm not a Detox user, but landed here because Xcode 15.1 and iOS 17.2 broke the Simulator -> Settings -> Passwords -> Disable AutoFill we had implemented via registering a test observer (XCTestObservation).

The reason, as far as I can tell, is that as soon as the Passwords screen is pushed in the navigation stack, it's popped back:

Simulator.Screen.Recording.-.iPhone.15.-.2023-12-15.at.14.50.47.mp4

Unfortunately, this is all I have to offer. It doesn't help much in terms of finding a solution, but hopefully can serve as a good explanation for folks who experience this issue anew.

@stale stale bot removed the 🏚 stale label Dec 15, 2023
zhyd1997 added a commit to zhyd1997/generator-jhipster-react-native that referenced this issue Dec 18, 2023
Copy link

stale bot commented Mar 17, 2024

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 Mar 17, 2024
@manu-abrantes
Copy link

Having the same issue in Xcode 15.2

@stale stale bot removed the 🏚 stale label Apr 3, 2024
@owens-ben
Copy link

owens-ben commented Jul 11, 2024

This is still an issue, Xcode 15.1 and 15.2, and only on iphone 15.

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