Added new atomic tests for Smoke phase 2

Signed-off-by: yevh-berdnyk <ie.berdnyk@gmail.com>
This commit is contained in:
yevh-berdnyk 2018-07-19 11:57:45 +02:00
parent 61374add53
commit 3229f95ca9
No known key found for this signature in database
GPG Key ID: E9B425FDFC4DEA9C
14 changed files with 529 additions and 53 deletions

View File

@ -161,3 +161,8 @@ group_chat_users['C_USER']['public_key'] = "0x04dcdb5cac266328c41bdb0e33a266544a
"3dba7e295445505ee55ea03ee99cb7d26bee05e6b486a9bdaaf6be73a0b" "3dba7e295445505ee55ea03ee99cb7d26bee05e6b486a9bdaaf6be73a0b"
common_password = 'qwerty' common_password = 'qwerty'
bootnode_address = "enode://a8a97f126f5e3a340cb4db28a1187c325290ec08b2c9a6b1f19845ac86c46f9fac2ba13328822590" \
"fd3de3acb09cc38b5a05272e583a2365ad1fa67f66c55b34@167.99.210.203:30404"
mailserver_address = "enode://531e252ec966b7e83f5538c19bf1cde7381cc7949026a6e499b6e998e695751aadf26d4c98d5a4eab" \
"fb7cefd31c3c88d600a775f14ed5781520a88ecd25da3c6:status-offline-inbox@35.225.227.79:30504"

View File

@ -1,8 +1,7 @@
import pytest import pytest
from tests import marks, group_chat_users from tests import marks, group_chat_users, basic_user, bootnode_address, mailserver_address
from tests import marks, group_chat_users, basic_user from tests.base_test_case import SingleDeviceTestCase, MultipleDeviceTestCase
from tests.base_test_case import SingleDeviceTestCase
from views.sign_in_view import SignInView from views.sign_in_view import SignInView
@ -192,3 +191,81 @@ class TestProfileSingleDevice(SingleDeviceTestCase):
chat_view.view_profile_button.click() chat_view.view_profile_button.click()
for text in basic_user['username'], 'In contacts', 'Send transaction', 'Send message', 'Contact code': for text in basic_user['username'], 'In contacts', 'Send transaction', 'Send message', 'Contact code':
chat_view.find_full_text(text) chat_view.find_full_text(text)
@marks.all
@marks.account
class TestProfileMultipleDevice(MultipleDeviceTestCase):
@marks.testrail_id(3708)
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)
public_key = home_2.get_public_key()
home_2.home_button.click()
profile_1 = home_1.profile_button.click()
profile_1.advanced_button.click()
profile_1.bootnodes_button.click()
profile_1.plus_button.click()
profile_1.specify_name_input.set_value('test')
profile_1.bootnode_address_input.set_value(bootnode_address)
profile_1.save_button.click()
profile_1.enable_bootnodes.click()
sign_in_1.sign_in()
chat_1 = home_1.add_contact(public_key)
message = 'test message'
chat_1.chat_message_input.send_keys(message)
chat_1.send_message_button.click()
chat_2 = home_2.get_chat_with_user(username_1).click()
chat_2.chat_element_by_text(message).wait_for_visibility_of_element()
chat_2.add_to_contacts.click()
chat_1.get_back_to_home_view()
home_1.profile_button.click()
profile_1.advanced_button.click()
profile_1.bootnodes_button.click()
profile_1.enable_bootnodes.click()
sign_in_1.sign_in()
home_1.get_chat_with_user(username_2).click()
message_1 = 'new message'
chat_1.chat_message_input.send_keys(message_1)
chat_1.send_message_button.click()
chat_2.chat_element_by_text(message_1).wait_for_visibility_of_element()
@marks.testrail_id(3737)
def test_switch_mailserver(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)
public_key = home_2.get_public_key()
home_2.home_button.click()
profile_1 = home_1.profile_button.click()
profile_1.advanced_button.click()
profile_1.mail_server_button.click()
profile_1.plus_button.click()
server_name = 'test'
profile_1.specify_name_input.set_value(server_name)
profile_1.mail_server_address_input.set_value(mailserver_address)
profile_1.save_button.click()
profile_1.mail_server_by_name(server_name).click()
profile_1.mail_server_connect_button.click()
profile_1.confirm_button.click()
sign_in_1.sign_in()
chat_1 = home_1.add_contact(public_key)
message = 'test message'
chat_1.chat_message_input.send_keys(message)
chat_1.send_message_button.click()
chat_2 = home_2.get_chat_with_user(username_1).click()
chat_2.chat_element_by_text(message).wait_for_visibility_of_element()
message_1 = 'new message'
chat_2.chat_message_input.send_keys(message_1)
chat_2.send_message_button.click()
chat_1.chat_element_by_text(message_1).wait_for_visibility_of_element()

View File

