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

'No matching clause' error is shown if ENS is entered into 'sent to' page #19741 #19957

Merged
merged 15 commits into from
May 14, 2024

Conversation

mmilad75
Copy link
Contributor

@mmilad75 mmilad75 commented May 9, 2024

fixes #19741

Screen.Recording.2024-05-09.at.21.16.16.mov

@status-im-auto
Copy link
Member

status-im-auto commented May 9, 2024

Jenkins Builds

Click to see older builds (41)
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ d0d7cc8 #1 2024-05-09 18:00:43 ~5 min tests 📄log
✔️ d0d7cc8 #1 2024-05-09 18:03:36 ~8 min android-e2e 🤖apk 📲
✔️ d0d7cc8 #1 2024-05-09 18:03:37 ~8 min android 🤖apk 📲
✔️ d0d7cc8 #1 2024-05-09 18:04:38 ~9 min ios 📱ipa 📲
✔️ 0e8352e #2 2024-05-10 12:31:42 ~5 min tests 📄log
✔️ 0e8352e #2 2024-05-10 12:33:41 ~7 min android 🤖apk 📲
✔️ 0e8352e #2 2024-05-10 12:33:42 ~7 min android-e2e 🤖apk 📲
✔️ 0e8352e #2 2024-05-10 12:36:20 ~9 min ios 📱ipa 📲
✔️ 13ccfa0 #3 2024-05-10 12:44:12 ~4 min tests 📄log
✔️ 13ccfa0 #3 2024-05-10 12:45:56 ~6 min android 🤖apk 📲
✔️ 13ccfa0 #3 2024-05-10 12:47:04 ~7 min android-e2e 🤖apk 📲
✔️ 951d93f #4 2024-05-10 12:53:15 ~5 min tests 📄log
✔️ 951d93f #4 2024-05-10 12:55:28 ~7 min android-e2e 🤖apk 📲
✔️ 951d93f #4 2024-05-10 12:55:32 ~7 min android 🤖apk 📲
✔️ 951d93f #4 2024-05-10 12:58:51 ~10 min ios 📱ipa 📲
e1ee3d7 #5 2024-05-13 12:46:09 ~3 min tests 📄log
dbc1dd3 #6 2024-05-13 12:49:28 ~2 min tests 📄log
✔️ dbc1dd3 #6 2024-05-13 12:52:42 ~6 min android-e2e 🤖apk 📲
✔️ dbc1dd3 #6 2024-05-13 12:53:55 ~7 min android 🤖apk 📲
✔️ dbc1dd3 #6 2024-05-13 12:57:30 ~10 min ios 📱ipa 📲
eb9165a #7 2024-05-13 13:46:55 ~3 min tests 📄log
6f49a13 #8 2024-05-13 13:52:13 ~2 min tests 📄log
✔️ b3a3eef #9 2024-05-13 14:00:39 ~6 min android-e2e 🤖apk 📲
✔️ b3a3eef #9 2024-05-13 14:01:14 ~6 min android 🤖apk 📲
b3a3eef #10 2024-05-13 14:02:45 ~8 min tests 📄log
✔️ b3a3eef #9 2024-05-13 14:06:02 ~11 min ios 📱ipa 📲
a9ec823 #12 2024-05-13 14:18:08 ~2 min tests 📄log
✔️ a9ec823 #11 2024-05-13 14:21:54 ~6 min android-e2e 🤖apk 📲
✔️ a9ec823 #11 2024-05-13 14:22:15 ~6 min android 🤖apk 📲
✔️ 68b2afc #13 2024-05-13 14:31:00 ~6 min tests 📄log
✔️ 68b2afc #12 2024-05-13 14:31:41 ~6 min android 🤖apk 📲
✔️ 68b2afc #12 2024-05-13 14:32:02 ~7 min android-e2e 🤖apk 📲
✔️ 68b2afc #12 2024-05-13 14:36:07 ~11 min ios 📱ipa 📲
✔️ 25ef6d7 #14 2024-05-13 15:06:34 ~5 min tests 📄log
✔️ 25ef6d7 #13 2024-05-13 15:07:25 ~5 min android 🤖apk 📲
✔️ 25ef6d7 #13 2024-05-13 15:09:02 ~7 min android-e2e 🤖apk 📲
✔️ 25ef6d7 #13 2024-05-13 15:11:31 ~10 min ios 📱ipa 📲
✔️ c3a9592 #15 2024-05-13 15:57:03 ~4 min tests 📄log
✔️ c3a9592 #14 2024-05-13 16:00:01 ~7 min android-e2e 🤖apk 📲
✔️ c3a9592 #14 2024-05-13 16:00:52 ~8 min android 🤖apk 📲
✔️ c3a9592 #14 2024-05-13 16:01:28 ~8 min ios 📱ipa 📲
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ b45b186 #16 2024-05-14 16:26:22 ~3 min tests 📄log
✔️ b45b186 #15 2024-05-14 16:29:38 ~7 min android-e2e 🤖apk 📲
✔️ b45b186 #15 2024-05-14 16:29:46 ~7 min android 🤖apk 📲
✔️ b45b186 #15 2024-05-14 16:31:11 ~8 min ios 📱ipa 📲
✔️ e45d25e #17 2024-05-14 17:38:00 ~4 min tests 📄log
✔️ e45d25e #16 2024-05-14 17:41:52 ~8 min android-e2e 🤖apk 📲
✔️ e45d25e #16 2024-05-14 17:42:06 ~8 min android 🤖apk 📲
✔️ e45d25e #16 2024-05-14 17:42:25 ~8 min ios 📱ipa 📲

