Fixed tests with relogin

Signed-off-by: yevh-berdnyk <ie.berdnyk@gmail.com>
This commit is contained in:
yevh-berdnyk 2018-07-17 18:27:00 +02:00
parent b38c2686c5
commit 59edf46be3
No known key found for this signature in database
GPG Key ID: E9B425FDFC4DEA9C
12 changed files with 43 additions and 43 deletions

View File

@ -41,10 +41,10 @@ class TestCreateAccount(SingleDeviceTestCase):
sign_in.create_user()
public_key = sign_in.get_public_key()
profile = sign_in.get_profile_view()
profile.logout_button.click()
profile.confirm_logout_button.click()
profile.logout()
if sign_in.ok_button.is_element_displayed():
sign_in.ok_button.click()
sign_in.other_accounts_button.click()
sign_in.create_user()
if sign_in.get_public_key() == public_key:
pytest.fail('New account was not created')
@ -92,4 +92,4 @@ class TestCreateAccount(SingleDeviceTestCase):
def test_password_in_logcat_creating_account(self):
sign_in = SignInView(self.driver)
sign_in.create_user()
sign_in.check_no_value_in_logcat(common_password)
sign_in.check_no_values_in_logcat(password=common_password)

View File

@ -103,8 +103,6 @@ class TestProfileSingleDevice(SingleDeviceTestCase):
self.errors.append('Profile button counter is not shown')
profile_view = sign_in_view.profile_button.click()
profile_view.logout()
if sign_in_view.ok_button.is_element_displayed():
sign_in_view.ok_button.click()
sign_in_view.sign_in()
if sign_in_view.profile_button.counter.text != '1':
self.errors.append('Profile button counter is not shown after relogin')
@ -147,7 +145,6 @@ class TestProfileSingleDevice(SingleDeviceTestCase):
sign_in_view.create_user()
profile_view = sign_in_view.profile_button.click()
profile_view.add_custom_network()
sign_in_view.click_account_by_position(0)
sign_in_view.sign_in()
profile_view = sign_in_view.profile_button.click()
profile_view.advanced_button.click()
@ -170,8 +167,8 @@ class TestProfileSingleDevice(SingleDeviceTestCase):
profile_view.recovery_phrase_word_input.set_value(recovery_phrase[word_number_1])
profile_view.done_button.click()
profile_view.yes_button.click()
for i in recovery_phrase[word_number], recovery_phrase[word_number_1]:
profile_view.check_no_value_in_logcat(i, 'Recovery phrase')
profile_view.check_no_values_in_logcat(passphrase1=recovery_phrase[word_number],
passphrase2=recovery_phrase[word_number_1])
@marks.testrail_id(3751)
def test_need_help_section(self):

View File

@ -59,5 +59,4 @@ class TestRecoverAccountSingleDevice(SingleDeviceTestCase):
def test_logcat_recovering_account(self):
sign_in = SignInView(self.driver)
sign_in.recover_access(basic_user['passphrase'], basic_user['password'])
sign_in.check_no_value_in_logcat(basic_user['passphrase'], 'Passphrase')
sign_in.check_no_value_in_logcat(basic_user['password'])
sign_in.check_no_values_in_logcat(passphrase=basic_user['passphrase'], password=basic_user['password'])

View File

@ -33,7 +33,8 @@ class TestSignIn(SingleDeviceTestCase):
sign_in.create_user()
profile = sign_in.profile_button.click()
profile.logout()
sign_in.click_account_by_position(0)
if sign_in.ok_button.is_element_displayed():
sign_in.ok_button.click()
sign_in.password_input.set_value(common_password + '1')
sign_in.sign_in_button.click()
sign_in.find_full_text('Wrong password')
@ -45,9 +46,8 @@ class TestSignIn(SingleDeviceTestCase):
sign_in.create_user()
profile = sign_in.profile_button.click()
profile.logout()
sign_in.click_account_by_position(0)
sign_in.sign_in()
sign_in.check_no_value_in_logcat(common_password)
sign_in.check_no_values_in_logcat(password=common_password)
@marks.all

View File

