test: unit test for CardTemplateEditor#19877
Conversation
e9a5afe to
45004e4
Compare
david-allison
left a comment
There was a problem hiding this comment.
I don't like requesting changes on test code, hopefully less frustrating as this is a patch 😅
|
|
||
| shadowOf(Looper.getMainLooper()).idle() | ||
|
|
||
| assertTrue("Button should be clickable after failure", confirmButton.isClickable) |
There was a problem hiding this comment.
If feasible, we should confirm that an error occurs, this informs us if someone 'breaks' the test by 'breaking' the failure simulation of:
// throw an exception to simulate failure
testEditor.tempNoteType = null
There was a problem hiding this comment.
I tried multiple ways the error is there but since we are throwing it the test fails due the reason I stated I would leave it for now, we can create more tests later for now something is better than nothing
There was a problem hiding this comment.
Sure, I didn't expect much effort to be put here, if it's not easy we can come back to it later
45004e4 to
a95cf87
Compare
- Ensure save button re-enables on exception Co-authored-by: David Allison <62114487+david-allison@users.noreply.github.com>
a95cf87 to
1d0e7ad
Compare
lukstbit
left a comment
There was a problem hiding this comment.
I fixed the conflict to move things forward.
I kept the original code, we use binding now but as this uses a menu item I didn't want to complicate things(we are also currently modifying this screen so the tests might be changed as well).
Purpose / Description
When a user attempted to save changes in the CardTemplateEditor, the save button was typically disabled to prevent double-submissions. However, if an unexpected exception occurs during the save logic, the button remained disabled, forcing the user to restart the activity. This change adds a regression test to ensure the button is always restored to an enabled state regardless of success or failure. resolves a TODO from my previous PR
Fixes
NA
Approach
NA
How Has This Been Tested?
Local test
Learning (optional, can help others)
NA
Checklist
Please, go through these checks before submitting the PR.