Wallet modal tests

Signed-off-by: yevh-berdnyk <ie.berdnyk@gmail.com>
This commit is contained in:
yevh-berdnyk 2018-08-01 02:16:33 +02:00
parent eaa4ef985b
commit 746d580e34
No known key found for this signature in database
GPG Key ID: E9B425FDFC4DEA9C
10 changed files with 144 additions and 21 deletions

View File

@ -53,7 +53,8 @@
(toolbar/nav-back-count {:home? true})
[toolbar-content/toolbar-content-view]
[toolbar/actions [{:icon :icons/wallet
:icon-opts {:color :black}
:icon-opts {:color :black
:accessibility-label :wallet-modal-button}
:handler #(re-frame/dispatch [:navigate-to-modal :wallet-modal])}
{:icon :icons/options
:icon-opts {:color :black

View File

@ -96,7 +96,8 @@
(re-frame/dispatch [:remove-browser browser-id]))))]
[toolbar-content url browser error? url-editing?]
[toolbar.view/actions [{:icon :icons/wallet
:icon-opts {:color :black}
:icon-opts {:color :black
:accessibility-label :wallet-modal-button}
:handler #(re-frame/dispatch [:navigate-to-modal :wallet-modal])}]]]
[react/view components.styles/flex
[components.webview-bridge/webview-bridge

View File

@ -38,7 +38,8 @@
[toolbar/content-wrapper]
[toolbar/actions
[{:icon (if modal-history? :icons/wallet :icons/transaction-history)
:icon-opts {:color :white}
:icon-opts {:color :white
:accessibility-label (if modal-history? :wallet-modal-button :transaction-history-button)}
:handler #(re-frame/dispatch [:set-in [:wallet :modal-history?] (not modal-history?)])}]]]])
(defn- total-section [value currency]

View File

@ -0,0 +1,101 @@
import pytest
from tests import marks, transaction_users
from tests.base_test_case import SingleDeviceTestCase
from views.sign_in_view import SignInView
@marks.wallet_modal
class TestWalletModal(SingleDeviceTestCase):
@marks.testrail_id(3794)
def test_wallet_modal_public_chat(self):
user = transaction_users['A_USER']
sign_in = SignInView(self.driver)
sign_in.recover_access(user['passphrase'], user['password'])
wallet = sign_in.wallet_button.click()
wallet.set_up_wallet()
usd_value = wallet.get_usd_total_value()
eth_value = wallet.get_eth_value()
stt_value = wallet.get_stt_value()
home = wallet.home_button.click()
chat = home.join_public_chat(home.get_public_chat_name())
wallet_modal = chat.wallet_modal_button.click()
if wallet_modal.address_text.text != '0x' + user['address']:
self.errors.append('Wallet address is not shown in wallet modal')
if wallet_modal.get_usd_total_value() != usd_value:
self.errors.append('Total value in USD is not correct in wallet modal')
if wallet_modal.get_eth_value() != eth_value:
self.errors.append('ETH value is not correct in wallet modal')
if wallet_modal.get_stt_value() != stt_value:
self.errors.append('STT value is not correct in wallet modal')
if not wallet_modal.transaction_history_button.is_element_displayed():
self.errors.append('Transaction history button is not visible in wallet modal')
self.verify_no_errors()
@marks.testrail_id(3795)
def test_wallet_modal_dapp(self):
user = transaction_users['B_USER']
sign_in = SignInView(self.driver)
sign_in.recover_access(user['passphrase'], user['password'])
wallet = sign_in.wallet_button.click()
wallet.set_up_wallet()
usd_value = wallet.get_usd_total_value()
eth_value = wallet.get_eth_value()
stt_value = wallet.get_stt_value()
home = wallet.home_button.click()
start_new_chat = home.plus_button.click()
start_new_chat.open_d_app_button.click()
start_new_chat.element_by_text('Airswap').click()
start_new_chat.open_button.click()
wallet_modal = start_new_chat.wallet_modal_button.click()
if wallet_modal.address_text.text != '0x' + user['address']:
self.errors.append('Wallet address is not shown in wallet modal')
if wallet_modal.get_usd_total_value() != usd_value:
self.errors.append('Total value in USD is not correct in wallet modal')
if wallet_modal.get_eth_value() != eth_value:
self.errors.append('ETH value is not correct in wallet modal')
if wallet_modal.get_stt_value() != stt_value:
self.errors.append('STT value is not correct in wallet modal')
if not wallet_modal.transaction_history_button.is_element_displayed():
self.errors.append('Transaction history button is not visible in wallet modal')
self.verify_no_errors()
@marks.testrail_id(3797)
def test_wallet_modal_transaction_history(self):
user = transaction_users['B_USER']
sign_in = SignInView(self.driver)
home = sign_in.recover_access(user['passphrase'], user['password'])
start_new_chat = home.plus_button.click()
start_new_chat.open_d_app_button.click()
start_new_chat.element_by_text('Airswap').click()
start_new_chat.open_button.click()
wallet_modal = start_new_chat.wallet_modal_button.click()
transaction_history = wallet_modal.transaction_history_button.click()
if transaction_history.transactions_table.get_transactions_number() < 1:
pytest.fail('Transactions history is not shown')
@marks.testrail_id(3800)
def test_close_and_open_wallet_modal(self):
user = transaction_users['B_USER']
sign_in = SignInView(self.driver)
home = sign_in.recover_access(user['passphrase'], user['password'])
start_new_chat = home.plus_button.click()
start_new_chat.open_d_app_button.click()
start_new_chat.element_by_text('Airswap').click()
start_new_chat.open_button.click()
web_view = start_new_chat.get_base_web_view()
wallet_modal = start_new_chat.wallet_modal_button.click()
if not wallet_modal.usd_total_value.is_element_displayed():
pytest.fail("Wallet modal doesn't contain balance")
transaction_history = wallet_modal.transaction_history_button.click()
if transaction_history.transactions_table.get_transactions_number() < 1:
pytest.fail('Transactions history is not shown')
transaction_history.cross_icon.click()
if not web_view.browser_previous_page_button.is_element_displayed():
pytest.fail('Modal wallet was not closed')
web_view.cross_icon.click()
chat = home.join_public_chat(home.get_public_chat_name())
chat.wallet_modal_button.click()
if not wallet_modal.usd_total_value.is_element_displayed():
pytest.fail("Wallet modal was not opened")

View File

@ -31,7 +31,7 @@ class TestBrowsing(SingleDeviceTestCase):
start_new_chat.confirm()
browsing_view = home_view.get_base_web_view()
browsing_view.find_text_part('Unable to load page')
browsing_view.browser_cross_icon.click()
browsing_view.cross_icon.click()
if home_view.element_by_text('Browser').is_element_displayed():
pytest.fail('Browser entity is shown for an invalid link')
@ -58,7 +58,7 @@ class TestBrowsing(SingleDeviceTestCase):
browsing_view = home_view.get_base_web_view()
browsing_view.url_edit_box_lock_icon.click()
browsing_view.find_full_text(connection_is_secure_text)
browsing_view.browser_cross_icon.click()
browsing_view.cross_icon.click()
start_new_chat_view = home_view.plus_button.click()
start_new_chat_view.open_d_app_button.click()
start_new_chat_view.element_by_text('Airswap').click()
@ -75,7 +75,7 @@ class TestBrowsing(SingleDeviceTestCase):
start_new_chat.enter_url_editbox.set_value('google.com')
start_new_chat.confirm()
browsing_view = home_view.get_base_web_view()
browsing_view.browser_cross_icon.click()
browsing_view.cross_icon.click()
home_view.get_chat_with_user('Browser').swipe_and_delete()
home_view.relogin()
if home_view.get_chat_with_user('Browser').is_element_present(20):

View File

@ -101,7 +101,7 @@ class TestTransactionDApp(SingleDeviceTestCase):
status_test_dapp.request_eth_button.click()
status_test_dapp.element_by_text('Faucet request recieved').wait_for_visibility_of_element()
status_test_dapp.ok_button.click()
status_test_dapp.browser_cross_icon.click()
status_test_dapp.cross_icon.click()
wallet_view = sign_in_view.wallet_button.click()
wallet_view.set_up_wallet()
wallet_view.wait_balance_changed_on_wallet_screen()

View File

@ -14,6 +14,7 @@ dapps = pytest.mark.dapps
message_reliability = pytest.mark.message_reliability
transaction = pytest.mark.transaction
wallet = pytest.mark.wallet
wallet_modal = pytest.mark.wallet_modal
sign_in = pytest.mark.sign_in
skip = pytest.mark.skip
logcat = pytest.mark.logcat

View File

@ -222,6 +222,23 @@ class ProgressBar(BaseElement):
self.locator = self.Locator.xpath_selector(parent_locator + '//android.widget.ProgressBar')
class WalletModalButton(BaseButton):
def __init__(self, driver):
super(WalletModalButton, self).__init__(driver)
self.locator = self.Locator.accessibility_id('wallet-modal-button')
def navigate(self):
from views.wallet_view import WalletView
return WalletView(self.driver)
class CrossIcon(BaseButton):
def __init__(self, driver):
super(CrossIcon, self).__init__(driver)
self.locator = self.Locator.xpath_selector('(//android.view.ViewGroup[@content-desc="icon"])[1]')
class BaseView(object):
def __init__(self, driver):
self.driver = driver
@ -246,12 +263,15 @@ class BaseView(object):
self.discard_button = DiscardButton(self.driver)
self.confirm_button = ConfirmButton(self.driver)
self.connection_status = ConnectionStatusText(self.driver)
self.cross_icon = CrossIcon(self.driver)
self.apps_button = AppsButton(self.driver)
self.status_app_icon = StatusAppIcon(self.driver)
self.test_fairy_warning = TestFairyWarning(self.driver)
self.wallet_modal_button = WalletModalButton(self.driver)
self.element_types = {
'base': BaseElement,
'button': BaseButton,

View File

@ -72,7 +72,7 @@ class STTAssetText(BaseText):
class UsdTotalValueText(BaseText):
def __init__(self, driver):
super(UsdTotalValueText, self).__init__(driver)
self.locator = self.Locator.xpath_selector("//*[@text='USD']/../android.widget.TextView[1]")
self.locator = self.Locator.accessibility_id('total-amount-value-text')
class SendTransactionRequestButton(BaseButton):

View File

@ -1,6 +1,9 @@
from views.base_view import *
import time
import pytest
from views.base_element import BaseElement, BaseEditBox, BaseButton
from views.base_view import BaseView
class ProgressBarIcon(BaseElement):
@ -9,6 +12,13 @@ class ProgressBarIcon(BaseElement):
self.locator = self.Locator.xpath_selector("//android.widget.ProgressBar")
class WebLinkEditBox(BaseEditBox):
def __init__(self, driver):
super(WebLinkEditBox, self).__init__(driver)
self.locator = self.Locator.xpath_selector("//android.widget.EditText")
class BackToHomeButton(BaseButton):
def __init__(self, driver):
super(BackToHomeButton, self).__init__(driver)
@ -46,17 +56,6 @@ class AlwaysButton(BaseButton):
self.locator = self.Locator.text_part_selector('ALWAYS')
class BrowserCrossIcon(BaseButton):
def __init__(self, driver):
super(BrowserCrossIcon, self).__init__(driver)
self.locator = self.Locator.xpath_selector('(//android.view.ViewGroup[@content-desc="icon"])[1]')
def navigate(self):
from views.home_view import HomeView
return HomeView(self.driver)
class URLEditBoxLockIcon(BaseEditBox):
def __init__(self, driver):
@ -80,7 +79,6 @@ class BaseWebView(BaseView):
self.web_view_browser = WebViewBrowserButton(self.driver)
self.always_button = AlwaysButton(self.driver)
self.browser_cross_icon = BrowserCrossIcon(self.driver)
self.browser_refresh_page_button = BrowserRefreshPageButton(self.driver)
def wait_for_d_aap_to_load(self, wait_time=35):