@ -111,3 +111,22 @@ class TestWallet(SingleDeviceTestCase):
pytest.fail("'Backup your Recovery phrase' option is not shown on Wallet for an account with funds") pytest.fail("'Backup your Recovery phrase' option is not shown on Wallet for an account with funds")
profile = wallet.get_profile_view() profile = wallet.get_profile_view()
profile.backup_recovery_phrase() profile.backup_recovery_phrase()
@marks.testrail_id(3777)
def test_no_collectibles_to_send_from_wallet(self):
sign_in = SignInView(self.driver)
sign_in.create_user()
profile = sign_in.profile_button.click()
profile.switch_network('Mainnet with upstream RPC')
sign_in.sign_in()
wallet = sign_in.wallet_button.click()
wallet.set_up_wallet()
wallet.options_button.click()
wallet.manage_assets_button.click()
asset_name = 'CryptoKitties'
wallet.asset_checkbox_by_name(asset_name).click()
wallet.done_button.click()
send_transaction = wallet.send_transaction_button.click()
send_transaction.select_asset_button.click()
if send_transaction.asset_by_name(asset_name).is_element_displayed():
pytest.fail('Collectibles can be sent from wallet')

View File

@ -1,5 +1,3 @@
import time
import pytest import pytest
from tests import marks from tests import marks
@ -46,3 +44,25 @@ class TestMessagesPublicChat(SingleDeviceTestCase):
break break
else: else:
pytest.fail('Actual block number is not shown') pytest.fail('Actual block number is not shown')
@marks.testrail_id(3732)
def test_show_hide_console_chat(self):
sign_in_view = SignInView(self.driver)
sign_in_view.create_user()
profile_view = sign_in_view.profile_button.click()
profile_view.advanced_button.click()
profile_view.debug_mode_toggle.click()
home_view = profile_view.home_button.click()
console_chat = home_view.get_chat_with_user('Status Console')
console_chat.swipe_element()
chat_view = home_view.get_chat_view()
if console_chat.swipe_delete_button.is_element_displayed() or chat_view.chat_options.is_element_displayed():
self.errors.append('Console chat can be deleted')
home_view.get_back_to_home_view()
sign_in_view.profile_button.click()
profile_view.advanced_button.click()
profile_view.debug_mode_toggle.click()
profile_view.home_button.click()
if console_chat.is_element_displayed():
self.errors.append('Console chat is not hidden after turning off debug mode')
self.verify_no_errors()

View File

