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: prevent multiple taps on Register button from opening several tx during ENS registration #10391

Merged
merged 1 commit into from
Apr 27, 2020

Conversation

michaelsbradleyjr
Copy link
Contributor

@michaelsbradleyjr michaelsbradleyjr commented Apr 21, 2020

fixes #9566

Summary

To prevent multiple taps from opening several transactions, the ::ens/register-name-pressed event is debounced (via status-im.utils.debounce/dispatch-and-chill).

Review notes

I set the "chill" time to 2 seconds — too long or short? I'm not sure.

Testing notes

If you tap on the Cancel button quickly to do a repeat test of the dispatch-and-chill effect, keep in mind the 2 second chill-time must expire before tapping Register again will have an effect.

Platforms

  • Android
  • iOS
Functional
  • user profile updates

Steps to test

  • Open Status
  • Navigate through Profile -> ENS usernames -> Your username (requires some input)
  • Check the "Agree..." box
  • Tap the Register button multiple times quickly; note that only one transaction is opened.

status: ready

@michaelsbradleyjr michaelsbradleyjr requested a review from a team as a code owner April 21, 2020 15:38
@status-github-bot
Copy link

Pull Request Checklist

  • Docs: Updated the documentation, if affected
  • Docs: Added or updated inline comments explaining intention of the code
  • Tests: Ensured that all new UI elements have been assigned accessibility IDs
  • Tests: Signaled need for E2E tests with label, if applicable
  • Tests: Briefly described what was tested and what platforms were used
  • UI: In case of UI changes, ensured that UI matches Figma
  • UI: In case of UI changes, requested review from a Core UI designer
  • UI: In case of UI changes, included screenshots of implementation

@michaelsbradleyjr michaelsbradleyjr self-assigned this Apr 21, 2020
@andremedeiros
Copy link
Contributor

I don't even think the button should be re-enabled until we get a response back.

Is there a visual indication that there is work being done at all?

@michaelsbradleyjr
Copy link
Contributor Author

michaelsbradleyjr commented Apr 21, 2020

Is there a visual indication that there is work being done at all?

I'm not 100% sure I know what you mean. When you tap the Register button, a transaction card appears very quickly. I think most users would then proceed to go ahead with the transaction. To get a behavior where the Register button might seem stuck, a user would need to deliberately be quick in tapping the Cancel button in the transaction card and then tap Register again (a Status tester might do that, which is why I mentioned it in Testing notes).

I don't even think the button should be re-enabled until we get a response back.

My initial idea was to make it a little state machine with a ClojureScript atom, but control doesn't get passed back to registration-bottom-bar's on-click handler; so I'd need to pass the atom along and I wasn't sure if that's how this kind of problem is typically solved with re-frame. On a hunch I guessed that maybe this kind of problem is solved with debouncing and a code search in status-react turned up a couple of cases that seem similar and that use dispatch-and-chill, so that's the direction I went. I'm happy to go a different route if dispatch-and-chill is not the correct approach.

@flexsurfer flexsurfer added this to REVIEW in Pipeline for QA via automation Apr 22, 2020
@flexsurfer flexsurfer moved this from REVIEW to E2E Tests in Pipeline for QA Apr 22, 2020
@flexsurfer flexsurfer moved this from E2E Tests to CONTRIBUTOR in Pipeline for QA Apr 22, 2020
@flexsurfer flexsurfer moved this from CONTRIBUTOR to E2E Tests in Pipeline for QA Apr 22, 2020
@flexsurfer flexsurfer self-requested a review April 22, 2020 09:50
@churik churik moved this from E2E Tests to REVIEW in Pipeline for QA Apr 23, 2020
@churik
Copy link
Member

churik commented Apr 23, 2020

@michaelsbradleyjr can you please rebase it to current develop to have builds in PR?

@michaelsbradleyjr michaelsbradleyjr force-pushed the fix/register-button-several-tx branch 2 times, most recently from 5b95237 to a34131d Compare April 23, 2020 15:15
@michaelsbradleyjr
Copy link
Contributor Author

@churik it's been rebased.

@status-im-auto
Copy link
Member

status-im-auto commented Apr 23, 2020

Jenkins Builds

Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ a34131d #2 2020-04-23 15:24:11 ~8 min android-e2e 📦apk 📲
✔️ a34131d #2 2020-04-23 15:25:01 ~9 min ios 📦ipa 📲
✔️ a34131d #2 2020-04-23 15:27:48 ~12 min android 📦apk 📲
✔️ 008ddf9 #4 2020-04-24 14:12:36 ~8 min android-e2e 📦apk 📲
✔️ 008ddf9 #4 2020-04-24 14:14:04 ~9 min ios 📦ipa 📲
✔️ 008ddf9 #4 2020-04-24 14:15:39 ~11 min android 📦apk 📲

