added 'recover user from console view' flow, modified info captions.

This commit is contained in:
Anton Danchenko 2017-10-23 13:23:14 +03:00 committed by Roman Volosovskyi
parent ec2d3a77a7
commit c8267106bc
4 changed files with 37 additions and 25 deletions

View File

@ -7,14 +7,11 @@ def set_password_as_new_user(*args):
view.confirm() view.confirm()
view.chat_request_input.send_keys("qwerty1234") view.chat_request_input.send_keys("qwerty1234")
view.confirm() view.confirm()
view.find_full_text("Tap here to enter your phone number & I\'ll find your friends") view.find_full_text("Tap here to validate your phone number & I\'ll find your friends.")
def recover_access(chats, passphrase, password, username): def recover_access(home, passphrase, password, username):
chats.back_button.click() login = home.recover_button.click()
chats.profile_button.click()
login = chats.switch_users_button.click()
login.recover_access_button.click()
login.passphrase_input.send_keys(passphrase) login.passphrase_input.send_keys(passphrase)
login.password_input.send_keys(password) login.password_input.send_keys(password)
login.confirm_recover_access.click() login.confirm_recover_access.click()

View File

@ -16,12 +16,11 @@ class TestTransactions(SingleDeviceTestCase):
ids=['group_chat', 'one_to_one_chat', 'wrong_password']) ids=['group_chat', 'one_to_one_chat', 'wrong_password'])
def test_send_transaction(self, test, recipient, sender): def test_send_transaction(self, test, recipient, sender):
home = HomeView(self.driver) home = HomeView(self.driver)
set_password_as_new_user(home) recover_access(home,
chats = home.get_chats()
recover_access(chats,
transaction_users[sender]['passphrase'], transaction_users[sender]['passphrase'],
transaction_users[sender]['password'], transaction_users[sender]['password'],
transaction_users[sender]['username']) transaction_users[sender]['username'])
chats = home.get_chats()
chats.wait_for_syncing_complete() chats.wait_for_syncing_complete()
sender_address = transaction_users[sender]['address'] sender_address = transaction_users[sender]['address']
@ -74,16 +73,14 @@ class TestTransactions(SingleDeviceTestCase):
@pytest.mark.transaction @pytest.mark.transaction
def test_send_transaction_from_daap(self): def test_send_transaction_from_daap(self):
home = HomeView(self.driver) home = HomeView(self.driver)
set_password_as_new_user(home) recover_access(home,
transaction_users['B_USER']['passphrase'],
transaction_users['B_USER']['password'],
transaction_users['B_USER']['username'])
chats = home.get_chats() chats = home.get_chats()
address = transaction_users['B_USER']['address'] address = transaction_users['B_USER']['address']
initial_balance = chats.get_balance(address) initial_balance = chats.get_balance(address)
recover_access(chats,
transaction_users['B_USER']['passphrase'],
transaction_users['B_USER']['password'],
transaction_users['B_USER']['username'])
contacts = chats.contacts_button.click() contacts = chats.contacts_button.click()
auction_house = contacts.auction_house_button.click() auction_house = contacts.auction_house_button.click()

View File

