Skip to content

Commit

Permalink
Fixed false failed tests
Browse files Browse the repository at this point in the history
Signed-off-by: Churikova Tetiana <[email protected]>
  • Loading branch information
yevh-berdnyk authored and churik committed Aug 19, 2019
1 parent 5fc3584 commit 2b3ef5b
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 48 deletions.
22 changes: 10 additions & 12 deletions test/appium/tests/atomic/account_management/test_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,7 @@ def test_version_format(self):
if not re.search("\d{1}[.]\d{1,2}[.]\d{1,2}\s[(]\d*[)]", version):
self.driver.fail("Version %s didn't match expected format" % version)


@marks.all
@marks.account
class TestProfileMultipleDevice(MultipleDeviceTestCase):
Expand All @@ -357,8 +358,7 @@ class TestProfileMultipleDevice(MultipleDeviceTestCase):
def test_custom_bootnodes(self):
self.create_drivers(2)
sign_in_1, sign_in_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
username_1, username_2 = 'user_1', 'user_2'
home_1, home_2 = sign_in_1.create_user(username=username_1), sign_in_2.create_user(username=username_2)
home_1, home_2 = sign_in_1.create_user(), sign_in_2.create_user()
public_key = home_2.get_public_key()
home_2.home_button.click()

Expand Down Expand Up @@ -498,11 +498,9 @@ def test_pair_devices_sync_one_to_one_contacts(self):
@marks.testrail_id(5680)
@marks.high
def test_pair_devices_sync_name_photo_public_group_chats(self):

self.create_drivers(2)
device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
username_before_sync = 'username_before_sync'
device_1_home = device_1.create_user(username_before_sync)
device_1_home = device_1.create_user()
device_1_home.profile_button.click()
device_1_profile = device_1_home.get_profile_view()
device_1_profile.backup_recovery_phrase_button.click()
Expand All @@ -517,7 +515,6 @@ def test_pair_devices_sync_name_photo_public_group_chats(self):
group_chat_name = 'group-%s' % device_1_home.get_public_chat_name()
profile_picture_before_sync = 'sauce_logo.png'
profile_picture_after_sync = 'sauce_logo_red.png'
# username_after_sync = 'username_after_sync'
message_after_sync = 'sent after sync'

# device 1: join public chat, create group chat, edit user picture
Expand Down Expand Up @@ -545,14 +542,15 @@ def test_pair_devices_sync_name_photo_public_group_chats(self):
# device 2: check that public chat and profile details are updated
device_2_home = device_2_profile.get_back_to_home_view()
if not device_2_home.element_by_text('#%s' % public_chat_before_sync_name).is_element_displayed():
pytest.fail('Public chat "%s" doesn\'t appear after initial sync' % public_chat_before_sync_name)
self.errors.append('Public chat "%s" doesn\'t appear after initial sync'
% public_chat_before_sync_name)
device_2_home.profile_button.click()
device_2_profile.contacts_button.scroll_to_element(9, 'up')
# if not device_2_profile.element_by_text(username_before_sync).is_element_displayed():
# pytest.fail('Profile username was not updated after initial sync')
device_2_profile.swipe_down()
if not device_2_profile.profile_picture.is_element_image_equals_template(profile_picture_before_sync):
pytest.fail('Profile picture was not updated after initial sync')
self.errors.append('Profile picture was not updated after initial sync')

# device 1: send message to group chat, edit profile details and join to new public chat
device_1_home = device_1_profile.get_back_to_home_view()
Expand All @@ -572,17 +570,17 @@ def test_pair_devices_sync_name_photo_public_group_chats(self):
# pytest.fail('Profile username was not updated after changing when devices are paired')
device_2_profile.swipe_down()
if not device_2_profile.profile_picture.is_element_image_equals_template(profile_picture_after_sync):
pytest.fail('Profile picture was not updated after changing when devices are paired')
self.errors.append('Profile picture was not updated after changing when devices are paired')

device_2_profile.get_back_to_home_view()
if not device_2_home.element_by_text('#%s' % public_chat_after_sync_name).is_element_displayed():
pytest.fail(
'Public chat "%s" doesn\'t appear on other device when devices are paired' % public_chat_before_sync_name)
self.errors.append('Public chat "%s" doesn\'t appear on other device when devices are paired'
% public_chat_before_sync_name)

