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
"type: default, secondary, grey, outline
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)
text-color (or override-text-color
(if (or
@ -38,7 +38,9 @@
1 16
2 20
28)]
[rn/view {:style (cond-> (merge
[rn/view {:accessible true
:accessibility-label accessibility-label
:style (cond-> (merge
{:align-items :center
:justify-content :center
:border-radius 6

View File

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

View File

@ -396,72 +396,72 @@ class TestDeeplinkOneDeviceNewUI(MultipleSharedDeviceTestCase):
self.driver.fail("User profile screen is not opened")
self.errors.verify_no_errors()
@marks.testrail_id(702777)
@marks.skip(reason="Skipping until chat names are implemented in new UI")
def test_scan_qr_with_scan_contact_code_via_start_chat(self):
# @marks.testrail_id(702777)
# @marks.skip(reason="Skipping until chat names are implemented in new UI")
# def test_scan_qr_with_scan_contact_code_via_start_chat(self):
url_data = {
'ens_with_stateofus_domain_deep_link': {
'url': 'https://join.status.im/u/%s.stateofus.eth' % 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': {
'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'
},
}
# url_data = {
# 'ens_with_stateofus_domain_deep_link': {
# 'url': 'https://join.status.im/u/%s.stateofus.eth' % 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': {
# '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:
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)
contacts = self.home.start_new_chat_button.click()
self.home.just_fyi('Checking scanning qr for "%s" case' % key)
contacts.scan_contact_code_button.click()
contacts.allow_button.click_if_shown(3)
contacts.enter_qr_edit_box.scan_qr(url_data[key]['url'])
chat = ChatView(self.drivers[0])
if url_data[key].get('error'):
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'])
chat.ok_button.click()
if url_data[key].get('username'):
if not chat.chat_message_input.is_element_displayed():
self.errors.append(
'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():
self.errors.append('In "%s" case "%s" not found after scanning' % (key, url_data[key]['username']))
chat.get_back_to_home_view()
self.errors.verify_no_errors()
# for key in url_data:
# 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)
# contacts = self.home.start_new_chat_button.click()
# self.home.just_fyi('Checking scanning qr for "%s" case' % key)
# contacts.scan_contact_code_button.click()
# contacts.allow_button.click_if_shown(3)
# contacts.enter_qr_edit_box.scan_qr(url_data[key]['url'])
# chat = ChatView(self.drivers[0])
# if url_data[key].get('error'):
# 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'])
# chat.ok_button.click()
# if url_data[key].get('username'):
# if not chat.chat_message_input.is_element_displayed():
# self.errors.append(
# '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():
# self.errors.append('In "%s" case "%s" not found after scanning' % (key, url_data[key]['username']))
# chat.get_back_to_home_view()
# self.errors.verify_no_errors()

View File

@ -207,7 +207,9 @@ class HomeView(BaseView):
# Notification centre
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_reject_and_delete_button = Button(self.driver, accessibility_id="reject-and-delete"
"-activity-center")
@ -257,7 +259,8 @@ class HomeView(BaseView):
self.driver.info("Looking for chat: '%s'" % username)
chat_element = ChatElement(self.driver, username[:25], community=community)
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.wait_for_element(20)
chat_in_ac.click()
@ -274,7 +277,8 @@ class HomeView(BaseView):
return chat_element
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])
if accept:
self.driver.info("Accepting contact request for %s" % username)