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(wallet): token max value not updated when switching #21201

Merged
merged 2 commits into from
Sep 20, 2024

Conversation

smohamedjavid
Copy link
Member

fixes #21184

Summary

This PR fixes the max value that is not updated when the user switches the token in the input amount screen

Platforms

  • Android
  • iOS

Steps to test

Prerequisites: User with multiple tokens (balance > 0)
  • Open Status
  • Navigate to the Wallet tab
  • Navigate to send > select assets
  • Select any asset
  • Continue to the route generation
  • Change the selected token by tapping on the token image (displayed left to the input amount)
  • Verify the max value is updated

status: ready

@status-im-auto
Copy link
Member

status-im-auto commented Sep 6, 2024

Jenkins Builds

Click to see older builds (16)
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ cddf1f7 #1 2024-09-06 13:20:34 ~5 min tests 📄log
✔️ cddf1f7 #1 2024-09-06 13:24:32 ~9 min android-e2e 🤖apk 📲
✔️ cddf1f7 #1 2024-09-06 13:25:05 ~9 min android 🤖apk 📲
✔️ cddf1f7 #1 2024-09-06 13:25:52 ~10 min ios 📱ipa 📲
✔️ ffcbc9b #2 2024-09-10 18:49:20 ~4 min tests 📄log
✔️ ffcbc9b #2 2024-09-10 18:53:17 ~8 min android-e2e 🤖apk 📲
✔️ ffcbc9b #2 2024-09-10 18:53:46 ~9 min android 🤖apk 📲
✔️ ffcbc9b #2 2024-09-10 19:02:30 ~18 min ios 📱ipa 📲
✔️ c0e0c67 #3 2024-09-12 16:24:33 ~5 min tests 📄log
✔️ c0e0c67 #3 2024-09-12 16:28:27 ~9 min android-e2e 🤖apk 📲
✔️ c0e0c67 #3 2024-09-12 16:28:52 ~9 min android 🤖apk 📲
✔️ c0e0c67 #3 2024-09-12 16:29:55 ~10 min ios 📱ipa 📲
✔️ 5ae0150 #4 2024-09-17 10:30:31 ~5 min tests 📄log
✔️ 5ae0150 #4 2024-09-17 10:34:26 ~9 min android-e2e 🤖apk 📲
✔️ 5ae0150 #4 2024-09-17 10:35:43 ~10 min android 🤖apk 📲
✔️ 5ae0150 #4 2024-09-17 10:37:25 ~12 min ios 📱ipa 📲
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ b8d46ae #5 2024-09-19 14:44:29 ~5 min tests 📄log
✔️ b8d46ae #5 2024-09-19 14:47:57 ~8 min android-e2e 🤖apk 📲
✔️ b8d46ae #5 2024-09-19 14:48:31 ~9 min android 🤖apk 📲
✔️ b8d46ae #5 2024-09-19 14:58:39 ~19 min ios 📱ipa 📲
✔️ 62384ce #6 2024-09-20 13:28:23 ~4 min tests 📄log
✔️ 62384ce #6 2024-09-20 13:30:12 ~6 min android-e2e 🤖apk 📲
✔️ 62384ce #6 2024-09-20 13:31:42 ~7 min android 🤖apk 📲
✔️ 62384ce #6 2024-09-20 13:35:45 ~12 min ios 📱ipa 📲

Copy link
Contributor

@mohsen-ghafouri mohsen-ghafouri left a comment

Choose a reason for hiding this comment

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

LGTM, just left a question.

src/status_im/contexts/wallet/send/input_amount/view.cljs Outdated Show resolved Hide resolved
Copy link
Contributor

@ulisesmac ulisesmac left a comment

Choose a reason for hiding this comment

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

Looks good 👍

Thank you for addressing these issues, the send flow is very important for the wallet 👍

src/status_im/contexts/wallet/send/input_amount/view.cljs Outdated Show resolved Hide resolved
@status-im-auto
Copy link
Member

57% of end-end tests have passed

Total executed tests: 7
Failed tests: 3
Expected to fail tests: 0
Passed tests: 4
IDs of failed tests: 702745,727229,702843 

Failed tests (3)

