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

Enable account closure #18412

Merged
merged 61 commits into from
May 19, 2023
Merged

Enable account closure #18412

merged 61 commits into from
May 19, 2023

Conversation

mkevins
Copy link
Contributor

@mkevins mkevins commented May 11, 2023

Description

This PR adds support for the user to close their account from the account settings screen.

Note: This is a feature branch, and should not be merged until all the respective upstream PRs have been reviewed, tested, and merged onto this branch.

PRs:

(PT: pcdRpT-2yo-p2)

To test:

Note: As this is a feature PR, please test with the latest changes in the HEAD PR's branch: #18444

A note about coverage

When considering the possible errors from the API, some scenarios may be difficult to test or are not relevant to real users / scenarios. E.g.:

  • UNAUTHORIZED: This may happen for A8C accounts, but will likely be preempted by the Atomic site error anyway
    • Also, I was not brave enough to try the account closure flow with my main account 😅 .
  • ATOMIC_SITE: This scenario is covered in the testing steps
  • CHARGEBACKED_SITE: This may require either mocking the response, or some elaborate manual setup
    • It also doesn't sound like a particularly good idea to test for real 😅
  • ACTIVE_SUBSCRIPTIONS: This scenario is covered in the testing steps
  • ACTIVE_MEMBERSHIPS: This is not tested, mainly because I didn't see an easy way to get a disposable account into this state
  • INVALID_TOKEN: This state should not be reachable, afaiu (outside of debugging the flow)
  • UNKNOWN: I don't know how to get this error (no pun intended)

I think the manual testing coverage is reasonable, given that, but please let me know if you feel otherwise.

Prerequisites (helpers)

In order to test the following flows, for convenience I have prepared some pre-configured accounts to test certain error conditions. Please see ref: pc8HXX-17y-p2 to access those credentials.

I have also prepared some scripts to make generating disposable accounts easier via adb

🔴 User with an Atomic site

  1. Log in with a pre-configured account (with an Atomic site)
  2. Navigate to the account settings (Me ➡️ Account Settings)
  3. Tap "Close Account"
  4. Expect that an error dialog is displayed with a button to contact support
    • Expect that the error is tracked: 🔵 Tracked: close_account_failed, Properties: {"error_code":"atomic-site"}
  5. Tap "Contact Support"
  6. Expect that the Help screen is displayed
    • Expect that the origin is tracked: 🔵 Tracked: support_opened, Properties: {"origin":"ACCOUNT_CLOSURE_DIALOG"}
  7. Tap back
  8. Tap dismiss
  9. Expect that the dialog is dismissed

🔴 User with a Personal site

  1. Log in with a pre-configured account (with a Personal site)
  2. Navigate to the account settings (Me ➡️ Account Settings)
  3. Tap "Close Account"
  4. Expect that a dialog is displayed requesting the user to type their username for confirmation
  5. Enter the username
  6. Expect a the dialog to go into a pending state briefly (spinner), then an error dialog is displayed with a button to contact support
    • Expect that the error is tracked: 🔵 Tracked: close_account_failed, Properties: {"error_code":"active-subscriptions"}
  7. Tap "Contact Support"
  8. Expect that the Help screen is displayed
    • Expect that the origin is tracked: 🔵 Tracked: support_opened, Properties: {"origin":"ACCOUNT_CLOSURE_DIALOG"}
  9. Tap back
  10. Tap dismiss
  11. Expect that the dialog is dismissed

🟢 Success case (disposable account)

  1. Create or login with a disposable account (the account will be deleted)
  2. Navigate to the account settings (Me ➡️ Account Settings)
  3. Tap "Close Account"
  4. Expect that a dialog is displayed requesting the user to type their username for confirmation
  5. Enter the username
  6. Expect a the dialog to go into a pending state briefly (spinner), then a success dialog is displayed with an ok button
    • Expect that the success is tracked: 🔵 Tracked: closed_account
  7. Tap "Ok"
  8. Expect to be logged out and brought to the app's landing screen

Regression Notes

  1. Potential unintended areas of impact
    Account settings

  2. What I did to test those areas of impact (or what existing automated tests I relied on)
    Manual testing

  3. What automated tests I added (or what prevented me from doing so)
    We do not currently have the established mocks for testing the account deletion flow, and adding that configuration would exceed the scope of this task.

PR submission checklist:

  • I have completed the Regression Notes.
  • I have considered adding accessibility improvements for my changes.
  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

UI Changes testing checklist:

  • Portrait and landscape orientations.
  • Light and dark modes.
  • Fonts: Larger, smaller and bold text.
  • High contrast.
  • Talkback.
  • Languages with large words or with letters/accents not frequently used in English.
  • Right-to-left languages. (Even if translation isn’t complete, formatting should still respect the right-to-left layout)
  • Large and small screen sizes. (Tablet and smaller phones)
  • Multi-tasking: Split screen and Pop-up view. (Android 10 or higher)