device_2_home.element_by_text(group_chat_name).click()
device_2_group_chat = device_2_home.get_chat_view()

if not device_2_group_chat.chat_element_by_text(message_after_sync).is_element_displayed():
pytest.fail('"%s" message in group chat is not synced' % message_after_sync)
self.errors.append('"%s" message in group chat is not synced' % message_after_sync)

self.verify_no_errors()
11 changes: 8 additions & 3 deletions test/appium/tests/atomic/account_management/test_recover.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,17 +108,20 @@ def test_pass_phrase_validation(self):
'validation message')
if signin_view.access_key_button.is_element_displayed():
signin_view.access_key_button.click()
if recover_access_view.enter_seed_phrase_button.is_element_displayed():
recover_access_view.enter_seed_phrase_button.click()

recover_access_view.send_as_keyevent(phrase)
recover_access_view.recover_account_password_input.click()
recover_access_view.next_button.click()

if not elm.is_element_displayed():
self.errors.append('"{}" message is not shown'.format(msg))
recover_access_view.click_system_back_button()

signin_view.access_key_button.click()

recover_access_view.enter_seed_phrase_button.click()
recover_access_view.send_as_keyevent(phrase_outside_the_mnemonic)
recover_access_view.next_button.click()
recover_access_view.recover_account_password_input.click()
recover_access_view.send_as_keyevent('123456')
recover_access_view.sign_in_button.click()
Expand All @@ -130,8 +133,9 @@ def test_pass_phrase_validation(self):
recover_access_view.click_system_back_button()

signin_view.access_key_button.click()

recover_access_view.enter_seed_phrase_button.click()
recover_access_view.send_as_keyevent(phrase_outside_the_mnemonic)
recover_access_view.next_button.click()
recover_access_view.recover_account_password_input.click()
recover_access_view.send_as_keyevent('123456')
recover_access_view.sign_in_button.click()
Expand Down Expand Up @@ -160,6 +164,7 @@ def test_uppercase_is_replaced_by_lowercase_automatically(self):
capitalized_passphrase = passphrase.upper()
signin_view = SignInView(self.driver)
recover_access_view = signin_view.access_key_button.click()
recover_access_view.enter_seed_phrase_button.click()
recover_access_view.passphrase_input.click()
recover_access_view.send_as_keyevent(capitalized_passphrase)
if recover_access_view.passphrase_input.text != passphrase:
Expand Down
5 changes: 2 additions & 3 deletions test/appium/tests/atomic/account_management/test_sign_in.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,10 @@ def test_login_with_new_account(self):
self.driver.launch_app()
sign_in.accept_agreements()
if not sign_in.element_by_text(default_username).is_element_displayed():
self.errors.append('Username is not shown while login')
self.driver.fail('Username is not shown while login')
sign_in.sign_in()
if not sign_in.home_button.is_element_displayed():
self.errors.append('User is not logged in')
self.verify_no_errors()
self.driver.fail('User is not logged in')

@marks.testrail_id(5463)
@marks.medium
Expand Down
42 changes: 22 additions & 20 deletions test/appium/tests/atomic/chats/test_chats_management.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,8 @@ def test_add_contact_from_public_chat(self):
def test_block_user_from_public_chat(self):
self.create_drivers(2)
device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
username_1 = 'user_%s' % get_current_time()
message_before_block_1, message_before_block_2 = "Before block from %s" % device_1.driver.number, "Before block from %s" % device_2.driver.number
message_before_block_1 = "Before block from %s" % device_1.driver.number
message_before_block_2 = "Before block from %s" % device_2.driver.number
message_after_block_2 = "After block from %s" % device_2.driver.number
home_1, home_2 = device_1.create_user(), device_2.recover_access(basic_user['passphrase'])

Expand All @@ -263,7 +263,8 @@ def test_block_user_from_public_chat(self):
# device 1: check that messages from blocked user are hidden in public chat
if chat_public_1.chat_element_by_text(message_before_block_2).is_element_displayed():
self.errors.append(
"Messages from blocked user %s are not cleared in public chat '%s'" % (device_2.driver.number, chat_name))
"Messages from blocked user %s are not cleared in public chat '%s'" % (
device_2.driver.number, chat_name))