@ -1,7 +1,7 @@
import random import random
import string import string
import emoji import emoji
import pytest from datetime import datetime
from selenium.common.exceptions import TimeoutException from selenium.common.exceptions import TimeoutException
from tests import marks, get_current_time, group_chat_users from tests import marks, get_current_time, group_chat_users
from tests.base_test_case import MultipleDeviceTestCase, SingleDeviceTestCase from tests.base_test_case import MultipleDeviceTestCase, SingleDeviceTestCase
@ -169,7 +169,7 @@ class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase):
chat_element.wait_for_visibility_of_element() chat_element.wait_for_visibility_of_element()
device_2_chat = chat_element.click() device_2_chat = chat_element.click()
if not device_2_chat.chat_element_by_text(message).is_element_displayed(): if not device_2_chat.chat_element_by_text(message).is_element_displayed():
self.erros.append("Message with test '%s' was not received" % message) self.errors.append("Message with test '%s' was not received" % message)
if not device_2_chat.add_to_contacts.is_element_displayed(): if not device_2_chat.add_to_contacts.is_element_displayed():
self.errors.append('Add to contacts button is not shown') self.errors.append('Add to contacts button is not shown')
if device_2_chat.user_name_text.text != username_1: if device_2_chat.user_name_text.text != username_1:
@ -205,7 +205,7 @@ class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase):
chat_element.wait_for_visibility_of_element() chat_element.wait_for_visibility_of_element()
device_2_chat = chat_element.click() device_2_chat = chat_element.click()
if not device_2_chat.chat_element_by_text(message).is_element_displayed(): if not device_2_chat.chat_element_by_text(message).is_element_displayed():
self.erros.append("Message with text '%s' was not received" % message) self.errors.append("Message with text '%s' was not received" % message)
device_2_chat.reconnect() device_2_chat.reconnect()
device_2_chat.add_to_contacts.click() device_2_chat.add_to_contacts.click()
@ -315,6 +315,140 @@ class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase):
self.errors.append("'Seen' status is not shown under the text message which was read by a receiver") self.errors.append("'Seen' status is not shown under the text message which was read by a receiver")
self.verify_no_errors() self.verify_no_errors()
@marks.testrail_id(3784)
def test_unread_messages_counter_1_1_chat(self):
self.create_drivers(2)
device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
username_2 = 'user_%s' % get_current_time()
device_1_home, device_2_home = device_1.create_user(), device_2.create_user(username=username_2)
device_1_public_key = device_1_home.get_public_key()
device_1_home.home_button.click()
device_2_chat = device_2_home.add_contact(device_1_public_key)
message = 'test message'
device_2_chat.chat_message_input.send_keys(message)
device_2_chat.send_message_button.click()
if device_1_home.home_button.counter.text != '1':
self.errors.append('New messages counter is not shown on Home button')
chat_element = device_1_home.get_chat_with_user(username_2)
if chat_element.new_messages_counter.text != '1':
self.errors.append('New messages counter is not shown on chat element')
chat_element.click()
device_1_home.get_back_to_home_view()
if device_1_home.home_button.counter.is_element_displayed():
self.errors.append('New messages counter is shown on Home button for already seen message')
if chat_element.new_messages_counter.is_element_displayed():
self.errors.append('New messages counter is shown on chat element for already seen message')
self.verify_no_errors()
@marks.testrail_id(1414)
def test_bold_and_italic_text_in_messages(self):
self.create_drivers(2)
sign_in_1, sign_in_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
username_2 = 'user_%s' % get_current_time()
device_1_home, device_2_home = sign_in_1.create_user(), sign_in_2.create_user(username=username_2)
device_1_public_key = device_1_home.get_public_key()
device_1_home.home_button.click()
device_2_chat = device_2_home.add_contact(device_1_public_key)
bold_text = 'bold text'
device_2_chat.chat_message_input.send_keys('*%s*' % bold_text)
device_2_chat.send_message_button.click()
if not device_2_chat.chat_element_by_text(bold_text).is_element_displayed():
self.errors.append('Bold text is not displayed in 1-1 chat for the sender')
device_1_chat = device_1_home.get_chat_with_user(username_2).click()
if not device_1_chat.chat_element_by_text(bold_text).is_element_displayed():
self.errors.append('Bold text is not displayed in 1-1 chat for the recipient')
italic_text = 'italic text'
device_2_chat.chat_message_input.send_keys('~%s~' % italic_text)
device_2_chat.send_message_button.click()
if not device_2_chat.chat_element_by_text(italic_text).is_element_displayed():
self.errors.append('Italic text is not displayed in 1-1 chat for the sender')
if not device_1_chat.chat_element_by_text(italic_text).is_element_displayed():
self.errors.append('Italic text is not displayed in 1-1 chat for the recipient')
device_1_chat.get_back_to_home_view()
device_2_chat.get_back_to_home_view()
chat_name = device_1_home.get_public_chat_name()
device_1_home.join_public_chat(chat_name)
device_2_home.join_public_chat(chat_name)
device_2_chat.chat_message_input.send_keys('*%s*' % bold_text)
device_2_chat.send_message_button.click()
if not device_2_chat.chat_element_by_text(bold_text).is_element_displayed():
self.errors.append('Bold text is not displayed in public chat for the sender')
if not device_1_chat.chat_element_by_text(bold_text).is_element_displayed():
self.errors.append('Bold text is not displayed in public chat for the recipient')
device_2_chat.chat_message_input.send_keys('~%s~' % italic_text)
device_2_chat.send_message_button.click()
if not device_2_chat.chat_element_by_text(italic_text).is_element_displayed():
self.errors.append('Italic text is not displayed in public chat for the sender')
if not device_1_chat.chat_element_by_text(italic_text).is_element_displayed():
self.errors.append('Italic text is not displayed in 1-1 chat for the recipient')
self.verify_no_errors()
@marks.testrail_id(2781)
def test_timestamp_in_chats(self):
self.create_drivers(2)
device_1, device_2 = self.drivers[0], self.drivers[1]
sign_in_1, sign_in_2 = SignInView(device_1), SignInView(device_2)
username_1 = 'user_%s' % get_current_time()
device_1_home, device_2_home = sign_in_1.create_user(username=username_1), sign_in_2.create_user()
device_2_public_key = device_2_home.get_public_key()
device_2_home.home_button.click()
device_1_chat = device_1_home.add_contact(device_2_public_key)
message = 'test text'
device_1_chat.chat_message_input.send_keys(message)
device_1_chat.send_message_button.click()
sent_time = datetime.strptime(device_1.device_time, '%a %b %d %H:%M:%S GMT %Y').strftime("%I:%M %p")
if not device_1_chat.chat_element_by_text(message).contains_text(sent_time):
self.errors.append('Timestamp is not displayed in 1-1 chat for the sender')
if device_1_chat.chat_element_by_text(message).member_photo.is_element_displayed():
self.errors.append('Member photo is displayed in 1-1 chat for the sender')
device_2_chat = device_2_home.get_chat_with_user(username_1).click()
if not device_2_chat.chat_element_by_text(message).contains_text(sent_time):
self.errors.append('Timestamp is not displayed in 1-1 chat for the recipient')
if not device_2_chat.chat_element_by_text(message).member_photo.is_element_displayed():
self.errors.append('Member photo is not displayed in 1-1 chat for the recipient')
device_1_chat.get_back_to_home_view()
device_2_chat.get_back_to_home_view()
chat_name = device_1_home.get_public_chat_name()
device_1_home.join_public_chat(chat_name)
device_2_home.join_public_chat(chat_name)
device_2_chat.chat_message_input.send_keys(message)
device_2_chat.send_message_button.click()
sent_time = datetime.strptime(device_2.device_time, '%a %b %d %H:%M:%S GMT %Y').strftime("%I:%M %p")
if not device_2_chat.chat_element_by_text(message).contains_text(sent_time):
self.errors.append('Timestamp is not displayed in public chat for the sender')
if device_2_chat.chat_element_by_text(message).member_photo.is_element_displayed():
self.errors.append('Member photo is displayed in public chat for the sender')
if not device_1_chat.chat_element_by_text(message).contains_text(sent_time):
self.errors.append('Timestamp is not displayed in public chat for the recipient')
if not device_1_chat.chat_element_by_text(message).member_photo.is_element_displayed():
self.errors.append('Member photo is not displayed in 1-1 chat for the recipient')
self.verify_no_errors()
@marks.all @marks.all
@marks.chat @marks.chat

