2020-11-11 15:37:27 +00:00
|
|
|
from tests import marks, connection_not_secure_text, connection_is_secure_text
|
2018-07-03 12:40:44 +00:00
|
|
|
from tests.base_test_case import SingleDeviceTestCase
|
|
|
|
from views.sign_in_view import SignInView
|
2019-09-24 08:50:21 +00:00
|
|
|
from views.dapps_view import DappsView
|
2018-07-03 12:40:44 +00:00
|
|
|
|
|
|
|
|
|
|
|
class TestBrowsing(SingleDeviceTestCase):
|
|
|
|
|
2018-09-28 15:30:06 +00:00
|
|
|
@marks.testrail_id(5424)
|
|
|
|
@marks.medium
|
2018-07-03 12:40:44 +00:00
|
|
|
def test_browse_page_with_non_english_text(self):
|
|
|
|
sign_in = SignInView(self.driver)
|
2018-07-20 08:27:33 +00:00
|
|
|
home_view = sign_in.create_user()
|
2019-04-05 13:05:23 +00:00
|
|
|
daap_view = home_view.dapp_tab_button.click()
|
|
|
|
browsing_view = daap_view.open_url('www.wikipedia.org')
|
2018-07-03 12:40:44 +00:00
|
|
|
wiki_texts = ['Español', '日本語', 'Français', '中文', 'Português']
|
|
|
|
for wiki_text in wiki_texts:
|
|
|
|
browsing_view.find_text_part(wiki_text, 15)
|
|
|
|
|
2020-01-08 15:12:12 +00:00
|
|
|
@marks.testrail_id(5395)
|
|
|
|
@marks.medium
|
|
|
|
def test_navigation_history_kept_after_relogin(self):
|
|
|
|
sign_in = SignInView(self.driver)
|
|
|
|
home_view = sign_in.create_user()
|
|
|
|
dapp_view = home_view.dapp_tab_button.click()
|
2020-02-24 11:30:45 +00:00
|
|
|
ru_url = 'https://ru.m.wikipedia.org'
|
2020-01-08 15:12:12 +00:00
|
|
|
browsing_view = dapp_view.open_url(ru_url)
|
2020-02-24 11:30:45 +00:00
|
|
|
browsing_view.find_text_part('Добро пожаловать')
|
2020-01-08 15:12:12 +00:00
|
|
|
|
2020-02-24 11:30:45 +00:00
|
|
|
browsing_view.just_fyi('Navigate to next page and back')
|
|
|
|
browsing_view.element_by_text_part('свободную энциклопедию').click()
|
|
|
|
browsing_view.element_by_text_part('Свободный контент')
|
2020-01-08 15:12:12 +00:00
|
|
|
browsing_view.browser_previous_page_button.click()
|
2020-08-14 16:05:41 +00:00
|
|
|
browsing_view.wait_for_element_starts_with_text('свободную энциклопедию')
|
2020-01-08 15:12:12 +00:00
|
|
|
|
2020-02-24 11:30:45 +00:00
|
|
|
browsing_view.just_fyi('Relogin and check that tap on "Next" navigates to next page')
|
2020-01-08 15:12:12 +00:00
|
|
|
browsing_view.relogin()
|
|
|
|
home_view.dapp_tab_button.click()
|
|
|
|
dapp_view.element_by_text_part(ru_url).click()
|
2020-08-14 16:05:41 +00:00
|
|
|
browsing_view.wait_for_element_starts_with_text('свободную энциклопедию')
|
2020-01-08 15:12:12 +00:00
|
|
|
browsing_view.browser_next_page_button.click()
|
2020-08-14 16:05:41 +00:00
|
|
|
browsing_view.element_by_text_part('Свободный контент').wait_for_element(30)
|
2020-01-08 15:12:12 +00:00
|
|
|
|
|
|
|
@marks.testrail_id(5438)
|
|
|
|
@marks.medium
|
|
|
|
def test_browser_shows_offline_state(self):
|
|
|
|
sign_in = SignInView(self.driver)
|
|
|
|
home_view = sign_in.create_user()
|
|
|
|
home_view.toggle_airplane_mode()
|
|
|
|
dapp_view = home_view.dapp_tab_button.click()
|
|
|
|
browsing_view = dapp_view.open_url('status.im')
|
|
|
|
offline_texts = ['Unable to load page', 'ERR_INTERNET_DISCONNECTED']
|
|
|
|
for text in offline_texts:
|
|
|
|
browsing_view.find_text_part(text, 15)
|
|
|
|
home_view.toggle_airplane_mode()
|
|
|
|
browsing_view.browser_refresh_page_button.click_until_presence_of_element(browsing_view.element_by_text_part('An Open Source Community'))
|
|
|
|
|
2018-09-28 15:30:06 +00:00
|
|
|
@marks.testrail_id(5465)
|
|
|
|
@marks.medium
|
2018-07-03 12:40:44 +00:00
|
|
|
def test_open_invalid_link(self):
|
|
|
|
sign_in = SignInView(self.driver)
|
2018-07-20 08:27:33 +00:00
|
|
|
home_view = sign_in.create_user()
|
2019-04-05 13:05:23 +00:00
|
|
|
daap_view = home_view.dapp_tab_button.click()
|
|
|
|
browsing_view = daap_view.open_url('invalid.takoe')
|
2018-07-03 12:40:44 +00:00
|
|
|
browsing_view.find_text_part('Unable to load page')
|
2018-08-01 00:16:33 +00:00
|
|
|
browsing_view.cross_icon.click()
|
2019-12-19 09:19:01 +00:00
|
|
|
if home_view.element_by_text('Recent').is_element_displayed():
|
2019-10-21 12:48:45 +00:00
|
|
|
self.driver.fail('Browser entity is shown for an invalid link')
|
2018-07-03 12:40:44 +00:00
|
|
|
|
2019-05-23 09:04:41 +00:00
|
|
|
@marks.testrail_id(6210)
|
|
|
|
@marks.high
|
2020-10-30 14:40:14 +00:00
|
|
|
def test_open_blocked_secure_not_secure_sites(self):
|
2019-05-23 09:04:41 +00:00
|
|
|
home_view = SignInView(self.driver).create_user()
|
|
|
|
daap_view = home_view.dapp_tab_button.click()
|
2020-10-06 14:48:08 +00:00
|
|
|
for url in ('metamask.site', 'https://www.cryptokitties.domainname'):
|
2020-10-30 14:40:14 +00:00
|
|
|
daap_view.just_fyi('Checking blocked website %s' % url)
|
2020-10-06 14:48:08 +00:00
|
|
|
dapp_detail = daap_view.open_url(url)
|
|
|
|
dapp_detail.find_text_part('This site is blocked')
|
|
|
|
if dapp_detail.browser_refresh_page_button.is_element_displayed():
|
|
|
|
self.errors.append("Refresh button is present in blocked site")
|
|
|
|
dapp_detail.go_back_button.click()
|
|
|
|
daap_view.element_by_text("Browser").click()
|
|
|
|
dapp_detail.continue_anyway_button.click()
|
|
|
|
if dapp_detail.element_by_text('This site is blocked').is_element_displayed():
|
|
|
|
self.errors.append("Failed to open Dapp after 'Continue anyway' tapped for %s" % url)
|
|
|
|
daap_view.cross_icon.click()
|
2020-10-30 14:40:14 +00:00
|
|
|
|
|
|
|
daap_view.just_fyi('Checking connection is not secure warning')
|
|
|
|
browsing_view = daap_view.open_url('http://www.dvwa.co.uk')
|
|
|
|
browsing_view.url_edit_box_lock_icon.click_until_presence_of_element(
|
|
|
|
browsing_view.element_by_text(connection_not_secure_text))
|
|
|
|
browsing_view.cross_icon.click()
|
|
|
|
|
|
|
|
for url in ('https://www.bbc.com', 'https://instant.airswap.io'):
|
|
|
|
daap_view.just_fyi('Checking connection is secure for %s' % url)
|
|
|
|
browsing_view = daap_view.open_url(url)
|
|
|
|
browsing_view.wait_for_d_aap_to_load()
|
|
|
|
browsing_view.url_edit_box_lock_icon.click_until_presence_of_element(
|
|
|
|
browsing_view.element_by_text(connection_is_secure_text))
|
|
|
|
browsing_view.cross_icon.click()
|
|
|
|
|
2020-10-06 14:48:08 +00:00
|
|
|
self.errors.verify_no_errors()
|
|
|
|
|
2019-05-23 09:04:41 +00:00
|
|
|
|
2020-08-19 15:04:21 +00:00
|
|
|
#TODO: waiting mode
|
2020-06-10 08:14:57 +00:00
|
|
|
@marks.testrail_id(6300)
|
2020-08-19 15:04:21 +00:00
|
|
|
@marks.skip
|
2020-06-10 08:14:57 +00:00
|
|
|
@marks.medium
|
|
|
|
def test_webview_security(self):
|
|
|
|
home_view = SignInView(self.driver).create_user()
|
|
|
|
daap_view = home_view.dapp_tab_button.click()
|
|
|
|
|
|
|
|
browsing_view = daap_view.open_url('https://simpledapp.status.im/webviewtest/url-spoof-ssl.html')
|
|
|
|
browsing_view.url_edit_box_lock_icon.click()
|
|
|
|
if not browsing_view.element_by_text_part(connection_not_secure_text).is_element_displayed():
|
|
|
|
self.errors.append("Broken certificate displayed as secure connection \n")
|
|
|
|
|
|
|
|
browsing_view.cross_icon.click()
|
|
|
|
daap_view.open_url('https://simpledapp.status.im/webviewtest/webviewtest.html')
|
|
|
|
browsing_view.element_by_text_part('204').click()
|
|
|
|
if browsing_view.element_by_text_part('google.com').is_element_displayed():
|
|
|
|
self.errors.append("URL changed on attempt to redirect to no-content page \n")
|
|
|
|
|
2020-06-22 13:54:34 +00:00
|
|
|
browsing_view.cross_icon.click()
|
|
|
|
daap_view.open_url('https://simpledapp.status.im/webviewtest/webviewtest.html')
|
|
|
|
browsing_view.element_by_text_part('XSS check').click()
|
|
|
|
browsing_view.open_in_status_button.click()
|
|
|
|
if browsing_view.element_by_text_part('simpledapp.status.im').is_element_displayed():
|
|
|
|
self.errors.append("XSS attemp succedded \n")
|
|
|
|
browsing_view.ok_button.click()
|
|
|
|
|
2020-06-10 08:14:57 +00:00
|
|
|
browsing_view.cross_icon.click()
|
|
|
|
daap_view.open_url('https://simpledapp.status.im/webviewtest/url-blank.html')
|
|
|
|
if daap_view.edit_url_editbox.text == '':
|
|
|
|
self.errors.append("Blank URL value. Must show the actual URL \n")
|
|
|
|
|
|
|
|
browsing_view.cross_icon.click()
|
|
|
|
daap_view.open_url('https://simpledapp.status.im/webviewtest/port-timeout.html')
|
|
|
|
# wait up ~2.5 mins for port time out
|
|
|
|
if daap_view.find_text_part('example.com', 150):
|
|
|
|
self.errors.append("URL spoof due to port timeout \n")
|
|
|
|
|
|
|
|
self.errors.verify_no_errors()
|
|
|
|
|
2018-09-28 15:30:06 +00:00
|
|
|
@marks.testrail_id(5390)
|
|
|
|
@marks.high
|
2019-09-24 08:50:21 +00:00
|
|
|
def test_long_press_delete_clear_all_dapps(self):
|
2018-07-03 12:40:44 +00:00
|
|
|
sign_in = SignInView(self.driver)
|
|
|
|
home_view = sign_in.create_user()
|
2019-09-24 08:50:21 +00:00
|
|
|
dapp_view = home_view.dapp_tab_button.click()
|
|
|
|
browsing_view = dapp_view.open_url('google.com')
|
2020-10-14 12:09:01 +00:00
|
|
|
browsing_view.back_button.click()
|
2019-09-24 08:50:21 +00:00
|
|
|
dapp_view = DappsView(self.driver)
|
|
|
|
browser_entry = dapp_view.remove_browser_entry_long_press('Google')
|
2018-07-03 12:40:44 +00:00
|
|
|
home_view.relogin()
|
2019-09-24 08:50:21 +00:00
|
|
|
home_view.dapp_tab_button.click()
|
2019-01-09 14:54:58 +00:00
|
|
|
if browser_entry.is_element_present(20):
|
2019-09-24 08:50:21 +00:00
|
|
|
self.errors.append('The browser entry is present after re-login')
|
|
|
|
for entry in ('google.com', 'status.im'):
|
|
|
|
browsing_view = dapp_view.open_url(entry)
|
2020-10-14 12:09:01 +00:00
|
|
|
browsing_view.back_button.click()
|
2020-04-29 14:42:54 +00:00
|
|
|
dapp_view.remove_browser_entry_long_press('status', clear_all=True)
|
2019-09-24 08:50:21 +00:00
|
|
|
home_view.relogin()
|
|
|
|
home_view.dapp_tab_button.click()
|
2020-01-07 12:33:47 +00:00
|
|
|
if not dapp_view.element_by_text('Browser history will appear here').is_element_displayed():
|
2019-09-24 08:50:21 +00:00
|
|
|
self.errors.append('Browser history is not empty')
|
2018-07-03 18:50:18 +00:00
|
|
|
|
2018-09-28 15:30:06 +00:00
|
|
|
@marks.testrail_id(5320)
|
|
|
|
@marks.critical
|
2018-07-03 18:50:18 +00:00
|
|
|
def test_open_google_com_via_open_dapp(self):
|
|
|
|
sign_in_view = SignInView(self.driver)
|
|
|
|
home = sign_in_view.create_user()
|
2019-03-13 09:36:51 +00:00
|
|
|
open_dapp_view = home.dapp_tab_button.click()
|
|
|
|
open_dapp_view.open_url('google.com')
|
|
|
|
browsing_view = open_dapp_view.get_base_web_view()
|
2018-11-30 11:42:48 +00:00
|
|
|
browsing_view.element_by_text('Google').wait_for_element(30)
|
2018-07-03 18:50:18 +00:00
|
|
|
|
2018-09-28 15:30:06 +00:00
|
|
|
@marks.testrail_id(5321)
|
|
|
|
@marks.critical
|
2018-07-03 18:50:18 +00:00
|
|
|
def test_back_forward_buttons_browsing_website(self):
|
|
|
|
sign_in = SignInView(self.driver)
|
|
|
|
home = sign_in.create_user()
|
2019-04-05 13:05:23 +00:00
|
|
|
daap_view = home.dapp_tab_button.click()
|
2020-02-24 11:30:45 +00:00
|
|
|
browsing_view = daap_view.open_url('dap.ps')
|
2020-03-19 16:34:20 +00:00
|
|
|
browsing_view.wait_for_element_starts_with_text('View all', 30)
|
2020-02-24 11:30:45 +00:00
|
|
|
browsing_view.element_by_text_part('View all', 'button').click()
|
|
|
|
if browsing_view.element_by_text_part('View all').is_element_displayed(20):
|
|
|
|
self.driver.fail("Failed to access Categories using ''View all'")
|
2018-07-03 18:50:18 +00:00
|
|
|
browsing_view.browser_previous_page_button.click()
|
2020-02-24 11:30:45 +00:00
|
|
|
browsing_view.find_text_part('Categories', 15)
|
2018-07-03 18:50:18 +00:00
|
|
|
browsing_view.browser_next_page_button.click()
|
2020-02-24 11:30:45 +00:00
|
|
|
browsing_view.find_text_part('Exchanges', 15)
|
2018-07-03 18:50:18 +00:00
|
|
|
browsing_view.back_to_home_button.click()
|
2018-07-22 13:38:01 +00:00
|
|
|
|
2018-09-28 15:30:06 +00:00
|
|
|
@marks.testrail_id(5354)
|
|
|
|
@marks.critical
|
2018-07-22 13:38:01 +00:00
|
|
|
def test_refresh_button_browsing_app_webview(self):
|
|
|
|
sign_in_view = SignInView(self.driver)
|
2018-12-25 15:39:05 +00:00
|
|
|
home_view = sign_in_view.create_user()
|
2020-10-14 09:34:53 +00:00
|
|
|
daap_view = home_view.dapp_tab_button.click()
|
|
|
|
browsing_view = daap_view.open_url('app.uniswap.org')
|
|
|
|
browsing_view.allow_button.click()
|
|
|
|
browsing_view.find_full_text('Select a token').click()
|
|
|
|
browsing_view.find_text_part("Token Name")
|
|
|
|
browsing_view.browser_refresh_page_button.click()
|
|
|
|
if browsing_view.element_by_text_part("Token Name").is_element_displayed():
|
|
|
|
self.driver.fail("Page failed to be refreshed")
|
|
|
|
|
2020-05-08 13:36:05 +00:00
|
|
|
|
|
|
|
@marks.testrail_id(5456)
|
|
|
|
@marks.medium
|
2020-09-09 15:06:07 +00:00
|
|
|
@marks.skip
|
|
|
|
# Decicded to leave for manual testing, as there is no simple way of comparing images depending on phone brightness
|
2020-05-08 13:36:05 +00:00
|
|
|
def test_can_access_images_by_link(self):
|
|
|
|
urls = {
|
|
|
|
'https://cdn.dribbble.com/users/45534/screenshots/3142450/logo_dribbble.png':
|
|
|
|
'url_1.png',
|
|
|
|
'https://thebitcoinpub-91d3.kxcdn.com/uploads/default/original/2X/d/db97611b41a96cb7642b06636b82c0800678b140.jpg':
|
|
|
|
'url_2.png',
|
|
|
|
'https://steemitimages.com/DQmYEjeBuAKVRa3b3ZqwLicSHaPUm7WFtQqohGaZdA9ghjx/images%20(4).jpeg':
|
|
|
|
'url_3.png'
|
|
|
|
}
|
|
|
|
sign_in_view = SignInView(self.driver)
|
|
|
|
home_view = sign_in_view.create_user()
|
|
|
|
dapp_view = home_view.dapp_tab_button.click()
|
|
|
|
for url in urls:
|
|
|
|
self.driver.set_clipboard_text(url)
|
|
|
|
dapp_view.enter_url_editbox.click()
|
|
|
|
dapp_view.paste_text()
|
|
|
|
dapp_view.confirm()
|
|
|
|
dapp_view.progress_bar.wait_for_invisibility_of_element(20)
|
|
|
|
if not dapp_view.web_page.is_element_image_equals_template(urls[url]):
|
2020-08-11 16:10:53 +00:00
|
|
|
self.errors.append('Web page does not match expected template %s' % urls[url])
|
2020-05-08 13:36:05 +00:00
|
|
|
dapp_view.cross_icon.click()
|
2020-08-11 16:10:53 +00:00
|
|
|
self.errors.verify_no_errors()
|