# device 1: close app
self.drivers[0].close_app()
Expand All @@ -288,13 +289,13 @@ def test_block_user_from_one_to_one_header(self):

self.create_drivers(2)
device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
username_1 = 'user_%s' % get_current_time()
message_before_block_1, message_before_block_2 = "Before block from %s" % device_1.driver.number, "Before block from %s" % device_2.driver.number
message_before_block_1 = "Before block from %s" % device_1.driver.number
message_before_block_2 = "Before block from %s" % device_2.driver.number
message_after_block_2 = "After block from %s" % device_2.driver.number
home_1, home_2 = device_1.create_user(), device_2.recover_access(basic_user['passphrase'])
profile_1 = home_1.profile_button.click()
default_username_1 = profile_1.default_username_text.text
home_1 = profile_1.get_back_to_home_view()
profile_1.get_back_to_home_view()

# device 1, device 2: join to public chat and send several messages
chat_name = device_1.get_public_chat_name()
Expand All @@ -305,7 +306,8 @@ def test_block_user_from_one_to_one_header(self):
chat.chat_message_input.send_keys("Before block from %s" % chat.driver.number)
chat.send_message_button.click()

home_1, home_2 = chat_public_1.get_back_to_home_view(), chat_public_2.get_back_to_home_view()
chat_public_1.get_back_to_home_view()
chat_public_2.get_back_to_home_view()

# device 1, device 2: create 1-1 chat and send there several messages
chat_1 = home_1.add_contact(basic_user['public_key'])
Expand All @@ -324,21 +326,22 @@ def test_block_user_from_one_to_one_header(self):
chat_1.profile_block_contact.click()
chat_1.block_button.click()

# device 1: check that chat with blocked user was deleted and messages from blocked user are hidden in public chat
# device 1: check that chat with blocked user was deleted
# and messages from blocked user are hidden in public chat
if home_1.get_chat_with_user(basic_user['username']).is_element_displayed():
pytest.fail("Chat with blocked user '%s' is not deleted" % device_2.driver.number)
home_1.driver.fail("Chat with blocked user '%s' is not deleted" % device_2.driver.number)

public_chat_after_block = home_1.join_public_chat(chat_name)
if public_chat_after_block.chat_element_by_text(message_before_block_2).is_element_displayed():
self.errors.append(
"Messages from blocked user '%s' are not cleared in public chat '%s'" % (device_2.driver.number,
chat_name))
chat_name))

# device 2: send messages to 1-1 and public chat
for _ in range(2):
chat_2.chat_message_input.send_keys(message_after_block_2)
chat_2.send_message_button.click()
home_2 = chat_2.get_back_to_home_view()
chat_2.get_back_to_home_view()
home_2.join_public_chat(chat_name)
chat_public_2 = home_2.get_chat_view()

Expand All @@ -349,11 +352,10 @@ def test_block_user_from_one_to_one_header(self):
# device 1: check that new messages sent from device 2 are not shown
if public_chat_after_block.chat_element_by_text(message_after_block_2).is_element_displayed():
self.errors.append("Message from blocked user '%s' is received" % device_2.driver.number)
home_1 = public_chat_after_block.get_back_to_home_view()
public_chat_after_block.get_back_to_home_view()

if home_1.get_chat_with_user(basic_user['username']).is_element_displayed():
pytest.fail(
"Chat with blocked user '%s' is reappeared after receiving new messages" % device_2.driver.number)
device_2.driver.fail("Chat with blocked user is reappeared after receiving new messages")