View File

@ -1,11 +1,11 @@
import pytest import pytest
from tests import marks from tests import marks
from tests.base_test_case import MultipleDeviceTestCase from tests.base_test_case import MultipleDeviceTestCase, SingleDeviceTestCase
from views.sign_in_view import SignInView from views.sign_in_view import SignInView
@marks.chat @marks.chat
class TestPublicChat(MultipleDeviceTestCase): class TestPublicChatMultipleDevice(MultipleDeviceTestCase):
@marks.testrail_id(1383) @marks.testrail_id(1383)
@marks.smoke_1 @marks.smoke_1
@ -68,3 +68,54 @@ class TestPublicChat(MultipleDeviceTestCase):
for message in message_1, message_2: for message in message_1, message_2:
if chat_1.element_starts_with_text(message).is_element_present(): if chat_1.element_starts_with_text(message).is_element_present():
pytest.fail("Message '%s' is shown after re-login, but public chat history has been cleared" % message) pytest.fail("Message '%s' is shown after re-login, but public chat history has been cleared" % message)
@marks.testrail_id(3729)
def test_unread_messages_counter_public_chat(self):
self.create_drivers(2)
device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
home_1, home_2 = device_1.create_user(), device_2.create_user()
chat_name = home_1.get_public_chat_name()
chat_1, chat_2 = home_1.join_public_chat(chat_name), home_2.join_public_chat(chat_name)
home_1.get_back_to_home_view()
message = 'test message'
chat_2.chat_message_input.send_keys(message)
chat_2.send_message_button.click()
if home_1.home_button.counter.text != '1':
self.errors.append('New messages counter is not shown on Home button')
chat_element = home_1.get_chat_with_user('#' + chat_name)
if chat_element.new_messages_counter.text != '1':
self.errors.append('New messages counter is not shown on chat element')
chat_element.click()
home_1.get_back_to_home_view()
if home_1.home_button.counter.is_element_displayed():
self.errors.append('New messages counter is shown on Home button for already seen message')
if chat_element.new_messages_counter.is_element_displayed():
self.errors.append('New messages counter is shown on chat element for already seen message')
self.verify_no_errors()
@marks.chat
class TestPublicChatSingleDevice(SingleDeviceTestCase):
@marks.skip
@marks.testrail_id(3752)
def test_send_korean_characters(self):
sign_in = SignInView(self.driver)
home = sign_in.create_user()
chat_name = home.get_public_chat_name()
public_chat = home.join_public_chat(chat_name)
message = '파란하늘'
public_chat.chat_message_input.send_keys(message)
if public_chat.chat_message_input.text != message:
self.errors.append('Korean characters are not displayed properly in the chat message input')
public_chat.send_message_button.click()
if not public_chat.chat_element_by_text(message).is_element_displayed():
self.errors.append('Message with korean characters is not shown')
self.verify_no_errors()

View File

