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

[#15019] small option card component #15077

Merged
merged 8 commits into from
Feb 14, 2023

Conversation

ulisesmac
Copy link
Contributor

@ulisesmac ulisesmac commented Feb 13, 2023

fixes #15019

Summary

Implements the small option card component in its two variants: main & icon.

Review notes

A new category in the Preview Quo2.0 Components section has been added, it's called "onboarding":

Credit to @J-Son89 for d83a14a. He did a PR (not merged yet) and I took his mock-fn.

Testing notes

Tests were added for this component. You can find them at quo2.components.small-option-card.--tests--.small-option-card-component-spec.

It's hard to check if the source's uri passed to a fast-image is correct. so I'm just testing that the fast-image is rendered.
These are the props that fast-image with uri source resources/images/mock/small_opt_card_main.png has during testing:

#js {:testID "small-option-card.main-image",
     :tintColor nil,
     :style #js {:position "absolute", 
                 :left 0,
                 :right 0,
                 :top 0,
                 :bottom 0},
     :source #js {:__packager_asset true,
                  :width 100,
                  :height 100,
                  :uri "file://assets/full/path/to/directory/icon@2x.png", 
                  :scale 2}, 
     :onFastImageLoadStart nil,
     :onFastImageProgress nil,
     :onFastImageLoad #object[Function],
     :onFastImageError #object[Function], 
     :onFastImageLoadEnd nil,
     :resizeMode "contain",
     :children nil}

That uri inside source key is not the same I provided, so I can't use those props to check it.

Please, share any ideas that you think would work to test if a fast-image component is rendered using a specific uri source.

Platforms

  • Android
  • iOS

Areas that maybe impacted

Functional
Non-functional

Steps to test

  • Open Status
  • Navigate to Quo2 component previews -> cards -> small-option-card
  • You should be able to play with the components:

image
image

status: ready

@status-im-auto
Copy link
Member

status-im-auto commented Feb 13, 2023

Jenkins Builds

Click to see older builds (12)
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ f78236e #1 2023-02-13 22:27:31 ~2 min tests 📄log
✔️ f78236e #1 2023-02-13 22:32:14 ~7 min android-e2e 🤖apk 📲
✔️ f78236e #1 2023-02-13 22:32:16 ~7 min ios 📱ipa 📲
✔️ f78236e #1 2023-02-13 22:32:50 ~8 min android 🤖apk 📲
✔️ 4238304 #2 2023-02-13 23:27:11 ~2 min tests 📄log
✔️ 4238304 #2 2023-02-13 23:31:54 ~7 min ios 📱ipa 📲
✔️ 4238304 #2 2023-02-13 23:33:17 ~8 min android-e2e 🤖apk 📲
✔️ 4238304 #2 2023-02-13 23:33:22 ~8 min android 🤖apk 📲
✔️ b28910f #3 2023-02-14 20:34:58 ~2 min tests 📄log
✔️ b28910f #3 2023-02-14 20:39:38 ~7 min ios 📱ipa 📲
✔️ b28910f #3 2023-02-14 20:39:41 ~7 min android-e2e 🤖apk 📲
✔️ b28910f #3 2023-02-14 20:40:15 ~7 min android 🤖apk 📲
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ 565e490 #4 2023-02-14 20:56:51 ~2 min tests 📄log
✔️ 565e490 #4 2023-02-14 21:01:41 ~7 min ios 📱ipa 📲
✔️ 565e490 #4 2023-02-14 21:01:45 ~7 min android-e2e 🤖apk 📲
✔️ 565e490 #4 2023-02-14 21:02:18 ~7 min android 🤖apk 📲
✔️ 927fd41 #5 2023-02-14 21:49:07 ~2 min tests 📄log
✔️ 927fd41 #5 2023-02-14 21:53:42 ~7 min ios 📱ipa 📲
✔️ 927fd41 #5 2023-02-14 21:54:14 ~7 min android-e2e 🤖apk 📲
✔️ 927fd41 #5 2023-02-14 21:54:27 ~7 min android 🤖apk 📲

@ulisesmac ulisesmac moved this from REVIEW to E2E Tests in Pipeline for QA Feb 13, 2023
Copy link
Member

@J-Son89 J-Son89 left a comment

Choose a reason for hiding this comment

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