@ -1,5 +1,4 @@
import pytest import pytest
import time
from tests.basetestcase import SingleDeviceTestCase from tests.basetestcase import SingleDeviceTestCase
from views.home import HomeView from views.home import HomeView
from tests.preconditions import set_password_as_new_user, recover_access from tests.preconditions import set_password_as_new_user, recover_access
@ -10,13 +9,16 @@ from tests import transaction_users
class TestWallet(SingleDeviceTestCase): class TestWallet(SingleDeviceTestCase):
@pytest.mark.wallet @pytest.mark.wallet
def test_insufficient_funds(self): def test_wallet_error_messages(self):
home = HomeView(self.driver) home = HomeView(self.driver)
set_password_as_new_user(home) set_password_as_new_user(home)
chats = home.get_chats() chats = home.get_chats()
chats.back_button.click() chats.back_button.click()
wallet_view = chats.wallet_button.click() wallet_view = chats.wallet_button.click()
wallet_view.send_button.click() wallet_view.send_button.click()
wallet_view.amount_edit_box.send_keys('asd')
wallet_view.find_full_text('Amount is not a valid number')
wallet_view.amount_edit_box.send_keys('0,1') wallet_view.amount_edit_box.send_keys('0,1')
wallet_view.find_full_text('Insufficient funds') wallet_view.find_full_text('Insufficient funds')
@ -26,21 +28,23 @@ class TestWallet(SingleDeviceTestCase):
ids=['sign_now', 'sign_later']) ids=['sign_now', 'sign_later'])
def test_send_transaction_from_wallet(self, test, recipient, sender): def test_send_transaction_from_wallet(self, test, recipient, sender):
home = HomeView(self.driver) home = HomeView(self.driver)
set_password_as_new_user(home) recover_access(home,
chats = home.get_chats()
recipient_key = transaction_users[recipient]['public_key']
recipient_address = transaction_users[recipient]['address']
initial_balance_recipient = chats.get_balance(recipient_address)
recover_access(chats,
transaction_users[sender]['passphrase'], transaction_users[sender]['passphrase'],
transaction_users[sender]['password'], transaction_users[sender]['password'],
transaction_users[sender]['username']) transaction_users[sender]['username'])
chats = home.get_chats()
chats.wait_for_syncing_complete() chats.wait_for_syncing_complete()
recipient_key = transaction_users[recipient]['public_key']
recipient_address = transaction_users[recipient]['address']
initial_balance_recipient = chats.get_balance(recipient_address)
chats.plus_button.click() chats.plus_button.click()
chats.add_new_contact.click() chats.add_new_contact.click()
chats.public_key_edit_box.send_keys(recipient_key) chats.public_key_edit_box.send_keys(recipient_key)
chats.confirm() chats.confirm()
chats.confirm_public_key_button.click() chats.confirm_public_key_button.click()
for _ in range(2): for _ in range(2):
chats.back_button.click() chats.back_button.click()
wallet = chats.wallet_button.click() wallet = chats.wallet_button.click()
@ -53,6 +57,7 @@ class TestWallet(SingleDeviceTestCase):
wallet.chose_from_contacts_button.click() wallet.chose_from_contacts_button.click()
user_contact = chats.element_by_text(transaction_users[recipient]['username'], 'button') user_contact = chats.element_by_text(transaction_users[recipient]['username'], 'button')
user_contact.click() user_contact.click()
if test == 'sign_later': if test == 'sign_later':
chats.sign_later_button.click() chats.sign_later_button.click()
wallet.yes_button.click() wallet.yes_button.click()
@ -60,6 +65,7 @@ class TestWallet(SingleDeviceTestCase):
wallet.transactions_icon.click() wallet.transactions_icon.click()
wallet.unsigned_tab.click() wallet.unsigned_tab.click()
wallet.sign_button.click() wallet.sign_button.click()
chats.sign_transaction_button.click() chats.sign_transaction_button.click()
chats.enter_password_input.send_keys(transaction_users[sender]['password']) chats.enter_password_input.send_keys(transaction_users[sender]['password'])
chats.sign_transaction_button.click() chats.sign_transaction_button.click()

View File

@ -24,6 +24,17 @@ class RequestPasswordIcon(BaseButton):
return self.navigate() return self.navigate()
class RecoverButton(BaseButton):
def __init__(self, driver):
super(RecoverButton, self).__init__(driver)
self.locator = self.Locator.xpath_selector("//*[@text='Recover']")
def navigate(self):
from views.login import LoginView
return LoginView(self.driver)
class HomeView(BaseViewObject): class HomeView(BaseViewObject):
def __init__(self, driver): def __init__(self, driver):
@ -33,5 +44,6 @@ class HomeView(BaseViewObject):
i.click() i.click()
except (NoSuchElementException, TimeoutException): except (NoSuchElementException, TimeoutException):
pass pass
self.chat_request_input = ChatRequestInput(driver) self.chat_request_input = ChatRequestInput(self.driver)
self.request_password_icon = RequestPasswordIcon(driver) self.request_password_icon = RequestPasswordIcon(self.driver)
self.recover_button = RecoverButton(self.driver)