e2e: exception and new custom network

This commit is contained in:
Churikova Tetiana 2022-10-07 00:31:27 +02:00
parent 1d5e1479f7
commit 823fce2457
No known key found for this signature in database
GPG Key ID: 0D4EA7B33B47E6D8
3 changed files with 19 additions and 15 deletions

View File

@ -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):

View File

@ -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)

View File

@ -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)