@flexsurfer, and devs we have icons2.. do we have any resources folder for new images etc? maybe it would be good to have images2.. wdyt?

@@ -0,0 +1,51 @@
(ns quo2.components.small-option-card.--tests--.small-option-card-component-spec
Copy link
Member

Choose a reason for hiding this comment

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

this can be in the name space

quo2.components.small-option-card..component-spec

also I just noticed you need to adjust the name spaces in quo2, they should match figma section and component name..

i.e in this case

quo2.components.onboarding-small-option-card.view
quo2.components.onboarding-small-option-card.style
quo2.components.onboarding-small-option-card.component-test

Copy link
Contributor Author

@ulisesmac ulisesmac Feb 13, 2023

Choose a reason for hiding this comment

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

Oh, thanks! I tried to follow the design's structure 😅

Solved in 3bb7d95

I moved them, except the last one suggested:
quo2.components.onboarding-small-option-card.component-test
Since there's no other test namespace ending with -test in the ns quo2.core-spec, they end with -spec:

(:require [quo2.components.banners.banner.component-spec]
            [quo2.components.buttons.--tests--.buttons-component-spec]
            [quo2.components.counter.--tests--.counter-component-spec]
            [quo2.components.onboarding.small-option-card.component-spec]  ;; <- I added this one
            [quo2.components.dividers.--tests--.divider-label-component-spec]
            [quo2.components.drawers.action-drawers.component-spec]
            [quo2.components.drawers.permission-context.component-spec]
            [quo2.components.markdown.--tests--.text-component-spec]
            [quo2.components.selectors.--tests--.selectors-component-spec]
            [quo2.components.selectors.filter.component-spec]
            [quo2.components.record-audio.record-audio.--tests--.record-audio-component-spec]
            [quo2.components.record-audio.soundtrack.--tests--.soundtrack-component-spec])

Will the new component tests added not be inside a --test-- namespace?

Copy link
Member

Choose a reason for hiding this comment

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

Whoops, I meant -spec 😑

Copy link
Member

@J-Son89 J-Son89 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, adjust the quo2 namespace. other than that LGTM 👍

@@ -105,6 +106,9 @@
{:name :dynamic-button
:insets {:top false}
:component dynamic-button/preview-dynamic-button}]
:cards [{:name :small-option-card
Copy link
Member

Choose a reason for hiding this comment

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

this should be :on-boarding it's mapped to the Figma design file to keep it familiar to navigate

Copy link
Contributor Author

@ulisesmac ulisesmac Feb 13, 2023

Choose a reason for hiding this comment

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

OK! it's solved in 3bb7d95

@status-im-auto
Copy link
Member

69% of end-end tests have passed

Total executed tests: 26
Failed tests: 8
Passed tests: 18
IDs of failed tests: 702733,702855,702783,702851,702731,702839,702842,702838 

Failed tests (8)

Click to expand
  • Rerun failed tests

  • Class TestOneToOneChatMultipleSharedDevicesNewUi:

    1. test_1_1_chat_text_message_delete_push_disappear, id: 702733

    Device 2: Long press on `Button`
    Device 2: Find `Button` by `xpath`: `//*[@text="Delete for me"]`

    critical/chats/test_1_1_public_chats.py:1283: in test_1_1_chat_text_message_delete_push_disappear
        self.chat_2.delete_message_in_chat(message_to_delete_for_me, everyone=False)
    ../views/chat_view.py:890: in delete_message_in_chat
        for_everyone.click() if everyone else for_me.click()
    ../views/base_element.py:90: in click
        self.find_element().click()
    ../views/base_element.py:79: in find_element
        raise NoSuchElementException(
     Device 2: Button by xpath: `//*[@text="Delete for me"]` is not found on the screen
    



    Device sessions

    2. test_1_1_chat_edit_message, id: 702855

    Device 1: Looking for a message by text: AFTER
    Device 1: Find Text by xpath: //*[starts-with(@text,'AFTER')]/ancestor::android.view.ViewGroup[@content-desc='chat-item']//*[contains(@text, 'DEBUG')]

    critical/chats/test_1_1_public_chats.py:1257: in test_1_1_chat_edit_message
        if chat_element.status != 'edited':
    ../views/chat_view.py:194: in status
        result = re.search('\[(.*) DEBUG\]', Text(self.driver, prefix=self.locator, xpath="//*[contains(@text, 'DEBUG')]").text)
    ../views/base_element.py:361: in text
        text = self.find_element().text
    ../views/base_element.py:79: in find_element
        raise NoSuchElementException(
     Device 1: Text by xpath: `//*[starts-with(@text,'AFTER')]/ancestor::android.view.ViewGroup[@content-desc='chat-item']//*[contains(@text, 'DEBUG')]` is not found on the screen
    



    Device sessions

    3. test_1_1_chat_is_shown_message_sent_delivered_from_offline, id: 702783

    Device 2: Looking for a message by text: test message
    Device 2: Find Text by xpath: //*[starts-with(@text,'test message')]/ancestor::android.view.ViewGroup[@content-desc='chat-item']//*[contains(@text, 'DEBUG')]

    critical/chats/test_1_1_public_chats.py:1337: in test_1_1_chat_is_shown_message_sent_delivered_from_offline
        if not (chat_element.status == ':sending' or chat_element.status == ':sent'):
    ../views/chat_view.py:194: in status
        result = re.search('\[(.*) DEBUG\]', Text(self.driver, prefix=self.locator, xpath="//*[contains(@text, 'DEBUG')]").text)
    ../views/base_element.py:361: in text
        text = self.find_element().text
    ../views/base_element.py:79: in find_element
        raise NoSuchElementException(
     Device 2: Text by xpath: `//*[starts-with(@text,'test message')]/ancestor::android.view.ViewGroup[@content-desc='chat-item']//*[contains(@text, 'DEBUG')]` is not found on the screen
    



    Device sessions

    4. test_1_1_chat_pin_messages, id: 702731

    # STEP: Unpin one message and check it's unpinned for another user
    Device 1: Find Button by xpath: //*[starts-with(@text,'Message 4')]/ancestor::android.view.ViewGroup[@content-desc='chat-item']//*[starts-with(@text,'[:')]

    critical/chats/test_1_1_public_chats.py:1135: in test_1_1_chat_pin_messages
        message_element.long_press_element()
    ../views/base_element.py:278: in long_press_element
        element = self.find_element()
    ../views/base_element.py:79: in find_element
        raise NoSuchElementException(
     Device 1: Button by xpath: `//*[starts-with(@text,'Message 4')]/ancestor::android.view.ViewGroup[@content-desc='chat-item']//*[starts-with(@text,'[:')]` is not found on the screen
    



    Device sessions

    Class TestActivityCenterMultipleDevicePR:

    1. test_activity_center_mentions_in_community_jump_to, id: 702851

    Device 2: Find Button by accessibility id: new-contact-button
    Device 2: Find Button by accessibility id: Add to contacts-item-button

    medium/test_activity_center.py:243: in test_activity_center_mentions_in_community_jump_to
        self.profile_2.add_contact_via_contacts_list(self.public_key_1)
    ../views/profile_view.py:373: in add_contact_via_contacts_list
        chat.profile_add_to_contacts.click()
    ../views/base_element.py:90: in click
        self.find_element().click()
    ../views/base_element.py:79: in find_element
        raise NoSuchElementException(
     Device 2: Button by accessibility id: `Add to contacts-item-button` is not found on the screen 
    

    [[blocked by 14798]]

    Device sessions

    Class TestCommunityMultipleDeviceMerged:

    1. test_community_message_delete, id: 702839

    Device 2: Looking for a message by text: delete for me
    Device 1: Looking for a message by text: delete for me

    critical/test_public_chat_browsing.py:668: in test_community_message_delete
        self.errors.verify_no_errors()
    base_test_case.py:182: in verify_no_errors
        pytest.fail('\n '.join([self.errors.pop(0) for _ in range(len(self.errors))]))
     System message about deletion for everyone is not displayed
    



    Device sessions

    2. test_community_mark_all_messages_as_read, id: 702842

    Device 2: Tap on found: SendMessageButton
    Device 1: Looking for chat: '# yfajtrt'

    critical/test_public_chat_browsing.py:782: in test_community_mark_all_messages_as_read
        chan_1_element.long_press_element()
    ../views/base_element.py:278: in long_press_element
        element = self.find_element()
    ../views/home_view.py:51: in find_element
        self.wait_for_visibility_of_element(20)
    ../views/base_element.py:134: in wait_for_visibility_of_element
        raise TimeoutException(
     Device 1: ChatElement by xpath:`//*[@content-desc='chat-name-text'][starts-with(@text,'# yfajtrt')]/..` is not found on the screen after wait_for_visibility_of_element 
    

    [[blocked due to navigation issue 14906]]

    Device sessions

    3. test_community_message_send_check_timestamps_sender_username, id: 702838

    Device 2: Verifying that 'hello' is under today
    Device 2: Looking for a message by text: hello

    critical/test_public_chat_browsing.py:628: in test_community_message_send_check_timestamps_sender_username
        channel.verify_message_is_under_today_text(message, self.errors)
    ../views/chat_view.py:851: in verify_message_is_under_today_text
        message_element.wait_for_visibility_of_element()
    ../views/base_element.py:134: in wait_for_visibility_of_element
        raise TimeoutException(
     Device 2: ChatElementByText by xpath:`//*[starts-with(@text,'hello')]/ancestor::android.view.ViewGroup[@content-desc='chat-item']` is not found on the screen after wait_for_visibility_of_element 
    

    [[blocked by 14797]]

    Device sessions

    Passed tests (18)

    Click to expand

    Class TestGroupChatMultipleDeviceMergedNewUI:

    1. test_group_chat_pin_messages, id: 702732
    Device sessions

    2. test_group_chat_join_send_text_messages_push, id: 702807
    Device sessions

    3. test_group_chat_offline_pn, id: 702808
    Device sessions

    Class TestOneToOneChatMultipleSharedDevicesNewUi:

    1. test_1_1_chat_non_latin_messages_stack_update_profile_photo, id: 702745
    Device sessions

    2. test_1_1_chat_message_reaction, id: 702730
    Device sessions

    3. test_1_1_chat_emoji_send_reply_and_open_link, id: 702782
    Device sessions

    4. test_1_1_chat_push_emoji, id: 702813
    Device sessions

    5. test_1_1_chat_delete_via_long_press_relogin, id: 702784
    Device sessions

    Class TestCommunityOneDeviceMerged:

    1. test_community_navigate_to_channel_when_relaunch, id: 702846
    Device sessions

    Class TestCommunityMultipleDeviceMerged:

    1. test_community_emoji_send_copy_paste_reply, id: 702840
    Device sessions

    2. test_community_links_with_previews_github_youtube_twitter_gif_send_enable, id: 702844
    Device sessions

    3. test_community_leave, id: 702845
    Device sessions

    4. test_community_unread_messages_badge, id: 702841
    Device sessions

    5. test_community_message_edit, id: 702843
    Device sessions

    Class TestActivityCenterMultipleDevicePR:

    1. test_activity_center_decline_contact_request_no_pn, id: 702850
    Device sessions

    Class TestDeeplinkOneDeviceNewUI:

    1. test_public_chat_open_using_deep_link, id: 702776
    Device sessions

    2. test_deep_link_with_invalid_user_public_key_own_profile_key, id: 702774
    Device sessions

    3. test_deep_link_open_user_profile, id: 702775
    Device sessions

    @flexsurfer flexsurfer changed the title 15019 small option card component [#15019] small option card component Feb 14, 2023
    Copy link
    Contributor

    @ilmotta ilmotta left a comment

    Choose a reason for hiding this comment

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

    It's hard to check if the source's uri passed to a fast-image is correct. so I'm just testing that the fast-image is rendered.

    I actually think it's good that we don't test the URIs because it's not the component's responsibility to check their existence/validity. The component just knows "gives me a URI and I'll do my best to render that".

    (let [title "A title"
    subtitle "A subtitle"
    component-props {:title title :subtitle subtitle}]
    (h/test "Title & subtitle are rendered - `:main` variant"
    Copy link
    Contributor

    Choose a reason for hiding this comment

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

    We can clearly see the test descriptions have duplicated prefixes to sort of "group tests", but JS test runners accept nested describes also for this very purpose. I think we should use this capability instead of duplicated prefixes.

    In the future, we can also extend the h/describe macro to accept :only or :skip options, so we can easily narrow/skip blocks of tests (very common approach in Jest).

    So my suggestion goes like this:

    (h/describe "small-option-card"
      (h/describe "Title & subtitle are rendered"
        (let [title           "A title"
              subtitle        "A subtitle"
              component-props {:title title :subtitle subtitle}]
          (h/test "`:main` variant"
            (h/render (testing-small-option-card :main component-props))
            (-> (h/get-by-text title) h/expect .toBeTruthy)
            (-> (h/get-by-text subtitle) h/expect .toBeTruthy))
    
          (h/test "`:icon` variant"
            (h/render (testing-small-option-card :icon component-props))
            (-> (h/get-by-text title) h/expect .toBeTruthy)
            (-> (h/get-by-text subtitle) h/expect .toBeTruthy)))))

    Copy link
    Contributor Author

    Choose a reason for hiding this comment

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

    Cool! I'll do it, previously I tried to nest h/test but got an error 😅 thanks for the advice

    Copy link
    Contributor Author

    Choose a reason for hiding this comment

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

    Solved in b28910f :)

    [rn/view {:style style/icon-variant}
    [rn/view {:style style/icon-variant-image-container}
    [fast-image/fast-image
    {:test-ID :small-option-card.icon-image
    Copy link
    Contributor

    Choose a reason for hiding this comment

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

    I believe we preferred to use accessibility labels to find elements instead of :test-ID. @J-Son89? The accessibility labels also end up being useful for e2e tests in Appium, so it's a win-win if we can use them.

    It would be nice to have this in the guidelines too. We already have a section on accessibility labels, so it's easy to add another sub section saying they should preferably be used for component tests instead of :test-ID.

    Copy link
    Member

    Choose a reason for hiding this comment

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

    Yeah that's true actually, in this case it depends whether the devs of that package fast-image have provided accessibility label as a prop. We should add to the docs as you said.

    Copy link
    Contributor Author

    Choose a reason for hiding this comment

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

    Ok, it''s fixed in 565e490

    @ulisesmac
    Copy link
    Contributor Author

    It's hard to check if the source's uri passed to a fast-image is correct. so I'm just testing that the fast-image is rendered.

    I actually think it's good that we don't test the URIs because it's not the component's responsibility to check their existence/validity. The component just knows "gives me a URI and I'll do my best to render that".

    @ilmotta Well, I was trying to test that if the URI received is correctly used in the images we expect to use them. But thinking more about it, probably it is a redundant test.

    Copy link
    Contributor

    @ilmotta ilmotta left a comment

    Choose a reason for hiding this comment

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

    Solid work @ulisesmac 🚀

    @ulisesmac
    Copy link
    Contributor Author

    Solid work @ulisesmac rocket

    @ilmotta Is this ready to merge?

    @ilmotta
    Copy link
    Contributor

    ilmotta commented Feb 14, 2023

    Solid work @ulisesmac rocket

    @ilmotta Is this ready to merge?

    Yes @ulisesmac, I approved 1h ago already. The code looks good to me. It's up to you if you want to merge it or if you prefer to wait/ask for feedback from other collaborators you assigned as reviewers.

    Given that the component does not affect production screens, it should be safe to merge. Sometimes it's a good idea to collect feedback from designers after the merge if you think the component has something to improve. It's a case by case decision of course :)

    @ulisesmac
    Copy link
    Contributor Author

    Solid work @ulisesmac rocket

    @ilmotta Is this ready to merge?

    Yes @ulisesmac, I approved 1h ago already. The code looks good to me. It's up to you if you want to merge it or if you prefer to wait/ask for feedback from other collaborators you assigned as reviewers.

    Given that the component does not affect production screens, it should be safe to merge. Sometimes it's a good idea to collect feedback from designers after the merge if you think the component has something to improve. It's a case by case decision of course :)

    Got it! thanks

    @ulisesmac ulisesmac merged commit 8ff7a16 into develop Feb 14, 2023
    Pipeline for QA automation moved this from E2E Tests to DONE Feb 14, 2023
    @ulisesmac ulisesmac deleted the 15019-small-option-card-component branch February 14, 2023 22:06
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    None yet
    Projects
    Archived in project
    Development

    Successfully merging this pull request may close these issues.

    Implement Quo2 component - Onboarding/ small option card
    4 participants