mkevins and others added 30 commits May 8, 2023 14:38
…t-closure--18380-add-close-account-button

Add close account button
This still needs some styling work.
This is to reduce some of the repetition.
This provides a button to contact support when account closure is not
immediately possible due to active purchases on the account.
This resumes the normal dialog after a three second delay for the
purpose of testing the ui, and will be wired up to the real
implementation after the FluxC changes are available.
…t-closure--18381-add-confirmation-dialog

Add a confirmation dialog for account closure
…t-closure--18381-add-confirmation-dialog

Add a confirmation dialog for account closure (addendum)
This will be useful to avoid visual jank from switching dialogs when an
error is encountered on the backend. Also, it removes some duplication,
and separates concerns.
…t-closure--18393-add-api-endpoint

Add support for the close account API endpoint in FluxC
@mkevins mkevins requested review from antonis and ovitrif May 17, 2023 07:25
@wpmobilebot
Copy link
Contributor

Found 1 violations:

The PR caused the following dependency changes:

-+--- org.wordpress:fluxc:{strictly trunk-eea5d065c93d9ca6680c28189750e92a6f05f8ac} -> trunk-eea5d065c93d9ca6680c28189750e92a6f05f8ac
-|    +--- org.wordpress:wellsql:1.7.0
-|    |    \--- org.wordpress.wellsql:wellsql-annotations:1.7.0
-|    +--- org.wordpress.fluxc:fluxc-annotations:trunk-eea5d065c93d9ca6680c28189750e92a6f05f8ac
-|    +--- org.greenrobot:eventbus:3.3.1
-|    |    \--- org.greenrobot:eventbus-java:3.3.1
-|    +--- com.squareup.okhttp3:okhttp:4.9.0 -> 4.9.2 (*)
-|    +--- com.android.volley:volley:1.1.1 -> 1.2.1
-|    +--- androidx.paging:paging-runtime:2.1.2
-|    |    +--- androidx.paging:paging-common:2.1.2
-|    |    |    +--- androidx.annotation:annotation:1.0.0 -> 1.3.0
-|    |    |    \--- androidx.arch.core:core-common:2.0.0 -> 2.1.0 (*)
-|    |    +--- androidx.arch.core:core-runtime:2.0.0 -> 2.1.0 (*)
-|    |    +--- androidx.lifecycle:lifecycle-runtime:2.0.0 -> 2.5.1 (*)
-|    |    +--- androidx.lifecycle:lifecycle-livedata:2.0.0 -> 2.5.1 (*)
-|    |    \--- androidx.recyclerview:recyclerview:1.0.0 -> 1.2.1 (*)
-|    +--- com.goterl:lazysodium-android:5.0.2
-|    +--- net.java.dev.jna:jna:5.5.0
-|    +--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.10 -> 1.6.21 (*)
-|    +--- org.jetbrains.kotlin:kotlin-android-extensions-runtime:1.6.10 (*)
-|    +--- androidx.appcompat:appcompat:1.0.2 -> 1.4.2 (*)
-|    +--- androidx.recyclerview:recyclerview:1.0.0 -> 1.2.1 (*)
-|    +--- androidx.exifinterface:exifinterface:1.0.0 -> 1.3.3 (*)
-|    +--- androidx.security:security-crypto:1.0.0
-|    |    +--- androidx.annotation:annotation:1.1.0 -> 1.3.0
-|    |    \--- com.google.crypto.tink:tink-android:1.5.0
-|    +--- com.squareup.okhttp3:okhttp-urlconnection:4.9.0 -> 4.9.2
-|    |    +--- com.squareup.okhttp3:okhttp:4.9.2 (*)
-|    |    \--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.4.10 -> 1.6.21 (*)
-|    +--- com.google.code.gson:gson:2.8.5 -> 2.10.1
-|    +--- org.apache.commons:commons-text:1.10.0
-|    |    \--- org.apache.commons:commons-lang3:3.12.0
-|    +--- androidx.room:room-runtime:2.4.2
-|    |    +--- androidx.room:room-common:2.4.2
-|    |    |    \--- androidx.annotation:annotation:1.1.0 -> 1.3.0
-|    |    +--- androidx.sqlite:sqlite-framework:2.2.0
-|    |    |    +--- androidx.annotation:annotation:1.0.0 -> 1.3.0
-|    |    |    \--- androidx.sqlite:sqlite:2.2.0
-|    |    |         \--- androidx.annotation:annotation:1.0.0 -> 1.3.0
-|    |    +--- androidx.sqlite:sqlite:2.2.0 (*)
-|    |    +--- androidx.arch.core:core-runtime:2.0.1 -> 2.1.0 (*)
-|    |    \--- androidx.annotation:annotation-experimental:1.1.0
-|    +--- androidx.room:room-ktx:2.4.2
-|    |    +--- androidx.room:room-common:2.4.2 (*)
-|    |    +--- androidx.room:room-runtime:2.4.2 (*)
-|    |    +--- org.jetbrains.kotlin:kotlin-stdlib:1.6.10 -> 1.6.21 (*)
-|    |    \--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.2 -> 1.6.4 (*)
-|    +--- com.google.dagger:dagger:2.42
-|    |    \--- javax.inject:javax.inject:1
-|    +--- org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9 -> 1.6.4 (*)
-|    \--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.9 -> 1.6.4 (*)
++--- org.wordpress:fluxc:{strictly trunk-3fe318a6de3463bf2444b0d798067546e9a18db0} -> trunk-3fe318a6de3463bf2444b0d798067546e9a18db0
+|    +--- org.wordpress:wellsql:1.7.0
+|    |    \--- org.wordpress.wellsql:wellsql-annotations:1.7.0
+|    +--- org.wordpress.fluxc:fluxc-annotations:trunk-3fe318a6de3463bf2444b0d798067546e9a18db0
+|    +--- org.greenrobot:eventbus:3.3.1
+|    |    \--- org.greenrobot:eventbus-java:3.3.1
+|    +--- com.squareup.okhttp3:okhttp:4.9.0 -> 4.9.2 (*)
+|    +--- com.android.volley:volley:1.1.1 -> 1.2.1
+|    +--- androidx.paging:paging-runtime:2.1.2
+|    |    +--- androidx.paging:paging-common:2.1.2
+|    |    |    +--- androidx.annotation:annotation:1.0.0 -> 1.3.0
+|    |    |    \--- androidx.arch.core:core-common:2.0.0 -> 2.1.0 (*)
+|    |    +--- androidx.arch.core:core-runtime:2.0.0 -> 2.1.0 (*)
+|    |    +--- androidx.lifecycle:lifecycle-runtime:2.0.0 -> 2.5.1 (*)
+|    |    +--- androidx.lifecycle:lifecycle-livedata:2.0.0 -> 2.5.1 (*)
+|    |    \--- androidx.recyclerview:recyclerview:1.0.0 -> 1.2.1 (*)
+|    +--- com.goterl:lazysodium-android:5.0.2
+|    +--- net.java.dev.jna:jna:5.5.0
+|    +--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.10 -> 1.6.21 (*)
+|    +--- org.jetbrains.kotlin:kotlin-android-extensions-runtime:1.6.10 (*)
+|    +--- androidx.appcompat:appcompat:1.0.2 -> 1.4.2 (*)
+|    +--- androidx.recyclerview:recyclerview:1.0.0 -> 1.2.1 (*)
+|    +--- androidx.exifinterface:exifinterface:1.0.0 -> 1.3.3 (*)
+|    +--- androidx.security:security-crypto:1.0.0
+|    |    +--- androidx.annotation:annotation:1.1.0 -> 1.3.0
+|    |    \--- com.google.crypto.tink:tink-android:1.5.0
+|    +--- com.squareup.okhttp3:okhttp-urlconnection:4.9.0 -> 4.9.2
+|    |    +--- com.squareup.okhttp3:okhttp:4.9.2 (*)
+|    |    \--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.4.10 -> 1.6.21 (*)
+|    +--- com.google.code.gson:gson:2.8.5 -> 2.10.1
+|    +--- org.apache.commons:commons-text:1.10.0
+|    |    \--- org.apache.commons:commons-lang3:3.12.0
+|    +--- androidx.room:room-runtime:2.4.2
+|    |    +--- androidx.room:room-common:2.4.2
+|    |    |    \--- androidx.annotation:annotation:1.1.0 -> 1.3.0
+|    |    +--- androidx.sqlite:sqlite-framework:2.2.0
+|    |    |    +--- androidx.annotation:annotation:1.0.0 -> 1.3.0
+|    |    |    \--- androidx.sqlite:sqlite:2.2.0
+|    |    |         \--- androidx.annotation:annotation:1.0.0 -> 1.3.0
+|    |    +--- androidx.sqlite:sqlite:2.2.0 (*)
+|    |    +--- androidx.arch.core:core-runtime:2.0.1 -> 2.1.0 (*)
+|    |    \--- androidx.annotation:annotation-experimental:1.1.0
+|    +--- androidx.room:room-ktx:2.4.2
+|    |    +--- androidx.room:room-common:2.4.2 (*)
+|    |    +--- androidx.room:room-runtime:2.4.2 (*)
+|    |    +--- org.jetbrains.kotlin:kotlin-stdlib:1.6.10 -> 1.6.21 (*)
+|    |    \--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.2 -> 1.6.4 (*)
+|    +--- com.google.dagger:dagger:2.42
+|    |    \--- javax.inject:javax.inject:1
+|    +--- org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9 -> 1.6.4 (*)
+|    \--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.9 -> 1.6.4 (*)
 \--- org.wordpress:login:1.3.0
