Skip to content
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

Merged
merged 9 commits into from
Oct 30, 2024

Conversation

agonzalez-r
Copy link
Member

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 the TopAppBar() composable, along with the a function of the desired navigation action when this button is clicked (passed as the onEditButtonClick 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 arguments editButton (boolean, to indicate if this button should exist for the respective screen that calls the function) and onEditButtonClick (nullable lambda function, where the navigation action upon click should be specified)

Removed

none

Testing

  • TopAppBarTest.kt: added tests for editButton feature by ensuring its presence when argument respective argument is true, that upon click the onEditButtonClick function is called, that exception is thrown if no such function is provided in this case, and other edge cases...

Screenshots

Screenshot 2024-10-29 at 22 18 53

@agonzalez-r agonzalez-r linked an issue Oct 29, 2024 that may be closed by this pull request
4 tasks
@francelu francelu self-requested a review October 29, 2024 21:50
@francelu
Copy link
Contributor

@agonzalez-r
Please assign yourself :) PO

@agonzalez-r agonzalez-r self-assigned this Oct 29, 2024
Copy link
Contributor

@francelu francelu left a 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

  1. Change the default values for onBackButtonClick and onEditButtonClick to null.
  2. Update tests to verify that buttons do not display when actions are null.

@francelu
Copy link
Contributor

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!

@agonzalez-r
Copy link
Member Author

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

Copy link
Contributor

@taghizadlaura taghizadlaura left a 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

  1. Change what France requested
  2. Try to match the naming convention used in other classes for test names

@charliemangano charliemangano added the bug Something isn't working label Oct 30, 2024
@charliemangano charliemangano mentioned this pull request Oct 30, 2024
11 tasks
agonzalez-r and others added 6 commits October 30, 2024 12:02
…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
Copy link
Contributor

@francelu francelu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Well done ! :))

Copy link
Contributor

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.

Copy link
Contributor

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.

Copy link
Contributor

@taghizadlaura taghizadlaura left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

now it LGTM :)

@agonzalez-r agonzalez-r added the enhancement New feature or request label Oct 30, 2024
@agonzalez-r agonzalez-r reopened this Oct 30, 2024
@agonzalez-r agonzalez-r merged commit 342bad7 into main Oct 30, 2024
4 checks passed
@agonzalez-r agonzalez-r deleted the fix/navigation/topAppBar-ui-tests branch October 30, 2024 12:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix UI tests for M1: TopAppBar
4 participants