@ -1,6 +1,6 @@
import pytest
from tests import marks, group_chat_users, basic_user, get_current_time
from tests import marks, group_chat_users, basic_user
from tests.base_test_case import SingleDeviceTestCase, MultipleDeviceTestCase
from views.sign_in_view import SignInView
@ -55,8 +55,6 @@ class TestChatManagement(SingleDeviceTestCase):
home.get_chat_with_user('#' + chat_name).swipe_and_delete()
profile = home.profile_button.click()
profile.logout()
if sign_in.ok_button.is_element_displayed():
sign_in.ok_button.click()
sign_in.sign_in()
if home.get_chat_with_user('#' + chat_name).is_element_displayed():
self.errors.append('Deleted public chat is present after relogin')

View File

@ -25,8 +25,6 @@ class TestCommandsMultipleDevices(MultipleDeviceTestCase):
public_key = device_2_home.get_public_key()
device_2_profile = device_2_home.get_profile_view()
device_2_profile.switch_network('Mainnet with upstream RPC')
if device_2_sign_in.ok_button.is_element_displayed():
device_2_sign_in.ok_button.click()
device_2_sign_in.sign_in()
device_1_chat = device_1_home.add_contact(public_key)
@ -46,6 +44,7 @@ class TestCommandsMultipleDevices(MultipleDeviceTestCase):
self.errors.append("Sent transaction message doesn't contain text 'testnet'")
except TimeoutException:
self.errors.append('Sent transaction message was not received')
device_2_chat.get_back_to_home_view()
amount_2 = device_1_chat.get_unique_amount()
device_1_chat.request_transaction_in_1_1_chat('ETH', amount_2)
@ -53,6 +52,7 @@ class TestCommandsMultipleDevices(MultipleDeviceTestCase):
if status_text_2 != 'Sent':
self.errors.append("Request funds message has status '%s' instead of 'Sent'" % status_text_2)
device_2_home.get_chat_with_user(sender['username']).click()
chat_element_2 = device_2_chat.chat_element_by_text(amount_2)
try:
chat_element_2.wait_for_visibility_of_element(120)
@ -361,7 +361,7 @@ class TestCommandsSingleDevices(SingleDeviceTestCase):
chat = home.add_contact(transaction_users['D_USER']['public_key'])
amount = chat.get_unique_amount()
chat.send_transaction_in_1_1_chat('ETH', amount, sender['password'])
chat.check_no_value_in_logcat(sender['password'])
chat.check_no_values_in_logcat(password=sender['password'])
@marks.testrail_id(3736)
@marks.smoke_1
@ -406,5 +406,5 @@ class TestCommandsSingleDevices(SingleDeviceTestCase):
amount = chat.get_unique_amount()
chat.send_transaction_in_1_1_chat('ETH', amount, sender['password'])
self.network_api.wait_for_confirmation_of_transaction(sender['address'], amount)
if not chat.chat_element_by_text(amount).contains_text('Confirmed'):
if not chat.chat_element_by_text(amount).contains_text('Confirmed', wait_time=90):
pytest.fail('Transaction state is not updated on the sender side')

View File

@ -92,12 +92,12 @@ class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase):
self.errors.append('Progress indicator is shown during %s seconds' % progress_time)
device_1.set_network_connection(2) # turning on WiFi connection
chat_1.element_by_text('Connecting to peers...').wait_for_invisibility_of_element(30)
chat_1.reconnect()
chat_1.element_by_text('Not sent. Tap for options').click()
if not chat_1.element_by_text('Delete message').is_element_displayed():
self.errors.append("'Delete message' button is not shown for not sent message")
chat_1.reconnect()
chat_element = chat_1.chat_element_by_text(message)
chat_1.element_by_text('Resend').click()
chat_element.status.wait_for_visibility_of_element()
@ -110,8 +110,8 @@ class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase):
self.verify_no_errors()
@marks.testrail_case_id(3743)
@marks.testrail_id(3710)
@marks.smoke_1
def test_messaging_in_different_networks(self):
self.create_drivers(2)
device_1, device_2 = self.drivers[0], self.drivers[1]
@ -123,7 +123,6 @@ class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase):
public_key_2 = home_2.get_public_key()
profile_2 = home_2.get_profile_view()
profile_2.switch_network('Mainnet with upstream RPC')
sign_in_2.click_account_by_position(0)
sign_in_2.sign_in()
chat_1 = home_1.add_contact(public_key_2)

View File

