Skip to content

Commit

Permalink
e2e tests update (wallet)
Browse files Browse the repository at this point in the history
  • Loading branch information
antdanchenko authored and goranjovic committed Feb 19, 2019
1 parent 56036a6 commit 16e6d93
Show file tree
Hide file tree
Showing 8 changed files with 116 additions and 117 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ def test_send_transaction_from_daap(self):
status_test_dapp.assets_button.click()
send_transaction_view = status_test_dapp.request_stt_button.click()
wallet_view = send_transaction_view.get_wallet_view()
wallet_view.done_button.click()
wallet_view.yes_button.click()
for _ in range(2):
wallet_view.got_it_button.click()
send_transaction_view.sign_transaction()
self.network_api.verify_balance_is_updated(initial_balance, address)

Expand Down
178 changes: 77 additions & 101 deletions test/appium/tests/atomic/transactions/test_wallet.py

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion test/appium/tests/base_test_case.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,11 @@ def get_alert_text(self, driver):

def add_alert_text_to_report(self, driver):
if self.is_alert_present(driver):
test_suite_data.current_test.testruns[-1].error += ", also Unexpected Alert is shown: '%s'" \
try:
test_suite_data.current_test.testruns[-1].error += ", also Unexpected Alert is shown: '%s'" \
% self.get_alert_text(driver)
except TypeError:
pass


class Driver(webdriver.Remote):
Expand Down
2 changes: 1 addition & 1 deletion test/appium/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def pytest_addoption(parser):
help='Specify environment: local/sauce/api')
parser.addoption('--platform_version',
action='store',
default='8.0',
default='7.1',
help='Android device platform version')
parser.addoption('--log',
action='store',
Expand Down
1 change: 1 addition & 0 deletions test/appium/tests/marks.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
message_reliability = pytest.mark.message_reliability
transaction = pytest.mark.transaction
wallet = pytest.mark.wallet
wallet_transaction = pytest.mark.wallet_transaction
wallet_modal = pytest.mark.wallet_modal
sign_in = pytest.mark.sign_in
skip = pytest.mark.skip
Expand Down
13 changes: 10 additions & 3 deletions test/appium/views/base_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,13 @@ def __init__(self, driver):
class YesButton(BaseButton):
def __init__(self, driver):
super(YesButton, self).__init__(driver)
self.locator = self.Locator.xpath_selector("//*[@text='YES' or @text='GOT IT']")
self.locator = self.Locator.xpath_selector("//*[@text='YES']")


class GotItButton(BaseButton):
def __init__(self, driver):
super(GotItButton, self).__init__(driver)
self.locator = self.Locator.xpath_selector("//*[@text='GOT IT']")


class NoButton(BaseButton):
Expand Down Expand Up @@ -149,7 +155,7 @@ class NextButton(BaseButton):
def __init__(self, driver):
super(NextButton, self).__init__(driver)
self.locator = self.Locator.xpath_selector(
"//android.widget.TextView[@text='NEXT']")
"//android.widget.TextView[@text='NEXT' or @text='Next']")


class AddButton(BaseButton):
Expand Down Expand Up @@ -213,7 +219,7 @@ def __init__(self, driver):
class ConfirmButton(BaseButton):
def __init__(self, driver):
super(ConfirmButton, self).__init__(driver)
self.locator = self.Locator.xpath_selector("//*[@text='CONFIRM']")
self.locator = self.Locator.xpath_selector("//*[@text='CONFIRM' or @text='Confirm']")


class ProgressBar(BaseElement):
Expand Down Expand Up @@ -287,6 +293,7 @@ def __init__(self, driver):
self.connection_status = ConnectionStatusText(self.driver)
self.cross_icon = CrossIcon(self.driver)
self.show_roots_button = ShowRoots(self.driver)
self.got_it_button = GotItButton(self.driver)

self.apps_button = AppsButton(self.driver)
self.status_app_icon = StatusAppIcon(self.driver)
Expand Down
25 changes: 18 additions & 7 deletions test/appium/views/send_transaction_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,12 @@ def __init__(self, driver):
class EnterRecipientAddressInput(BaseEditBox):
def __init__(self, driver):
super(EnterRecipientAddressInput, self).__init__(driver)
self.locator = self.Locator.xpath_selector("//*[@text='Enter recipient address']")
self.locator = self.Locator.accessibility_id("recipient-address-input")


class RecentRecipientsButton(BaseButton):
class ContactsButton(BaseButton):
def __init__(self, driver):
super(RecentRecipientsButton, self).__init__(driver)
super(ContactsButton, self).__init__(driver)
self.locator = self.Locator.xpath_selector("//*[@text='Contacts']")


Expand Down Expand Up @@ -156,6 +156,12 @@ def __init__(self, driver):
self.locator = self.Locator.text_selector('Not enough ETH for gas')


class SendButton(BaseButton):
def __init__(self, driver):
super(SendButton, self).__init__(driver)
self.locator = self.Locator.xpath_selector("//*[@text='Send']")


class ValidationWarnings(object):
def __init__(self, driver):
self.not_enough_eth_for_gas = NotEnoughEthForGas(driver)
Expand All @@ -170,7 +176,7 @@ def __init__(self, driver):
self.scan_qr_code_button = ScanQRCodeButton(self.driver)
self.enter_recipient_address_input = EnterRecipientAddressInput(self.driver)
self.first_recipient_button = FirstRecipient(self.driver)
self.recent_recipients_button = RecentRecipientsButton(self.driver)
self.contacts_button = ContactsButton(self.driver)
self.amount_edit_box = AmountEditBox(self.driver)

self.advanced_button = AdvancedButton(self.driver)
Expand All @@ -183,6 +189,7 @@ def __init__(self, driver):
self.cancel_button = CancelButton(self.driver)
self.sign_transaction_button = SignTransactionButton(self.driver)
self.sign_in_phrase_text = SignInPhraseText(self.driver)
self.send_button = SendButton(self.driver)
self.password_input = PasswordInput(self.driver)
self.enter_password_input = EnterPasswordInput(self.driver)
self.got_it_button = GotItButton(self.driver)
Expand All @@ -205,12 +212,16 @@ def complete_onboarding(self):
self.yes_button.click()

def sign_transaction(self, sender_password: str = common_password):
self.sign_transaction_button.click_until_presence_of_element(self.enter_password_input)
self.confirm_button.click()
self.enter_password_input.send_keys(sender_password)
self.sign_transaction_button.click_until_presence_of_element(self.got_it_button)
self.progress_bar.wait_for_invisibility_of_element(20)
self.send_button.click()
self.got_it_button.click()

def select_token(self, token_text):
for text in 'Ropsten Ether', token_text:
button = self.element_by_text(text)
button.click()

def get_transaction_fee_total(self):
return float(self.transaction_fee_total_value.text.split()[0])

5 changes: 3 additions & 2 deletions test/appium/views/wallet_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,9 @@ def get_sign_in_phrase(self):
def set_up_wallet(self):
self.set_up_button.click()
phrase = self.sign_in_phrase.string
self.done_button.click()
self.yes_button.click()
self.got_it_button.click()
time.sleep(2)
self.got_it_button.click()
return phrase

def get_wallet_address(self):
Expand Down

0 comments on commit 16e6d93

Please sign in to comment.