diff --git a/ci/tests/Jenkinsfile.e2e-nightly b/ci/tests/Jenkinsfile.e2e-nightly index d686c5de54..d04fae4243 100644 --- a/ci/tests/Jenkinsfile.e2e-nightly +++ b/ci/tests/Jenkinsfile.e2e-nightly @@ -62,7 +62,7 @@ pipeline { --rerun_count=2 \ --testrail_report=True \ -m testrail_id \ - -m \"not upgrade\" \ + -m \"new_ui_critical\" \ -k \"${params.KEYWORD_EXPRESSION}\" \ --apk=${params.APK_NAME} """ diff --git a/ci/tests/Jenkinsfile.e2e-prs b/ci/tests/Jenkinsfile.e2e-prs index ad5710560a..2a6f45d5c9 100644 --- a/ci/tests/Jenkinsfile.e2e-prs +++ b/ci/tests/Jenkinsfile.e2e-prs @@ -14,7 +14,7 @@ pipeline { string( name: 'TEST_MARKERS', description: 'Marker expression for matching tests to run.', - defaultValue: 'critical', + defaultValue: 'new_ui_critical', ) */ string( name: 'APK_NAME', diff --git a/test/appium/support/testrail_report.py b/test/appium/support/testrail_report.py index 425d290b6e..56bd660d22 100644 --- a/test/appium/support/testrail_report.py +++ b/test/appium/support/testrail_report.py @@ -22,7 +22,8 @@ class TestrailReport(BaseTestReport): self.user = environ.get('TESTRAIL_USER') self.run_id = None - self.suite_id = 48 + #self.suite_id = 48 + self.suite_id = 5274 self.project_id = 14 self.outcomes = { @@ -104,43 +105,47 @@ class TestrailReport(BaseTestReport): test_cases['pr'] = dict() test_cases['nightly'] = dict() test_cases['upgrade'] = dict() - ## PR e2e - test_cases['pr']['critical'] = 730 - test_cases['pr']['contacts'] = 50831 - test_cases['pr']['public_chat'] = 50654 - test_cases['pr']['one_to_one_chat'] = 50655 - test_cases['pr']['group_chat'] = 50656 - test_cases['pr']['onboarding'] = 50659 - test_cases['pr']['recovery'] = 50660 - test_cases['pr']['wallet'] = 50661 - test_cases['pr']['send_tx'] = 50662 - test_cases['pr']['keycard_tx'] = 50663 - test_cases['pr']['1_1_chat_commands'] = 50825 - test_cases['pr']['ens'] = 50827 - test_cases['pr']['sync'] = 50834 - test_cases['pr']['browser'] = 50812 + ## PR e2e old UI + # test_cases['pr']['critical'] = 730 + # test_cases['pr']['contacts'] = 50831 + # test_cases['pr']['public_chat'] = 50654 + # test_cases['pr']['one_to_one_chat'] = 50655 + # test_cases['pr']['group_chat'] = 50656 + # test_cases['pr']['onboarding'] = 50659 + # test_cases['pr']['recovery'] = 50660 + # test_cases['pr']['wallet'] = 50661 + # test_cases['pr']['send_tx'] = 50662 + # test_cases['pr']['keycard_tx'] = 50663 + # test_cases['pr']['1_1_chat_commands'] = 50825 + # test_cases['pr']['ens'] = 50827 + # test_cases['pr']['sync'] = 50834 + # test_cases['pr']['browser'] = 50812 + + test_cases['pr']['critical'] = 50955 + test_cases['pr']['one_to_one_chat'] = 50956 + ## Nightly e2e - test_cases['nightly']['medium'] = 736 - test_cases['nightly']['chat'] = 50811 - test_cases['nightly']['browser'] = 50826 - test_cases['nightly']['profile'] = 50828 - test_cases['nightly']['deep_link'] = 50836 - test_cases['nightly']['share_profile'] = 50837 - test_cases['nightly']['chat_2'] = 50838 - test_cases['nightly']['group_chat'] = 50839 - test_cases['nightly']['pairing'] = 50840 - test_cases['nightly']['activity_center'] = 50833 - test_cases['nightly']['timeline'] = 50842 - test_cases['nightly']['community'] = 50841 - test_cases['nightly']['permissions'] = 50843 - test_cases['nightly']['scan qr'] = 50844 - test_cases['nightly']['mentions'] = 50845 - test_cases['nightly']['mutual_contact_requests'] = 50857 - test_cases['nightly']['keycard'] = 50850 - test_cases['nightly']['wallet'] = 50851 + # test_cases['nightly']['medium'] = 736 + # test_cases['nightly']['chat'] = 50811 + # test_cases['nightly']['browser'] = 50826 + # test_cases['nightly']['profile'] = 50828 + # test_cases['nightly']['deep_link'] = 50836 + # test_cases['nightly']['share_profile'] = 50837 + # test_cases['nightly']['chat_2'] = 50838 + # test_cases['nightly']['group_chat'] = 50839 + # test_cases['nightly']['pairing'] = 50840 + # test_cases['nightly']['activity_center'] = 50833 + # test_cases['nightly']['timeline'] = 50842 + # test_cases['nightly']['community'] = 50841 + # test_cases['nightly']['permissions'] = 50843 + # test_cases['nightly']['scan qr'] = 50844 + # test_cases['nightly']['mentions'] = 50845 + # test_cases['nightly']['mutual_contact_requests'] = 50857 + # test_cases['nightly']['keycard'] = 50850 + # test_cases['nightly']['wallet'] = 50851 ## Upgrade e2e - test_cases['upgrade']['general'] = 881 + # test_cases['upgrade']['general'] = 881 case_ids = list() for arg in argv: @@ -148,7 +153,8 @@ class TestrailReport(BaseTestReport): key, value = arg.split('=') case_ids = value.split(',') if len(case_ids) == 0: - if 'critical' in argv: + # if 'critical' in argv: + if 'new_ui_critical' in argv: for category in test_cases['pr']: for case in self.get_cases([test_cases['pr'][category]]): case_ids.append(case['id']) diff --git a/test/appium/tests/__init__.py b/test/appium/tests/__init__.py index cb2798d7ee..22d7dc2302 100644 --- a/test/appium/tests/__init__.py +++ b/test/appium/tests/__init__.py @@ -60,7 +60,7 @@ test_dapp_web_url = "status-im.github.io/dapp" test_dapp_url = 'https://simpledapp.status.im/' test_dapp_name = 'simpledapp.status.im' -emojis = {'thumbs-up': 2, 'thumbs-down': 3, 'love': 1, 'laugh': 4, 'angry': 6, 'sad': 5} +emojis = {'thumbs-up': 5, 'thumbs-down': 6, 'love': 1, 'laugh': 4, 'angry': 2, 'sad': 3} with open(os.sep.join(__file__.split(os.sep)[:-1]) + '/../../../translations/en.json') as json_file: diff --git a/test/appium/tests/critical/chats/test_1_1_public_chats.py b/test/appium/tests/critical/chats/test_1_1_public_chats.py index a057cbd7f9..e98a5524f2 100644 --- a/test/appium/tests/critical/chats/test_1_1_public_chats.py +++ b/test/appium/tests/critical/chats/test_1_1_public_chats.py @@ -1212,3 +1212,51 @@ class TestEnsStickersMultipleDevicesMerged(MultipleSharedDeviceTestCase): and account.qr_code_image.is_element_displayed()): self.errors.append('No self profile pop-up data displayed after My_profile button tap') self.errors.verify_no_errors() + + +@pytest.mark.xdist_group(name="one_2") +@marks.new_ui_critical +class TestOneToOneChatMultipleSharedDevices(MultipleSharedDeviceTestCase): + + def prepare_devices(self): + self.drivers, self.loop = create_shared_drivers(2) + self.device_1, self.device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1]) + self.home_1 = self.device_1.create_user(enable_notifications=True) + self.home_2 = self.device_2.create_user(enable_notifications=True) + self.home_1.browser_tab.click() #temp, until profile is on browser tab + self.profile_1 = self.home_1.get_profile_view() + self.default_username_1 = self.profile_1.default_username_text.text + self.profile_1.chats_tab.click() + self.public_key_2, self.default_username_2 = self.home_2.get_public_key_and_username(return_username=True) + self.chat_1 = self.home_1.add_contact(self.public_key_2) + self.chat_1.send_message('hey') + self.home_2.click_system_back_button_until_element_is_shown() + self.home_2.chats_tab.click() + self.chat_2 = self.home_2.get_chat(self.default_username_1).click() + + @marks.testrail_id(702730) + def test_1_1_chat_message_reaction(self): + message_from_sender = "Message sender" + self.device_1.just_fyi("Sender start 1-1 chat, set emoji and check counter") + self.chat_1.send_message(message_from_sender) + self.chat_1.set_reaction(message_from_sender) + + message_sender = self.chat_1.chat_element_by_text(message_from_sender) + if message_sender.emojis_below_message() != 1: + self.errors.append("Counter of reaction is not updated on your own message!") + + self.device_2.just_fyi("Receiver sets own emoji and verifies counter on received message in 1-1 chat") + message_receiver = self.chat_2.chat_element_by_text(message_from_sender) + if message_receiver.emojis_below_message() != 1: + self.errors.append("Counter of reaction is not updated on received message!") + self.chat_2.set_reaction(message_from_sender) + for counter in message_sender.emojis_below_message(), message_receiver.emojis_below_message(): + if counter != 2: + self.errors.append('Counter is not updated after setting emoji from receiver!') + + self.device_2.just_fyi("Receiver pick the same emoji and verify that counter will decrease for both users") + self.chat_2.set_reaction(message_from_sender) + for counter in message_sender.emojis_below_message(), message_receiver.emojis_below_message(): + if counter != 1: + self.errors.append('Counter is not decreased after re-tapping emoji from receiver!') + self.errors.verify_no_errors() diff --git a/test/appium/tests/marks.py b/test/appium/tests/marks.py index 7421bb2759..24770fff14 100644 --- a/test/appium/tests/marks.py +++ b/test/appium/tests/marks.py @@ -4,6 +4,8 @@ testrail_case_id = pytest.mark.testrail_case_id testrail_id = pytest.mark.testrail_id # atomic tests critical = pytest.mark.critical medium = pytest.mark.medium +# new ui +new_ui_critical = pytest.mark.new_ui_critical flaky = pytest.mark.flaky upgrade = pytest.mark.upgrade diff --git a/test/appium/views/base_view.py b/test/appium/views/base_view.py index 08dfcfa86f..fe3e5052dc 100644 --- a/test/appium/views/base_view.py +++ b/test/appium/views/base_view.py @@ -79,8 +79,28 @@ class HomeButton(TabButton): self.click_until_presence_of_element(element) return self.navigate() +class CommunitiesTab(TabButton): + def __init__(self, driver): + super().__init__(driver, accessibility_id="communities-stack-tab") +class ChatsTab(TabButton): + def __init__(self, driver): + super().__init__(driver, accessibility_id="chats-stack-tab") + + def navigate(self): + from views.home_view import HomeView + return HomeView(self.driver) + + +class WalletTab(TabButton): + def __init__(self, driver): + super().__init__(driver, accessibility_id="wallet-stack-tab") + +class BrowserTab(TabButton): + def __init__(self, driver): + super().__init__(driver, accessibility_id="browser-stack-tab") + class DappTabButton(TabButton): def __init__(self, driver): super().__init__(driver, xpath="//*[contains(@content-desc,'tab, 2 out of 5')]") @@ -224,13 +244,19 @@ class BaseView(object): self.send_message_button = SendMessageButton(self.driver) self.send_contact_request_button = Button(self.driver, translation_id="send-request") - # Tabs + # Old UI Tabs self.home_button = HomeButton(self.driver) self.wallet_button = WalletButton(self.driver) self.profile_button = ProfileButton(self.driver) self.dapp_tab_button = DappTabButton(self.driver) self.status_button = StatusButton(self.driver) + # New UI Tabs + self.communities_tab = CommunitiesTab(self.driver) + self.chats_tab = ChatsTab(self.driver) + self.browser_tab = BrowserTab(self.driver) + self.wallet_tab = WalletTab(self.driver) + self.yes_button = Button(self.driver, xpath="//*[@text='YES' or @text='GOT IT']") self.no_button = Button(self.driver, translation_id="no") self.back_button = BackButton(self.driver) @@ -351,7 +377,9 @@ class BaseView(object): def click_system_back_button_until_element_is_shown(self, attempts=3, element='home'): counter = 0 if element == 'home': - element = self.home_button + element = self.chats_tab + # Old UI + # element = self.home_button while not element.is_element_displayed(1) and counter <= attempts: self.driver.press_keycode(4) try: @@ -573,7 +601,9 @@ class BaseView(object): def get_public_key_and_username(self, return_username=False): self.driver.info("Get public key and username") - profile_view = self.profile_button.click() + # profile_view = self.profile_button.click() + self.browser_tab.click() # temp, until profile is on browser tab + profile_view = self.get_profile_view() default_username = profile_view.default_username_text.text profile_view.share_my_profile_button.click() profile_view.public_key_text.wait_for_visibility_of_element(20) diff --git a/test/appium/views/chat_view.py b/test/appium/views/chat_view.py index e41af85cae..7be0a69c47 100644 --- a/test/appium/views/chat_view.py +++ b/test/appium/views/chat_view.py @@ -228,26 +228,43 @@ class ChatElementByText(Text): return RepliedToUsernameText(self.driver, self.message_locator).text except NoSuchElementException: return '' + # Old UI + # def emojis_below_message(self, emoji: str = 'thumbs-up', own=True): + # class EmojisNumber(Text): + # def __init__(self, driver, parent_locator: str): + # self.own = own + # self.emoji = emoji + # self.emojis_id = 'emoji-' + str(emojis[self.emoji]) + '-is-own-' + str(self.own).lower() + # super().__init__(driver, prefix=parent_locator, xpath="/../..//*[@content-desc='%s']" % self.emojis_id) + # + # @property + # def text(self): + # try: + # text = self.find_element().text + # self.driver.info("%s is '%s' for '%s' where my reaction is set on message is '%s'" % (self.name, text, self.emoji, str(self.own))) + # return text + # except NoSuchElementException: + # return 0 + # + # return int(EmojisNumber(self.driver, self.locator).text) - def emojis_below_message(self, emoji: str = 'thumbs-up', own=True): + def emojis_below_message(self, emoji: str = 'thumbs-up'): class EmojisNumber(Text): def __init__(self, driver, parent_locator: str): - self.own = own self.emoji = emoji - self.emojis_id = 'emoji-' + str(emojis[self.emoji]) + '-is-own-' + str(self.own).lower() - super().__init__(driver, prefix=parent_locator, xpath="/../..//*[@content-desc='%s']" % self.emojis_id) + self.emojis_id = 'emoji-reaction-%s' % str(emojis[self.emoji]) + super().__init__(driver, prefix=parent_locator, xpath="/../..//*[@content-desc='%s']/android.widget.TextView" % self.emojis_id) @property def text(self): try: text = self.find_element().text - self.driver.info("%s is '%s' for '%s' where my reaction is set on message is '%s'" % (self.name, text, self.emoji, str(self.own))) - return text + self.driver.info("%s is '%s' for '%s'" % (self.name, text, self.emoji)) + return int(text.strip()) except NoSuchElementException: return 0 return int(EmojisNumber(self.driver, self.locator).text) - @property def pinned_by_label(self): class PinnedByLabelText(Text): @@ -858,7 +875,9 @@ class ChatView(BaseView): self.chat_element_by_text(message).long_press_element() else: self.element_by_text_part(message).long_press_element() - element = Button(self.driver, accessibility_id='pick-emoji-%s' % key) + # old UI + # element = Button(self.driver, accessibility_id='pick-emoji-%s' % key) + element = Button(self.driver, accessibility_id='emoji-picker-%s' % key) element.click() element.wait_for_invisibility_of_element() diff --git a/test/appium/views/home_view.py b/test/appium/views/home_view.py index 3a1f5919be..c4f6d67284 100644 --- a/test/appium/views/home_view.py +++ b/test/appium/views/home_view.py @@ -290,7 +290,8 @@ class HomeView(BaseView): chat.public_key_edit_box.click() chat.public_key_edit_box.send_keys(public_key) one_to_one_chat = self.get_chat_view() - chat.confirm_until_presence_of_element(one_to_one_chat.chat_message_input) + chat.confirm() + # chat.confirm_until_presence_of_element(one_to_one_chat.chat_message_input) if add_in_contacts and one_to_one_chat.add_to_contacts.is_element_displayed(): one_to_one_chat.add_to_contacts.click() if nickname: diff --git a/test/appium/views/sign_in_view.py b/test/appium/views/sign_in_view.py index e3d832dc2d..2bfcc34a48 100644 --- a/test/appium/views/sign_in_view.py +++ b/test/appium/views/sign_in_view.py @@ -191,13 +191,18 @@ class SignInView(BaseView): self.create_password_input.set_value(password) self.confirm_your_password_input.set_value(password) self.next_button.click() - self.maybe_later_button.wait_for_visibility_of_element(30) - if enable_notifications: - self.enable_notifications_button.click() - else: - self.maybe_later_button.click_until_presence_of_element(self.lets_go_button) - self.lets_go_button.click_until_absense_of_element(self.lets_go_button) - self.profile_button.wait_for_visibility_of_element(30) + + # Old UI + # self.maybe_later_button.wait_for_visibility_of_element(30) + # if enable_notifications: + # self.enable_notifications_button.click() + # else: + # self.maybe_later_button.click_until_presence_of_element(self.lets_go_button) + # self.lets_go_button.click_until_absense_of_element(self.lets_go_button) + # self.profile_button.wait_for_visibility_of_element(30) + + self.chats_tab.wait_for_visibility_of_element(30) + self.driver.info("## New multiaccount is created successfully!", device=False) return self.get_home_view()