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

[#21557] feat: show from account page in swap flow #21611

Merged
merged 6 commits into from
Nov 22, 2024

Conversation

mohsen-ghafouri
Copy link
Contributor

@mohsen-ghafouri mohsen-ghafouri commented Nov 12, 2024

fixes #21557

Summary

The "From" page should appear, allowing the user to choose the account for the swap.

Areas that maybe impacted

  • Swap flow when user has multiple account

Steps to test

  1. Ensure user has at least 2 accounts set up.
  2. Go to the wallet main page.
  3. Tap on "Swap" for any asset.

Result

Simulator.Screen.Recording.-.iPhone.13.-.2024-11-13.at.23.25.52.mp4

status: ready

@mohsen-ghafouri mohsen-ghafouri self-assigned this Nov 12, 2024
@status-im-auto
Copy link
Member

status-im-auto commented Nov 12, 2024

Jenkins Builds

Click to see older builds (42)
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ d516016 #1 2024-11-12 10:18:17 ~5 min tests 📄log
✔️ d516016 #1 2024-11-12 10:22:02 ~9 min android-e2e 🤖apk 📲
✔️ d516016 #1 2024-11-12 10:22:20 ~9 min ios 📱ipa 📲
✔️ d516016 #1 2024-11-12 10:22:33 ~9 min android 🤖apk 📲
✔️ d730706 #2 2024-11-13 20:25:04 ~4 min tests 📄log
✔️ d730706 #2 2024-11-13 20:28:56 ~8 min android-e2e 🤖apk 📲
✔️ d730706 #2 2024-11-13 20:29:11 ~8 min ios 📱ipa 📲
✔️ d730706 #2 2024-11-13 20:29:36 ~9 min android 🤖apk 📲
✔️ f2900c3 #3 2024-11-13 20:39:43 ~4 min tests 📄log
✔️ f2900c3 #3 2024-11-13 20:43:55 ~8 min ios 📱ipa 📲
✔️ f2900c3 #3 2024-11-13 20:43:56 ~8 min android-e2e 🤖apk 📲
✔️ f2900c3 #3 2024-11-13 20:44:26 ~9 min android 🤖apk 📲
✔️ cddf6c2 #4 2024-11-19 13:53:19 ~4 min tests 📄log
✔️ cddf6c2 #4 2024-11-19 13:54:59 ~6 min android-e2e 🤖apk 📲
✔️ cddf6c2 #4 2024-11-19 13:56:49 ~8 min android 🤖apk 📲
✔️ cddf6c2 #4 2024-11-19 13:58:02 ~9 min ios 📱ipa 📲
b2f6b15 #5 2024-11-19 14:17:30 ~4 min tests 📄log
✔️ b2f6b15 #6 2024-11-19 14:20:45 ~2 min tests 📄log
✔️ b2f6b15 #5 2024-11-19 14:21:48 ~9 min android-e2e 🤖apk 📲
✔️ b2f6b15 #5 2024-11-19 14:21:55 ~9 min ios 📱ipa 📲
✔️ b2f6b15 #5 2024-11-19 14:22:24 ~9 min android 🤖apk 📲
✔️ f83deb5 #7 2024-11-19 17:34:14 ~4 min tests 📄log
✔️ f83deb5 #6 2024-11-19 17:38:19 ~8 min android-e2e 🤖apk 📲
✔️ f83deb5 #6 2024-11-19 17:38:51 ~9 min android 🤖apk 📲
✔️ f83deb5 #6 2024-11-19 17:40:13 ~10 min ios 📱ipa 📲
✔️ e093d42 #8 2024-11-20 16:06:20 ~5 min tests 📄log
✔️ e093d42 #7 2024-11-20 16:10:48 ~9 min android-e2e 🤖apk 📲
✔️ e093d42 #7 2024-11-20 16:12:15 ~11 min android 🤖apk 📲
e093d42 #7 2024-11-20 16:13:25 ~12 min ios 📄log
✔️ 9143d15 #9 2024-11-20 18:40:08 ~4 min tests 📄log
✔️ 9143d15 #8 2024-11-20 18:43:59 ~8 min android-e2e 🤖apk 📲
✔️ 9143d15 #8 2024-11-20 18:44:42 ~9 min android 🤖apk 📲
✔️ 9143d15 #8 2024-11-20 18:47:44 ~12 min ios 📱ipa 📲
✔️ cc11a5f #10 2024-11-21 15:57:10 ~4 min tests 📄log
✔️ cc11a5f #9 2024-11-21 15:59:03 ~6 min android-e2e 🤖apk 📲
✔️ cc11a5f #9 2024-11-21 16:01:05 ~8 min android 🤖apk 📲
✔️ cc11a5f #10 2024-11-21 17:29:20 ~7 min android 🤖apk 📲
✔️ cc11a5f #10 2024-11-21 17:31:07 ~9 min ios 📱ipa 📲
✔️ 95cc78b #11 2024-11-21 18:00:20 ~4 min tests 📄log
✔️ 95cc78b #11 2024-11-21 18:04:17 ~8 min ios 📱ipa 📲
✔️ 95cc78b #10 2024-11-21 18:04:25 ~9 min android-e2e 🤖apk 📲
✔️ 95cc78b #11 2024-11-21 18:04:55 ~9 min android 🤖apk 📲
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ a234559 #12 2024-11-22 09:53:08 ~6 min tests 📄log
✔️ a234559 #11 2024-11-22 09:55:34 ~8 min android-e2e 🤖apk 📲
✔️ a234559 #12 2024-11-22 09:56:29 ~9 min ios 📱ipa 📲
✔️ a234559 #12 2024-11-22 09:58:49 ~11 min android 🤖apk 📲
✔️ 398289a #13 2024-11-22 12:58:35 ~4 min tests 📄log
✔️ 398289a #12 2024-11-22 13:00:43 ~7 min android-e2e 🤖apk 📲
✔️ 398289a #13 2024-11-22 13:02:57 ~9 min android 🤖apk 📲
✔️ 398289a #13 2024-11-22 13:04:20 ~10 min ios 📱ipa 📲

@Horupa-Olena Horupa-Olena self-assigned this Nov 19, 2024
@status-im-auto
Copy link
Member

62% of end-end tests have passed

Total executed tests: 8
Failed tests: 2
Expected to fail tests: 1
Passed tests: 5
IDs of failed tests: 727231,740490 
IDs of expected to fail tests: 702843 

Failed tests (2)

Click to expand
  • Rerun failed tests

  • Class TestWalletOneDevice:

    1. test_wallet_add_remove_regular_account, id: 727231
    Test setup failed: critical/test_wallet.py:200: in prepare_devices
        self.drivers, self.loop = create_shared_drivers(1)
    base_test_case.py:310: in create_shared_drivers
        drivers = loop.run_until_complete(start_threads(test_suite_data.current_test.name,
    /usr/lib/python3.10/asyncio/base_events.py:649: in run_until_complete
        return future.result()
    __init__.py:26: in start_threads
        returns[k] = await returns[k]
    /usr/lib/python3.10/concurrent/futures/thread.py:58: in run
        result = self.fn(*self.args, **self.kwargs)
    ../../../../status-app-prs@tmp/venv/lib/python3.10/site-packages/appium/webdriver/webdriver.py:257: in __init__
        super().__init__(
    ../../../../status-app-prs@tmp/venv/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:206: in __init__
        self.start_session(capabilities)
    ../../../../status-app-prs@tmp/venv/lib/python3.10/site-packages/appium/webdriver/webdriver.py:346: in start_session
        response = self.execute(RemoteCommand.NEW_SESSION, w3c_caps)
    ../../../../status-app-prs@tmp/venv/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:345: in execute
        self.error_handler.check_response(response)
    ../../../../status-app-prs@tmp/venv/lib/python3.10/site-packages/selenium/webdriver/remote/errorhandler.py:229: in check_response
        raise exception_class(message, screen, stacktrace)
     Internal Server Error
    



    2. test_wallet_balance_mainnet, id: 740490

    Test setup failed: critical/test_wallet.py:200: in prepare_devices
        self.drivers, self.loop = create_shared_drivers(1)
    base_test_case.py:310: in create_shared_drivers
        drivers = loop.run_until_complete(start_threads(test_suite_data.current_test.name,
    /usr/lib/python3.10/asyncio/base_events.py:649: in run_until_complete
        return future.result()
    __init__.py:26: in start_threads
        returns[k] = await returns[k]
    /usr/lib/python3.10/concurrent/futures/thread.py:58: in run
        result = self.fn(*self.args, **self.kwargs)
    ../../../../status-app-prs@tmp/venv/lib/python3.10/site-packages/appium/webdriver/webdriver.py:257: in __init__
        super().__init__(
    ../../../../status-app-prs@tmp/venv/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:206: in __init__
        self.start_session(capabilities)
    ../../../../status-app-prs@tmp/venv/lib/python3.10/site-packages/appium/webdriver/webdriver.py:346: in start_session
        response = self.execute(RemoteCommand.NEW_SESSION, w3c_caps)
    ../../../../status-app-prs@tmp/venv/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:345: in execute
        self.error_handler.check_response(response)
    ../../../../status-app-prs@tmp/venv/lib/python3.10/site-packages/selenium/webdriver/remote/errorhandler.py:229: in check_response
        raise exception_class(message, screen, stacktrace)
     Internal Server Error
    



    Expected to fail tests (1)

    Click to expand

    Class TestCommunityMultipleDeviceMerged:

    1. test_community_message_edit, id: 702843

    Test is not run, e2e blocker  
    

    [[reason: [NOTRUN] Skipped due to waku issue on staging fleet]]

    Passed tests (5)

    Click to expand

    Class TestCommunityOneDeviceMerged:

    1. test_community_copy_and_paste_message_in_chat_input, id: 702742
    Device sessions

    2. test_restore_multiaccount_with_waku_backup_remove_profile_switch, id: 703133
    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

    src/status_im/contexts/wallet/swap/from/view.cljs Outdated Show resolved Hide resolved
    src/status_im/subs/wallet/swap.cljs Outdated Show resolved Hide resolved
    Comment on lines 39 to 40
    :fx (if (and multi-account? (= view-id :wallet-stack) (not from-account))
    [[:dispatch [:open-modal :screen/wallet.swap-from]]]
    Copy link
    Member

    Choose a reason for hiding this comment

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

    Quick question: From reading the code, i can understand that this opens the account selection screen (from) screen if the user has more than one account (any type). This is different in send/bridge flow. Only if the asset is available on multiple accounts, that's when we open the from screen with list of accounts that has that asset.

    cc @briansztamfater

    Copy link
    Member

    Choose a reason for hiding this comment

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

    Yes, we should open this modal only if the selected asset is in multiple accounts and has any balance on more than one account.

    Copy link
    Contributor Author

    @mohsen-ghafouri mohsen-ghafouri Nov 19, 2024

    Choose a reason for hiding this comment

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

    yes it's different according to QA's doc list of test cases

    Copy link
    Contributor Author

    Choose a reason for hiding this comment

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

    according to design we list all accounts but show account with zero balance with disabled state

    Copy link
    Contributor Author

    Choose a reason for hiding this comment

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

    Copy link
    Contributor Author

    Choose a reason for hiding this comment

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

    yeah maybe just condition here has a wrong text, otherwise we have account with zero balance in design.

    Copy link
    Member

    @briansztamfater briansztamfater Nov 19, 2024

    Choose a reason for hiding this comment

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

    In the designs three accounts are shown, which two of them have balance, and that's why the third one is disabled. But (from my understanding) if the user has two (or more) accounts and only balance for the selected asset in only one of them, the account selection page should not be shown.

    Copy link
    Contributor Author

    Choose a reason for hiding this comment

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

    I guess better to check linked issue description, #21557 (comment)

    also list of list of test cases

    I implemented it accordingly

    Copy link
    Member

    @briansztamfater briansztamfater Nov 19, 2024

    Choose a reason for hiding this comment

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

    Implementation looks correct based in the test cases document, I am just wondering if test cases are correctly set, as design implies that the From page should be shown only if asset exist in multiple accounts, but on the document there are some test cases that expect the From page to be always shown if the user has more than one account, no matter if the asset exist on more than one account. I think we should double check test cases. cc @Horupa-Olena

    Choose a reason for hiding this comment

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

    @briansztamfater Thanks for your comments! I’ll review these cases one more time.

    @Horupa-Olena
    Copy link

    @mohsen-ghafouri Thank you for your PR!
    Can I start testing?

    @mohsen-ghafouri
    Copy link
    Contributor Author

    mohsen-ghafouri commented Nov 19, 2024

    Hey @Horupa-Olena yes please, thanks

    Copy link
    Member

    @briansztamfater briansztamfater left a comment

    Choose a reason for hiding this comment

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

    Code-wise, it looks good to me!

    @Horupa-Olena @pavloburykh, could you check this comment and verify that we are not misrepresenting the expected behavior? Thanks 🙏 #21611 (comment)

    @pavloburykh
    Copy link
    Contributor

    pavloburykh commented Nov 20, 2024

    Code-wise, it looks good to me!

    @Horupa-Olena @pavloburykh, could you check this comment and verify that we are not misrepresenting the expected behavior? Thanks 🙏 #21611 (comment)

    @briansztamfater @mohsen-ghafouri Thank you, guys!
    From my perspective, the expected behavior seems partially incorrect in both the issue description and the referenced test cases.

    Here’s what I believe should be the correct behavior:

    The FROM page should only appear if more than one account holds the token selected for the swap.

    • Scenario 1: If the user has two accounts (e.g., Account 1 and Account 2) but the selected token exists only in one of the accounts, the FROM page should not be displayed.
    • Scenario 2: If the user selects a token present in both accounts, the FROM page should be displayed.
    • Scenario 3: If the user has more than two accounts, and the selected token is available in some (more than one) but not all accounts, the FROM page should display. Accounts without the selected token should still be listed but appear disabled, as shown in the design reference.

    Let me know your thoughts or if we need further alignment! cc @xAlisher

    @xAlisher
    Copy link

    Looks good to me

    @pavloburykh
    Copy link
    Contributor

    Looks good to me

    thank you @xAlisher

    @Horupa-Olena
    Copy link

    Code-wise, it looks good to me!
    @Horupa-Olena @pavloburykh, could you check this comment and verify that we are not misrepresenting the expected behavior? Thanks 🙏 #21611 (comment)

    @briansztamfater @mohsen-ghafouri Thank you, guys! From my perspective, the expected behavior seems partially incorrect in both the issue description and the referenced test cases.

    Here’s what I believe should be the correct behavior:

    The FROM page should only appear if more than one account holds the token selected for the swap.

    • Scenario 1: If the user has two accounts (e.g., Account 1 and Account 2) but the selected token exists only in one of the accounts, the FROM page should not be displayed.
    • Scenario 2: If the user selects a token present in both accounts, the FROM page should be displayed.
    • Scenario 3: If the user has more than two accounts, and the selected token is available in some but not all accounts, the FROM page should display. Accounts without the selected token should still be listed but appear disabled, as shown in the design reference.

    Let me know your thoughts or if we need further alignment! cc @xAlisher

    @mohsen-ghafouri @briansztamfater I agree with this behavior. If it’s implemented this way, I will start testing.
    What do you think?

    @mohsen-ghafouri
    Copy link
    Contributor Author

    Thank you @pavloburykh , could you please correct the description of linked issue and also test case document? as it will be reference for dev and QA.

    @Horupa-Olena I need to apply some changes to cover Scenario 1, will let you know once it's ready for review.

    @pavloburykh
    Copy link
    Contributor

    Thank you @pavloburykh , could you please correct the description of linked issue and also test case document? as it will be reference for dev and QA.

    @mohsen-ghafouri I have corrected issue description. Regarding the document , @VolodLytvynenko could you please correct it, as I have View only permissions.

    @VolodLytvynenko
    Copy link
    Contributor

    Thank you @pavloburykh , could you please correct the description of linked issue and also test case document? as it will be reference for dev and QA.

    @mohsen-ghafouri I have corrected issue description. Regarding the document , @VolodLytvynenko could you please correct it, as I have View only permissions.

    I just corrected the table thanx

    Copy link
    Member

    @briansztamfater briansztamfater left a comment

    Choose a reason for hiding this comment

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

    Thanks for the modifications @mohsen-ghafouri 🚀

    @mohsen-ghafouri
    Copy link
    Contributor Author

    Hey @Horupa-Olena, it's ready for test. thanks in advance

    @status-im-auto
    Copy link
    Member

    88% of end-end tests have passed

    Total executed tests: 8
    Failed tests: 0
    Expected to fail tests: 1
    Passed tests: 7
    
    IDs of expected to fail tests: 702843 
    

    Expected to fail tests (1)

    Click to expand

    Class TestCommunityMultipleDeviceMerged:

    1. test_community_message_edit, id: 702843
    Test is not run, e2e blocker  
    

    [[reason: [NOTRUN] Skipped due to waku issue on staging fleet]]

    Passed tests (7)

    Click to expand

    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_profile_switch, id: 703133
    Device sessions

    Class TestWalletOneDevice:

    1. test_wallet_add_remove_regular_account, id: 727231
    2. test_wallet_balance_mainnet, id: 740490

    @Horupa-Olena
    Copy link

    @mohsen-ghafouri Thanks for your work!

    Unfortunately, I’m unable to trigger the From page.

    I restored a profile using a seed phrase that had two accounts with assets.
    I also tried to trigger the From page on a profile with two empty accounts and two imported accounts with funds. Both attempts were unsuccessful on Android and iOS.

    Could you please take a look and check what might be wrong? Let me know if logs are needed.

    @mohsen-ghafouri
    Copy link
    Contributor Author

    mohsen-ghafouri commented Nov 21, 2024

    Hey @Horupa-Olena, a video of test would be helpful, as you can see in my last comment the result with my account is like this #21611 (comment)

    swap with account that has balance worked fine for my accounts

    @mohsen-ghafouri
    Copy link
    Contributor Author

    mohsen-ghafouri commented Nov 21, 2024

    Just retest it with latest changes, the result is the same, you should have an asset available at least in 2 accounts to see the "From" page in swap flow
    CC @Horupa-Olena

    scenarios #21611 (comment)

    Simulator.Screen.Recording.-.iPhone.13.-.2024-11-21.at.18.51.09.mp4

    @Horupa-Olena
    Copy link

    @mohsen-ghafouri Sorry, I rushed to switch to another task and seem to have sent the comment without waiting for the video to upload.
    Here’s the video.

    Screenrecorder-2024-11-21-18-15-29-966.mp4

    @Horupa-Olena
    Copy link

    Just retest it with latest changes, the result is the same, you should have an asset available at least in 2 accounts to see the "From" page in swap flow CC @Horupa-Olena

    scenarios #21611 (comment)

    Simulator.Screen.Recording.-.iPhone.13.-.2024-11-21.at.18.51.09.mp4

    @mohsen-ghafouri I retest on last build. The same result.

    ISSUE 1: From page not appears for multichain account

    Step

    1. Restore user profile by seed phrase
    2. Turn off test network -> Log out
    3. Log in
    4. Add second acc in wallet
    5. Longtap on ETH on owerview in wallet

    Expected results:
    Form page appears and allow chose account for swap

    Actual results:
    Form page not appears

    video_2024-11-21_18-26-56.mp4

    @VolodLytvynenko
    Copy link
    Contributor

    Hi @mohsen-ghafouri, I am also reproducing the issue on the latest builds of current PR. I’ve tried two different users with varying numbers of accounts, some with more than three accounts holding assets. However, I am still unable to see the FROM page:

    FROM.mp4

    Devices:

    • Pixel 7a, Android 13
    • iPhone 11 Pro Max, IOS 17
    • Android Studion: Pixel XL API 33

    @mohsen-ghafouri
    Copy link
    Contributor Author

    I might find the source if issue, it can't detect the root screen, i guess if you switch between tabs and then click on wallet tab it will start working, I just pushed a fix. will test and let you know if it's ready.
    CC @Horupa-Olena @VolodLytvynenko

    @mohsen-ghafouri
    Copy link
    Contributor Author

    All looks good now, in latest PR's build on my iPhone device, please test and let me know @Horupa-Olena . thanks

    2024-11-21.21.22.23.mp4

    @Horupa-Olena
    Copy link

    @mohsen-ghafouri Thanks for your fix! Everything is finally working.

    screen-20241122-135719.mp4

    However, I can’t fully test the entire flow and verify that the assets are swapped on the correct account (chosen on the From page) because there’s a bug in the swap flow. I’m waiting for this PR to resolve the issue.

    I’d greatly appreciate it if you could also take a look at this issue next, as it’s related to the Swap flow and makes sense to address after fixing the problem with the From page.

    @Horupa-Olena
    Copy link

    @mohsen-ghafouri You can merge it PR.

    @mohsen-ghafouri mohsen-ghafouri merged commit 21c2a52 into develop Nov 22, 2024
    5 checks passed
    @mohsen-ghafouri mohsen-ghafouri deleted the fix/from-page-swap branch November 22, 2024 13:12
    @mohsen-ghafouri
    Copy link
    Contributor Author

    Hey @Horupa-Olena thank you for testing this PR, sure i will try to check that as well

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

    Successfully merging this pull request may close these issues.

    "From" page with list of accounts not displayed when tapping swap on wallet main page with multiple accounts
    10 participants