@ -1,5 +1,4 @@
import random import random
from tests import transaction_users, transaction_users_wallet, marks, common_password from tests import transaction_users, transaction_users_wallet, marks, common_password
from tests.base_test_case import SingleDeviceTestCase, MultipleDeviceTestCase from tests.base_test_case import SingleDeviceTestCase, MultipleDeviceTestCase
from views.sign_in_view import SignInView from views.sign_in_view import SignInView
@ -260,6 +259,86 @@ class TestTransactionWalletSingleDevice(SingleDeviceTestCase):
self.errors.append('Warning about too precise amount is not shown when requesting a transaction') self.errors.append('Warning about too precise amount is not shown when requesting a transaction')
self.verify_no_errors() self.verify_no_errors()
@marks.testrail_id(1405)
def test_insufficient_funds_error_wallet(self):
sender = transaction_users['H_USER']
sign_in_view = SignInView(self.driver)
sign_in_view.recover_access(sender['passphrase'], sender['password'])
wallet_view = sign_in_view.wallet_button.click()
wallet_view.set_up_wallet()
bigger_amount = wallet_view.get_eth_value() + 1
send_transaction = wallet_view.send_transaction_button.click()
amount_edit_box = send_transaction.amount_edit_box
amount_edit_box.click()
amount_edit_box.set_value(bigger_amount)
send_transaction.element_by_text('Insufficient funds').wait_for_visibility_of_element(5)
valid_amount = send_transaction.get_unique_amount()
amount_edit_box.clear()
amount_edit_box.set_value(valid_amount)
send_transaction.confirm()
send_transaction.chose_recipient_button.click()
send_transaction.enter_recipient_address_button.click()
send_transaction.enter_recipient_address_input.set_value(transaction_users['G_USER']['address'])
send_transaction.done_button.click()
send_transaction.sign_transaction_button.click()
send_transaction.enter_password_input.send_keys(sender['password'])
send_transaction.sign_transaction_button.click()
send_transaction.got_it_button.click()
self.network_api.find_transaction_by_unique_amount(sender['address'], valid_amount)
@marks.testrail_id(3728)
def test_modify_transaction_fee_values(self):
sender = transaction_users['H_USER']
sign_in_view = SignInView(self.driver)
sign_in_view.recover_access(sender['passphrase'], sender['password'])
wallet_view = sign_in_view.wallet_button.click()
wallet_view.set_up_wallet()
send_transaction = wallet_view.send_transaction_button.click()
amount = send_transaction.get_unique_amount()
send_transaction.amount_edit_box.set_value(amount)
send_transaction.confirm()
send_transaction.chose_recipient_button.click()
send_transaction.enter_recipient_address_button.click()
recipient_address = transaction_users['G_USER']['address']
send_transaction.enter_recipient_address_input.set_value(recipient_address)
send_transaction.done_button.click()
send_transaction.advanced_button.click()
send_transaction.transaction_fee_button.click()
send_transaction.gas_limit_input.clear()
send_transaction.gas_limit_input.set_value('1')
send_transaction.gas_price_input.clear()
send_transaction.gas_price_input.set_value('1')
send_transaction.total_fee_input.click()
send_transaction.done_button.click()
send_transaction.sign_transaction_button.click_until_presence_of_element(send_transaction.enter_password_input)
send_transaction.enter_password_input.send_keys(sender['password'])
send_transaction.sign_transaction_button.click()
send_transaction.element_by_text('intrinsic gas too low').wait_for_visibility_of_element()
send_transaction.ok_button.click()
wallet_view.send_transaction_button.click()
send_transaction.amount_edit_box.set_value(amount)
send_transaction.confirm()
send_transaction.chose_recipient_button.click()
send_transaction.enter_recipient_address_button.click()
send_transaction.enter_recipient_address_input.set_value(recipient_address)
send_transaction.done_button.click()
send_transaction.advanced_button.click()
send_transaction.transaction_fee_button.click()
send_transaction.gas_limit_input.clear()
gas_limit = '1005000'
send_transaction.gas_limit_input.set_value(gas_limit)
send_transaction.gas_price_input.clear()
gas_price = '24'
send_transaction.gas_price_input.set_value(gas_price)
send_transaction.total_fee_input.click()
send_transaction.done_button.click()
send_transaction.sign_transaction(sender['password'])
self.network_api.find_transaction_by_unique_amount(sender['address'], amount)
@marks.transaction @marks.transaction
class TestTransactionWalletMultipleDevice(MultipleDeviceTestCase): class TestTransactionWalletMultipleDevice(MultipleDeviceTestCase):

View File

