-
Notifications
You must be signed in to change notification settings - Fork 632
Fixes #6147: Keep Save enabled by default on Authorize to add profiles screen #6193
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
base: develop
Are you sure you want to change the base?
Changes from 1 commit
93f6726
420f502
a3d44e8
68ce03e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -325,7 +325,7 @@ class AdminPinActivityTest { | |
| } | ||
|
|
||
| @Test | ||
| fun testAdminPinActivity_inputShortPin_clickIsDisabled() { | ||
| fun testAdminPinActivity_inputShortPin_clickIsEnabled() { | ||
| launch<AdminPinActivity>( | ||
| AdminPinActivity.createAdminPinActivityIntent( | ||
| context = context, | ||
|
|
@@ -344,7 +344,28 @@ class AdminPinActivityTest { | |
| closeSoftKeyboard() | ||
| ) | ||
| onView(withId(R.id.submit_button)).perform(nestedScrollTo()) | ||
| onView(withId(R.id.submit_button)).check(matches(not(isClickable()))) | ||
| onView(withId(R.id.submit_button)).check(matches(isClickable())) | ||
| } | ||
| } | ||
|
|
||
| @Test | ||
| fun testAdminPinActivity_emptyPins_submit_showsPinLengthError() { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It would be nice to also assert that the submit button is no longer clickable in this case.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You're absolutely right. I've updated the test to assert that the submit button is disabled (not clickable) when the pin length error is shown. This validates the fix properly. |
||
| launch<AdminPinActivity>( | ||
| AdminPinActivity.createAdminPinActivityIntent( | ||
| context = context, | ||
| profileId = 0, | ||
| colorRgb = -10710042, | ||
| adminPinEnum = 0 | ||
| ) | ||
| ).use { | ||
| onView(withId(R.id.submit_button)).perform(nestedScrollTo(), click()) | ||
| onView(withId(R.id.admin_pin_input_pin)).check( | ||
| matches( | ||
| hasErrorText( | ||
| context.resources.getString(R.string.admin_pin_error_pin_length) | ||
| ) | ||
| ) | ||
| ) | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -717,7 +738,7 @@ class AdminPinActivityTest { | |
| } | ||
|
|
||
| @Test | ||
| fun testAdminPinActivity_configChange_inputShortPin_submit_clickIsDisabled() { | ||
| fun testAdminPinActivity_configChange_inputShortPin_submit_clickIsEnabled() { | ||
| launch<AdminPinActivity>( | ||
| AdminPinActivity.createAdminPinActivityIntent( | ||
| context = context, | ||
|
|
@@ -737,7 +758,7 @@ class AdminPinActivityTest { | |
| closeSoftKeyboard() | ||
| ) | ||
| onView(withId(R.id.submit_button)).perform(nestedScrollTo()) | ||
| onView(withId(R.id.submit_button)).check(matches(not(isClickable()))) | ||
| onView(withId(R.id.submit_button)).check(matches(isClickable())) | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -1040,7 +1061,7 @@ class AdminPinActivityTest { | |
| } | ||
|
|
||
| @Test | ||
| fun testAdminPinActivity_inputShortPin_configChange_clickIsDisabled() { | ||
| fun testAdminPinActivity_inputShortPin_configChange_clickIsEnabled() { | ||
| launch<AdminPinActivity>( | ||
| AdminPinActivity.createAdminPinActivityIntent( | ||
| context = context, | ||
|
|
@@ -1060,7 +1081,7 @@ class AdminPinActivityTest { | |
| ) | ||
| onView(withId(R.id.submit_button)).perform(nestedScrollTo()) | ||
| onView(isRoot()).perform(orientationLandscape()) | ||
| onView(withId(R.id.submit_button)).check(matches(not(isClickable()))) | ||
| onView(withId(R.id.submit_button)).check(matches(isClickable())) | ||
| } | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this being removed? We do still want to disable the button when there's an error state.
I'm also wondering if more tests need to be added in
AdminPinActivityTestif you were able to remove this without any other tests failing besides the ones you fixed. If that's the case then we should add or update tests in that file to validate that the submit button correctly gets disabled when there's an error and re-enables when the user updates the input pin text after an error, including for configuration changes (rotations).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for that! The button state logic wasn't removed—it's now centralized with better structure. Here's what changed:
I created an
updateSubmitButtonState()method that disables the submit button whenever any PIN validation error exists. This gets called:I've also added tests throughout
AdminPinActivityTestto verify the button disables on error and re-enables when the user corrects the input—including cases where the configuration changes (device rotation).This approach ensures the button state always stays in sync with the error state, which prevents accidental submissions of invalid data.