From 823fce24570900cd2699fe679867fdf723c13561 Mon Sep 17 00:00:00 2001 From: Churikova Tetiana Date: Fri, 7 Oct 2022 00:31:27 +0200 Subject: [PATCH] e2e: exception and new custom network --- test/appium/support/testrail_report.py | 3 ++- .../tests/medium/test_browser_profile.py | 11 ++++++---- test/appium/views/profile_view.py | 20 +++++++++---------- 3 files changed, 19 insertions(+), 15 deletions(-) diff --git a/test/appium/support/testrail_report.py b/test/appium/support/testrail_report.py index e54d0be4bd..425d290b6e 100644 --- a/test/appium/support/testrail_report.py +++ b/test/appium/support/testrail_report.py @@ -298,7 +298,8 @@ class TestrailReport(BaseTestReport): try: test_id = self.get('get_results_for_case/%s/%s' % (test_run_id, test_case_id))['results'][0]['test_id'] return '%stests/view/%s' % (self.url, test_id) - except KeyError: + except (KeyError, JSONDecodeError): + print('Cannot extract result for %s e2e' % test_case_id) return None def get_not_executed_tests(self, test_run_id): diff --git a/test/appium/tests/medium/test_browser_profile.py b/test/appium/tests/medium/test_browser_profile.py index 0f8a430c71..5d3213502a 100644 --- a/test/appium/tests/medium/test_browser_profile.py +++ b/test/appium/tests/medium/test_browser_profile.py @@ -280,18 +280,21 @@ class TestBrowserProfileOneDevice(MultipleSharedDeviceTestCase): @marks.testrail_id(702166) def test_profile_add_custom_network(self): self.home.get_back_to_home_view() + rpc, name, id, symbol = 'https://polygon-rpc.com/', 'Polygon', '137', 'MATIC' profile = self.home.profile_button.click() - profile.add_custom_network() + profile.add_custom_network(rpc_url=rpc, netwrok_id=id, symbol=symbol, name=name) self.sign_in.sign_in() + wallet = self.home.wallet_button.click() + if not wallet.element_by_text_part(symbol).is_element_displayed(): + self.errors.append("No %s currency is shown when switching to custom network" % symbol) self.home.profile_button.click() profile.advanced_button.click() profile.network_settings_button.scroll_to_element(10, 'up') - if not profile.element_by_text_part('custom_ropsten').is_element_displayed(): - self.driver.fail("Network custom_ropsten was not added!") + if not profile.element_by_text_part(name).is_element_displayed(): + self.driver.fail("Custom network %s was not added!" % name) profile.get_back_to_home_view() # Switching back to Goerli for the next cases profile.switch_network('Goerli with upstream RPC') - self.errors.verify_no_errors() @marks.testrail_id(702164) diff --git a/test/appium/views/profile_view.py b/test/appium/views/profile_view.py index 875373faf0..c159a1f319 100644 --- a/test/appium/views/profile_view.py +++ b/test/appium/views/profile_view.py @@ -298,12 +298,13 @@ class ProfileView(BaseView): self.active_network_name = Text(self.driver, xpath="//android.widget.TextView[contains(@text,'with upstream RPC')]") self.plus_button = Button(self.driver, xpath="(//android.widget.ImageView[@content-desc='icon'])[2]") - self.ropsten_chain_button = Button(self.driver, translation_id="ropsten-network") + self.custom_chain_button = Button(self.driver, translation_id="custom") self.custom_network_url_input = EditBox(self.driver, translation_id="rpc-url", suffix="/following-sibling::*[1]/android.widget.EditText") self.custom_network_symbol_input = EditBox(self.driver, translation_id="specify-symbol") self.specify_name_input = EditBox(self.driver, translation_id="name", suffix="/following-sibling::*[1]/android.widget.EditText") + self.specify_network_id_input = EditBox(self.driver, translation_id="specify-network-id") self.connect_button = Button(self.driver, accessibility_id="network-connect-button") ## Toggles self.transaction_management_enabled_toggle = Button(self.driver, @@ -361,19 +362,18 @@ class ProfileView(BaseView): from views.chat_view import ChatView return ChatView(self.driver) - def add_custom_network(self, rpc_url='https://ropsten.infura.io/v3/f315575765b14720b32382a61a89341a', - name='custom_ropsten', symbol='ETHro'): - self.driver.info("## Add predefined custom network", device=False) + def add_custom_network(self, rpc_url: str, name: str, symbol: str, netwrok_id:str): + self.driver.info("## Add custom network", device=False) self.advanced_button.click() self.network_settings_button.scroll_to_element() self.network_settings_button.click() - self.plus_button.click_until_presence_of_element(self.ropsten_chain_button) - self.custom_network_url_input.send_keys(rpc_url) - self.specify_name_input.send_keys(name) + self.plus_button.click_until_presence_of_element(self.custom_chain_button) + self.custom_network_url_input.set_value(rpc_url) + self.specify_name_input.set_value(name) self.custom_network_symbol_input.set_value(symbol) - self.ropsten_chain_button.scroll_to_element() - self.ropsten_chain_button.click() - self.ropsten_chain_button.click() + self.custom_chain_button.scroll_and_click() + self.specify_network_id_input.scroll_to_element() + self.specify_network_id_input.set_value(netwrok_id) self.save_button.click() self.element_by_text_part(name).scroll_to_element() self.element_by_text_part(name).click_until_presence_of_element(self.connect_button)