@ -81,9 +81,9 @@ class BaseElement(object):
seconds) seconds)
raise exception raise exception
def wait_for_visibility_of_element(self, seconds=10): def wait_for_visibility_of_element(self, seconds=10, ignored_exceptions=None):
try: try:
return WebDriverWait(self.driver, seconds) \ return WebDriverWait(self.driver, seconds, ignored_exceptions=ignored_exceptions) \
.until(expected_conditions.visibility_of_element_located((self.locator.by, self.locator.value))) .until(expected_conditions.visibility_of_element_located((self.locator.by, self.locator.value)))
except TimeoutException as exception: except TimeoutException as exception:
exception.msg = "'%s' is not found on screen, using: '%s', during '%s' seconds" % (self.name, self.locator, exception.msg = "'%s' is not found on screen, using: '%s', during '%s' seconds" % (self.name, self.locator,
@ -115,10 +115,10 @@ class BaseElement(object):
except TimeoutException: except TimeoutException:
return False return False
def is_element_displayed(self, sec=5): def is_element_displayed(self, sec=5, ignored_exceptions=None):
try: try:
info('Wait for %s' % self.name) info('Wait for %s' % self.name)
return self.wait_for_visibility_of_element(sec) return self.wait_for_visibility_of_element(sec, ignored_exceptions=ignored_exceptions)
except TimeoutException: except TimeoutException:
return False return False

View File

@ -7,7 +7,7 @@ import re
import zbarlight import zbarlight
from tests import info, common_password from tests import info, common_password
from eth_keys import datatypes from eth_keys import datatypes
from selenium.common.exceptions import NoSuchElementException, TimeoutException from selenium.common.exceptions import NoSuchElementException, TimeoutException, StaleElementReferenceException
from PIL import Image from PIL import Image
from datetime import datetime from datetime import datetime
from io import BytesIO from io import BytesIO
@ -84,7 +84,7 @@ class TabButton(BaseButton):
def __init__(self, driver, parent_locator): def __init__(self, driver, parent_locator):
super(Counter, self).__init__(driver) super(Counter, self).__init__(driver)
self.locator = self.Locator.xpath_selector( self.locator = self.Locator.xpath_selector(
"//*[@content-desc='%s']/android.view.ViewGroup[2]/android.widget.TextView" % parent_locator) "//*[@content-desc='%s']//android.view.ViewGroup[2]/android.widget.TextView" % parent_locator)
return Counter(self.driver, self.locator.value) return Counter(self.driver, self.locator.value)
@ -191,6 +191,12 @@ class DiscardButton(BaseButton):
self.locator = self.Locator.xpath_selector("//*[@text='DISCARD']") self.locator = self.Locator.xpath_selector("//*[@text='DISCARD']")
class ConfirmButton(BaseButton):
def __init__(self, driver):
super(ConfirmButton, self).__init__(driver)
self.locator = self.Locator.xpath_selector("//*[@text='CONFIRM']")
class BaseView(object): class BaseView(object):
def __init__(self, driver): def __init__(self, driver):
self.driver = driver self.driver = driver
@ -213,6 +219,7 @@ class BaseView(object):
self.delete_button = DeleteButton(self.driver) self.delete_button = DeleteButton(self.driver)
self.ok_continue_button = OkContinueButton(self.driver) self.ok_continue_button = OkContinueButton(self.driver)
self.discard_button = DiscardButton(self.driver) self.discard_button = DiscardButton(self.driver)
self.confirm_button = ConfirmButton(self.driver)
self.connection_status = ConnectionStatusText(self.driver) self.connection_status = ConnectionStatusText(self.driver)
self.apps_button = AppsButton(self.driver) self.apps_button = AppsButton(self.driver)
@ -416,7 +423,8 @@ class BaseView(object):
def reconnect(self): def reconnect(self):
connect_status = self.connection_status connect_status = self.connection_status
for i in range(3): for i in range(3):
if connect_status.is_element_displayed(5) and 'Tap to reconnect' in connect_status.text: if connect_status.is_element_displayed(5, ignored_exceptions=StaleElementReferenceException):
if 'Tap to reconnect' in connect_status.text:
try: try:
connect_status.click() connect_status.click()
except AttributeError: except AttributeError:
@ -431,5 +439,5 @@ class BaseView(object):
def check_no_values_in_logcat(self, **kwargs): def check_no_values_in_logcat(self, **kwargs):
logcat = self.logcat logcat = self.logcat
for key, value in kwargs.items(): for key, value in kwargs.items():
if re.findall('\W%s|\W%s\W' % (value, value), logcat): if re.findall('\W%s$|\W%s\W' % (value, value), logcat):
pytest.fail('%s in logcat!!!' % key.capitalize(), pytrace=False) pytest.fail('%s in logcat!!!' % key.capitalize(), pytrace=False)

View File

@ -87,6 +87,16 @@ class ChatElement(BaseButton):
counter += 1 counter += 1
self.swipe_delete_button.click() self.swipe_delete_button.click()
@property
def new_messages_counter(self):
class UnreadMessagesCountText(BaseText):
def __init__(self, driver, parent_locator: str):
super(UnreadMessagesCountText, self).__init__(driver)
locator_str = "//*[@content-desc='unread-messages-count-text']"
self.locator = self.Locator.xpath_selector(parent_locator + locator_str)
return UnreadMessagesCountText(self.driver, self.locator.value)
class ChatNameText(BaseText): class ChatNameText(BaseText):
def __init__(self, driver): def __init__(self, driver):
@ -146,7 +156,7 @@ class HomeView(BaseView):
user_contact.click() user_contact.click()
start_new_chat.next_button.click() start_new_chat.next_button.click()
start_new_chat.chat_name_editbox.send_keys(group_chat_name) start_new_chat.chat_name_editbox.send_keys(group_chat_name)
start_new_chat.confirm_button.click() start_new_chat.create_button.click()
def join_public_chat(self, chat_name: str): def join_public_chat(self, chat_name: str):
start_new_chat = self.plus_button.click() start_new_chat = self.plus_button.click()

View File

@ -132,10 +132,10 @@ class EditPictureButton(BaseButton):
self.locator = self.Locator.accessibility_id('edit-profile-photo-button') self.locator = self.Locator.accessibility_id('edit-profile-photo-button')
class ConfirmButton(BaseButton): class ConfirmEditButton(BaseButton):
def __init__(self, driver): def __init__(self, driver):
super(ConfirmButton, self).__init__(driver) super(ConfirmEditButton, self).__init__(driver)
self.locator = self.Locator.accessibility_id('done-button') self.locator = self.Locator.accessibility_id('done-button')
@ -238,10 +238,10 @@ class MainCurrencyButton(BaseButton):
self.locator = self.Locator.accessibility_id("currency-button") self.locator = self.Locator.accessibility_id("currency-button")
class NetworkPlusButton(BaseButton): class PlusButton(BaseButton):
def __init__(self, driver): def __init__(self, driver):
super(NetworkPlusButton, self).__init__(driver) super(PlusButton, self).__init__(driver)
self.locator = self.Locator.xpath_selector("(//android.view.ViewGroup[@content-desc='icon'])[2]") self.locator = self.Locator.xpath_selector("(//android.view.ViewGroup[@content-desc='icon'])[2]")
@ -253,10 +253,10 @@ class RopstenChainButton(BaseButton):
"//*[contains(@text,'Ropsten test network')]/following-sibling::android.widget.CheckBox[1]") "//*[contains(@text,'Ropsten test network')]/following-sibling::android.widget.CheckBox[1]")
class CustomNetworkName(BaseEditBox): class SpecifyNameInput(BaseEditBox):
def __init__(self, driver): def __init__(self, driver):
super(CustomNetworkName, self).__init__(driver) super(SpecifyNameInput, self).__init__(driver)
self.locator = self.Locator.xpath_selector("//*[@text='Name']/following-sibling::*[1]/android.widget.EditText") self.locator = self.Locator.xpath_selector("//*[@text='Name']/following-sibling::*[1]/android.widget.EditText")
@ -300,6 +300,69 @@ class FaqButton(BaseButton):
return BaseWebView(self.driver) return BaseWebView(self.driver)
class BootnodesButton(BaseButton):
def __init__(self, driver):
super(BootnodesButton, self).__init__(driver)
self.locator = self.Locator.accessibility_id('bootnodes-settings-button')
class AddBootnodeButton(BaseButton):
def __init__(self, driver):
super(AddBootnodeButton, self).__init__(driver)
self.locator = self.Locator.xpath_selector("(//*[@content-desc='icon'])[2]")
class BootnodeNameInput(BaseEditBox):
def __init__(self, driver):
super(BootnodeNameInput, self).__init__(driver)
self.locator = self.Locator.xpath_selector("//android.widget.EditText[@text='Specify a name']")
class BootnodeAddressInput(BaseEditBox):
def __init__(self, driver):
super(BootnodeAddressInput, self).__init__(driver)
self.locator = self.Locator.xpath_selector("//android.widget.EditText[@text='Specify bootnode address']")
class EnableBootnodesToggle(BaseEditBox):
def __init__(self, driver):
super(EnableBootnodesToggle, self).__init__(driver)
self.locator = self.Locator.xpath_selector('//android.widget.Switch')
class MailServerButton(BaseButton):
def __init__(self, driver):
super(MailServerButton, self).__init__(driver)
self.locator = self.Locator.accessibility_id('offline-messages-settings-button')
class MailServerAddressInput(BaseEditBox):
def __init__(self, driver):
super(MailServerAddressInput, self).__init__(driver)
self.locator = self.Locator.xpath_selector("//android.widget.EditText[@text='Specify a mailserver address']")
class MailServerElement(BaseButton):
def __init__(self, driver, server_name):
super(MailServerElement, self).__init__(driver)
self.locator = self.Locator.xpath_selector("//*[@content-desc='mailserver-item']//*[@text='%s']" % server_name)
class MailServerConnectButton(BaseButton):
def __init__(self, driver):
super(MailServerConnectButton, self).__init__(driver)
self.locator = self.Locator.accessibility_id('mailserver-connect-button')
class ProfileView(BaseView): class ProfileView(BaseView):
def __init__(self, driver): def __init__(self, driver):
@ -314,10 +377,10 @@ class ProfileView(BaseView):
self.profile_address_text = ProfileAddressText(self.driver) self.profile_address_text = ProfileAddressText(self.driver)
self.network_settings_button = NetworkSettingsButton(self.driver) self.network_settings_button = NetworkSettingsButton(self.driver)
self.network_plus_button = NetworkPlusButton(self.driver) self.plus_button = PlusButton(self.driver)
self.ropsten_chain_button = RopstenChainButton(self.driver) self.ropsten_chain_button = RopstenChainButton(self.driver)
self.custom_network_url = CustomNetworkURL(self.driver) self.custom_network_url = CustomNetworkURL(self.driver)
self.custom_network_name = CustomNetworkName(self.driver) self.specify_name_input = SpecifyNameInput(self.driver)
self.connect_button = NetworkSettingsButton.ConnectButton(self.driver) self.connect_button = NetworkSettingsButton.ConnectButton(self.driver)
self.logout_button = LogoutButton(self.driver) self.logout_button = LogoutButton(self.driver)
self.logout_dialog = LogoutDialog(self.driver) self.logout_dialog = LogoutDialog(self.driver)
@ -330,7 +393,7 @@ class ProfileView(BaseView):
self.edit_button = EditButton(self.driver) self.edit_button = EditButton(self.driver)
self.profile_picture = ProfilePictureElement(self.driver) self.profile_picture = ProfilePictureElement(self.driver)
self.edit_picture_button = EditPictureButton(self.driver) self.edit_picture_button = EditPictureButton(self.driver)
self.confirm_button = ConfirmButton(self.driver) self.confirm_edit_button = ConfirmEditButton(self.driver)
self.cross_icon = CrossIcon(self.driver) self.cross_icon = CrossIcon(self.driver)
self.share_button = ShareButton(self.driver) self.share_button = ShareButton(self.driver)
self.advanced_button = AdvancedButton(self.driver) self.advanced_button = AdvancedButton(self.driver)
@ -350,6 +413,16 @@ class ProfileView(BaseView):
self.submit_bug_button = SubmitBugButton(self.driver) self.submit_bug_button = SubmitBugButton(self.driver)
self.faq_button = FaqButton(self.driver) self.faq_button = FaqButton(self.driver)
# Bootnodes
self.bootnodes_button = BootnodesButton(self.driver)
self.bootnode_address_input = BootnodeAddressInput(self.driver)
self.enable_bootnodes = EnableBootnodesToggle(self.driver)
# Mailservers
self.mail_server_button = MailServerButton(self.driver)
self.mail_server_address_input = MailServerAddressInput(self.driver)
self.mail_server_connect_button = MailServerConnectButton(self.driver)
def switch_network(self, network): def switch_network(self, network):
self.advanced_button.click() self.advanced_button.click()
self.debug_mode_toggle.click() self.debug_mode_toggle.click()
@ -366,10 +439,10 @@ class ProfileView(BaseView):
self.debug_mode_toggle.click() self.debug_mode_toggle.click()
self.network_settings_button.scroll_to_element() self.network_settings_button.scroll_to_element()
self.network_settings_button.click() self.network_settings_button.click()
self.network_plus_button.click_until_presence_of_element(self.ropsten_chain_button) self.plus_button.click_until_presence_of_element(self.ropsten_chain_button)
self.ropsten_chain_button.click() self.ropsten_chain_button.click()
self.custom_network_url.send_keys('https://ropsten.infura.io/iMko0kJNQUdhbCSaJcox') self.custom_network_url.send_keys('https://ropsten.infura.io/iMko0kJNQUdhbCSaJcox')
self.custom_network_name.send_keys('custom_ropsten') self.specify_name_input.send_keys('custom_ropsten')
self.save_button.click() self.save_button.click()
self.element_by_text_part('custom_ropsten').click_until_presence_of_element(self.connect_button) self.element_by_text_part('custom_ropsten').click_until_presence_of_element(self.connect_button)
self.connect_button.click() self.connect_button.click()
@ -413,7 +486,7 @@ class ProfileView(BaseView):
for element_text in 'Images', 'DCIM': for element_text in 'Images', 'DCIM':
self.element_by_text(element_text).click() self.element_by_text(element_text).click()
picture.click() picture.click()
self.confirm_button.click() self.confirm_edit_button.click()
def logout(self): def logout(self):
self.logout_button.click() self.logout_button.click()
@ -425,3 +498,5 @@ class ProfileView(BaseView):
desired_currency.scroll_to_element() desired_currency.scroll_to_element()
desired_currency.click() desired_currency.click()
def mail_server_by_name(self, server_name):
return MailServerElement(self.driver, server_name)

