[iOS][PRDBD] Adds EG tests for the removal of the password cell.Angela NovakovicIt would be great if we could squeeze in some context over the concerned view in the title. We could have something like
```suggestion
[iOS][PRDBD] EG tests for password removal from QuickDeleteBrowsingDVC
```I find, "Adds EG tests for the removal of the password cell" a bit too broad
Done
- (void)testCancelButtonDoesNotUpdatePrefs {Angela NovakovicWhy are we forcing the flag on for this test?
Done
if (![QuickDeleteAppInterface
isPasswordRemovalFromDeleteBrowsingDataEnabled]) {
[[EarlGrey selectElementWithMatcher:ClearSavedPasswordsButton()]
assertWithMatcher:elementIsSelectedMatcher(false)];
}Angela NovakovicHow about we do:
```
[[EarlGrey selectElementWithMatcher:ClearSavedPasswordsButton()]
assertWithMatcher:[QuickDeleteAppInterface
isPasswordRemovalFromDeleteBrowsingDataEnabled]
? grey_nil()
: elementIsSelectedMatcher(false)];
```we could to the same below when asserting that all rows are selected
Done
GREYAssertEqual(
[ChromeEarlGrey userBooleanPref:browsing_data::prefs::kDeletePasswords],
NO, @"Passwords pref changed on cancel.");Angela NovakovicI don't think checking this part would hurt when the feature is enabled. If anything, it would just confirm that we're not inadvertently changing this pref
Done
if (![QuickDeleteAppInterface
isPasswordRemovalFromDeleteBrowsingDataEnabled]) {
[ChromeEarlGrey setBoolValue:NO
forUserPref:browsing_data::prefs::kDeletePasswords];
}Angela NovakovicI think it's also fine to leave this part in when the feature is enabled. It shouldn't make the test fail
Same for all other instances in both EG test files
Done
if (![QuickDeleteAppInterface
isPasswordRemovalFromDeleteBrowsingDataEnabled]) {
NoDeleteBrowsingDataDialogHistogram(
DeleteBrowsingDataDialogAction::kPasswordsToggledOn);
}Angela NovakovicSame, the metric should be empty regardless of the feature's enabled state
Done
if (![QuickDeleteAppInterface
isPasswordRemovalFromDeleteBrowsingDataEnabled]) {
[[EarlGrey selectElementWithMatcher:ClearSavedPasswordsButton()]
assertWithMatcher:elementIsSelectedMatcher(false)];
}Angela Novakovic```
[[EarlGrey selectElementWithMatcher:ClearSavedPasswordsButton()]
assertWithMatcher:[QuickDeleteAppInterface
isPasswordRemovalFromDeleteBrowsingDataEnabled]
? grey_nil()
: elementIsSelectedMatcher(false)];
```
Done
if (![QuickDeleteAppInterface
isPasswordRemovalFromDeleteBrowsingDataEnabled]) {
[[EarlGrey selectElementWithMatcher:ClearSavedPasswordsButton()]
assertWithMatcher:elementIsSelectedMatcher(true)];
}Angela Novakovic```
[[EarlGrey selectElementWithMatcher:ClearSavedPasswordsButton()]
assertWithMatcher:[QuickDeleteAppInterface
isPasswordRemovalFromDeleteBrowsingDataEnabled]
? grey_nil()
: elementIsSelectedMatcher(true)];
```
Done
if (![QuickDeleteAppInterface
isPasswordRemovalFromDeleteBrowsingDataEnabled]) {
GREYAssertEqual(
[ChromeEarlGrey userBooleanPref:browsing_data::prefs::kDeletePasswords],
YES, @"Failed to save passwords pref change on confirm.");
}Angela Novakovic```
BOOL shouldPrefBeUpdated =
![QuickDeleteAppInterface isPasswordRemovalFromDeleteBrowsingDataEnabled];
GREYAssertEqual(
[ChromeEarlGrey userBooleanPref:browsing_data::prefs::kDeletePasswords],
shouldPrefBeUpdated, @"Failed to save passwords pref change on confirm.");
```
Done
if (![QuickDeleteAppInterface
isPasswordRemovalFromDeleteBrowsingDataEnabled]) {
ExpectDeleteBrowsingDataDialogHistogram(
DeleteBrowsingDataDialogAction::kPasswordsToggledOn);
}Angela Novakovic```
if ([QuickDeleteAppInterface
isPasswordRemovalFromDeleteBrowsingDataEnabled]) {
NoDeleteBrowsingDataDialogHistogram(
DeleteBrowsingDataDialogAction::kPasswordsToggledOn);
} else {
ExpectDeleteBrowsingDataDialogHistogram(
DeleteBrowsingDataDialogAction::kPasswordsToggledOn);
}```
Done
if ([self isRunningTest:@selector
(testButtonColorWhenThePasswordRemovalFeatureIsDisabled)]) {
config.features_disabled.push_back(kPasswordRemovalFromDeleteBrowsingData);
}
if ([self isRunningTest:@selector(testPasswordsForDeletion)]) {
config.features_disabled.push_back(kPasswordRemovalFromDeleteBrowsingData);
}
if ([self isRunningTest:@selector(testKeepPasswords)]) {
config.features_disabled.push_back(kPasswordRemovalFromDeleteBrowsingData);
}Angela NovakovicPlease combine these into a single if statement
Done
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
// These tests will always run with the featurenit: `This test`
if (![QuickDeleteAppInterface
isPasswordRemovalFromDeleteBrowsingDataEnabled]) {
[ChromeEarlGrey setBoolValue:NO
forUserPref:browsing_data::prefs::kDeletePasswords];
}Angela NovakovicI think it's also fine to leave this part in when the feature is enabled. It shouldn't make the test fail
Same for all other instances in both EG test files
Done
There are a couple instances left in both test files
BOOL shouldPrefBeUpdated =Sorry, should have been more precise when I made the initial suggestion
```suggestion
BOOL shouldPasswordPrefBeUpdated =
```
[self isRunningTest:@selector
(testButtonColorWhenThePasswordRemovalFeatureIsDisabled)] ||
[self isRunningTest:@selector(testPasswordsForDeletion)] ||
[self isRunningTest:@selector(testKeepPasswords)]) {Shouldn't the flag be `disabled` for these tests?
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
// These tests will always run with the featureAngela Novakovicnit: `This test`
Done
Sorry, should have been more precise when I made the initial suggestion
```suggestion
BOOL shouldPasswordPrefBeUpdated =
```
Done
[self isRunningTest:@selector
(testButtonColorWhenThePasswordRemovalFeatureIsDisabled)] ||
[self isRunningTest:@selector(testPasswordsForDeletion)] ||
[self isRunningTest:@selector(testKeepPasswords)]) {Shouldn't the flag be `disabled` for these tests?
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |