chore: fix issues with e2e tests after refactors (#14440)

This commit is contained in:
Jamie Caprani 2022-11-28 11:17:12 +00:00 committed by GitHub
parent 0e614d51ef
commit 6d5ff4aa92
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 82 additions and 73 deletions

View File

@ -20,7 +20,7 @@
(defn counter (defn counter
"type: default, secondary, grey, outline "type: default, secondary, grey, outline
value: integer" value: integer"
[{:keys [type override-text-color override-bg-color style]} value] [{:keys [type override-text-color override-bg-color style accessibility-label]} value]
(let [type (or type :default) (let [type (or type :default)
text-color (or override-text-color text-color (or override-text-color
(if (or (if (or
@ -38,7 +38,9 @@
1 16 1 16
2 20 2 20
28)] 28)]
[rn/view {:style (cond-> (merge [rn/view {:accessible true
:accessibility-label accessibility-label
:style (cond-> (merge
{:align-items :center {:align-items :center
:justify-content :center :justify-content :center
:border-radius 6 :border-radius 6

View File

@ -94,14 +94,17 @@
:open-activity-center-button button-common-props]] :open-activity-center-button button-common-props]]
(when new-notifications? (when new-notifications?
(if (= notification-indicator :counter) (if (= notification-indicator :counter)
[quo/counter {:outline false [quo/counter {:accessibility-label :notifications-unread-badge
:outline false
:override-text-color colors/white :override-text-color colors/white
:override-bg-color colors/primary-50 :override-bg-color colors/primary-50
:style {:position :absolute :style {:position :absolute
:left 34 :left 34
:top -6}} :top -6}}
counter-label] counter-label]
[rn/view {:style {:width 8 [rn/view {:accessible true
:accessibility-label :notifications-unread-badge
:style {:width 8
:height 8 :height 8
:border-radius 4 :border-radius 4
:top -2 :top -2

View File

@ -396,72 +396,72 @@ class TestDeeplinkOneDeviceNewUI(MultipleSharedDeviceTestCase):
self.driver.fail("User profile screen is not opened") self.driver.fail("User profile screen is not opened")
self.errors.verify_no_errors() self.errors.verify_no_errors()
@marks.testrail_id(702777) # @marks.testrail_id(702777)
@marks.skip(reason="Skipping until chat names are implemented in new UI") # @marks.skip(reason="Skipping until chat names are implemented in new UI")
def test_scan_qr_with_scan_contact_code_via_start_chat(self): # def test_scan_qr_with_scan_contact_code_via_start_chat(self):
url_data = { # url_data = {
'ens_with_stateofus_domain_deep_link': { # 'ens_with_stateofus_domain_deep_link': {
'url': 'https://join.status.im/u/%s.stateofus.eth' % ens_user_message_sender['ens'], # 'url': 'https://join.status.im/u/%s.stateofus.eth' % ens_user_message_sender['ens'],
'username': '@%s' % ens_user_message_sender['ens'] # 'username': '@%s' % ens_user_message_sender['ens']
},
'ens_without_stateofus_domain_deep_link': {
'url': 'https://join.status.im/u/%s' % ens_user_message_sender['ens'],
'username': '@%s' % ens_user_message_sender['ens']
},
'ens_another_domain_deep_link': {
'url': 'status-im://u/%s' % ens_user['ens'],
'username': '@%s' % ens_user['ens']
},
'own_profile_key_deep_link': {
'url': 'https://join.status.im/u/%s' % self.public_key,
'error': "That's you"
},
'other_user_profile_key_deep_link': {
'url': 'https://join.status.im/u/%s' % transaction_senders['M']['public_key'],
'username': transaction_senders['M']['username']
},
'other_user_profile_key_deep_link_invalid': {
'url': 'https://join.status.im/u/%sinvalid' % ens_user['public_key'],
'error': 'Please enter or scan a valid chat key'
},
'own_profile_key': {
'url': self.public_key,
'error': "That's you"
},
# 'ens_without_stateofus_domain': {
# 'url': ens_user['ens'],
# 'username': ens_user['username']
# }, # },
'other_user_profile_key': { # 'ens_without_stateofus_domain_deep_link': {
'url': transaction_senders['M']['public_key'], # 'url': 'https://join.status.im/u/%s' % ens_user_message_sender['ens'],
'username': transaction_senders['M']['username'] # 'username': '@%s' % ens_user_message_sender['ens']
}, # },
'other_user_profile_key_invalid': { # 'ens_another_domain_deep_link': {
'url': '%s123' % ens_user['public_key'], # 'url': 'status-im://u/%s' % ens_user['ens'],
'error': 'Please enter or scan a valid chat key' # 'username': '@%s' % ens_user['ens']
}, # },
} # 'own_profile_key_deep_link': {
# 'url': 'https://join.status.im/u/%s' % self.public_key,
# 'error': "That's you"
# },
# 'other_user_profile_key_deep_link': {
# 'url': 'https://join.status.im/u/%s' % transaction_senders['M']['public_key'],
# 'username': transaction_senders['M']['username']
# },
# 'other_user_profile_key_deep_link_invalid': {
# 'url': 'https://join.status.im/u/%sinvalid' % ens_user['public_key'],
# 'error': 'Please enter or scan a valid chat key'
# },
# 'own_profile_key': {
# 'url': self.public_key,
# 'error': "That's you"
# },
# # 'ens_without_stateofus_domain': {
# # 'url': ens_user['ens'],
# # 'username': ens_user['username']
# # },
# 'other_user_profile_key': {
# 'url': transaction_senders['M']['public_key'],
# 'username': transaction_senders['M']['username']
# },
# 'other_user_profile_key_invalid': {
# 'url': '%s123' % ens_user['public_key'],
# 'error': 'Please enter or scan a valid chat key'
# },
# }
for key in url_data: # for key in url_data:
self.home.chats_tab.click_until_presence_of_element(self.home.plus_button) # self.home.chats_tab.click_until_presence_of_element(self.home.plus_button)
self.home.plus_button.click_until_presence_of_element(self.home.start_new_chat_button) # self.home.plus_button.click_until_presence_of_element(self.home.start_new_chat_button)
contacts = self.home.start_new_chat_button.click() # contacts = self.home.start_new_chat_button.click()
self.home.just_fyi('Checking scanning qr for "%s" case' % key) # self.home.just_fyi('Checking scanning qr for "%s" case' % key)
contacts.scan_contact_code_button.click() # contacts.scan_contact_code_button.click()
contacts.allow_button.click_if_shown(3) # contacts.allow_button.click_if_shown(3)
contacts.enter_qr_edit_box.scan_qr(url_data[key]['url']) # contacts.enter_qr_edit_box.scan_qr(url_data[key]['url'])
chat = ChatView(self.drivers[0]) # chat = ChatView(self.drivers[0])
if url_data[key].get('error'): # if url_data[key].get('error'):
if not chat.element_by_text_part(url_data[key]['error']).is_element_displayed(): # if not chat.element_by_text_part(url_data[key]['error']).is_element_displayed():
self.errors.append('Expected error %s is not shown' % url_data[key]['error']) # self.errors.append('Expected error %s is not shown' % url_data[key]['error'])
chat.ok_button.click() # chat.ok_button.click()
if url_data[key].get('username'): # if url_data[key].get('username'):
if not chat.chat_message_input.is_element_displayed(): # if not chat.chat_message_input.is_element_displayed():
self.errors.append( # self.errors.append(
'In "%s" case chat input is not found after scanning, so no redirect to 1-1' % key) # 'In "%s" case chat input is not found after scanning, so no redirect to 1-1' % key)
if not chat.element_by_text(url_data[key]['username']).is_element_displayed(): # if not chat.element_by_text(url_data[key]['username']).is_element_displayed():
self.errors.append('In "%s" case "%s" not found after scanning' % (key, url_data[key]['username'])) # self.errors.append('In "%s" case "%s" not found after scanning' % (key, url_data[key]['username']))
chat.get_back_to_home_view() # chat.get_back_to_home_view()
self.errors.verify_no_errors() # self.errors.verify_no_errors()

View File

@ -207,7 +207,9 @@ class HomeView(BaseView):
# Notification centre # Notification centre
self.notifications_button = Button(self.driver, accessibility_id="notifications-button") self.notifications_button = Button(self.driver, accessibility_id="notifications-button")
self.notifications_unread_badge = Button(self.driver, accessibility_id="notifications-unread-badge") self.notifications_unread_badge = BaseElement(self.driver, accessibility_id="notifications-unread-badge")
self.open_activity_center_button = Button(self.driver, accessibility_id="open-activity-center-button")
self.notifications_select_button = Button(self.driver, translation_id="select") self.notifications_select_button = Button(self.driver, translation_id="select")
self.notifications_reject_and_delete_button = Button(self.driver, accessibility_id="reject-and-delete" self.notifications_reject_and_delete_button = Button(self.driver, accessibility_id="reject-and-delete"
"-activity-center") "-activity-center")
@ -257,7 +259,8 @@ class HomeView(BaseView):
self.driver.info("Looking for chat: '%s'" % username) self.driver.info("Looking for chat: '%s'" % username)
chat_element = ChatElement(self.driver, username[:25], community=community) chat_element = ChatElement(self.driver, username[:25], community=community)
if not chat_element.is_element_displayed(10): if not chat_element.is_element_displayed(10):
self.notifications_unread_badge.wait_and_click(wait_time) if self.notifications_unread_badge.is_element_displayed(30):
self.open_activity_center_button.click()
chat_in_ac = ActivityCenterChatElement(self.driver, username[:25]) chat_in_ac = ActivityCenterChatElement(self.driver, username[:25])
chat_in_ac.wait_for_element(20) chat_in_ac.wait_for_element(20)
chat_in_ac.click() chat_in_ac.click()
@ -274,7 +277,8 @@ class HomeView(BaseView):
return chat_element return chat_element
def handle_contact_request(self, username: str, accept=True): def handle_contact_request(self, username: str, accept=True):
self.notifications_unread_badge.wait_and_click() if self.notifications_unread_badge.is_element_displayed(30):
self.open_activity_center_button.click()
chat_element = ActivityCenterChatElement(self.driver, username[:25]) chat_element = ActivityCenterChatElement(self.driver, username[:25])
if accept: if accept:
self.driver.info("Accepting contact request for %s" % username) self.driver.info("Accepting contact request for %s" % username)