Skip to content

Commit

Permalink
e2e: bypass save password prompt.
Browse files Browse the repository at this point in the history
  • Loading branch information
zhyd1997 authored Dec 18, 2023
1 parent 9c2590f commit 0ed0dc1
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions generators/app/templates/e2e/utils.js.ejs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
const { device } = require('detox');

const execSync = require('child_process').execSync;
const username = process.env.E2E_USERNAME || 'user';
const password = process.env.E2E_PASSWORD || 'user';
const expoPublishedUrl = process.env.E2E_EXPO_URL || 'exp://localhost:8081';
Expand Down Expand Up @@ -123,6 +122,18 @@ const closeDeveloperMenu = async () => {

const reloadApp = async (bailOnFailure) => {
try {
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({ url: expoPublishedUrl, launchArgs: { detoxEnableSynchronization: false } });
await closeDeveloperMenu();
} catch (e) {
Expand Down

0 comments on commit 0ed0dc1

Please sign in to comment.