-     \--- org.wordpress:fluxc:2.21.0 -> trunk-eea5d065c93d9ca6680c28189750e92a6f05f8ac (*)
+     \--- org.wordpress:fluxc:2.21.0 -> trunk-3fe318a6de3463bf2444b0d798067546e9a18db0 (*)

Please review and act accordingly

@mkevins mkevins marked this pull request as ready for review May 17, 2023 09:18
ovitrif and others added 10 commits May 17, 2023 19:56
…t-closure--18413-add-tracks-events

Add account closure tracks events
…t-closure-18409-ut-fix

Fix compilation issues in account settings vm tests
This is useful for mocking the implementation in unit tests
…t-closure--18406-add-error-handling-to-flow

Add error handling to the account closure flow
…t-closure--add-unit-tests

Add unit tests for the account closure feature
Copy link
Contributor

@antonis antonis left a comment

Choose a reason for hiding this comment

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

Great work @mkevins 🥇
The code changes LGTM to me and the added tests look great. I've tested the implementation and went through the UI Changes testing checklist and everything worked great for me 🎉

Deleting progress Account deleted Error flow
Screenshot_20230518_131037 Screenshot_20230518_131045 Screenshot_20230517_151250

I have two minor UI suggestions that I do not consider blocking:

  • Lock the edit box when the deletion is in progress.
  • Would it be possible to remove the empty space below the button when the process is complete? If not, would adding some text below the title make it better (e.g. You would now be logged out and redirected to the app landing screen.).