View File

@ -46,12 +46,6 @@ class EnterPasswordInput(BaseEditBox):
self.locator = self.Locator.accessibility_id('enter-password-input') self.locator = self.Locator.accessibility_id('enter-password-input')
class ConfirmButton(BaseButton):
def __init__(self, driver):
super(ConfirmButton, self).__init__(driver)
self.locator = self.Locator.xpath_selector("//*[@text='CONFIRM']")
class GotItButton(BaseButton): class GotItButton(BaseButton):
def __init__(self, driver): def __init__(self, driver):
super(GotItButton, self).__init__(driver) super(GotItButton, self).__init__(driver)
@ -161,7 +155,6 @@ class SendTransactionView(BaseView):
self.cancel_button = CancelButton(self.driver) self.cancel_button = CancelButton(self.driver)
self.sign_transaction_button = SignTransactionButton(self.driver) self.sign_transaction_button = SignTransactionButton(self.driver)
self.confirm_button = ConfirmButton(self.driver)
self.sign_in_phrase_text = SignInPhraseText(self.driver) self.sign_in_phrase_text = SignInPhraseText(self.driver)
self.password_input = PasswordInput(self.driver) self.password_input = PasswordInput(self.driver)
self.enter_password_input = EnterPasswordInput(self.driver) self.enter_password_input = EnterPasswordInput(self.driver)

