e2e about switching accounts in DApp
Signed-off-by: Churikova Tetiana <churikova.tm@gmail.com>
This commit is contained in:
parent
1c51731aea
commit
8fc823f94b
|
@ -45,3 +45,6 @@ connection_not_secure_text = "Connection is not secure! " \
|
|||
"Do not sign transactions or send personal data on this site."
|
||||
connection_is_secure_text = "Connection is secure. Make sure you really trust this site " \
|
||||
"before signing transactions or entering personal data."
|
||||
|
||||
test_dapp_url = 'status-im.github.io/dapp'
|
||||
test_dapp_name = 'status-im.github.io'
|
||||
|
|
|
@ -2,7 +2,7 @@ import pytest
|
|||
import re
|
||||
|
||||
from tests import marks, bootnode_address, mailserver_address, camera_access_error_text, \
|
||||
photos_access_error_text
|
||||
photos_access_error_text, test_dapp_url, test_dapp_name
|
||||
from tests.base_test_case import SingleDeviceTestCase, MultipleDeviceTestCase
|
||||
from tests.users import transaction_senders, basic_user, ens_user
|
||||
from views.dapps_view import DappsView
|
||||
|
@ -424,25 +424,30 @@ class TestProfileSingleDevice(SingleDeviceTestCase):
|
|||
self.verify_no_errors()
|
||||
|
||||
@marks.testrail_id(5738)
|
||||
@marks.medium
|
||||
@marks.high
|
||||
def test_dapps_permissions(self):
|
||||
sign_in_view = SignInView(self.driver)
|
||||
home_view = sign_in_view.create_user()
|
||||
account_name = 'Status account'
|
||||
|
||||
home_view.just_fyi('open Status Test Dapp, allow all and check permissions in Profile')
|
||||
home_view.open_status_test_dapp()
|
||||
home_view.cross_icon.click()
|
||||
profile_view = home_view.profile_button.click()
|
||||
profile_view.privacy_and_security_button.click()
|
||||
profile_view.dapp_permissions_button.click()
|
||||
profile_view.element_by_text('status-im.github.io').click()
|
||||
if not profile_view.element_by_text('Wallet').is_element_displayed():
|
||||
profile_view.element_by_text(test_dapp_name).click()
|
||||
if not profile_view.element_by_text(account_name).is_element_displayed():
|
||||
self.errors.append('Wallet permission was not granted')
|
||||
if not profile_view.element_by_text('Chat key').is_element_displayed():
|
||||
self.errors.append('Contact code permission was not granted')
|
||||
|
||||
profile_view.just_fyi('revoke access and check that they are asked second time')
|
||||
profile_view.revoke_access_button.click()
|
||||
profile_view.back_button.click()
|
||||
dapp_view = profile_view.dapp_tab_button.click()
|
||||
dapp_view.open_url('status-im.github.io/dapp')
|
||||
if not dapp_view.element_by_text_part('connect to your wallet').is_element_displayed():
|
||||
dapp_view.open_url(test_dapp_url)
|
||||
if not dapp_view.element_by_text_part(account_name).is_element_displayed():
|
||||
self.errors.append('Wallet permission is not asked')
|
||||
if dapp_view.allow_button.is_element_displayed():
|
||||
dapp_view.allow_button.click(times_to_click=1)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import pytest
|
||||
from tests import marks
|
||||
from tests import marks, test_dapp_url, test_dapp_name
|
||||
from tests.base_test_case import SingleDeviceTestCase
|
||||
from tests.users import basic_user
|
||||
from views.sign_in_view import SignInView
|
||||
|
@ -38,6 +38,62 @@ class TestDApps(SingleDeviceTestCase):
|
|||
if not status_test_dapp.element_by_text(user['public_key']).is_element_displayed():
|
||||
pytest.fail('Public key is not returned')
|
||||
|
||||
@marks.testrail_id(6232)
|
||||
@marks.medium
|
||||
def test_switching_accounts_in_dapp(self):
|
||||
sign_in_view = SignInView(self.driver)
|
||||
home_view = sign_in_view.create_user()
|
||||
wallet_view = sign_in_view.wallet_button.click()
|
||||
|
||||
wallet_view.just_fyi('create new account in multiaccount')
|
||||
wallet_view.set_up_wallet()
|
||||
status_account = 'Status account'
|
||||
account_name = 'subaccount'
|
||||
wallet_view.add_account(account_name)
|
||||
address = wallet_view.get_wallet_address(account_name)
|
||||
|
||||
sign_in_view.just_fyi('can see two accounts in DApps')
|
||||
dapp_view = sign_in_view.dapp_tab_button.click()
|
||||
dapp_view.select_account_button.click()
|
||||
for text in 'Select the account', status_account, account_name:
|
||||
if not dapp_view.element_by_text_part(text).is_element_displayed():
|
||||
self.driver.fail("No expected element %s is shown in menu" % text)
|
||||
|
||||
sign_in_view.just_fyi('add permission to Status account')
|
||||
dapp_view.enter_url_editbox.click()
|
||||
status_test_dapp = home_view.open_status_test_dapp()
|
||||
|
||||
sign_in_view.just_fyi('check that permissions from previous account was removed once you choose another')
|
||||
dapp_view.select_account_button.click()
|
||||
dapp_view.select_account_by_name(account_name).wait_for_element(30)
|
||||
dapp_view.select_account_by_name(account_name).click()
|
||||
profile_view = dapp_view.profile_button.click()
|
||||
profile_view.privacy_and_security_button.click()
|
||||
profile_view.dapp_permissions_button.click()
|
||||
if profile_view.element_by_text(test_dapp_name).is_element_displayed():
|
||||
self.errors.append("Permissions for %s are not removed" % test_dapp_name)
|
||||
|
||||
sign_in_view.just_fyi('check that can change account')
|
||||
profile_view.dapp_tab_button.click()
|
||||
if not status_test_dapp.element_by_text(account_name).is_element_displayed():
|
||||
self.errors.append("No expected account %s is shown in authorize web3 popup for wallet" % account_name)
|
||||
status_test_dapp.allow_button.click()
|
||||
status_test_dapp.allow_button.click()
|
||||
dapp_view.profile_button.click()
|
||||
profile_view.element_by_text(test_dapp_name).click()
|
||||
for text in 'Chat key', account_name:
|
||||
if not dapp_view.element_by_text(text).is_element_displayed():
|
||||
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')
|
||||
profile_view.dapp_tab_button.click()
|
||||
status_test_dapp.assets_button.click()
|
||||
send_transaction_view = status_test_dapp.request_stt_button.click()
|
||||
if not send_transaction_view.element_by_text(address).is_element_displayed():
|
||||
self.errors.append("Wallet address %s in not shown in 'From' on Send Transaction screen" % address)
|
||||
|
||||
self.verify_no_errors()
|
||||
|
||||
@marks.testrail_id(5654)
|
||||
@marks.low
|
||||
def test_can_proceed_dapp_usage_after_transacting_it(self):
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
from selenium.common.exceptions import NoSuchElementException
|
||||
|
||||
from tests import marks
|
||||
from tests import marks, test_dapp_url
|
||||
from tests.base_test_case import SingleDeviceTestCase
|
||||
from tests.users import basic_user
|
||||
from views.sign_in_view import SignInView
|
||||
|
@ -42,7 +42,7 @@ class TestDeepLinks(SingleDeviceTestCase):
|
|||
sign_in_view = SignInView(self.driver)
|
||||
sign_in_view.create_user()
|
||||
self.driver.close_app()
|
||||
dapp_name = 'status-im.github.io/dapp'
|
||||
dapp_name = test_dapp_url
|
||||
dapp_deep_link = 'https://get.status.im/browse/%s' % dapp_name
|
||||
sign_in_view.open_weblink_and_login(dapp_deep_link)
|
||||
web_view = sign_in_view.get_chat_view()
|
||||
|
|
|
@ -55,6 +55,17 @@ class ClearAllDappButton(BaseButton):
|
|||
super(ClearAllDappButton, self).__init__(driver)
|
||||
self.locator = self.Locator.accessibility_id('clear-all-dapps')
|
||||
|
||||
class SelectAccountButton(BaseButton):
|
||||
def __init__(self, driver):
|
||||
super(SelectAccountButton, self).__init__(driver)
|
||||
self.locator = self.Locator.accessibility_id('select-account')
|
||||
|
||||
class SelectAccountRadioButton(BaseButton):
|
||||
def __init__(self, driver, account_name):
|
||||
super(SelectAccountRadioButton, self).__init__(driver)
|
||||
self.locator = self.Locator.xpath_selector("//*[@text='%s']/../../android.view.ViewGroup/android.view.ViewGroup[2]" % account_name)
|
||||
|
||||
|
||||
|
||||
class DappsView(BaseView):
|
||||
|
||||
|
@ -73,6 +84,11 @@ class DappsView(BaseView):
|
|||
self.remove_d_app_button = RemoveDappButton(self.driver)
|
||||
self.clear_all_d_app_button = ClearAllDappButton(self.driver)
|
||||
|
||||
#select account
|
||||
self.select_account_button = SelectAccountButton(self.driver)
|
||||
self.select_account_radio_button = SelectAccountRadioButton(self.driver,
|
||||
account_name='Status account')
|
||||
|
||||
|
||||
def open_url(self, url):
|
||||
self.enter_url_editbox.click()
|
||||
|
@ -89,3 +105,6 @@ class DappsView(BaseView):
|
|||
entry.long_press_element()
|
||||
self.clear_all_d_app_button if clear_all else self.remove_d_app_button.click()
|
||||
return entry
|
||||
|
||||
def select_account_by_name(self, account_name='Status account'):
|
||||
return SelectAccountRadioButton(self.driver, account_name)
|
||||
|
|
|
@ -2,6 +2,7 @@ import time
|
|||
from selenium.common.exceptions import TimeoutException, NoSuchElementException
|
||||
from views.base_element import BaseButton, BaseText, BaseElement, BaseEditBox
|
||||
from views.base_view import BaseView
|
||||
from tests import test_dapp_url
|
||||
|
||||
|
||||
class WelcomeImageElement(BaseElement):
|
||||
|
@ -197,7 +198,7 @@ class HomeView(BaseView):
|
|||
|
||||
def open_status_test_dapp(self, allow_all=True):
|
||||
dapp_view = self.dapp_tab_button.click()
|
||||
dapp_view.open_url('status-im.github.io/dapp')
|
||||
dapp_view.open_url(test_dapp_url)
|
||||
status_test_dapp = dapp_view.get_status_test_dapp_view()
|
||||
for _ in range(2):
|
||||
if allow_all:
|
||||
|
|
Loading…
Reference in New Issue