Skip to content

Commit

Permalink
Fix part of #3363 AddProfileActivityTest some test didn't pass. (#5229)
Browse files Browse the repository at this point in the history
<!-- READ ME FIRST: Please fill in the explanation section below and
check off every point from the Essential Checklist! -->
## Explanation
Fix part of #3363 
Remove
testAddProfileActivity_inputPin_configChange_downloadAccessSwitchIsOn()
as discussed with Ben and Adhiambo.

- The old test failed when testing the checkbox should persevere its
state after the screen rotated, which native checkbox doesn't have this
ability and we agree that we don't need extra implementation to achieve
this.

Negate download access logic in AddProfileActivityPresenter so it will
correctly set the listener.

Improve
testAddProfileActivity_configChange_inputShortPin_create_pinLengthError()
by adding the swipeup() action to make the create button fully visible
during the test but the test is still flaky

## Essential Checklist
<!-- Please tick the relevant boxes by putting an "x" in them. -->
- [x] The PR title and explanation each start with "Fix #bugnum: " (If
this PR fixes part of an issue, prefix the title with "Fix part of
#bugnum: ...".)
- [x] Any changes to
[scripts/assets](https://github.com/oppia/oppia-android/tree/develop/scripts/assets)
files have their rationale included in the PR explanation.
- [x] The PR follows the [style
guide](https://github.com/oppia/oppia-android/wiki/Coding-style-guide).
- [x] The PR does not contain any unnecessary code changes from Android
Studio
([reference](https://github.com/oppia/oppia-android/wiki/Guidance-on-submitting-a-PR#undo-unnecessary-changes)).
- [x] The PR is made from a branch that's **not** called "develop" and
is up-to-date with "develop".
- [x] The PR is **assigned** to the appropriate reviewers
([reference](https://github.com/oppia/oppia-android/wiki/Guidance-on-submitting-a-PR#clarification-regarding-assignees-and-reviewers-section)).

## For UI-specific PRs only
<!-- Delete these section if this PR does not include UI-related
changes. -->
If your PR includes UI-related changes, then:
- Add screenshots for portrait/landscape for both a tablet & phone of
the before & after UI changes
- For the screenshots above, include both English and pseudo-localized
(RTL) screenshots (see [RTL
guide](https://github.com/oppia/oppia-android/wiki/RTL-Guidelines))
- Add a video showing the full UX flow with a screen reader enabled (see
[accessibility
guide](https://github.com/oppia/oppia-android/wiki/Accessibility-A11y-Guide))
- For PRs introducing new UI elements or color changes, both light and
dark mode screenshots must be included
- Add a screenshot demonstrating that you ran affected Espresso tests
locally & that they're passing
![Screenshot 2023-11-15
160038](https://github.com/oppia/oppia-android/assets/74568012/54670e41-9a41-4368-a9cb-0b47b83abe8b)

---------

Co-authored-by: Adhiambo Peres <[email protected]>
  • Loading branch information
XichengSpencer and adhiamboperes authored Dec 7, 2023
1 parent d021afd commit c931ba4
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 83 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,9 @@ class AddProfileActivityPresenter @Inject constructor(
lifecycleOwner = activity
viewModel = profileViewModel
}
if (!enableDownloadsSupport.value) {
if (enableDownloadsSupport.value) {
binding.addProfileActivityAllowDownloadConstraintLayout.setOnClickListener {
// Negating logic to sync with the switch component state
allowDownloadAccess = !allowDownloadAccess
binding.addProfileActivityAllowDownloadSwitch.isChecked = allowDownloadAccess
}
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/layout/add_profile_activity.xml
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="60dp"
android:focusable="true"
android:background="@{viewModel.isButtonActive() ? @drawable/state_button_primary_background : @drawable/start_button_transparent_background}"
android:enabled="@{viewModel.isButtonActive()}"
android:gravity="center"
Expand Down
Loading

0 comments on commit c931ba4

Please sign in to comment.