-
Notifications
You must be signed in to change notification settings - Fork 37
#298: Select active child #361
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: master
Are you sure you want to change the base?
Conversation
The section was renamed to Add/Choose active profile, as suggested in https://preview.uxpin.com/dc276af793ed5a347736f473bdabe8c5112f8983#/pages/87956056/simulate/sitemap?mode=i . Tests were added but Espresso doesn't let them through, despite them working on production.
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.
Thank you! Sorry for the delay I didn't noticed you needed help. You can always ping me on slack. I found some issues with the task, hope it will help.
|
|
||
| private void setActiveChild(){ | ||
| List<Child> childList = childRepository.getAll(); | ||
| for (Child child : childList) |
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.
could you please add brackets here? it would be easier to read.
| for (Child child : childList) | ||
| if(child.getIsActive()) | ||
| child.setIsActive(false); | ||
| childListAdapter.getChild(selectedChildPosition).setIsActive(true); |
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.
When I tested it the active value was not setting, you could select the row but it does not look that the value is stored anywhere. I don't think we update child in db and we should update the record after selected it with is_active to true. In my opinion it should also change the color of the row, when the list is displayed on opening child list view. That is probably implemented now, but one child should always be active and it should be visible on the list. The list should not allow to disactivate all children. Could you please verify it?
The ability to select an active child in "Add / remove child" section was added.
Section was renamed to "Add/Choose active child", as suggested in https://preview.uxpin.com/dc276af793ed5a347736f473bdabe8c5112f8983#/pages/87956056/simulate/sitemap?mode=i .
I once again struggle with Espresso though - tests were added but Espresso doesn't let them through, despite them working great on production.
Having two breakpoints, in line 110 and 111 of ChildListActivity.java (setActiveChild()), we can see, that if we set any child to active, we will hit the 111 line breakpoint. Then if we set another child to active (meaning we change the active child, as there can only be one at a time), we struck both breakpoints one after another (110 and 111). That proves that the previous one was set correctly.
That does not replicate in espresso though. During assertion, Child.isActive is always false (and always hits only 111 during setting child active). Just as if there were 2 separate databases used - one during action and other during assertion or something wild like that. Returning to the previous activity isn't an issue this time, as I tried removing it at all and it didn't help.
Apart from that everything seems to work fine and the rest of the tests are going through.