@ -79,7 +79,7 @@ class TestTransactionDApp(SingleDeviceTestCase):
status_test_dapp.assets_button.click()
send_transaction_view = status_test_dapp.request_stt_button.click()
send_transaction_view.sign_transaction(sender['password'])
send_transaction_view.check_no_value_in_logcat(sender['password'])
send_transaction_view.check_no_values_in_logcat(password=sender['password'])
@marks.logcat
@marks.testrail_id(3775)
@ -94,4 +94,4 @@ class TestTransactionDApp(SingleDeviceTestCase):
send_transaction_view.enter_password_input)
send_transaction_view.enter_password_input.send_keys(common_password)
send_transaction_view.sign_transaction_button.click()
send_transaction_view.check_no_value_in_logcat(common_password)
send_transaction_view.check_no_values_in_logcat(password=common_password)

View File

@ -191,7 +191,7 @@ class TestTransactionWalletSingleDevice(SingleDeviceTestCase):
send_transaction.send_as_keyevent(sender['password'])
send_transaction.sign_transaction_button.click()
send_transaction.got_it_button.click()
send_transaction.check_no_value_in_logcat(sender['password'])
send_transaction.check_no_values_in_logcat(password=sender['password'])
@marks.testrail_id(3746)
@marks.smoke_1

View File

@ -243,12 +243,10 @@ class BaseView(object):
@property
def logcat(self):
for i in range(60):
logcat = self.driver.get_log("logcat")
if len(logcat) > 1000:
return str([i for i in logcat if 'appium' not in str(i).lower()])
time.sleep(10)
raise TimeoutError('Logcat is empty after 300 sec')
logcat = self.driver.get_log("logcat")
if len(logcat) > 1000:
return str([i for i in logcat if 'appium' not in str(i).lower()])
raise TimeoutError('Logcat is empty')
def confirm(self):
info("Tap 'Confirm' on native keyboard")
@ -395,13 +393,9 @@ class BaseView(object):
def relogin(self, password=common_password):
self.get_back_to_home_view()
profile_view = self.profile_button.click()
profile_view.logout_button.click()
profile_view.confirm_logout_button.click()
profile_view.logout()
sign_in_view = self.get_sign_in_view()
sign_in_view.click_account_by_position(0)
sign_in_view.password_input.send_keys(password)
sign_in_view.sign_in_button.click()
sign_in_view.home_button.wait_for_visibility_of_element()
sign_in_view.sign_in(password)
def get_public_key(self):
profile_view = self.profile_button.click()
@ -433,6 +427,8 @@ class BaseView(object):
e.msg = "Can't reconnect to mail server after 3 attempts"
raise e
def check_no_value_in_logcat(self, exp_value: str, value_name: str = 'Password'):
if exp_value in self.logcat:
pytest.fail('%s in logcat!!!' % value_name, pytrace=False)
def check_no_values_in_logcat(self, **kwargs):
logcat = self.logcat
for key, value in kwargs.items():
if value in logcat:
pytest.fail('%s in logcat!!!' % key.capitalize(), pytrace=False)

View File

@ -190,7 +190,8 @@ class ChatElementByText(BaseText):
class StatusText(BaseText):
def __init__(self, driver, parent_locator: str):
super(StatusText, self).__init__(driver)
text = "//android.widget.TextView[@text='Seen' or @text='Sent' or @text='Not sent. Tap for options']"
text = "//android.widget.TextView[@text='Seen' or @text='Sent' or " \
"@text='Not sent. Tap for options' or @text='Network mismatch']"
self.locator = self.Locator.xpath_selector(parent_locator + text)
return StatusText(self.driver, self.locator.value)

View File

@ -95,6 +95,13 @@ class DonNotShareButton(BaseButton):
'or @text="Do not share"]' % "'")
class OtherAccountsButton(BaseButton):
def __init__(self, driver):
super(OtherAccountsButton, self).__init__(driver)
self.locator = self.Locator.text_selector('OTHER ACCOUNTS')
class SignInView(BaseView):
def __init__(self, driver):
@ -115,6 +122,7 @@ class SignInView(BaseView):
self.learn_more_link = LearnMoreLink(self.driver)
self.share_data_button = ShareDataButton(self.driver)
self.do_not_share_button = DonNotShareButton(self.driver)
self.other_accounts_button = OtherAccountsButton(self.driver)
def create_user(self, username: str = '', password=common_password):
self.create_account_button.click()
@ -157,6 +165,8 @@ class SignInView(BaseView):
return status_test_daap
def sign_in(self, password=common_password):
if self.ok_button.is_element_displayed():
self.ok_button.click()
self.password_input.set_value(password)
return self.sign_in_button.click()