# device 1: close app
self.drivers[0].close_app()
Expand All @@ -362,8 +364,8 @@ def test_block_user_from_one_to_one_header(self):
for _ in range(2):
chat_public_2.chat_message_input.send_keys(message_after_block_2)
chat_public_2.send_message_button.click()
home_2 = chat_public_2.get_back_to_home_view()
chat_2 = home_2.get_chat_with_user(default_username_1).click()
chat_public_2.get_back_to_home_view()
home_2.get_chat_with_user(default_username_1).click()
for _ in range(2):
chat_2.chat_message_input.send_keys(message_after_block_2)
chat_2.send_message_button.click()
Expand All @@ -373,12 +375,12 @@ def test_block_user_from_one_to_one_header(self):
device_1.accept_agreements()
device_1.sign_in()
if home_1.get_chat_with_user(basic_user['username']).is_element_displayed():
pytest.fail(
"Chat with blocked user '%s' is reappeared after fetching new messages from offline" % device_2.driver.number)
self.errors.append("Chat with blocked user is reappeared after fetching new messages from offline")
home_1.join_public_chat(chat_name)
chat_public_1 = home_1.get_chat_view()
home_1.get_chat_view()
if chat_public_1.chat_element_by_text(message_after_block_2).is_element_displayed():
self.errors.append(
"Message from blocked user '%s' is received after fetching new messages from offline" % device_2.driver.number)
"Message from blocked user '%s' is received after fetching new messages from offline"
% device_2.driver.number)

self.verify_no_errors()
11 changes: 5 additions & 6 deletions test/appium/tests/atomic/chats/test_group_chat.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from tests import marks, get_current_time
from tests import marks
from tests.base_test_case import MultipleDeviceTestCase
from tests.users import chat_users
from views.sign_in_view import SignInView
Expand Down Expand Up @@ -153,8 +153,6 @@ def test_delete_group_chat_via_delete_button(self):
@marks.testrail_id(3998)
@marks.high
def test_add_new_group_chat_member(self):
username_1 = 'user1_%s' % get_current_time()
username_2 = 'user2_%s' % get_current_time()
message_for_device_2 = 'This message should be visible for device 2'
chat_member = chat_users['A']

Expand All @@ -180,12 +178,13 @@ def test_add_new_group_chat_member(self):
# device 1: add device 2 as a new member of the group chat
device_1_chat.add_members_to_group_chat([device_2_default_username])

# device 2: open the chat
device_2_chat = device_2_home.get_chat_with_user(chat_name).click()
device_2_chat.join_chat_button.click()

# device 1: send a message that should be visible for device 2
device_1_chat.send_message(message_for_device_2)

# device 2: open the chat and check messages
device_2_chat = device_2_home.get_chat_with_user(chat_name).click()
device_2_chat.join_chat_button.click()
if not device_2_chat.chat_element_by_text(message_for_device_2).is_element_displayed(30):
self.errors.append('Message that was sent after device 2 has joined is not visible')
self.verify_no_errors()
Expand Down
6 changes: 3 additions & 3 deletions test/appium/tests/users.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
basic_user = dict()
basic_user['passphrase'] = "tree weekend ceiling awkward universe pyramid glimpse raven pair lounge grant grief"
basic_user['username'] = "Little Weighty Iberianmole"
basic_user['public_key'] = "0x040d3400f0ba80b2f6017a9021a66e042abc33cf7051ddf98a24a815c93d6c052ce2b7873d799f096325" \
"9f41c5a1bf08133dd4f3fe63ea1cceaa1e86ebc4bc42c9"
basic_user['username'] = "Cadetblue Popular Monoclonius"
basic_user['public_key'] = "0x042e0309b5f6bedee93a1b984af08f89a101aff62d01ddd0a1c8f4a1d4db3b91e648c914019d09de9f07dd" \
"baacb77fdf07e89b5e0d60e9a8df05b75f213661fcad"
basic_user['address'] = "f184747445c3B85CEb147DfB136067CB93d95F1D"
basic_user['special_chars_password'] = " !\"#$Á%Ö&'()*+Í, -./:ä;<=>?@[\\]^_`{|}~ "

Expand Down
2 changes: 1 addition & 1 deletion test/appium/views/profile_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ def __init__(self, driver, device_name):
super(SyncedDeviceToggle, self).__init__(driver)
self.device_name = device_name
self.locator = self.Locator.xpath_selector(
'//android.widget.TextView[@text="%s"]/../android.widget.Switch' % device_name)
'//android.widget.TextView[contains(@text,"%s")]/../android.widget.Switch' % device_name)


class SyncAllButton(BaseButton):
Expand Down

0 comments on commit 2b3ef5b

Please sign in to comment.