Click to expand
  • Rerun failed tests

  • Class TestOneToOneChatMultipleSharedDevicesNewUi:

    1. test_1_1_chat_non_latin_messages_stack_update_profile_photo, id: 702745

    Device 1: Find `EditBox` by `accessibility id`: `enter-contact-code-input`
    Device 1: Type `eth:arb1:oeth:0x18e0e6f94ec044576da851e425dd01d0dac106bf` to `EditBox`

    Test setup failed: critical/chats/test_1_1_public_chats.py:37: in prepare_devices
        self.home_1.add_contact(self.public_key_2)
    ../views/home_view.py:436: in add_contact
        chat.element_by_translation_id("user-found").wait_for_visibility_of_element()
    ../views/base_element.py:147: in wait_for_visibility_of_element
        raise TimeoutException(
     Device 1: Button by xpath:`//*[@text="User found"]` is not found on the screen after wait_for_visibility_of_element
    



    Device sessions

    Class TestWalletMultipleDevice:

    1. test_wallet_send_eth, id: 727229

    Device 2: Find Text by xpath: //android.view.ViewGroup[@content-desc='container']/android.widget.TextView[@text='Ether']/../android.widget.TextView[3]
    Device 2: Text is 0.05379 ETH

    critical/test_wallet.py:159: in test_wallet_send_eth
        self.errors.verify_no_errors()
    base_test_case.py:191: in verify_no_errors
        pytest.fail('\n '.join([self.errors.pop(0) for _ in range(len(self.errors))]))
     Sender balance is not updated on Etherscan, it is 0.4322 but expected to be 0.4323
    



    Class TestCommunityMultipleDeviceMerged:

    1. test_community_message_edit, id: 702843

    Device 1: Find EditBox by accessibility id: enter-contact-code-input
    Device 1: Type eth:arb1:oeth:0xa4bf9aee93b9feae77fc4ca903dabc95cf327a6e to EditBox

    Test setup failed: critical/chats/test_public_chat_browsing.py:319: in prepare_devices
        self.home_1.add_contact(self.public_key_2)
    ../views/home_view.py:436: in add_contact
        chat.element_by_translation_id("user-found").wait_for_visibility_of_element()
    ../views/base_element.py:147: in wait_for_visibility_of_element
        raise TimeoutException(
     Device 1: Button by xpath:`//*[@text="User found"]` is not found on the screen after wait_for_visibility_of_element
    



    Device sessions

    Passed tests (4)

    Click to expand

    Class TestCommunityOneDeviceMerged:

    1. test_restore_multiaccount_with_waku_backup_remove_switch, id: 703133
    Device sessions

    2. test_community_copy_and_paste_message_in_chat_input, id: 702742
    Device sessions

    Class TestWalletMultipleDevice:

    1. test_wallet_send_asset_from_drawer, id: 727230

    Class TestWalletOneDevice:

    1. test_wallet_add_remove_regular_account, id: 727231
    Device sessions

    @VolodLytvynenko VolodLytvynenko self-assigned this Sep 13, 2024
    @status-im-auto
    Copy link
    Member

    86% of end-end tests have passed

    Total executed tests: 7
    Failed tests: 1
    Expected to fail tests: 0
    Passed tests: 6
    
    IDs of failed tests: 703133 
    

    Failed tests (1)

    Click to expand
  • Rerun failed tests

  • Class TestCommunityOneDeviceMerged:

    1. test_restore_multiaccount_with_waku_backup_remove_switch, id: 703133

    Device 1: Find `Button` by `accessibility id`: `show-profiles`
    Device 1: Tap on found: Button

    critical/chats/test_public_chat_browsing.py:243: in test_restore_multiaccount_with_waku_backup_remove_switch
        self.errors.verify_no_errors()
    base_test_case.py:191: in verify_no_errors
        pytest.fail('\n '.join([self.errors.pop(0) for _ in range(len(self.errors))]))
     zQ3...dWXh5 was not restored as a contact from waku backup!
    E    zQ3...Vacac was not restored as a contact from waku backup!
    E    admin_open was not restored from waku-backup!!
    E    member_open was not restored from waku-backup!!
    E    admin_closed was not restored from waku-backup!!
    E    member_closed was not restored from waku-backup!!
    



    Device sessions

    Passed tests (6)

    Click to expand

    Class TestWalletOneDevice:

    1. test_wallet_add_remove_regular_account, id: 727231
    Device sessions

    Class TestOneToOneChatMultipleSharedDevicesNewUi:

    1. test_1_1_chat_non_latin_messages_stack_update_profile_photo, id: 702745
    Device sessions

    Class TestCommunityOneDeviceMerged:

    1. test_community_copy_and_paste_message_in_chat_input, id: 702742
    Device sessions

    Class TestCommunityMultipleDeviceMerged:

    1. test_community_message_edit, id: 702843
    Device sessions

    Class TestWalletMultipleDevice:

    1. test_wallet_send_asset_from_drawer, id: 727230
    2. test_wallet_send_eth, id: 727229

    @VolodLytvynenko
    Copy link
    Contributor

    Hey @smohamedjavid, the original issue is fixed, but there are some additional cases where the max value isn't updated. Could you address these within this PR, or would it be better to handle them separately?

    • Max value is not updated when switching accounts.
    • Max value is not updated after a network is disabled (in this case, the max value should only reflect the max value of remaining available networks, excluding the disabled one).
    max.mp4

    @smohamedjavid
    Copy link
    Member Author

    @VolodLytvynenko - Thank you for testing the PR 🙏
    The issues you have listed above should be fixed now. Let me know if you find anything else 🙏 Thanks again!

    @status-im-auto
    Copy link
    Member

    100% of end-end tests have passed

    Total executed tests: 7
    Failed tests: 0
    Expected to fail tests: 0
    Passed tests: 7
    

    Passed tests (7)

    Click to expand

    Class TestCommunityMultipleDeviceMerged:

    1. test_community_message_edit, id: 702843
    Device sessions

    Class TestOneToOneChatMultipleSharedDevicesNewUi:

    1. test_1_1_chat_non_latin_messages_stack_update_profile_photo, id: 702745
    Device sessions

    Class TestWalletMultipleDevice:

    1. test_wallet_send_asset_from_drawer, id: 727230
    2. test_wallet_send_eth, id: 727229

    Class TestCommunityOneDeviceMerged:

    1. test_community_copy_and_paste_message_in_chat_input, id: 702742
    Device sessions

    2. test_restore_multiaccount_with_waku_backup_remove_switch, id: 703133
    Device sessions

    Class TestWalletOneDevice:

    1. test_wallet_add_remove_regular_account, id: 727231
    Device sessions

    @VolodLytvynenko
    Copy link
    Contributor

    @smohamedjavid Thank you for fixes. Take a look please one more found issue

    ISSUE 2: Max value is updated incorrectly when the balance is shown in fiat and any network is disabled

    Steps:

    1. Go to the routes generation page using the ETH token.
    2. Build any route.
    3. Tap switch current button to show balances in fiat
    4. Disable any network in the "FROM" section.

    Actual result:

    The max value is not updated correctly when the balance is displayed in fiat after disabling a network. This causes the entered value to be highlighted in red, indicating that the user doesn't have enough assets to rebuild the route for another enabled networks.

    (Example my user has:

    1. On L1: 1.16 ETH = 2789 USD
    2. On L2 (Opt): 0.41 ETH = 993 USD
    3. On L2 (Arb): 0.54 ETH = 131 USD

    But after disabling any network, the max value = 1.22 usd)

    switch_currency.mp4

    Expected result:

    The max value should be updated accurately based on the available balance after any network is disabled/enabled.

    @smohamedjavid
    Copy link
    Member Author

    @VolodLytvynenko - Issue 2 should be fixed now 🙏 . Please check.

    @status-im-auto
    Copy link
    Member

    0% of end-end tests have passed

    Total executed tests: 7
    Failed tests: 7
    Expected to fail tests: 0
    Passed tests: 0
    
    IDs of failed tests: 727231,727230,702745,702742,703133,702843,727229 
    

    Failed tests (7)

    Click to expand
  • Rerun failed tests

  • Class TestCommunityOneDeviceMerged:

    1. test_community_copy_and_paste_message_in_chat_input, id: 702742
    Test setup failed: critical/chats/test_public_chat_browsing.py:23: in prepare_devices
        self.sign_in = SignInView(self.drivers[0])
    ../views/sign_in_view.py:194: in __init__
        self.enter_seed_phrase_next_button = Button(self.driver, translation_id="enter-seed-phrase")
    ../views/base_element.py:427: in __init__
        super(Button, self).__init__(driver, **kwargs)
    ../views/base_element.py:36: in __init__
        self.set_locator()
    ../views/base_element.py:45: in set_locator
        text = transl[self.translation_id]
     'enter-seed-phrase'
    



    Device sessions

    2. test_restore_multiaccount_with_waku_backup_remove_switch, id: 703133

    Test setup failed: critical/chats/test_public_chat_browsing.py:23: in prepare_devices
        self.sign_in = SignInView(self.drivers[0])
    ../views/sign_in_view.py:194: in __init__
        self.enter_seed_phrase_next_button = Button(self.driver, translation_id="enter-seed-phrase")
    ../views/base_element.py:427: in __init__
        super(Button, self).__init__(driver, **kwargs)
    ../views/base_element.py:36: in __init__
        self.set_locator()
    ../views/base_element.py:45: in set_locator
        text = transl[self.translation_id]
     'enter-seed-phrase'
    



    Class TestWalletMultipleDevice:

    1. test_wallet_send_asset_from_drawer, id: 727230

    Test setup failed: critical/test_wallet.py:24: in prepare_devices
        self.sign_in_1, self.sign_in_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
    ../views/sign_in_view.py:194: in __init__
        self.enter_seed_phrase_next_button = Button(self.driver, translation_id="enter-seed-phrase")
    ../views/base_element.py:427: in __init__
        super(Button, self).__init__(driver, **kwargs)
    ../views/base_element.py:36: in __init__
        self.set_locator()
    ../views/base_element.py:45: in set_locator
        text = transl[self.translation_id]
     'enter-seed-phrase'
    



    2. test_wallet_send_eth, id: 727229

    Test setup failed: critical/test_wallet.py:24: in prepare_devices
        self.sign_in_1, self.sign_in_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
    ../views/sign_in_view.py:194: in __init__
        self.enter_seed_phrase_next_button = Button(self.driver, translation_id="enter-seed-phrase")
    ../views/base_element.py:427: in __init__
        super(Button, self).__init__(driver, **kwargs)
    ../views/base_element.py:36: in __init__
        self.set_locator()
    ../views/base_element.py:45: in set_locator
        text = transl[self.translation_id]
     'enter-seed-phrase'
    



    Class TestOneToOneChatMultipleSharedDevicesNewUi:

    1. test_1_1_chat_non_latin_messages_stack_update_profile_photo, id: 702745

    Test setup failed: critical/chats/test_1_1_public_chats.py:21: in prepare_devices
        self.device_1, self.device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
    ../views/sign_in_view.py:194: in __init__
        self.enter_seed_phrase_next_button = Button(self.driver, translation_id="enter-seed-phrase")
    ../views/base_element.py:427: in __init__
        super(Button, self).__init__(driver, **kwargs)
    ../views/base_element.py:36: in __init__
        self.set_locator()
    ../views/base_element.py:45: in set_locator
        text = transl[self.translation_id]
     'enter-seed-phrase'
    



    Device sessions

    Class TestCommunityMultipleDeviceMerged:

    1. test_community_message_edit, id: 702843

    Test setup failed: critical/chats/test_public_chat_browsing.py:309: in prepare_devices
        self.device_1, self.device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
    ../views/sign_in_view.py:194: in __init__
        self.enter_seed_phrase_next_button = Button(self.driver, translation_id="enter-seed-phrase")
    ../views/base_element.py:427: in __init__
        super(Button, self).__init__(driver, **kwargs)
    ../views/base_element.py:36: in __init__
        self.set_locator()
    ../views/base_element.py:45: in set_locator
        text = transl[self.translation_id]
     'enter-seed-phrase'
    



    Device sessions

    Class TestWalletOneDevice:

    1. test_wallet_add_remove_regular_account, id: 727231

    Test setup failed: critical/test_wallet.py:201: in prepare_devices
        self.sign_in_view = SignInView(self.drivers[0])
    ../views/sign_in_view.py:194: in __init__
        self.enter_seed_phrase_next_button = Button(self.driver, translation_id="enter-seed-phrase")
    ../views/base_element.py:427: in __init__
        super(Button, self).__init__(driver, **kwargs)
    ../views/base_element.py:36: in __init__
        self.set_locator()
    ../views/base_element.py:45: in set_locator
        text = transl[self.translation_id]
     'enter-seed-phrase'
    



    Device sessions

    @VolodLytvynenko
    Copy link
    Contributor

    @smohamedjavid Thank you for the PR. No issues from my side, but I did notice one more place where the max value isn’t updated after the account is changed. If it's better to fix this separately, then the PR can be merged.

    ISSUE 3: Max value is not updated when the account is switched on the swap page

    Steps:

    1. Go to the swap page
    2. Switch to another account with a different balance.

    Actual result:

    The max value is not updated to reflect the balance of the newly switched account.

    maxswap.mp4

    Expected result:

    The max value should update immediately when the account is switched, reflecting the correct token balance of the new account.

    Devices:

    Pixel 7a, Android 13
    iPhone 11 Pro Max, iOS 17

    @smohamedjavid
    Copy link
    Member Author

    Sure @VolodLytvynenko, we will fix it separately 👍 Thank you for testing the PR 🙏

    @smohamedjavid smohamedjavid merged commit a140438 into develop Sep 20, 2024
    6 checks passed
    @smohamedjavid smohamedjavid deleted the fix/send-max-value-not-updated branch September 20, 2024 13:58
    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.

    [IOS] Token value and max fee not updated on the routes generation page
    6 participants