I would also suggest adding a release note since it's a new user facing feature.

@antonis
Copy link
Contributor

antonis commented May 18, 2023

I think the failing instrumented tests will be fixed with this PR #18464 (related internal ref: p1684409358185439/1684256862.513919-slack-C04TBSWP09M)

@mkevins
Copy link
Contributor Author

mkevins commented May 19, 2023

Thanks for reviewing and testing, and for your feedback Antonis!

I have two minor UI suggestions that I do not consider blocking:

  • Lock the edit box when the deletion is in progress.

Great idea! Addressed w/

  • Would it be possible to remove the empty space below the button when the process is complete? If not, would adding some text below the title make it better (e.g. You would now be logged out and redirected to the app landing screen.).

This is something I noticed as well, and I opened a task for it (#18468). It is a strange issue where the dialog does not change height unless usePlatformDefaultWidth is false. It isn't clear why that width property would affect the height, but the work-around seems to work, so I'll push a PR for that.

Update: I've opened a PR for this: #18470

I would also suggest adding a release note since it's a new user facing feature.

Thanks, I agree, I'll add one to this PR. 👍

@mkevins mkevins enabled auto-merge May 19, 2023 03:33
@mkevins mkevins merged commit a21210b into trunk May 19, 2023
@mkevins mkevins deleted the feature/enable-account-closure branch May 19, 2023 03:52
@mkevins
Copy link
Contributor Author

mkevins commented May 19, 2023

Thank you for reviewing and testing this. I know the testing was cumbersome 😅 .

@ovitrif
Copy link
Contributor

ovitrif commented May 19, 2023

FYI I didn't review this again because I reviewed it via all PRs that were merged into it.

Not sure if #18464 would've fixed the UI tests, the failures were different:

Capture 20230518T2010@2x

@antonis
Copy link
Contributor

antonis commented May 19, 2023

Not sure if #18464 would've fixed the UI tests, the failures were different:

Good catch @ovitrif 👍
I was fast in my judgement above 😬
Do you think this is related with the new code added for this project?

@ovitrif
Copy link
Contributor

ovitrif commented May 19, 2023

Good catch @ovitrif 👍 I was fast in my judgement above 😬 Do you think this is related with the new code added for this project?

Thank you @antonis for engaging my input 🙇🏻

My feelings tell me the test failures are not caused by the changes we added here 🤞🏻

Though even the slightest possibility should keep us alert, keeping an eye on the tests status IMHO 👀

@antonis
Copy link
Contributor

antonis commented May 19, 2023

Though even the slightest possibility should keep us alert, keeping an eye on the tests status IMHO 👀

Sounds good @ovitrif 👍

Checking the test crash I think it is related to this Sentry report p1683819728601849-slack-CK3STS3PB

@mkevins
Copy link
Contributor Author

mkevins commented May 22, 2023

Thank you both for all your work reviewing and testing this feature. Also, extra thanks for looking into the UI tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants