Removed getting latest nightly apk, fixed messaging tests
Signed-off-by: yevh-berdnyk <ie.berdnyk@gmail.com>
This commit is contained in:
parent
505c546fca
commit
c95bc11d52
|
@ -46,11 +46,15 @@ def verify_balance_is_updated(initial_balance, recipient_address, wait_time=240)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
|
def faucet(address):
|
||||||
|
return requests.request('GET', 'http://51.15.45.169:3001/donate/0x%s' % address).json()
|
||||||
|
|
||||||
|
|
||||||
def get_donate(address, wait_time=300):
|
def get_donate(address, wait_time=300):
|
||||||
initial_balance = get_balance(address)
|
initial_balance = get_balance(address)
|
||||||
counter = 0
|
counter = 0
|
||||||
if initial_balance < 1000000000000000000:
|
if initial_balance < 1000000000000000000:
|
||||||
response = requests.request('GET', 'http://51.15.45.169:3001/donate/0x%s' % address).json()
|
response = faucet(address)
|
||||||
while True:
|
while True:
|
||||||
if counter >= wait_time:
|
if counter >= wait_time:
|
||||||
pytest.fail("Donation was not received during %s seconds!" % wait_time)
|
pytest.fail("Donation was not received during %s seconds!" % wait_time)
|
||||||
|
|
|
@ -33,11 +33,11 @@ latest_nightly_apk['url'] = storage + latest_nightly_apk['name']
|
||||||
def pytest_addoption(parser):
|
def pytest_addoption(parser):
|
||||||
parser.addoption("--build",
|
parser.addoption("--build",
|
||||||
action="store",
|
action="store",
|
||||||
default='build_' + latest_nightly_apk['name'],
|
default=datetime.now().strftime('%Y-%m-%d-%H-%M'), # 'build_' + latest_nightly_apk['name'],
|
||||||
help="Specify build name")
|
help="Specify build name")
|
||||||
parser.addoption('--apk',
|
parser.addoption('--apk',
|
||||||
action='store',
|
action='store',
|
||||||
default=latest_nightly_apk['url'],
|
default=None,
|
||||||
help='Url or local path to apk')
|
help='Url or local path to apk')
|
||||||
parser.addoption('--env',
|
parser.addoption('--env',
|
||||||
action='store',
|
action='store',
|
||||||
|
|
|
@ -117,13 +117,8 @@ class TestSanity(SingleDeviceTestCase):
|
||||||
def test_password_logcat(self):
|
def test_password_logcat(self):
|
||||||
password = 'qwerty1234'
|
password = 'qwerty1234'
|
||||||
sign_in_view = SignInView(self.driver)
|
sign_in_view = SignInView(self.driver)
|
||||||
sign_in_view.create_account_button.click()
|
sign_in_view.create_user(password=password)
|
||||||
sign_in_view.password_input.send_keys(password)
|
sign_in_view.home_button.wait_for_visibility_of_element()
|
||||||
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):
|
if password in str(sign_in_view.logcat):
|
||||||
pytest.fail('Password in logcat!!!', pytrace=False)
|
pytest.fail('Password in logcat!!!', pytrace=False)
|
||||||
|
|
||||||
|
|
|
@ -203,11 +203,15 @@ class TestTransaction(SingleDeviceTestCase):
|
||||||
|
|
||||||
@pytest.mark.all
|
@pytest.mark.all
|
||||||
class TestTransactions(MultipleDeviceTestCase):
|
class TestTransactions(MultipleDeviceTestCase):
|
||||||
|
senders = dict()
|
||||||
|
senders['c_user'] = transaction_users_wallet['C_USER']
|
||||||
|
senders['d_user'] = transaction_users['D_USER']
|
||||||
|
senders['f_user'] = transaction_users['F_USER']
|
||||||
|
|
||||||
@pytest.mark.pr
|
@pytest.mark.pr
|
||||||
def test_send_eth_to_request_in_group_chat(self):
|
def test_send_eth_to_request_in_group_chat(self):
|
||||||
recipient = transaction_users['E_USER']
|
recipient = transaction_users['E_USER']
|
||||||
sender = transaction_users['F_USER']
|
sender = self.senders['f_user']
|
||||||
self.create_drivers(2)
|
self.create_drivers(2)
|
||||||
device_1, device_2 = SignInView(self.drivers[0]), SignInView(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):
|
for user_details in (recipient, device_1), (sender, device_2):
|
||||||
|
@ -236,7 +240,7 @@ class TestTransactions(MultipleDeviceTestCase):
|
||||||
@pytest.mark.pr
|
@pytest.mark.pr
|
||||||
def test_send_eth_to_request_in_one_to_one_chat(self):
|
def test_send_eth_to_request_in_one_to_one_chat(self):
|
||||||
recipient = transaction_users['C_USER']
|
recipient = transaction_users['C_USER']
|
||||||
sender = transaction_users['D_USER']
|
sender = self.senders['d_user']
|
||||||
self.create_drivers(2)
|
self.create_drivers(2)
|
||||||
device_1, device_2 = SignInView(self.drivers[0]), SignInView(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):
|
for user_details in (recipient, device_1), (sender, device_2):
|
||||||
|
@ -274,8 +278,8 @@ class TestTransactions(MultipleDeviceTestCase):
|
||||||
|
|
||||||
@pytest.mark.pr
|
@pytest.mark.pr
|
||||||
def test_send_eth_to_request_from_wallet(self):
|
def test_send_eth_to_request_from_wallet(self):
|
||||||
recipient = transaction_users['D_USER']
|
recipient = transaction_users_wallet['D_USER']
|
||||||
sender = transaction_users['C_USER']
|
sender = self.senders['c_user']
|
||||||
self.create_drivers(2)
|
self.create_drivers(2)
|
||||||
device_1, device_2 = SignInView(self.drivers[0]), SignInView(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):
|
for user_details in (recipient, device_1), (sender, device_2):
|
||||||
|
@ -306,3 +310,8 @@ class TestTransactions(MultipleDeviceTestCase):
|
||||||
request_button = device_2_chat.element_by_text_part('Requesting %s ETH' % amount, 'button')
|
request_button = device_2_chat.element_by_text_part('Requesting %s ETH' % amount, 'button')
|
||||||
device_2_chat.send_eth_to_request(request_button, sender['password'])
|
device_2_chat.send_eth_to_request(request_button, sender['password'])
|
||||||
api_requests.verify_balance_is_updated(initial_balance_recipient, recipient['address'])
|
api_requests.verify_balance_is_updated(initial_balance_recipient, recipient['address'])
|
||||||
|
|
||||||
|
def teardown_method(self, method):
|
||||||
|
for user in self.senders:
|
||||||
|
api_requests.faucet(address=self.senders[user]['address'])
|
||||||
|
super(TestTransactions, self).teardown_method(method)
|
||||||
|
|
|
@ -240,6 +240,18 @@ class BaseView(object):
|
||||||
element.locator = element.Locator.xpath_selector('//*[contains(@text, "' + text + '")]')
|
element.locator = element.Locator.xpath_selector('//*[contains(@text, "' + text + '")]')
|
||||||
return element
|
return element
|
||||||
|
|
||||||
|
def element_starts_with_text(self, text, element_type='base'):
|
||||||
|
info("Looking for full text: '%s'" % text)
|
||||||
|
element = self.element_types[element_type](self.driver)
|
||||||
|
element.locator = element.Locator.xpath_selector("//*[starts-with(@text,'%s')]" % text)
|
||||||
|
return element
|
||||||
|
|
||||||
|
def wait_for_element_starts_with_text(self, text, wait_time=60):
|
||||||
|
info("Looking for full text: '%s'" % text)
|
||||||
|
element = BaseElement(self.driver)
|
||||||
|
element.locator = element.Locator.xpath_selector("//*[starts-with(@text,'%s')]" % text)
|
||||||
|
return element.wait_for_element(wait_time)
|
||||||
|
|
||||||
def get_home_view(self):
|
def get_home_view(self):
|
||||||
from views.home_view import HomeView
|
from views.home_view import HomeView
|
||||||
return HomeView(self.driver)
|
return HomeView(self.driver)
|
||||||
|
|
|
@ -166,7 +166,7 @@ class ChatView(BaseView):
|
||||||
|
|
||||||
def wait_for_message_in_one_to_one_chat(self, expected_message: str, errors: list):
|
def wait_for_message_in_one_to_one_chat(self, expected_message: str, errors: list):
|
||||||
try:
|
try:
|
||||||
self.find_full_text(expected_message, wait_time=20)
|
self.wait_for_element_starts_with_text(expected_message, wait_time=20)
|
||||||
except TimeoutException:
|
except TimeoutException:
|
||||||
errors.append('Message with text "%s" was not received' % expected_message)
|
errors.append('Message with text "%s" was not received' % expected_message)
|
||||||
|
|
||||||
|
@ -189,7 +189,7 @@ class ChatView(BaseView):
|
||||||
received_messages = list()
|
received_messages = list()
|
||||||
while repeat <= wait_time:
|
while repeat <= wait_time:
|
||||||
for message in expected_messages:
|
for message in expected_messages:
|
||||||
if self.element_by_text(message, 'text').is_element_present(1):
|
if self.element_starts_with_text(message, 'text').is_element_present(1):
|
||||||
received_messages.append(message)
|
received_messages.append(message)
|
||||||
if not set(expected_messages) - set(received_messages):
|
if not set(expected_messages) - set(received_messages):
|
||||||
break
|
break
|
||||||
|
|
|
@ -97,11 +97,11 @@ class SignInView(BaseView):
|
||||||
self.name_input = NameInput(self.driver)
|
self.name_input = NameInput(self.driver)
|
||||||
self.do_not_share = DonNotShare(self.driver)
|
self.do_not_share = DonNotShare(self.driver)
|
||||||
|
|
||||||
def create_user(self):
|
def create_user(self, password: str = 'qwerty1234'):
|
||||||
self.create_account_button.click()
|
self.create_account_button.click()
|
||||||
self.password_input.set_value('qwerty1234')
|
self.password_input.set_value(password)
|
||||||
self.next_button.click()
|
self.next_button.click()
|
||||||
self.confirm_password_input.set_value('qwerty1234')
|
self.confirm_password_input.set_value(password)
|
||||||
self.next_button.click()
|
self.next_button.click()
|
||||||
self.name_input.wait_for_element(45)
|
self.name_input.wait_for_element(45)
|
||||||
self.name_input.set_value('user_%s' % get_current_time())
|
self.name_input.set_value('user_%s' % get_current_time())
|
||||||
|
|
Loading…
Reference in New Issue