e2e: fixed browser tests

Signed-off-by: Churikova Tetiana <churikova.tm@gmail.com>
This commit is contained in:
Churikova Tetiana 2020-12-14 18:39:29 +01:00
parent 879f441b7d
commit 1b9bd8b017
No known key found for this signature in database
GPG Key ID: 0D4EA7B33B47E6D8
8 changed files with 58 additions and 61 deletions

View File

@ -614,16 +614,13 @@ class TestProfileSingleDevice(SingleDeviceTestCase):
@marks.testrail_id(5738) @marks.testrail_id(5738)
@marks.high @marks.high
@marks.skip
# TODO: rebuild with browser 1.0
def test_dapps_permissions(self): def test_dapps_permissions(self):
sign_in_view = SignInView(self.driver) home_view = SignInView(self.driver).create_user()
home_view = sign_in_view.create_user()
account_name = home_view.status_account_name account_name = home_view.status_account_name
home_view.just_fyi('open Status Test Dapp, allow all and check permissions in Profile') home_view.just_fyi('open Status Test Dapp, allow all and check permissions in Profile')
home_view.open_status_test_dapp() home_view.open_status_test_dapp()
home_view.cross_icon.click() home_view.dapp_tab_button.click()
profile_view = home_view.profile_button.click() profile_view = home_view.profile_button.click()
profile_view.privacy_and_security_button.click() profile_view.privacy_and_security_button.click()
profile_view.dapp_permissions_button.click() profile_view.dapp_permissions_button.click()

View File

@ -486,13 +486,10 @@ class TestChatManagement(SingleDeviceTestCase):
@marks.testrail_id(5498) @marks.testrail_id(5498)
@marks.medium @marks.medium
@marks.skip
# TODO: rebuild with browser 1.0
def test_share_user_profile_url_public_chat(self): def test_share_user_profile_url_public_chat(self):
sign_in = SignInView(self.driver) home = SignInView(self.driver).create_user()
home = sign_in.create_user()
sign_in.just_fyi('Join to one-to-one chat and share link to other user profile via messenger') home.just_fyi('Join to one-to-one chat and share link to other user profile via messenger')
chat_view = home.add_contact(dummy_user["public_key"]) chat_view = home.add_contact(dummy_user["public_key"])
chat_view.chat_options.click() chat_view.chat_options.click()
chat_view.view_profile_button.click_until_presence_of_element(chat_view.remove_from_contacts) chat_view.view_profile_button.click_until_presence_of_element(chat_view.remove_from_contacts)
@ -505,7 +502,7 @@ class TestChatManagement(SingleDeviceTestCase):
for _ in range(2): for _ in range(2):
chat_view.click_system_back_button() chat_view.click_system_back_button()
sign_in.just_fyi('Join to public chat and share link to it via messenger') home.just_fyi('Join to public chat and share link to it via messenger')
chat_view.get_back_to_home_view() chat_view.get_back_to_home_view()
public_chat_name = 'pubchat' public_chat_name = 'pubchat'
public_chat = home.join_public_chat(public_chat_name) public_chat = home.join_public_chat(public_chat_name)
@ -518,10 +515,10 @@ class TestChatManagement(SingleDeviceTestCase):
chat_view.click_system_back_button() chat_view.click_system_back_button()
chat_view.get_back_to_home_view() chat_view.get_back_to_home_view()
sign_in.just_fyi('Open URL and share link to it via messenger') home.just_fyi('Open URL and share link to it via messenger')
daap_view = home.dapp_tab_button.click() daap_view = home.dapp_tab_button.click()
browsing_view = daap_view.open_url('dap.ps') browsing_view = daap_view.open_url('dap.ps')
browsing_view.options_button.click()
browsing_view.share_url_button.click() browsing_view.share_url_button.click()
browsing_view.share_via_messenger() browsing_view.share_via_messenger()
expeceted_text_1 = 'https://join.status.im/b/https://dap.ps' expeceted_text_1 = 'https://join.status.im/b/https://dap.ps'

View File