@rachelhamlin
Copy link
Contributor

Nice work @michaelsbradleyjr! I'll be very happy to see this one fixed.

@flexsurfer flexsurfer moved this from REVIEW to E2E Tests in Pipeline for QA Apr 24, 2020
@status-im-auto
Copy link
Member

98% of end-end tests have passed

Total executed tests: 92
Failed tests: 2
Passed tests: 90

Failed tests (2)

Click to expand
1. test_home_view

Device 1: Tap on GenerateKeyButton
Device 1: Wait for MultiAccountButton

Device 1: 'Username' is not found on the screen

Device sessions

2. test_can_add_existing_ens

Device 1: Looking for an element by text: '@statuse2e'
Device 1: Looking for an element by text: 'statuse2e.stateofus.eth'

Owned username is not shown in ENS Dapp.

Device sessions

Passed tests (90)

Click to expand
1. test_decline_transactions_in_1_1_chat
Device sessions

2. test_delete_chats_via_delete_button
Device sessions

3. test_can_see_all_transactions_in_history
Device sessions

4. test_install_pack_and_send_sticker
Device sessions

5. test_login_with_new_account
Device sessions

6. test_timestamp_in_chats
Device sessions

7. test_password_in_logcat_sign_in
Device sessions

8. test_logcat_recovering_account
Device sessions

9. test_modify_transaction_fee_values
Device sessions

10. test_public_chat_clear_history (TestRail link is not found)
Device sessions

11. test_need_help_section
Device sessions

12. test_send_and_open_links
Device sessions

13. test_mobile_data_usage_popup_stop_syncing
Device sessions

14. test_mobile_data_usage_settings
Device sessions

15. test_create_new_group_chat
Device sessions

16. test_sign_typed_message
Device sessions

17. test_user_can_switch_network
Device sessions

18. test_mobile_data_usage_popup_continue_syncing
Device sessions

19. test_open_google_com_via_open_dapp
Device sessions

20. test_send_message_to_newly_added_contact
Device sessions

21. test_share_contact_code_and_wallet_address
Device sessions

22. test_connection_is_secure
Device sessions

23. test_add_to_contacts
Device sessions

24. test_add_account_to_multiaccount_instance_private_key
Device sessions

25. test_refresh_button_browsing_app_webview
Device sessions

26. test_transaction_wrong_password_wallet
Device sessions

27. test_unread_messages_counter_public_chat
Device sessions

28. test_text_message_1_1_chat
Device sessions

29. test_can_use_purchased_stickers_on_recovered_account
Device sessions

30. test_open_transaction_on_etherscan
Device sessions

31. test_onboarding_screen_when_requesting_tokens_for_recovered_account
Device sessions

32. test_contact_profile_view
Device sessions

33. test_offline_add_new_group_chat_member
Device sessions

34. test_logcat_backup_recovery_phrase
Device sessions

35. test_start_chat_with_ens
Device sessions

36. test_add_and_remove_contact_from_public_chat
Device sessions

37. test_add_account_to_multiaccount_instance_seed_phrase
Device sessions

38. test_open_blocked_site
Device sessions

39. test_open_chat_by_pasting_public_key
Device sessions

40. test_pair_devices_sync_one_to_one_contacts_public_chat
Device sessions

41. test_ens_username_recipient
Device sessions

42. test_token_with_more_than_allowed_decimals
Device sessions

43. test_fetch_more_history_in_empty_chat
Device sessions

44. test_open_public_chat_using_deep_link
Device sessions

45. test_switch_users_and_add_new_account
Device sessions

46. test_add_account_to_multiaccount_instance_generate_new
Device sessions

47. test_copy_contact_code_and_wallet_address
Device sessions

48. test_send_transaction_from_daap
Device sessions

49. test_send_eth_to_ens
Device sessions

50. test_send_two_transactions_one_after_another_in_dapp
Device sessions

51. test_message_marked_as_sent_in_1_1_chat
Device sessions

52. test_long_press_delete_clear_all_dapps
Device sessions

53. test_copy_and_paste_messages
Device sessions

54. test_deploy_contract_from_daap
Device sessions

55. test_back_forward_buttons_browsing_website
Device sessions

56. test_password_in_logcat_creating_account
Device sessions

57. test_add_custom_token
Device sessions

58. test_sign_message_from_daap
Device sessions

59. test_dapps_permissions
Device sessions

60. test_request_public_key_status_test_daap
Device sessions

61. test_logcat_send_transaction_from_wallet
Device sessions

62. test_long_press_to_delete_chat
Device sessions

63. test_log_level_and_fleet
Device sessions

