-
Notifications
You must be signed in to change notification settings - Fork 2
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
Fix/navigation/top app bar UI tests #91
Conversation
@agonzalez-r |
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.
Summary
You did a great job implementing the edit button! However, the tests need a few changes to improve quality, primarily by setting the on-click actions to null
instead of {}
. More details are in the code comments.
Important
Code Quality
- Improve navigation by using
null
for default on-click actions.
Functionality
- Ensure buttons are displayed only when actions are assigned.
Testing
- Update tests to check for button visibility based on action assignments.
Documentation
- Ensure any changes in parameters are reflected in the documentation.
Suggestions
- Review and implement the proposed changes in the code comments.
Steps before PR approved
- Change the default values for
onBackButtonClick
andonEditButtonClick
tonull
. - Update tests to verify that buttons do not display when actions are
null
.
app/src/main/java/com/android/periodpals/ui/navigation/TopAppBar.kt
Outdated
Show resolved
Hide resolved
app/src/androidTest/java/com/android/periodpals/ui/navigation/TopAppBarTest.kt
Outdated
Show resolved
Hide resolved
app/src/androidTest/java/com/android/periodpals/ui/navigation/TopAppBarTest.kt
Show resolved
Hide resolved
app/src/androidTest/java/com/android/periodpals/ui/navigation/TopAppBarTest.kt
Outdated
Show resolved
Hide resolved
I realize there are quite a few changes in the tests, mainly because I didn't test thoroughly while implementing navigation. Sorry for the extra work! |
no worries, they are minor changes but they do make the code a lot better |
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.
Summary
Unless what France said and my comment, it LGTM.
The TopAppBarTest
class contains unit tests for the TopAppBar
component, ensuring that it behaves as expected regarding its title, button visibility, and click functionality.
Important
Code Quality
- Readability: The code is well-structured with clear test names that indicate what each test is verifying. However, the names could be shortened, and fit more the other tests for improved readability.
- Consistency: PTAL, The test names do not match the naming conventions used in other classes, such as the
Alert
class (e.g.,createInvalidAlertNoProduct
). Establishing a consistent naming pattern across all test classes would improve maintainability and clarity.
Functionality
If you make the changes France requested :
- Correctness: LGTM, Each test checks specific features of the
TopAppBar
, ensuring that titles and buttons appear correctly based on the provided parameters. - Edge Cases: LGTM, Tests handle scenarios where buttons are not displayed or when click handlers are null, asserting that appropriate exceptions are thrown or behaviors occur.
Performance
- Nothing to add.
Security
- Nothing to add.
Testing
- If you make the changes France requested, it LGTM.
Documentation
- LGTM, The test methods are self-explanatory (additional comments could enhance clarity about the purpose of specific tests or edge cases but it's not relevant).
Suggestions
- Make the changes France requested
- Match the naming conventions used in other classes for test names
Steps before PR approved
- Change what France requested
- Try to match the naming convention used in other classes for test names
app/src/androidTest/java/com/android/periodpals/ui/navigation/TopAppBarTest.kt
Outdated
Show resolved
Hide resolved
…r functionality - Added documentation for the edit button parameters
- Adapted tests to new default values of the parameters - Made tests more complete and removed useless ones
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.
LGTM. Well done ! :))
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.
LGTM. I think this is from a merge with main into the branch.
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.
LGTM. Seems like a merge with main into the branch too.
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.
now it LGTM :)
Fix UI tests for M1: TopAppBar
Description
This PR closes issue #90. It completes all features of the
TopAppBar
by adding an edit button!As for the back button, this feature is conditional, and can be set up by passing as argument
editButton = True
to theTopAppBar()
composable, along with the a function of the desired navigation action when this button is clicked (passed as theonEditButtonClick
argument).I must remark that no further tests were added, the tests for pre-existing features of the top bar were already very extensive and complete. Navigation should not be tested in
TopAppBarTest
.Changes
Files
Added
none
Modified
TopAppBar.kt
: created argumentseditButton
(boolean, to indicate if this button should exist for the respective screen that calls the function) andonEditButtonClick
(nullable lambda function, where the navigation action upon click should be specified)Removed
none
Testing
TopAppBarTest.kt
: added tests foreditButton
feature by ensuring its presence when argument respective argument is true, that upon click theonEditButtonClick
function is called, that exception is thrown if no such function is provided in this case, and other edge cases...Screenshots