@ -873,9 +873,8 @@ class TestMessagesOneToOneChatSingle(SingleDeviceTestCase):
@marks.testrail_id(6322) @marks.testrail_id(6322)
@marks.medium @marks.medium
def test_can_scan_different_links_with_universal_qr_scanner(self): def test_can_scan_different_links_with_universal_qr_scanner(self):
sign_in_view = SignInView(self.driver)
user = transaction_senders['C'] user = transaction_senders['C']
home_view = sign_in_view.recover_access(user['passphrase']) home_view = SignInView(self.driver).recover_access(user['passphrase'])
wallet_view = home_view.wallet_button.click() wallet_view = home_view.wallet_button.click()
wallet_view.set_up_wallet() wallet_view.set_up_wallet()
wallet_view.home_button.click() wallet_view.home_button.click()
@ -923,13 +922,12 @@ class TestMessagesOneToOneChatSingle(SingleDeviceTestCase):
'address': '0x3D59…F415', 'address': '0x3D59…F415',
}, },
}, },
# TODO: rebuild with browser 1.0 'dapp_deep_link': {
# 'dapp_deep_link': { 'url': 'https://join.status.im/b/simpledapp.eth',
# 'url': 'https://join.status.im/b/simpledapp.eth', },
# }, 'dapp_deep_link_https': {
# 'dapp_deep_link_https': { 'url': 'https://join.status.im/b/https://simpledapp.eth',
# 'url': 'https://join.status.im/b/https://simpledapp.eth', },
# },
'public_chat_deep_link': { 'public_chat_deep_link': {
'url': 'https://join.status.im/baga-ma-2020', 'url': 'https://join.status.im/baga-ma-2020',
'chat_name': 'baga-ma-2020' 'chat_name': 'baga-ma-2020'
@ -938,7 +936,7 @@ class TestMessagesOneToOneChatSingle(SingleDeviceTestCase):
for key in url_data: for key in url_data:
home_view.plus_button.click_until_presence_of_element(home_view.start_new_chat_button) home_view.plus_button.click_until_presence_of_element(home_view.start_new_chat_button)
sign_in_view.just_fyi('Checking %s case' % key) home_view.just_fyi('Checking %s case' % key)
if home_view.universal_qr_scanner_button.is_element_displayed(): if home_view.universal_qr_scanner_button.is_element_displayed():
home_view.universal_qr_scanner_button.click() home_view.universal_qr_scanner_button.click()
if home_view.allow_button.is_element_displayed(): if home_view.allow_button.is_element_displayed():
@ -970,7 +968,7 @@ class TestMessagesOneToOneChatSingle(SingleDeviceTestCase):
home_view.open_in_status_button.click() home_view.open_in_status_button.click()
if not chat_view.allow_button.is_element_displayed(): if not chat_view.allow_button.is_element_displayed():
self.errors.append('No allow button is shown in case of navigating to Status dapp!') self.errors.append('No allow button is shown in case of navigating to Status dapp!')
chat_view.cross_icon.click() chat_view.dapp_tab_button.click()
if 'public' in key: if 'public' in key:
if not chat_view.chat_message_input.is_element_displayed(): if not chat_view.chat_message_input.is_element_displayed():
self.errors.append('No message input is shown in case of navigating to public chat via deep link!') self.errors.append('No message input is shown in case of navigating to public chat via deep link!')

View File

@ -147,43 +147,36 @@ class TestBrowsing(SingleDeviceTestCase):
@marks.testrail_id(5390) @marks.testrail_id(5390)
@marks.high @marks.high
@marks.skip @marks.skip
# TODO: rebuild with browser 1.0 # TODO: failed due to #11544 and #11545
def test_delete_close_all_tabs(self): def test_delete_close_all_tabs(self):
home_view = SignInView(self.driver).create_user() home_view = SignInView(self.driver).create_user()
dapp_view = home_view.dapp_tab_button.click() dapp_view = home_view.dapp_tab_button.click()
urls = { urls = {
'google.com': 'Google', 'google.com': 'Google',
'status.im': 'Status', 'status.im': 'Status',
'bbc.com' : 'BBC' 'bbc.com' : 'bbc.com'
} }
tab_name, tab_name_status = 'Google' , 'Status'
#browsing_view = dapp_view.open_url('google.com')
for url in urls: for url in urls:
browsing_view = dapp_view.open_url(url) browsing_view = dapp_view.open_url(url)
browsing_view.browser_previous_page_button.click() [browsing_view.dapp_tab_button.click() for _ in range(2)]
# browsing_view.back_button.click() home_view.just_fyi('Close one tab, relogin and check that it is not reappearing')
browsing_view.remove_tab(name=urls['bbc.com']) browsing_view.remove_tab(name=urls['bbc.com'])
home_view.relogin() home_view.relogin()
# home_view.dapp_tab_button.click() home_view.dapp_tab_button.click()
# browsing_view.open_tabs_button.click() browsing_view.open_tabs_button.click()
# if browsing_view.element_by_text_part(tab_name).is_element_displayed(): if browsing_view.element_by_text_part(urls['bbc.com']).is_element_displayed():
# self.errors.append('Closed tab is present after re-login') self.errors.append('Closed tab is present after re-login')
# for entry in ('google.com', 'status.im'):
# browsing_view = dapp_view.open_url(entry)
# browsing_view.browser_previous_page_button.click()
# browsing_view.remove_tab(clear_all=True)
# # dapp_view.remove_browser_entry_long_press('status', clear_all=True)
# home_view.relogin()
# home_view.dapp_tab_button.click()
# browsing_view.open_tabs_button.click()
# for closed_tab in (tab_name, tab_name_status):
# if browsing_view.element_by_text_part(closed_tab).is_element_displayed():
# self.errors.append('Closed tab %s is present after re-login')
home_view.just_fyi('Close all tabs via "Close all", relogin and check that it is not reappearing')
browsing_view.close_all_button.click()
home_view.relogin()
home_view.dapp_tab_button.click()
browsing_view.open_tabs_button.click()
for url in urls:
if browsing_view.element_by_text_part(urls[url]).is_element_displayed():
self.errors.append('Closed tab %s present after re-login after "Close all"' % url)
# if not dapp_view.element_by_text('Browser history will appear here').is_element_displayed(): self.errors.verify_no_errors()
# self.errors.append('Browser history is not empty')
# self.errors.verify_no_errors()
@marks.testrail_id(5321) @marks.testrail_id(5321)
@marks.critical @marks.critical

View File

@ -56,8 +56,6 @@ class TestDApps(SingleDeviceTestCase):
@marks.testrail_id(6232) @marks.testrail_id(6232)
@marks.medium @marks.medium
@marks.skip
# TODO: rebuild with browser 1.0
def test_switching_accounts_in_dapp(self): def test_switching_accounts_in_dapp(self):
sign_in_view = SignInView(self.driver) sign_in_view = SignInView(self.driver)
home_view = sign_in_view.create_user() home_view = sign_in_view.create_user()
@ -92,18 +90,18 @@ class TestDApps(SingleDeviceTestCase):
self.errors.append("Permissions for %s are not removed" % test_dapp_name) self.errors.append("Permissions for %s are not removed" % test_dapp_name)
sign_in_view.just_fyi('check that can change account') sign_in_view.just_fyi('check that can change account')
profile_view.dapp_tab_button.click() profile_view.dapp_tab_button.click(desired_element_text='Allow')
if not status_test_dapp.element_by_text(account_name).is_element_displayed(): if not status_test_dapp.element_by_text_part(account_name).is_element_displayed():
self.errors.append("No expected account %s is shown in authorize web3 popup for wallet" % account_name) self.errors.append("No expected account %s is shown in authorize web3 popup for wallet" % account_name)
status_test_dapp.allow_button.wait_and_click() status_test_dapp.allow_button.click()
dapp_view.profile_button.click(desired_element_text='DApp permissions') dapp_view.profile_button.click(desired_element_text='DApp permissions')
profile_view.element_by_text(test_dapp_name).click() profile_view.element_by_text(test_dapp_name).click()
for text in 'Chat key', account_name: for text in 'Chat key', account_name:
if not dapp_view.element_by_text(text).is_element_displayed(): if not dapp_view.element_by_text_part(text).is_element_displayed():
self.errors.append("Access is not granted to %s" % text) self.errors.append("Access is not granted to %s" % text)
sign_in_view.just_fyi('check correct account is shown for transaction if sending from DApp') sign_in_view.just_fyi('check correct account is shown for transaction if sending from DApp')
profile_view.dapp_tab_button.click() profile_view.dapp_tab_button.click(desired_element_text='Accounts')
status_test_dapp.assets_button.click() status_test_dapp.assets_button.click()
send_transaction_view = status_test_dapp.request_stt_button.click() send_transaction_view = status_test_dapp.request_stt_button.click()
address = send_transaction_view.get_formatted_recipient_address(address) address = send_transaction_view.get_formatted_recipient_address(address)
@ -117,8 +115,11 @@ class TestDApps(SingleDeviceTestCase):
sign_in_view.wallet_button.click() sign_in_view.wallet_button.click()
if not wallet_view.element_by_text(account_name).is_element_displayed(): if not wallet_view.element_by_text(account_name).is_element_displayed():
self.errors.append("Subaccount is gone after relogin in Wallet!") self.errors.append("Subaccount is gone after relogin in Wallet!")
sign_in_view.dapp_tab_button.click() sign_in_view.profile_button.click()
if not dapp_view.element_by_text(account_name).is_element_displayed(): profile_view.privacy_and_security_button.click()
profile_view.dapp_permissions_button.click()
profile_view.element_by_text(test_dapp_name).click()
if not profile_view.element_by_text(account_name).is_element_displayed():
self.errors.append("Subaccount is not selected after relogin in Dapps!") self.errors.append("Subaccount is not selected after relogin in Dapps!")
self.errors.verify_no_errors() self.errors.verify_no_errors()

View File

@ -148,9 +148,14 @@ class DappTabButton(TabButton):
from views.dapps_view import DappsView from views.dapps_view import DappsView
return DappsView(self.driver) return DappsView(self.driver)
def click(self): def click(self, desired_element_text = 'enter_url'):
from views.dapps_view import EnterUrlEditbox from views.dapps_view import EnterUrlEditbox
self.click_until_presence_of_element(EnterUrlEditbox(self.driver)) if desired_element_text == 'enter_url':
self.click_until_presence_of_element(EnterUrlEditbox(self.driver))
else:
base_view = BaseView(self.driver)
self.click_until_presence_of_element(base_view.element_by_text_part(desired_element_text))
return self.navigate() return self.navigate()

View File

@ -123,6 +123,7 @@ class DappsView(BaseView):
self.close_web3_permissions_window_button = CrossCloseWeb3PermissionButton(self.driver) self.close_web3_permissions_window_button = CrossCloseWeb3PermissionButton(self.driver)
def open_url(self, url): def open_url(self, url):
self.enter_url_editbox.wait_for_visibility_of_element(10)
self.enter_url_editbox.click() self.enter_url_editbox.click()
self.enter_url_editbox.send_keys(url) self.enter_url_editbox.send_keys(url)
self.confirm() self.confirm()

View File

@ -84,14 +84,18 @@ class PolicySummary(BaseElement):
class ShareUrlButton(BaseButton): class ShareUrlButton(BaseButton):
def __init__(self, driver): def __init__(self, driver):
super(ShareUrlButton, self).__init__(driver) super(ShareUrlButton, self).__init__(driver)
self.locator = self.Locator.accessibility_id('modal-share-link-button') self.locator = self.Locator.accessibility_id('share')
class GoBackButton(BaseButton): class GoBackButton(BaseButton):
def __init__(self, driver): def __init__(self, driver):
super(GoBackButton, self).__init__(driver) super(GoBackButton, self).__init__(driver)
self.locator = self.Locator.translation_id_selector('browsing-site-blocked-go-back') self.locator = self.Locator.translation_id_selector('browsing-site-blocked-go-back')
class OptionsButton(BaseButton):
def __init__(self, driver):
super(OptionsButton, self).__init__(driver)
self.locator = self.Locator.accessibility_id('browser-options')
class OpenTabsButton(BaseButton): class OpenTabsButton(BaseButton):
def __init__(self, driver): def __init__(self, driver):
super(OpenTabsButton, self).__init__(driver) super(OpenTabsButton, self).__init__(driver)
@ -128,6 +132,7 @@ class BaseWebView(BaseView):
self.browser_refresh_page_button = BrowserRefreshPageButton(self.driver) self.browser_refresh_page_button = BrowserRefreshPageButton(self.driver)
self.share_url_button = ShareUrlButton(self.driver) self.share_url_button = ShareUrlButton(self.driver)
self.go_back_button = GoBackButton(self.driver) self.go_back_button = GoBackButton(self.driver)
self.options_button = OptionsButton(self.driver)
self.continue_anyway_button = ContinueAnywayButton(self.driver) self.continue_anyway_button = ContinueAnywayButton(self.driver)
self.open_tabs_button = OpenTabsButton(self.driver) self.open_tabs_button = OpenTabsButton(self.driver)
self.close_all_button = CloseAllButton(self.driver) self.close_all_button = CloseAllButton(self.driver)