64. test_add_and_delete_watch_only_account_to_multiaccount_instance
Device sessions

65. test_recover_account_from_new_user_seedphrase (TestRail link is not found)
Device sessions

66. test_send_eth_in_1_1_chat
Device sessions

67. test_send_two_transactions_in_batch_in_dapp
Device sessions

68. test_ens_in_public_and_1_1_chats
Device sessions

69. test_block_user_from_public_chat
Device sessions

70. test_fetching_balance_after_offline
Device sessions

71. test_logcat_sign_message_from_daap
Device sessions

72. test_offline_status
Device sessions

73. test_wallet_set_up
Device sessions

74. test_manage_assets
Device sessions

75. test_offline_messaging_1_1_chat
Device sessions

76. test_account_recovery_with_uppercase_recovery_phrase
Device sessions

77. test_add_new_keycard_account
Device sessions

78. test_send_token_with_7_decimals
Device sessions

79. test_user_can_see_all_own_assets_after_account_recovering
Device sessions

80. test_pass_phrase_validation
Device sessions

81. test_send_emoji
Device sessions

82. test_filters_from_daap
Device sessions

83. test_redirect_to_public_chat_tapping_tag_message
Device sessions

84. test_logcat_send_transaction_from_daap
Device sessions

85. test_send_eth_from_wallet_to_address
Device sessions

86. test_send_stt_from_wallet
Device sessions

87. test_request_and_receive_stt_in_1_1_chat_offline
Device sessions

88. test_messaging_in_different_networks
Device sessions

89. test_collectible_from_wallet_opens_in_browser_view
Device sessions

90. test_insufficient_funds_wallet_positive_balance
Device sessions

@Serhy Serhy moved this from E2E Tests to IN TESTING in Pipeline for QA Apr 24, 2020
@status-im-auto
Copy link
Member

50% of end-end tests have passed

Total executed tests: 2
Failed tests: 1
Passed tests: 1

Failed tests (1)

Click to expand
1. test_can_add_existing_ens

Device 1: Looking for an element by text: '@statuse2e'
Device 1: Looking for an element by text: 'statuse2e.stateofus.eth'

Owned username is not shown in ENS Dapp.

Device sessions

Passed tests (1)

Click to expand
1. test_home_view
Device sessions

@Serhy
Copy link
Contributor

Serhy commented Apr 24, 2020

Looks good to me! Can't reproduce initial issue on iOS and Android (v8). I'm not sure yet why test_can_add_existing_ens e2e test failed but it's false failure.
Thanks a lot @michaelsbradleyjr ! Let's merge in develop!

@Serhy Serhy moved this from IN TESTING to MERGE in Pipeline for QA Apr 24, 2020
@michaelsbradleyjr
Copy link
Contributor Author

@Serhy I just now rebased against develop and force-pushed, thinking maybe the failures were related to being behind develop, sorry if it was bad timing to force-push.

@michaelsbradleyjr
Copy link
Contributor Author

Also, I forgot to sign the commit as part of the rebase... fixing now.

@status-im-auto
Copy link
Member

0% of end-end tests have passed

Total executed tests: 2
Failed tests: 2
Passed tests: 0

Failed tests (2)

Click to expand
1. test_home_view

Device 1: Wait for OkButton
Device 1: Wait for ContinueButton

Device 1: 'GetStartedButton' is not found on the screen; also Unexpected Alert is shown: 'java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/im.status.ethereum.pr-FNpcK2GAztVaSfyDxqQeDw==/base.apk"],nativeLibra

Device sessions

2. test_can_add_existing_ens

Device 1: Wait for OkButton
Device 1: Wait for ContinueButton

Device 1: 'AccessKeyButton' is not found on the screen; also Unexpected Alert is shown: 'java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/im.status.ethereum.pr-3ak5psc8MVlIwM9k7Ieliw==/base.apk"],nativeLibrar

Device sessions

@Serhy
Copy link
Contributor

Serhy commented Apr 24, 2020

One min, something wrong (likely develop)

Right after start in emulators there
Screenshot 2020-04-24 at 17 47 49

… during ENS registration

Signed-off-by: Andrey Shovkoplyas <motor4ik@gmail.com>
@flexsurfer flexsurfer force-pushed the fix/register-button-several-tx branch from 008ddf9 to 5002b4c Compare April 27, 2020 07:16
@flexsurfer flexsurfer merged commit 5002b4c into develop Apr 27, 2020
Pipeline for QA automation moved this from MERGE to DONE Apr 27, 2020
@delete-merged-branch delete-merged-branch bot deleted the fix/register-button-several-tx branch April 27, 2020 07:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Multitapping on "Register" button opens several transaction signing screens when register new ENS
7 participants