View File

@ -40,9 +40,9 @@ class OpenButton(BaseButton):
self.locator = self.Locator.accessibility_id('open-dapp-button') self.locator = self.Locator.accessibility_id('open-dapp-button')
class ConfirmButton(BaseButton): class CreateButton(BaseButton):
def __init__(self, driver): def __init__(self, driver):
super(ConfirmButton, self).__init__(driver) super(CreateButton, self).__init__(driver)
self.locator = self.Locator.accessibility_id('create-button') self.locator = self.Locator.accessibility_id('create-button')
@ -78,7 +78,7 @@ class StartNewChatView(ContactsView):
self.chat_name_editbox = ChatNameEditBox(self.driver) self.chat_name_editbox = ChatNameEditBox(self.driver)
self.enter_url_editbox = EnterUrlEditbox(self.driver) self.enter_url_editbox = EnterUrlEditbox(self.driver)
self.confirm_button = ConfirmButton(self.driver) self.create_button = CreateButton(self.driver)
def get_username_checkbox(self, username: str): def get_username_checkbox(self, username: str):
return UsernameCheckbox(self.driver, username) return UsernameCheckbox(self.driver, username)

View File

@ -141,7 +141,12 @@ class AssetTextElement(BaseText):
class AssetCheckBox(BaseButton): class AssetCheckBox(BaseButton):
def __init__(self, driver, asset_name): def __init__(self, driver, asset_name):
super(AssetCheckBox, self).__init__(driver) super(AssetCheckBox, self).__init__(driver)
self.locator = self.Locator.xpath_selector("//*[@text='%s']/../android.widget.CheckBox" % asset_name) self.asset_name = asset_name
self.locator = self.Locator.xpath_selector("//*[@text='%s']/../android.widget.CheckBox" % self.asset_name)
def click(self):
self.scroll_to_element().click()
info('Click %s asset checkbox' % self.asset_name)
class TotalAmountText(BaseText): class TotalAmountText(BaseText):