Tests updated with new onboarding flow
This commit is contained in:
parent
35e8278e8c
commit
3a33e04410
|
@ -1,6 +1,6 @@
|
|||
import pytest
|
||||
from views.console_view import ConsoleView
|
||||
from tests.base_test_case import SingleDeviceTestCase
|
||||
from views.sign_in_view import SignInView
|
||||
|
||||
|
||||
@pytest.mark.all
|
||||
|
@ -8,10 +8,9 @@ class TestDappsAnsBrowsing(SingleDeviceTestCase):
|
|||
|
||||
@pytest.mark.pr
|
||||
def test_browse_link_entering_url_in_dapp_view(self):
|
||||
console = ConsoleView(self.driver)
|
||||
console.create_user()
|
||||
console.back_button.click()
|
||||
home_view = console.get_home_view()
|
||||
sign_in = SignInView(self.driver)
|
||||
sign_in.create_user()
|
||||
home_view = sign_in.get_home_view()
|
||||
start_new_chat = home_view.plus_button.click()
|
||||
start_new_chat.open_d_app_button.click()
|
||||
start_new_chat.enter_url_editbox.send_keys('status.im')
|
||||
|
|
|
@ -4,7 +4,7 @@ import pytest
|
|||
import emoji
|
||||
|
||||
from tests.base_test_case import MultipleDeviceTestCase
|
||||
from views.console_view import ConsoleView
|
||||
from views.sign_in_view import SignInView
|
||||
|
||||
unicode_text_message = '%s%s%s%s %s%s%s%s%s%s%s' % (chr(355), chr(275), chr(353), chr(539), chr(1084), chr(949),
|
||||
chr(349), chr(353), chr(513), chr(485), chr(283))
|
||||
|
@ -23,10 +23,9 @@ class TestMessages(MultipleDeviceTestCase):
|
|||
@pytest.mark.pr
|
||||
def test_one_to_one_chat_messages_and_delete_chat(self):
|
||||
self.create_drivers(2)
|
||||
device_1, device_2 = ConsoleView(self.drivers[0]), ConsoleView(self.drivers[1])
|
||||
for console in device_1, device_2:
|
||||
console.create_user()
|
||||
console.back_button.click()
|
||||
device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
|
||||
for sign_in in device_1, device_2:
|
||||
sign_in.create_user()
|
||||
device_1_home, device_2_home = device_1.get_home_view(), device_2.get_home_view()
|
||||
device_2_public_key = device_2_home.get_public_key()
|
||||
device_2_profile = device_2_home.get_profile_view()
|
||||
|
@ -78,6 +77,7 @@ class TestMessages(MultipleDeviceTestCase):
|
|||
|
||||
device_1_chat.chat_options.click()
|
||||
device_1_chat.delete_chat_button.click()
|
||||
device_1_chat.delete_button.click()
|
||||
if not device_1_home.plus_button.is_element_present() or \
|
||||
device_1_chat.element_by_text_part(device_2_username[:25]).is_element_present():
|
||||
self.errors.append('Chat was not deleted')
|
||||
|
@ -86,11 +86,10 @@ class TestMessages(MultipleDeviceTestCase):
|
|||
@pytest.mark.pr
|
||||
def test_group_chat_messages(self):
|
||||
self.create_drivers(3)
|
||||
device_1, device_2, device_3 = ConsoleView(self.drivers[0]), ConsoleView(self.drivers[1]), \
|
||||
ConsoleView(self.drivers[2])
|
||||
for console in device_1, device_2, device_3:
|
||||
console.create_user()
|
||||
console.back_button.click()
|
||||
device_1, device_2, device_3 = SignInView(self.drivers[0]), SignInView(self.drivers[1]), \
|
||||
SignInView(self.drivers[2])
|
||||
for sign_in in device_1, device_2, device_3:
|
||||
sign_in.create_user()
|
||||
home_1, home_2, home_3 = device_1.get_home_view(), device_2.get_home_view(), device_3.get_home_view()
|
||||
public_key_2, public_key_3 = home_2.get_public_key(), home_3.get_public_key()
|
||||
profile_1 = home_1.profile_button.click()
|
||||
|
@ -140,13 +139,12 @@ class TestMessages(MultipleDeviceTestCase):
|
|||
@pytest.mark.pr
|
||||
def test_public_chat(self):
|
||||
self.create_drivers(2)
|
||||
device_1, device_2 = ConsoleView(self.drivers[0]), ConsoleView(self.drivers[1])
|
||||
device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
|
||||
users = []
|
||||
chat_name = ''.join(random.choice(string.ascii_lowercase) for _ in range(7))
|
||||
for console in device_1, device_2:
|
||||
console.create_user()
|
||||
console.back_button.click()
|
||||
home = console.get_home_view()
|
||||
for sign_in in device_1, device_2:
|
||||
sign_in.create_user()
|
||||
home = sign_in.get_home_view()
|
||||
profile = home.profile_button.click()
|
||||
users.append(profile.username_text.text)
|
||||
profile.home_button.click()
|
||||
|
|
|
@ -1,18 +1,16 @@
|
|||
import pytest
|
||||
from selenium.common.exceptions import NoSuchElementException, TimeoutException
|
||||
from tests.base_test_case import MultipleDeviceTestCase
|
||||
from views.console_view import ConsoleView
|
||||
from views.sign_in_view import SignInView
|
||||
|
||||
|
||||
class TestMultipleDevices(MultipleDeviceTestCase):
|
||||
|
||||
def test_group_chat_send_receive_messages_and_remove_user(self):
|
||||
self.create_drivers(2)
|
||||
device_1, device_2 = \
|
||||
ConsoleView(self.drivers[0]), ConsoleView(self.drivers[1])
|
||||
for console in device_1, device_2:
|
||||
console.create_user()
|
||||
console.back_button.click()
|
||||
device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
|
||||
for sign_in in device_1, device_2:
|
||||
sign_in.create_user()
|
||||
device_1_home = device_1.get_home_view()
|
||||
device_2_home = device_2.get_home_view()
|
||||
device_1_public_key = device_1_home.get_public_key()
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
import pytest
|
||||
from itertools import combinations_with_replacement
|
||||
from tests.base_test_case import MultipleDeviceTestCase, SingleDeviceTestCase
|
||||
from views.console_view import ConsoleView
|
||||
from selenium.common.exceptions import TimeoutException
|
||||
|
||||
from views.sign_in_view import SignInView
|
||||
|
||||
|
||||
class TestNetwork(SingleDeviceTestCase):
|
||||
|
||||
|
@ -11,11 +12,10 @@ class TestNetwork(SingleDeviceTestCase):
|
|||
@pytest.mark.parametrize("network", ['Ropsten', 'Rinkeby', 'Rinkeby with upstream RPC',
|
||||
'Mainnet', 'Mainnet with upstream RPC'])
|
||||
def test_network_switch(self, network):
|
||||
console = ConsoleView(self.driver)
|
||||
console.create_user()
|
||||
console.back_button.click()
|
||||
profile_view = console.profile_button.click()
|
||||
sign_in_view = profile_view.switch_network(network)
|
||||
sign_in_view = SignInView(self.driver)
|
||||
sign_in_view.create_user()
|
||||
profile_view = sign_in_view.profile_button.click()
|
||||
profile_view.switch_network(network)
|
||||
sign_in_view.first_account_button.click()
|
||||
sign_in_view.password_input.send_keys('qwerty1234')
|
||||
sign_in_view.sign_in_button.click()
|
||||
|
@ -32,10 +32,9 @@ class TestNetworkChats(MultipleDeviceTestCase):
|
|||
ids=[i[0] + ' & ' + i[1] for i in network_combinations])
|
||||
def test_one_to_one_chat_between(self, network):
|
||||
self.create_drivers(2)
|
||||
device_1, device_2 = ConsoleView(self.drivers[0]), ConsoleView(self.drivers[1])
|
||||
for console in device_1, device_2:
|
||||
console.create_user()
|
||||
device_1.back_button.click()
|
||||
device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
|
||||
for sign_in in device_1, device_2:
|
||||
sign_in.create_user()
|
||||
device_1_profile_view = device_1.profile_button.click()
|
||||
device_1_public_key = device_1_profile_view.public_key_text.text
|
||||
if network[0] != 'Ropsten with upstream RPC':
|
||||
|
@ -46,7 +45,6 @@ class TestNetworkChats(MultipleDeviceTestCase):
|
|||
login_d1.find_full_text('Wallet', 60)
|
||||
else:
|
||||
device_1_profile_view.back_button.click()
|
||||
device_2.back_button.click()
|
||||
device_2_home_view = device_2.get_home_view()
|
||||
if network[1] != 'Ropsten with upstream RPC':
|
||||
device_2_profile_view = device_2.profile_button.click()
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import pytest
|
||||
import time
|
||||
from tests.base_test_case import SingleDeviceTestCase
|
||||
from views.console_view import ConsoleView
|
||||
from tests import basic_user
|
||||
from views.sign_in_view import SignInView
|
||||
|
||||
|
||||
@pytest.mark.all
|
||||
|
@ -10,10 +10,9 @@ class TestProfileView(SingleDeviceTestCase):
|
|||
|
||||
@pytest.mark.pr
|
||||
def test_qr_code_and_its_value(self):
|
||||
console_view = ConsoleView(self.driver)
|
||||
console_view.create_user()
|
||||
console_view.back_button.click()
|
||||
profile_view = console_view.profile_button.click()
|
||||
sign_in_view = SignInView(self.driver)
|
||||
sign_in_view.create_user()
|
||||
profile_view = sign_in_view.profile_button.click()
|
||||
profile_view.share_my_contact_key_button.click()
|
||||
key_value = profile_view.public_key_text.text
|
||||
time.sleep(5)
|
||||
|
@ -22,10 +21,9 @@ class TestProfileView(SingleDeviceTestCase):
|
|||
|
||||
@pytest.mark.pr
|
||||
def test_contact_profile_view(self):
|
||||
console_view = ConsoleView(self.driver)
|
||||
console_view.create_user()
|
||||
console_view.back_button.click()
|
||||
home_view = console_view.get_home_view()
|
||||
sign_in_view = SignInView(self.driver)
|
||||
sign_in_view.create_user()
|
||||
home_view = sign_in_view.get_home_view()
|
||||
home_view.add_contact(basic_user['public_key'])
|
||||
chat_view = home_view.get_chat_view()
|
||||
chat_view.user_profile_icon_top_right.click()
|
||||
|
@ -34,10 +32,9 @@ class TestProfileView(SingleDeviceTestCase):
|
|||
|
||||
@pytest.mark.pr
|
||||
def test_network_switch(self):
|
||||
console = ConsoleView(self.driver)
|
||||
console.create_user()
|
||||
console.back_button.click()
|
||||
profile_view = console.profile_button.click()
|
||||
sign_in_view = SignInView(self.driver)
|
||||
sign_in_view.create_user()
|
||||
profile_view = sign_in_view.profile_button.click()
|
||||
sign_in_view = profile_view.switch_network('Rinkeby with upstream RPC')
|
||||
sign_in_view.first_account_button.click()
|
||||
sign_in_view.password_input.send_keys('qwerty1234')
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import pytest
|
||||
from tests import transaction_users, transaction_users_wallet
|
||||
from tests.base_test_case import SingleDeviceTestCase
|
||||
from views.console_view import ConsoleView
|
||||
from tests import basic_user
|
||||
from views.sign_in_view import SignInView
|
||||
|
||||
|
||||
@pytest.mark.all
|
||||
|
@ -10,10 +10,9 @@ class TestSanity(SingleDeviceTestCase):
|
|||
|
||||
@pytest.mark.profile
|
||||
def test_change_user_name(self):
|
||||
console_view = ConsoleView(self.driver)
|
||||
console_view.create_user()
|
||||
console_view.back_button.click()
|
||||
profile_view = console_view.profile_button.click()
|
||||
sign_in_view = SignInView(self.driver)
|
||||
sign_in_view.create_user()
|
||||
profile_view = sign_in_view.profile_button.click()
|
||||
profile_view.edit_button.click()
|
||||
profile_view.username_input.clear()
|
||||
new_username = 'NewUserName!'
|
||||
|
@ -30,29 +29,23 @@ class TestSanity(SingleDeviceTestCase):
|
|||
|
||||
@pytest.mark.recover
|
||||
def test_recover_access(self):
|
||||
console_view = ConsoleView(self.driver)
|
||||
console_view.create_user()
|
||||
console_view.back_button.click()
|
||||
profile_view = console_view.profile_button.click()
|
||||
sign_in_view = profile_view.logout_button.click()
|
||||
recover_access_view = sign_in_view.recover_access_button.click()
|
||||
sign_in_view = SignInView(self.driver)
|
||||
sign_in_view.create_user()
|
||||
profile_view = sign_in_view.profile_button.click()
|
||||
profile_view.logout_button.click()
|
||||
recover_access_view = sign_in_view.add_existing_account_button.click()
|
||||
recover_access_view.passphrase_input.send_keys(basic_user['passphrase'])
|
||||
recover_access_view.password_input.send_keys(basic_user['password'])
|
||||
recover_access_view.confirm_recover_access.click()
|
||||
recovered_user = sign_in_view.element_by_text(basic_user['username'], 'button')
|
||||
recovered_user.click()
|
||||
sign_in_view.password_input.send_keys(basic_user['password'])
|
||||
sign_in_view.sign_in_button.click()
|
||||
console_view.find_full_text('Wallet', 60)
|
||||
if basic_user['password'] in str(console_view.logcat):
|
||||
home_view = recover_access_view.sign_in_button.click()
|
||||
home_view.find_full_text('Wallet', 60)
|
||||
if basic_user['password'] in str(home_view.logcat):
|
||||
pytest.fail('Password in logcat!!!', pytrace=False)
|
||||
|
||||
@pytest.mark.gorup_chat
|
||||
def test_group_chat_members(self):
|
||||
console_view = ConsoleView(self.driver)
|
||||
console_view.create_user()
|
||||
console_view.back_button.click()
|
||||
home_view = console_view.get_home_view()
|
||||
sign_in_view = SignInView(self.driver)
|
||||
sign_in_view.create_user()
|
||||
home_view = sign_in_view.get_home_view()
|
||||
|
||||
users = [transaction_users_wallet['A_USER'], transaction_users_wallet['B_USER'],
|
||||
transaction_users['A_USER'], transaction_users['B_USER'], basic_user]
|
||||
|
@ -60,7 +53,7 @@ class TestSanity(SingleDeviceTestCase):
|
|||
|
||||
for user in users:
|
||||
home_view.add_contact(user['public_key'])
|
||||
console_view.back_button.click(2)
|
||||
home_view.back_button.click(2)
|
||||
home_view.create_group_chat(sorted([user['username'] for user in users]))
|
||||
group_chat = home_view.get_chat_view()
|
||||
group_chat.chat_options.click()
|
||||
|
@ -71,10 +64,9 @@ class TestSanity(SingleDeviceTestCase):
|
|||
group_chat.find_full_text(username, 10)
|
||||
|
||||
def test_commands_on_second_app_run(self):
|
||||
console_view = ConsoleView(self.driver)
|
||||
console_view.create_user()
|
||||
console_view.back_button.click()
|
||||
home_view = console_view.get_home_view()
|
||||
sign_in_view = SignInView(self.driver)
|
||||
sign_in_view.create_user()
|
||||
home_view = sign_in_view.get_home_view()
|
||||
start_new_chat_view = home_view.plus_button.click()
|
||||
start_new_chat_view.add_new_contact.click()
|
||||
contact_jarrad = home_view.element_by_text('Jarrad', 'button')
|
||||
|
@ -87,11 +79,10 @@ class TestSanity(SingleDeviceTestCase):
|
|||
for command in commands:
|
||||
chat_view.find_full_text(command, 2)
|
||||
self.driver.close_app()
|
||||
console_view.apps_button.click()
|
||||
console_view.status_app_icon.scroll_to_element()
|
||||
console_view.status_app_icon.click()
|
||||
console_view.ok_button_apk.click()
|
||||
sign_in_view = console_view.get_sign_in_view()
|
||||
sign_in_view.apps_button.click()
|
||||
sign_in_view.status_app_icon.scroll_to_element()
|
||||
sign_in_view.status_app_icon.click()
|
||||
sign_in_view.ok_button_apk.click()
|
||||
sign_in_view.first_account_button.click()
|
||||
sign_in_view.password_input.send_keys('qwerty1234')
|
||||
sign_in_view.sign_in_button.click()
|
||||
|
@ -103,48 +94,54 @@ class TestSanity(SingleDeviceTestCase):
|
|||
home_view.create_group_chat(['Jarrad'])
|
||||
|
||||
@pytest.mark.sign_in
|
||||
@pytest.mark.parametrize("verification", ["invalid", "valid"])
|
||||
def test_sign_in(self, verification):
|
||||
verifications = {"valid":
|
||||
{"input": "qwerty1234",
|
||||
"outcome": "Wallet"},
|
||||
"invalid":
|
||||
{"input": "12345ewq",
|
||||
"outcome": "Wrong password"}}
|
||||
console_view = ConsoleView(self.driver)
|
||||
console_view.create_user()
|
||||
console_view.back_button.click()
|
||||
profile_view = console_view.profile_button.click()
|
||||
@pytest.mark.parametrize("input_text,outcome",
|
||||
[("qwerty1234", "Wallet"), ("12345ewq", "Wrong password")],
|
||||
ids=['Sign on with valid password', 'Sign in with wrong password'])
|
||||
def test_sign_in(self, input_text, outcome):
|
||||
sign_in_view = SignInView(self.driver)
|
||||
sign_in_view.create_user()
|
||||
profile_view = sign_in_view.profile_button.click()
|
||||
profile_view.logout_button.scroll_to_element()
|
||||
sign_in_view = profile_view.logout_button.click()
|
||||
sign_in_view.first_account_button.click()
|
||||
sign_in_view.password_input.send_keys(verifications[verification]['input'])
|
||||
sign_in_view.password_input.send_keys(input_text)
|
||||
sign_in_view.sign_in_button.click()
|
||||
sign_in_view.find_full_text(verifications[verification]["outcome"], 60)
|
||||
if verifications[verification]["input"] in str(console_view.logcat):
|
||||
sign_in_view.find_full_text(outcome, 60)
|
||||
if input_text in str(sign_in_view.logcat):
|
||||
pytest.fail('Password in logcat!!!', pytrace=False)
|
||||
|
||||
@pytest.mark.password
|
||||
@pytest.mark.parametrize("verification", ["logcat", "mismatch", "short"])
|
||||
def test_password(self, verification):
|
||||
verifications = {
|
||||
"short": {"input": "qwe1",
|
||||
"outcome": "Password should be not less then 6 symbols."},
|
||||
|
||||
"mismatch": {"input": "mismatch1234",
|
||||
"outcome": "Password confirmation doesn\'t match password."},
|
||||
|
||||
"logcat": {"input": "new_unique_password",
|
||||
"outcome": "Here is your signing phrase. "
|
||||
"You will use it to verify your transactions. "
|
||||
"Write it down and keep it safe!"}}
|
||||
console = ConsoleView(self.driver)
|
||||
console.request_password_icon.click()
|
||||
console.chat_request_input.send_keys(verifications[verification]["input"])
|
||||
console.confirm()
|
||||
if 'short' not in verification:
|
||||
console.chat_request_input.send_keys("new_unique_password")
|
||||
console.confirm()
|
||||
console.find_full_text(verifications[verification]["outcome"])
|
||||
if verifications[verification]["input"] in str(console.logcat):
|
||||
def test_password_logcat(self):
|
||||
password = 'qwerty1234'
|
||||
sign_in_view = SignInView(self.driver)
|
||||
sign_in_view.create_account_button.click()
|
||||
sign_in_view.password_input.send_keys(password)
|
||||
sign_in_view.next_button.click()
|
||||
sign_in_view.confirm_password_input.send_keys(password)
|
||||
sign_in_view.next_button.click()
|
||||
sign_in_view.find_full_text(
|
||||
"Creating your account on the blockchain. We can't touch it, no one can, except for you!")
|
||||
if password in str(sign_in_view.logcat):
|
||||
pytest.fail('Password in logcat!!!', pytrace=False)
|
||||
|
||||
@pytest.mark.password
|
||||
def test_password_mismatch(self):
|
||||
sign_in_view = SignInView(self.driver)
|
||||
sign_in_view.create_account_button.click()
|
||||
sign_in_view.password_input.send_keys('password1')
|
||||
sign_in_view.next_button.click()
|
||||
sign_in_view.confirm_password_input.send_keys("password2")
|
||||
sign_in_view.next_button.click()
|
||||
sign_in_view.find_full_text('Password confirmation doesn\'t match password.')
|
||||
logcat = str(sign_in_view.logcat)
|
||||
if 'password1' in logcat or 'password2' in logcat:
|
||||
pytest.fail('Password in logcat!!!', pytrace=False)
|
||||
|
||||
@pytest.mark.password
|
||||
def test_password_too_short(self):
|
||||
sign_in_view = SignInView(self.driver)
|
||||
sign_in_view.create_account_button.click()
|
||||
sign_in_view.password_input.send_keys('qwe1')
|
||||
sign_in_view.next_button.click()
|
||||
sign_in_view.password_input.find_element()
|
||||
assert not sign_in_view.confirm_password_input.is_element_present()
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
import pytest
|
||||
import time
|
||||
from views.console_view import ConsoleView
|
||||
from tests.base_test_case import SingleDeviceTestCase, MultipleDeviceTestCase
|
||||
from tests import transaction_users, api_requests, get_current_time, transaction_users_wallet
|
||||
from selenium.common.exceptions import TimeoutException
|
||||
|
||||
from views.sign_in_view import SignInView
|
||||
|
||||
|
||||
@pytest.mark.all
|
||||
class TestTransaction(SingleDeviceTestCase):
|
||||
|
@ -12,10 +13,9 @@ class TestTransaction(SingleDeviceTestCase):
|
|||
@pytest.mark.pr
|
||||
def test_transaction_send_command_one_to_one_chat(self):
|
||||
recipient = transaction_users['B_USER']
|
||||
console_view = ConsoleView(self.driver)
|
||||
console_view.create_user()
|
||||
console_view.back_button.click()
|
||||
home_view = console_view.get_home_view()
|
||||
sign_in_view = SignInView(self.driver)
|
||||
sign_in_view.create_user()
|
||||
home_view = sign_in_view.get_home_view()
|
||||
transaction_amount = home_view.get_unique_amount()
|
||||
sender_public_key = home_view.get_public_key()
|
||||
sender_address = home_view.public_key_to_address(sender_public_key)
|
||||
|
@ -44,9 +44,9 @@ class TestTransaction(SingleDeviceTestCase):
|
|||
def test_transaction_send_command_wrong_password(self):
|
||||
sender = transaction_users['A_USER']
|
||||
recipient = transaction_users['B_USER']
|
||||
console_view = ConsoleView(self.driver)
|
||||
console_view.recover_access(sender['passphrase'], sender['password'], sender['username'])
|
||||
home_view = console_view.get_home_view()
|
||||
sign_in_view = SignInView(self.driver)
|
||||
sign_in_view.recover_access(sender['passphrase'], sender['password'])
|
||||
home_view = sign_in_view.get_home_view()
|
||||
transaction_amount = '0.001'
|
||||
home_view.add_contact(recipient['public_key'])
|
||||
chat_view = home_view.get_chat_with_user(recipient['username']).click()
|
||||
|
@ -63,10 +63,9 @@ class TestTransaction(SingleDeviceTestCase):
|
|||
@pytest.mark.pr
|
||||
def test_transaction_send_command_group_chat(self):
|
||||
recipient = transaction_users['A_USER']
|
||||
console_view = ConsoleView(self.driver)
|
||||
console_view.create_user()
|
||||
console_view.back_button.click()
|
||||
home_view = console_view.get_home_view()
|
||||
sign_in_view = SignInView(self.driver)
|
||||
sign_in_view.create_user()
|
||||
home_view = sign_in_view.get_home_view()
|
||||
transaction_amount = '0.001'
|
||||
sender_public_key = home_view.get_public_key()
|
||||
sender_address = home_view.public_key_to_address(sender_public_key)
|
||||
|
@ -89,12 +88,10 @@ class TestTransaction(SingleDeviceTestCase):
|
|||
|
||||
@pytest.mark.pr
|
||||
def test_send_transaction_from_daap(self):
|
||||
console = ConsoleView(self.driver)
|
||||
sender = transaction_users['B_USER']
|
||||
console.recover_access(sender['passphrase'],
|
||||
sender['password'],
|
||||
sender['username'])
|
||||
home_view = console.get_home_view()
|
||||
sign_in_view = SignInView(self.driver)
|
||||
sign_in_view.recover_access(sender['passphrase'], sender['password'])
|
||||
home_view = sign_in_view.get_home_view()
|
||||
address = transaction_users['B_USER']['address']
|
||||
initial_balance = api_requests.get_balance(address)
|
||||
start_new_chat_view = home_view.plus_button.click()
|
||||
|
@ -117,11 +114,9 @@ class TestTransaction(SingleDeviceTestCase):
|
|||
def test_send_eth_from_wallet_sign_later(self):
|
||||
sender = transaction_users_wallet['B_USER']
|
||||
recipient = transaction_users_wallet['A_USER']
|
||||
console_view = ConsoleView(self.driver)
|
||||
console_view.recover_access(sender['passphrase'],
|
||||
sender['password'],
|
||||
sender['username'])
|
||||
home_view = console_view.get_home_view()
|
||||
sign_in_view = SignInView(self.driver)
|
||||
sign_in_view.recover_access(sender['passphrase'], sender['password'])
|
||||
home_view = sign_in_view.get_home_view()
|
||||
initial_balance_recipient = api_requests.get_balance(recipient['address'])
|
||||
home_view.add_contact(recipient['public_key'])
|
||||
home_view.get_back_to_home_view()
|
||||
|
@ -155,11 +150,9 @@ class TestTransaction(SingleDeviceTestCase):
|
|||
def test_send_stt_from_wallet_via_enter_contact_code(self):
|
||||
sender = transaction_users_wallet['A_USER']
|
||||
recipient = transaction_users_wallet['B_USER']
|
||||
console_view = ConsoleView(self.driver)
|
||||
console_view.recover_access(sender['passphrase'],
|
||||
sender['password'],
|
||||
sender['username'])
|
||||
home_view = console_view.get_home_view()
|
||||
sign_in_view = SignInView(self.driver)
|
||||
sign_in_view.recover_access(sender['passphrase'], sender['password'])
|
||||
home_view = sign_in_view.get_home_view()
|
||||
home_view.add_contact(recipient['public_key'])
|
||||
home_view.get_back_to_home_view()
|
||||
wallet_view = home_view.wallet_button.click()
|
||||
|
@ -185,11 +178,9 @@ class TestTransaction(SingleDeviceTestCase):
|
|||
@pytest.mark.pr
|
||||
def test_send_eth_from_wallet_sign_now(self):
|
||||
sender = transaction_users_wallet['A_USER']
|
||||
console_view = ConsoleView(self.driver)
|
||||
console_view.recover_access(sender['passphrase'],
|
||||
sender['password'],
|
||||
sender['username'])
|
||||
home_view = console_view.get_home_view()
|
||||
sign_in_view = SignInView(self.driver)
|
||||
sign_in_view.recover_access(sender['passphrase'], sender['password'])
|
||||
home_view = sign_in_view.get_home_view()
|
||||
wallet_view = home_view.wallet_button.click()
|
||||
send_transaction = wallet_view.send_button.click()
|
||||
send_transaction.amount_edit_box.click()
|
||||
|
@ -214,12 +205,10 @@ class TestTransactions(MultipleDeviceTestCase):
|
|||
recipient = transaction_users['A_USER']
|
||||
sender = transaction_users['B_USER']
|
||||
self.create_drivers(2)
|
||||
device_1, device_2 = \
|
||||
ConsoleView(self.drivers[0]), ConsoleView(self.drivers[1])
|
||||
device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
|
||||
for user_details in (recipient, device_1), (sender, device_2):
|
||||
user_details[1].recover_access(passphrase=user_details[0]['passphrase'],
|
||||
password=user_details[0]['password'],
|
||||
username=user_details[0]['username'])
|
||||
password=user_details[0]['password'])
|
||||
device_2_home = device_2.get_home_view()
|
||||
device_1_home = device_1.get_home_view()
|
||||
device_1_home.add_contact(sender['public_key'])
|
||||
|
@ -244,12 +233,10 @@ class TestTransactions(MultipleDeviceTestCase):
|
|||
recipient = transaction_users['B_USER']
|
||||
sender = transaction_users['A_USER']
|
||||
self.create_drivers(2)
|
||||
device_1, device_2 = \
|
||||
ConsoleView(self.drivers[0]), ConsoleView(self.drivers[1])
|
||||
device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
|
||||
for user_details in (recipient, device_1), (sender, device_2):
|
||||
user_details[1].recover_access(passphrase=user_details[0]['passphrase'],
|
||||
password=user_details[0]['password'],
|
||||
username=user_details[0]['username'])
|
||||
password=user_details[0]['password'])
|
||||
device_2_home = device_2.get_home_view()
|
||||
device_1_home = device_1.get_home_view()
|
||||
device_1_home.add_contact(sender['public_key'])
|
||||
|
@ -279,12 +266,10 @@ class TestTransactions(MultipleDeviceTestCase):
|
|||
recipient = transaction_users_wallet['B_USER']
|
||||
sender = transaction_users_wallet['A_USER']
|
||||
self.create_drivers(2)
|
||||
device_1, device_2 = \
|
||||
ConsoleView(self.drivers[0]), ConsoleView(self.drivers[1])
|
||||
device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
|
||||
for user_details in (recipient, device_1), (sender, device_2):
|
||||
user_details[1].recover_access(passphrase=user_details[0]['passphrase'],
|
||||
password=user_details[0]['password'],
|
||||
username=user_details[0]['username'])
|
||||
password=user_details[0]['password'])
|
||||
device_2_home = device_2.get_home_view()
|
||||
device_1_home = device_1.get_home_view()
|
||||
device_1_home.add_contact(sender['public_key'])
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import pytest
|
||||
from tests import api_requests, transaction_users_wallet
|
||||
from tests.base_test_case import SingleDeviceTestCase
|
||||
from views.console_view import ConsoleView
|
||||
from views.sign_in_view import SignInView
|
||||
|
||||
|
||||
@pytest.mark.all
|
||||
|
@ -9,10 +9,9 @@ class TestWallet(SingleDeviceTestCase):
|
|||
|
||||
@pytest.mark.wallet
|
||||
def test_wallet_error_messages(self):
|
||||
console = ConsoleView(self.driver)
|
||||
console.create_user()
|
||||
console.back_button.click()
|
||||
wallet_view = console.wallet_button.click()
|
||||
sign_in_view = SignInView(self.driver)
|
||||
sign_in_view.create_user()
|
||||
wallet_view = sign_in_view.wallet_button.click()
|
||||
send_transaction = wallet_view.send_button.click()
|
||||
send_transaction.amount_edit_box.send_keys('asd')
|
||||
send_transaction.find_full_text('Amount is not a valid number')
|
||||
|
@ -22,12 +21,10 @@ class TestWallet(SingleDeviceTestCase):
|
|||
@pytest.mark.wallet
|
||||
def test_eth_and_currency_balance(self):
|
||||
errors = list()
|
||||
console = ConsoleView(self.driver)
|
||||
console.recover_access(passphrase=transaction_users_wallet['A_USER']['passphrase'],
|
||||
password=transaction_users_wallet['A_USER']['password'],
|
||||
username=transaction_users_wallet['A_USER']['username'])
|
||||
home_view = console.get_home_view()
|
||||
wallet = home_view.wallet_button.click()
|
||||
sign_in_view = SignInView(self.driver)
|
||||
sign_in_view.recover_access(passphrase=transaction_users_wallet['A_USER']['passphrase'],
|
||||
password=transaction_users_wallet['A_USER']['password'])
|
||||
wallet = sign_in_view.wallet_button.click()
|
||||
address = transaction_users_wallet['A_USER']['address']
|
||||
balance = api_requests.get_balance(address) / 1000000000000000000
|
||||
eth_rate = api_requests.get_ethereum_price_in_usd()
|
||||
|
|
|
@ -112,7 +112,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']")
|
||||
|
||||
|
||||
class DoneButton(BaseButton):
|
||||
|
@ -135,6 +135,12 @@ class StatusAppIcon(BaseButton):
|
|||
"//*[@text='Status']")
|
||||
|
||||
|
||||
class DeleteButton(BaseButton):
|
||||
def __init__(self, driver):
|
||||
super(DeleteButton, self).__init__(driver)
|
||||
self.locator = self.Locator.xpath_selector("//*[@text='Delete']")
|
||||
|
||||
|
||||
class BaseView(object):
|
||||
def __init__(self, driver):
|
||||
self.driver = driver
|
||||
|
@ -153,6 +159,7 @@ class BaseView(object):
|
|||
self.next_button = NextButton(self.driver)
|
||||
self.save_button = SaveButton(self.driver)
|
||||
self.done_button = DoneButton(self.driver)
|
||||
self.delete_button = DeleteButton(self.driver)
|
||||
|
||||
self.apps_button = AppsButton(self.driver)
|
||||
self.status_app_icon = StatusAppIcon(self.driver)
|
||||
|
|
|
@ -60,7 +60,7 @@ class RequestCommand(BaseButton):
|
|||
class ChatOptions(BaseButton):
|
||||
def __init__(self, driver):
|
||||
super(ChatOptions, self).__init__(driver)
|
||||
self.locator = self.Locator.accessibility_id('chat-menu')
|
||||
self.locator = self.Locator.xpath_selector('(//android.view.ViewGroup[@content-desc="icon"])[2]')
|
||||
|
||||
|
||||
class MembersButton(BaseButton):
|
||||
|
|
|
@ -89,7 +89,7 @@ class HomeView(BaseView):
|
|||
def join_public_chat(self, chat_name: str):
|
||||
start_new_chat = self.plus_button.click()
|
||||
start_new_chat.join_public_chat_button.click()
|
||||
start_new_chat.chat_name_edit_box.send_keys(chat_name)
|
||||
start_new_chat.chat_name_editbox.send_keys(chat_name)
|
||||
start_new_chat.confirm_button.click()
|
||||
|
||||
def get_public_key(self):
|
||||
|
|
|
@ -67,7 +67,7 @@ class ChooseRecipientButton(BaseButton):
|
|||
class EnterContactCodeButton(BaseButton):
|
||||
def __init__(self, driver):
|
||||
super(EnterContactCodeButton, self).__init__(driver)
|
||||
self.locator = self.Locator.xpath_selector("//*[@text='Enter contact code']")
|
||||
self.locator = self.Locator.xpath_selector("//*[@text='Enter recipient address']")
|
||||
|
||||
|
||||
class EnterRecipientAddressInput(BaseEditBox):
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
from selenium.common.exceptions import NoSuchElementException, TimeoutException
|
||||
|
||||
from views.base_element import BaseButton, BaseEditBox
|
||||
from views.base_view import BaseView
|
||||
|
||||
|
@ -13,14 +15,15 @@ class PasswordInput(BaseEditBox):
|
|||
|
||||
def __init__(self, driver):
|
||||
super(PasswordInput, self).__init__(driver)
|
||||
self.locator = self.Locator.xpath_selector("//android.widget.TextView[@text='Password']")
|
||||
self.locator = self.Locator.xpath_selector("//android.widget.TextView[@text='Password']"
|
||||
"/following-sibling::android.view.ViewGroup/android.widget.EditText")
|
||||
|
||||
|
||||
class SignInButton(BaseButton):
|
||||
|
||||
def __init__(self, driver):
|
||||
super(SignInButton, self).__init__(driver)
|
||||
self.locator = self.Locator.xpath_selector("//android.widget.TextView[@text='Sign in']")
|
||||
self.locator = self.Locator.xpath_selector("//android.widget.TextView[@text='Sign in' or @text='SIGN IN']")
|
||||
|
||||
def navigate(self):
|
||||
from views.home_view import HomeView
|
||||
|
@ -38,6 +41,36 @@ class RecoverAccessButton(BaseButton):
|
|||
return RecoverAccessView(self.driver)
|
||||
|
||||
|
||||
class CreateAccountButton(BaseButton):
|
||||
def __init__(self, driver):
|
||||
super(CreateAccountButton, self).__init__(driver)
|
||||
self.locator = self.Locator.xpath_selector("//android.widget.TextView[@text='CREATE ACCOUNT']")
|
||||
|
||||
|
||||
class IHaveAccountButton(RecoverAccessButton):
|
||||
def __init__(self, driver):
|
||||
super(IHaveAccountButton, self).__init__(driver)
|
||||
self.locator = self.Locator.xpath_selector("//android.widget.TextView[@text='I ALREADY HAVE AN ACCOUNT']")
|
||||
|
||||
|
||||
class AddExistingAccountButton(RecoverAccessButton):
|
||||
def __init__(self, driver):
|
||||
super(AddExistingAccountButton, self).__init__(driver)
|
||||
self.locator = self.Locator.xpath_selector("//android.widget.TextView[@text='ADD EXISTING ACCOUNT']")
|
||||
|
||||
|
||||
class ConfirmPasswordInput(BaseEditBox):
|
||||
def __init__(self, driver):
|
||||
super(ConfirmPasswordInput, self).__init__(driver)
|
||||
self.locator = self.Locator.xpath_selector("//android.widget.TextView[@text='Confirm']")
|
||||
|
||||
|
||||
class NameInput(BaseEditBox):
|
||||
def __init__(self, driver):
|
||||
super(NameInput, self).__init__(driver)
|
||||
self.locator = self.Locator.xpath_selector("//android.widget.TextView[@text='Name']")
|
||||
|
||||
|
||||
class SignInView(BaseView):
|
||||
|
||||
def __init__(self, driver):
|
||||
|
@ -48,3 +81,37 @@ class SignInView(BaseView):
|
|||
self.password_input = PasswordInput(self.driver)
|
||||
self.sign_in_button = SignInButton(self.driver)
|
||||
self.recover_access_button = RecoverAccessButton(self.driver)
|
||||
|
||||
# new design
|
||||
self.create_account_button = CreateAccountButton(self.driver)
|
||||
self.i_have_account_button = IHaveAccountButton(self.driver)
|
||||
self.add_existing_account_button = AddExistingAccountButton(self.driver)
|
||||
self.confirm_password_input = ConfirmPasswordInput(self.driver)
|
||||
self.name_input = NameInput(self.driver)
|
||||
|
||||
self.accept_agreements()
|
||||
|
||||
def accept_agreements(self):
|
||||
for i in self.ok_button_apk, self.continue_button_apk:
|
||||
try:
|
||||
i.click()
|
||||
except (NoSuchElementException, TimeoutException):
|
||||
pass
|
||||
|
||||
def create_user(self):
|
||||
self.create_account_button.click()
|
||||
self.password_input.send_keys('qwerty1234')
|
||||
self.next_button.click()
|
||||
self.confirm_password_input.send_keys('qwerty1234')
|
||||
self.next_button.click()
|
||||
self.name_input.wait_for_element(30)
|
||||
self.name_input.send_keys('Test Name')
|
||||
self.next_button.click()
|
||||
self.element_by_text("NO, I DON'T WANT TO SHARE").click()
|
||||
|
||||
def recover_access(self, passphrase, password):
|
||||
recover_access_view = self.i_have_account_button.click()
|
||||
recover_access_view.passphrase_input.send_keys(passphrase)
|
||||
recover_access_view.password_input.click()
|
||||
recover_access_view.password_input.send_keys(password)
|
||||
recover_access_view.sign_in_button.click()
|
||||
|
|
Loading…
Reference in New Issue