@mmilad75 mmilad75 self-assigned this May 9, 2024
:ens ens
:address (eip55/address->checksum result)
:networks [:ethereum :optimism]
:full-address (str "eth:opt:" (eip55/address->checksum result))}]
Copy link
Contributor

Choose a reason for hiding this comment

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

I see this `"eth:opt:" string as a magical string. It could be a constant or better yet IMO, a function that converts a sequence of network keywords into their shorthand versions. I can't remember, but I think such a function even exists already, but don't trust my memory.

Copy link
Contributor

Choose a reason for hiding this comment

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

I wrote some functions to convert network ids to address prefix:

(def network->short-name
  {constants/mainnet-network-name  constants/mainnet-short-name
   constants/optimism-network-name constants/optimism-short-name
   constants/arbitrum-network-name constants/arbitrum-short-name})

(def short-name->network
  {constants/mainnet-short-name  constants/mainnet-network-name
   constants/optimism-short-name constants/optimism-network-name
   constants/arbitrum-short-name constants/arbitrum-network-name})

(defn short-names->network-preference-prefix
  [short-names]
  (str (string/join ":" short-names) ":"))

(defn network-preference-prefix->network-names
  [prefix]
  (as-> prefix $
    (string/split $ ":")
    (map short-name->network $)))

These were in wallet.common.utils ns. But my PR was not merged because I was moved to another team and Ibrahim started working on that feature.

Agreed that we should have a namespace to manage addresses. They are not strings. They just look like strings.

Copy link
Contributor

Choose a reason for hiding this comment

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

That's great @shivekkhurana, exactly what I had in mind. Thanks

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'm gonna copy your code and put it in my PR @shivekkhurana

Copy link
Contributor Author

Choose a reason for hiding this comment

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

status-im.contexts.wallet.common.utils.networks This will be a better namespace to include them in.

@@ -167,7 +170,9 @@
:disabled? (not valid-ens-or-address?)
:on-press #(rf/dispatch
[:wallet/select-send-address
{:address @input-value
{:address (if local-suggestion-address
Copy link
Contributor

Choose a reason for hiding this comment

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

You can or the conditions instead of using if. A bit shorter.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

DOne

valid-ens-or-address? (boolean (rf/sub [:wallet/valid-ens-or-address?]))
local-suggestions (rf/sub [:wallet/local-suggestions])
local-suggestion-address (:full-address (first local-suggestions))
{:keys [color]} (rf/sub [:wallet/current-viewing-account])]
Copy link
Contributor

Choose a reason for hiding this comment

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

I know it's not from this PR, but subscribing to :wallet/current-viewing-account just to get the color is not good, especially because that sub and its inputs signals are quite heavy in processing. The better approach would be to have a sub that returns only the color of the current-viewing-account from the input of sub :wallet/accounts.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm sub-inspector Shivek. You have been found in possession of {:keys [color]} (rf/sub ...), which is an illegal substance. You have the right to resolve this.

image

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 created this wallet/current-viewing-account->color which only returns the color

Copy link
Contributor

Choose a reason for hiding this comment

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

Why isn't it called wallet/current-viewing-account-color ?
The -> is a convention for a pure transformation function.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. Thanks for letting me know

(let [selected-tab (or (rf/sub [:wallet/send-tab]) (:id (first tabs-data)))
valid-ens-or-address? (boolean (rf/sub [:wallet/valid-ens-or-address?]))
local-suggestions (rf/sub [:wallet/local-suggestions])
local-suggestion-address (:full-address (first local-suggestions))
Copy link
Contributor

Choose a reason for hiding this comment

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

Just a suggestion: it's better to have a new sub that returns only what the view needs. In this case, any change to the output of :wallet/local-suggestions will force Reagent to re-process the entire component, but you only care about the full-address of the first suggestion. Maybe it's not a big deal here, but these details can easily pile up in terms of performance.

Not sure if it helps, but the mindset I put myself in is to not think of subs as normal functions. When we subscribe in the component, we're forming a dependency graph of subscriptions for the duration of the component lifecycle. This has a cost and affects re-renders, not like normal function calls that we can sprinkle anywhere and usually only care about what they do.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Very good point. Done

Copy link
Contributor

Choose a reason for hiding this comment

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

btw @mmilad75, this is a known problem we have throughout the codebase. I wrote a ton of code not following my own suggestion here, I guess because it took me a long time to understand the performance implications in mobile versus web development (which is where I came from using re-frame). Now we should gradually improve things or not make them worse if we can.

:ens ens
:address (eip55/address->checksum result)
:networks [:ethereum :optimism]
:full-address (str "eth:opt:" (eip55/address->checksum result))}]
Copy link
Contributor

Choose a reason for hiding this comment

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

I wrote some functions to convert network ids to address prefix:

(def network->short-name
  {constants/mainnet-network-name  constants/mainnet-short-name
   constants/optimism-network-name constants/optimism-short-name
   constants/arbitrum-network-name constants/arbitrum-short-name})

(def short-name->network
  {constants/mainnet-short-name  constants/mainnet-network-name
   constants/optimism-short-name constants/optimism-network-name
   constants/arbitrum-short-name constants/arbitrum-network-name})

(defn short-names->network-preference-prefix
  [short-names]
  (str (string/join ":" short-names) ":"))

(defn network-preference-prefix->network-names
  [prefix]
  (as-> prefix $
    (string/split $ ":")
    (map short-name->network $)))

These were in wallet.common.utils ns. But my PR was not merged because I was moved to another team and Ibrahim started working on that feature.

Agreed that we should have a namespace to manage addresses. They are not strings. They just look like strings.

valid-ens-or-address? (boolean (rf/sub [:wallet/valid-ens-or-address?]))
local-suggestions (rf/sub [:wallet/local-suggestions])
local-suggestion-address (:full-address (first local-suggestions))
{:keys [color]} (rf/sub [:wallet/current-viewing-account])]
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm sub-inspector Shivek. You have been found in possession of {:keys [color]} (rf/sub ...), which is an illegal substance. You have the right to resolve this.

image

@mmilad75
Copy link
Contributor Author

@shivekkhurana @ilmotta Please have another look. I resolved your comments

@shivekkhurana
Copy link
Contributor

@mmilad75 All good, except for this
#19957 (comment)

@mmilad75
Copy link
Contributor Author

@mmilad75 All good, except for this #19957 (comment)

Done

:address (eip55/address->checksum result)
:networks [constants/ethereum-network-name constants/optimism-network-name]
:full-address (str (network-utils/short-names->network-preference-prefix
[(get network-utils/network->short-name
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice improvement @mmilad75. What follows is just a light suggestion, something I'd do. Maybe you like the overall idea, even if you don't want to apply it now.

This part can be more general/functional and you can reuse the sequence of networks too. While thinking about this suggestion, it forced me to think about what result really means as a word. The goal in this refactor was to use the principle of "tell don't ask", but applied to a functional paradigm.

Tell-Don't-Ask is a principle that helps people remember that object-orientation is about bundling data with the functions that operate on that data. It reminds us that rather than asking an object for data and acting on that data, we should instead tell an object what to do.

-- https://martinfowler.com/bliki/TellDontAsk.html

Translated to our case here, it's like rather than asking for individual pieces of data and assembling them together, make that a verb (function) and tell it to do its thing.

(defn- resolved-address->prefixed-address
  [address networks]
  (let [prefixes (->> networks
                      (map network-utils/network->short-name)
                      network-utils/short-names->network-preference-prefix)]
    (str prefixes (eip55/address->checksum address))))

(rf/reg-event-fx :wallet/set-ens-address
 (fn [{:keys [db]} [result ens]]
   (let [networks   [constants/ethereum-network-name constants/optimism-network-name]
         suggestion (if result
                      [{:type         item-types/address
                        :ens          ens
                        :address      (eip55/address->checksum result)
                        :networks     networks
                        :full-address (resolved-address->prefixed-address result networks)}]
                      [])]
     {:db (-> db
              (assoc-in [:wallet :ui :search-address :local-suggestions] suggestion)
              (assoc-in [:wallet :ui :search-address :valid-ens-or-address?] (boolean result)))})))

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a very great suggestion, thanks man. Every time I learn a lot from you 🙏 @ilmotta

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

{:keys [color]} (rf/sub [:wallet/current-viewing-account])]
(let [selected-tab (or (rf/sub [:wallet/send-tab]) (:id (first tabs-data)))
valid-ens-or-address? (boolean (rf/sub [:wallet/valid-ens-or-address?]))
local-suggestion-address (rf/sub [:wallet/local-suggestions->full-address])
Copy link
Contributor

Choose a reason for hiding this comment

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

As an outsider to the wallet domain, I wondered why getting the first suggestion is important and I thought that reason could be on the name/keyword. In other words, why is the first suggestion relevant? What's the order? Why not the last? If that was in the name, it could help others understand. Also, the name is in the plural, which gives me the impression the sub will return a sequence of full addresses, and not just one.

Suggestions? :wallet/top-suggestion-full-address. Or if it's really arbitrary the choice of suggestion the name could be :wallet/first-suggestion-full-address.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

To be honest, I don't know even why it's returning an array. I thought it'd be useful later. At the moment, only one item is returned and even the implementation is for one ens match. And, each ens has only one address. So, only one item is stored in the db, but it's in an array.

[short-names]
(str (string/join ":" short-names) ":"))

(defn network-preference-prefix->network-names
Copy link
Contributor

Choose a reason for hiding this comment

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

Only thing missing to me is a couple unit tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@status-im-auto
Copy link
Member

81% of end-end tests have passed

Total executed tests: 52
Failed tests: 8
Expected to fail tests: 2
Passed tests: 42
IDs of failed tests: 727230,704613,727229,702807,702731,702730,727232,702775 
IDs of expected to fail tests: 703495,703503 

Failed tests (8)

Click to expand
  • Rerun failed tests

  • Class TestWalletMultipleDevice:

    1. test_wallet_send_asset_from_drawer, id: 727230

    # STEP: Getting ETH amount in the wallet of the sender before transaction
    Device 1: Find `WalletTab` by `accessibility id`: `wallet-stack-tab`

    critical/test_wallet.py:117: in test_wallet_send_asset_from_drawer
        sender_balance, receiver_balance, eth_amount_sender, eth_amount_receiver = self._get_balances_before_tx()
    critical/test_wallet.py:39: in _get_balances_before_tx
        self.wallet_1.wallet_tab.click()
    ../views/base_element.py:90: in click
        element = self.find_element()
    ../views/base_element.py:79: in find_element
        raise NoSuchElementException(
     Device 1: WalletTab by accessibility id: `wallet-stack-tab` is not found on the screen; For documentation on this error, please visit: https://www.selenium.dev/documentation/webdriver/troubleshooting/errors#no-such-element-exception
    



    2. test_wallet_send_eth, id: 727229

    Device 1: Swiping right on element SlideButton
    Device 1: Find SlideButton by xpath: //*[@resource-id='slide-button-track']

    critical/test_wallet.py:109: in test_wallet_send_eth
        self.wallet_1.send_asset(address=self.receiver['address'], asset_name='Ether', amount=amount_to_send)
    ../views/wallet_view.py:99: in send_asset
        self.confirm_transaction()
    ../views/wallet_view.py:86: in confirm_transaction
        self.slide_and_confirm_with_password()
    ../views/wallet_view.py:80: in slide_and_confirm_with_password
        self.slide_button_track.slide()
    ../views/base_view.py:257: in slide
        self.swipe_right_on_element(width_percentage=1.3, start_x=100)
    ../views/base_element.py:308: in swipe_right_on_element
        location, size = self.get_element_coordinates()
    ../views/base_element.py:294: in get_element_coordinates
        element = self.find_element()
    ../views/base_element.py:79: in find_element
        raise NoSuchElementException(
     Device 1: SlideButton by xpath: `//*[@resource-id='slide-button-track']` is not found on the screen; For documentation on this error, please visit: https://www.selenium.dev/documentation/webdriver/troubleshooting/errors#no-such-element-exception
    



    Class TestOneToOneChatMultipleSharedDevicesNewUi:

    1. test_1_1_chat_pin_messages, id: 702731

    Device 1: Find Text by xpath: //*[starts-with(@text,'Message 3')]/ancestor::android.view.ViewGroup[@content-desc='chat-item']//*[@content-desc='message-status']/android.widget.TextView
    Device 1: Text is Sent

    critical/chats/test_1_1_public_chats.py:223: in test_1_1_chat_pin_messages
        self.chat_1.chat_element_by_text(message).wait_for_status_to_be("Delivered")
    ../views/chat_view.py:225: in wait_for_status_to_be
        raise TimeoutException("Message status was not changed to %s, it's %s" % (expected_status, current_status))
     Message status was not changed to Delivered, it's Sent
    



    Device sessions

    2. test_1_1_chat_message_reaction, id: 702730

    Device 1: Find EmojisNumber by xpath: //*[starts-with(@text,'Message sender')]/ancestor::android.view.ViewGroup[@content-desc='chat-item']/../..//*[@content-desc='emoji-reaction-2']/android.widget.TextView[2]
    Device 1: Find EmojisNumber by xpath: //*[starts-with(@text,'Message sender')]/ancestor::android.view.ViewGroup[@content-desc='chat-item']/../..//*[@content-desc='emoji-reaction-2']/android.widget.TextView[2]

    critical/chats/test_1_1_public_chats.py:67: in test_1_1_chat_message_reaction
        message_sender.emojis_below_message(emoji="thumbs-up").wait_for_element_text(2, 90)
    ../views/base_element.py:190: in wait_for_element_text
        self.driver.fail(message if message else "`%s` is not equal to expected `%s` in %s sec" % (
    base_test_case.py:178: in fail
        pytest.fail('Device %s: %s' % (self.number, text))
     Device 1: `1` is not equal to expected `2` in 90 sec
    



    Device sessions

    Class TestWalletOneDevice:

    1. test_wallet_add_remove_watch_only_account, id: 727232

    Device 1: Find EditBox by accessibility id: add-address-to-watch
    Device 1: Type 0x8d2413447ff297d30bdc475f6d5cb00254685aae to EditBox

    critical/test_wallet.py:190: in test_wallet_add_remove_watch_only_account
        self.wallet_view.add_watch_only_account(address=address_to_watch, account_name=new_account_name)
    ../views/wallet_view.py:120: in add_watch_only_account
        self.account_has_activity_label.wait_for_visibility_of_element()
    ../views/base_element.py:147: in wait_for_visibility_of_element
        raise TimeoutException(
     Device 1: Text by accessibility id:`account-has-activity` is not found on the screen after wait_for_visibility_of_element
    



    Device sessions

    Class TestGroupChatMultipleDeviceMergedNewUI:

    1. test_group_chat_join_send_text_messages_push, id: 702807

    Device 2: Find Text by xpath: //*[starts-with(@text,'Hey, admin!')]/ancestor::android.view.ViewGroup[@content-desc='chat-item']//*[@content-desc='message-status']/android.widget.TextView
    Device 2: Text is Sent

    critical/chats/test_group_chat.py:95: in test_group_chat_join_send_text_messages_push
        self.chats[1].chat_element_by_text(message_to_admin).wait_for_status_to_be('Delivered', timeout=120)
    ../views/chat_view.py:225: in wait_for_status_to_be
        raise TimeoutException("Message status was not changed to %s, it's %s" % (expected_status, current_status))
     Message status was not changed to Delivered, it's Sent
    



    Device sessions

    Class TestDeepLinksOneDevice:

    1. test_links_open_universal_links_from_chat, id: 704613

    Device 1: Find Button by xpath: //*[@text="open community"]
    Device 1: Tap on found: Button

    critical/test_deep_and_universal_links.py:70: in test_links_open_universal_links_from_chat
        self.errors.verify_no_errors()
    base_test_case.py:190: in verify_no_errors
        pytest.fail('\n '.join([self.errors.pop(0) for _ in range(len(self.errors))]))
     Community 'Open community for e2e' was not requested to join by the url https://status.app/c/G1AAAGR0G-IRb2YJD4lRXwLusAFnGrDHGNl6Wt55MIARwVYvarnO873011-fdVSz1kHSan-qq0G96vOaMqyTRhJnQV74KCUr#zQ3shb9irJR66rhG1E8sQZX8pDU3dpGm4daYSmPVDd2e73ewE
    



    Device sessions

    2. test_links_deep_links, id: 702775

    Device 1: Find BrowserTab by accessibility id: browser-stack-tab
    Device 1: Tap on found: BrowserTab

    critical/test_deep_and_universal_links.py:114: in test_links_deep_links
        self.errors.verify_no_errors()
    base_test_case.py:190: in verify_no_errors
        pytest.fail('\n '.join([self.errors.pop(0) for _ in range(len(self.errors))]))
     Community 'Open community for e2e' was not requested to join by the deep link status.app://c/G1AAAGR0G-IRb2YJD4lRXwLusAFnGrDHGNl6Wt55MIARwVYvarnO873011-fdVSz1kHSan-qq0G96vOaMqyTRhJnQV74KCUr#zQ3shb9irJR66rhG1E8sQZX8pDU3dpGm4daYSmPVDd2e73ewE
    



    Device sessions

    Expected to fail tests (2)

    Click to expand

    Class TestCommunityOneDeviceMerged:

    1. test_community_discovery, id: 703503

    Test is not run, e2e blocker  
    

    [[reason: [NOTRUN] Curated communities not loading, https://github.com//issues/17852]]

    Class TestGroupChatMultipleDeviceMergedNewUI:

    1. test_group_chat_mute_chat, id: 703495

    # STEP: Change device time so chat will be unmuted by timer
    Device 2: Long press on ChatElement

    critical/chats/test_group_chat.py:464: in test_group_chat_mute_chat
        self.errors.verify_no_errors()
    base_test_case.py:190: in verify_no_errors
        pytest.fail('\n '.join([self.errors.pop(0) for _ in range(len(self.errors))]))
     Chat is still muted after timeout 
    

    [[Chat is not unmuted after expected time: https://github.com//issues/19627]]

    Device sessions

    Passed tests (42)

    Click to expand

    Class TestOneToOneChatMultipleSharedDevicesNewUi:

    1. test_1_1_chat_emoji_send_reply_and_open_link, id: 702782
    Device sessions

    2. test_1_1_chat_text_message_delete_push_disappear, id: 702733
    Device sessions

    3. test_1_1_chat_push_emoji, id: 702813
    Device sessions

    4. test_1_1_chat_non_latin_messages_stack_update_profile_photo, id: 702745
    Device sessions

    5. test_1_1_chat_edit_message, id: 702855
    Device sessions

    6. test_1_1_chat_send_image_save_and_share, id: 703391
    Device sessions

    Class TestCommunityMultipleDeviceMerged:

    1. test_community_several_images_send_reply, id: 703194
    Device sessions

    2. test_community_one_image_send_reply, id: 702859
    Device sessions

    3. test_community_emoji_send_copy_paste_reply, id: 702840
    Device sessions

    4. test_community_mark_all_messages_as_read, id: 703086
    Device sessions

    5. test_community_contact_block_unblock_offline, id: 702894
    Device sessions

    6. test_community_edit_delete_message_when_offline, id: 704615
    Device sessions

    7. test_community_message_delete, id: 702839
    Device sessions

    8. test_community_message_send_check_timestamps_sender_username, id: 702838
    Device sessions

    9. test_community_links_with_previews_github_youtube_twitter_gif_send_enable, id: 702844
    Device sessions

    10. test_community_message_edit, id: 702843
    Device sessions

    11. test_community_unread_messages_badge, id: 702841
    Device sessions

    Class TestActivityMultipleDevicePR:

    1. test_navigation_jump_to, id: 702936
    Device sessions

    2. test_activity_center_reply_read_unread_delete_filter_swipe, id: 702947
    Device sessions

    Class TestWalletOneDevice:

    1. test_wallet_add_remove_regular_account, id: 727231
    Device sessions

    Class TestCommunityMultipleDeviceMergedTwo:

    1. test_community_markdown_support, id: 702809
    Device sessions

    2. test_community_hashtag_links_to_community_channels, id: 702948
    Device sessions

    3. test_community_mentions_push_notification, id: 702786
    Device sessions

    4. test_community_leave, id: 702845
    Device sessions

    5. test_community_join_when_node_owner_offline, id: 703629
    Device sessions

    Class TestOneToOneChatMultipleSharedDevicesNewUiTwo:

    1. test_1_1_chat_delete_via_long_press_relogin, id: 702784
    Device sessions

    2. test_1_1_chat_is_shown_message_sent_delivered_from_offline, id: 702783
    Device sessions

    3. test_1_1_chat_mute_chat, id: 703496
    Device sessions

    Class TestGroupChatMultipleDeviceMergedNewUI:

    1. test_group_chat_pin_messages, id: 702732
    Device sessions

    2. test_group_chat_send_image_save_and_share, id: 703297
    Device sessions

    3. test_group_chat_reactions, id: 703202
    Device sessions

    4. test_group_chat_offline_pn, id: 702808
    Device sessions

    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

    3. test_community_undo_delete_message, id: 702869
    Device sessions

    4. test_community_navigate_to_channel_when_relaunch, id: 702846
    Device sessions

    5. test_community_mute_community_and_channel, id: 703382
    Device sessions

    Class TestActivityMultipleDevicePRTwo:

    1. test_activity_center_mentions, id: 702957
    Device sessions

    2. test_activity_center_admin_notification_accept_swipe, id: 702958
    Device sessions

    Class TestActivityCenterContactRequestMultipleDevicePR:

    1. test_add_contact_field_validation, id: 702777
    Device sessions

    2. test_activity_center_contact_request_accept_swipe_mark_all_as_read, id: 702851
    Device sessions

    3. test_activity_center_contact_request_decline, id: 702850
    Device sessions

    @VolodLytvynenko
    Copy link
    Contributor

    hi @mmilad75 thank you for PR. No issues from my side. PR is ready to be merged

    @@ -20,3 +20,21 @@
    constants/arbitrum-mainnet-chain-id))
    (is (= (utils/network->chain-id {:network :arbitrum :testnet-enabled? true :goerli-enabled? false})
    constants/arbitrum-sepolia-chain-id))))

    (deftest test-short-names->network-preference-prefix
    Copy link
    Contributor

    Choose a reason for hiding this comment

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

    @mmilad75, thanks for covering the code with unit tests! I think we can further improve this code.

    1. In our codebase, but also in many other Clojure repos out there, the name of the test var is suffixed with the test word, not prefixed. It's just a convention.
    2. The testing macro is unnecessary because we already know which function is under test based on the test var, which in our repo tend to be the name of the function under test followed by -test. Therefore, we try to use the testing macro for the cases where we actually need to give more context about the test.
    3. (Totally optional, but you may prefer) You can make the tests more concise using the are macro. This macro is incredibly useful for testing these pure functions with a small input & output, which is the case of many utility functions. It helps make testing and adding examples cheap and if it's cheap, the greater likelihood devs will test. And even nicer, zprint will autoformat in tabular form. For example (untested):
    (deftest short-names->network-preference-prefix-test
      (are [expected short-names]
       (= expected (utils/short-names->network-preference-prefix short-names))
       "eth:"          ["eth"]
       "eth:opt:"      ["eth" "opt"]
       "eth:opt:arb1:" ["eth" "opt" "arb1"]))

    I see you're following the pattern in the file that existed before your PR, but if you could apply the suggestions above, that would be a nice bonus :)

    Copy link
    Contributor

    Choose a reason for hiding this comment

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

    Additionally, the are macro for this sort of utility function makes adding examples so cheap that it becomes more obvious to me that the examples are lacking more sad path examples or nil/empty cases because this is where many implementations fail. Example inputs: "", ":", " ", and of course nil.

    Copy link
    Contributor Author

    Choose a reason for hiding this comment

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

    Done

    @mmilad75 mmilad75 merged commit 8d4f1f9 into develop May 14, 2024
    6 checks passed
    @mmilad75 mmilad75 deleted the milad/19741-fix-enter-ens branch May 14, 2024 17:54
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    Archived in project
    Archived in project
    Development

    Successfully merging this pull request may close these issues.

    'No matching clause' error is shown if ENS is entered into 'sent to' page
    5 participants