Added e2e tests for account management verifications
Signed-off-by: yevh-berdnyk <ie.berdnyk@gmail.com>
This commit is contained in:
parent
ca80926433
commit
f94e1c5826
|
@ -16,7 +16,7 @@ class TestNetwork(SingleDeviceTestCase):
|
|||
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.click_account_by_position(0)
|
||||
sign_in_view.password_input.send_keys('qwerty1234')
|
||||
sign_in_view.sign_in_button.click()
|
||||
sign_in_view.find_full_text('Wallet', 20)
|
||||
|
@ -39,7 +39,7 @@ class TestNetworkChats(MultipleDeviceTestCase):
|
|||
device_1_public_key = device_1_profile_view.public_key_text.text
|
||||
if network[0] != 'Ropsten with upstream RPC':
|
||||
login_d1 = device_1_profile_view.switch_network(network[0])
|
||||
login_d1.first_account_button.click()
|
||||
login_d1.click_account_by_position(0)
|
||||
login_d1.password_input.send_keys('qwerty1234')
|
||||
login_d1.sign_in_button.click()
|
||||
login_d1.find_full_text('Wallet', 60)
|
||||
|
@ -49,7 +49,7 @@ class TestNetworkChats(MultipleDeviceTestCase):
|
|||
if network[1] != 'Ropsten with upstream RPC':
|
||||
device_2_profile_view = device_2.profile_button.click()
|
||||
device_2_sign_in = device_2_profile_view.switch_network(network[1])
|
||||
device_2_sign_in.first_account_button.click()
|
||||
device_2_sign_in.click_account_by_position(0)
|
||||
device_2_sign_in.password_input.send_keys('qwerty1234')
|
||||
device_2_home_view = device_2_sign_in.sign_in_button.click()
|
||||
device_2_home_view.find_full_text('Wallet', 60)
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import random
|
||||
import emoji
|
||||
import pytest
|
||||
import time
|
||||
from tests.base_test_case import SingleDeviceTestCase
|
||||
|
@ -8,6 +10,7 @@ from views.sign_in_view import SignInView
|
|||
@pytest.mark.all
|
||||
class TestProfileView(SingleDeviceTestCase):
|
||||
|
||||
@pytest.mark.testrail_case_id(3395)
|
||||
def test_qr_code_and_its_value(self):
|
||||
sign_in_view = SignInView(self.driver)
|
||||
sign_in_view.create_user()
|
||||
|
@ -16,9 +19,21 @@ class TestProfileView(SingleDeviceTestCase):
|
|||
key_value = profile_view.public_key_text.text
|
||||
time.sleep(5)
|
||||
key_value_from_qr = profile_view.get_text_from_qr()
|
||||
assert key_value == key_value_from_qr
|
||||
if key_value != key_value_from_qr:
|
||||
self.errors.append("QR code value '%s' doesn't match public key '%s'" % (key_value_from_qr, key_value))
|
||||
profile_view.cross_icon.click()
|
||||
wallet_view = profile_view.wallet_button.click()
|
||||
wallet_view.request_button.click()
|
||||
wallet_view.qr_code_image.wait_for_element()
|
||||
key_value = wallet_view.address_text.text
|
||||
key_value_from_qr = wallet_view.get_text_from_qr()
|
||||
if key_value_from_qr != "ethereum:%s'" % key_value:
|
||||
self.errors.append(
|
||||
"Wallet QR code value '%s' doesn't match wallet address '%s'" % (key_value_from_qr, key_value))
|
||||
self.verify_no_errors()
|
||||
|
||||
@pytest.mark.pr
|
||||
@pytest.mark.testrail_case_id(3396)
|
||||
def test_contact_profile_view(self):
|
||||
sign_in_view = SignInView(self.driver)
|
||||
sign_in_view.create_user()
|
||||
|
@ -29,6 +44,12 @@ class TestProfileView(SingleDeviceTestCase):
|
|||
chat_view.view_profile_button.click()
|
||||
for text in basic_user['username'], 'In contacts', 'Send transaction', 'Send message', 'Contact code':
|
||||
chat_view.find_full_text(text)
|
||||
chat_view.profile_send_message.click()
|
||||
chat_view.chat_message_input.wait_for_visibility_of_element()
|
||||
chat_view.chat_options.click_until_presence_of_element(chat_view.view_profile_button)
|
||||
chat_view.view_profile_button.click()
|
||||
chat_view.profile_send_transaction.click()
|
||||
assert chat_view.chat_message_input.text.strip() == '/send'
|
||||
|
||||
@pytest.mark.pr
|
||||
def test_network_switch(self):
|
||||
|
@ -37,7 +58,7 @@ class TestProfileView(SingleDeviceTestCase):
|
|||
profile_view = sign_in_view.profile_button.click()
|
||||
profile_view.advanced_button.click()
|
||||
sign_in_view = profile_view.switch_network('Rinkeby with upstream RPC')
|
||||
sign_in_view.first_account_button.click()
|
||||
sign_in_view.click_account_by_position(0)
|
||||
sign_in_view.password_input.set_value('qwerty1234')
|
||||
sign_in_view.sign_in_button.click()
|
||||
sign_in_view.profile_button.click_until_presence_of_element(profile_view.advanced_button)
|
||||
|
@ -45,3 +66,110 @@ class TestProfileView(SingleDeviceTestCase):
|
|||
desired_network = profile_view.element_by_text('RINKEBY WITH UPSTREAM RPC', 'text')
|
||||
desired_network.scroll_to_element()
|
||||
assert desired_network.is_element_displayed()
|
||||
|
||||
@pytest.mark.testrail_case_id(3398)
|
||||
def test_profile_picture(self):
|
||||
sign_in_view = SignInView(self.driver)
|
||||
sign_in_view.create_user()
|
||||
profile_view = sign_in_view.profile_button.click()
|
||||
profile_view.edit_profile_picture(file_name='sauce_logo.png')
|
||||
profile_view.relogin()
|
||||
sign_in_view.profile_button.click()
|
||||
if not profile_view.profile_picture.is_element_image_equals_template():
|
||||
pytest.fail('Profile picture was not updated')
|
||||
|
||||
@pytest.mark.testrail_case_id(3399)
|
||||
def test_backup_seed_phrase_and_recover_account(self):
|
||||
sign_in_view = SignInView(self.driver)
|
||||
sign_in_view.create_user(password='qwerty1234')
|
||||
home_view = sign_in_view.get_home_view()
|
||||
public_key = home_view.get_public_key()
|
||||
profile_view = home_view.get_profile_view()
|
||||
profile_view.backup_seed_phrase_button.click()
|
||||
profile_view.ok_continue_button.click()
|
||||
seed_phrase = profile_view.get_seed_phrase()
|
||||
profile_view.next_button.click()
|
||||
word_number = profile_view.seed_phrase_word_number.text
|
||||
profile_view.seed_phrase_word_input.set_value(seed_phrase[word_number])
|
||||
profile_view.next_button.click()
|
||||
word_number_1 = profile_view.seed_phrase_word_number.text
|
||||
profile_view.seed_phrase_word_input.set_value(seed_phrase[word_number_1])
|
||||
profile_view.done_button.click()
|
||||
profile_view.yes_button.click()
|
||||
profile_view.ok_got_it_button.click()
|
||||
profile_view.logout_button.click()
|
||||
profile_view.confirm_logout_button.click()
|
||||
recover_access_view = sign_in_view.add_existing_account_button.click()
|
||||
recover_access_view.passphrase_input.set_value(' '.join(seed_phrase.values()))
|
||||
recover_access_view.password_input.set_value('qwerty1234')
|
||||
recover_access_view.sign_in_button.click()
|
||||
sign_in_view.do_not_share.click()
|
||||
public_key_1 = home_view.get_public_key()
|
||||
assert public_key == public_key_1
|
||||
|
||||
@pytest.mark.testrail_case_id(3411)
|
||||
def test_debug_on_of(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()
|
||||
chat_view = home_view.get_chat_with_user('Status Console').click()
|
||||
chat_view.commands_button.click()
|
||||
chat_view.debug_command.click()
|
||||
chat_view.debug_on_command.click()
|
||||
chat_view.send_message_button.click()
|
||||
chat_view.wait_for_message_in_one_to_one_chat('Debug server has been launched! You can now execute '
|
||||
'status-dev-cli scan to find the server from your computer '
|
||||
'on the same network.', self.errors)
|
||||
chat_view.wait_for_message_in_one_to_one_chat('Debug mode: On', self.errors)
|
||||
chat_view.commands_button.click()
|
||||
chat_view.debug_command.click()
|
||||
chat_view.debug_off_command.click()
|
||||
chat_view.send_message_button.click()
|
||||
chat_view.wait_for_message_in_one_to_one_chat('Debug mode: Off', self.errors)
|
||||
self.verify_no_errors()
|
||||
|
||||
@pytest.mark.testrail_case_id(3421)
|
||||
def test_switch_users(self):
|
||||
sign_in_view = SignInView(self.driver)
|
||||
for _ in range(3):
|
||||
sign_in_view.create_user(password='qwerty1234')
|
||||
home_view = sign_in_view.get_home_view()
|
||||
profile_view = home_view.profile_button.click()
|
||||
profile_view.logout_button.click()
|
||||
profile_view.confirm_logout_button.click()
|
||||
sign_in_view.click_account_by_position(0)
|
||||
sign_in_view.password_input.send_keys('qwerty1234')
|
||||
sign_in_view.sign_in_button.click()
|
||||
sign_in_view.home_button.wait_for_visibility_of_element()
|
||||
|
||||
@pytest.mark.testrail_case_id(3424)
|
||||
def test_incorrect_password(self):
|
||||
sign_in_view = SignInView(self.driver)
|
||||
sign_in_view.create_account_button.click()
|
||||
sign_in_view.password_input.set_value('123456')
|
||||
sign_in_view.next_button.click()
|
||||
sign_in_view.confirm_password_input.set_value('123455')
|
||||
sign_in_view.next_button.click()
|
||||
sign_in_view.find_full_text("Password confirmation doesn't match password.")
|
||||
sign_in_view.confirm_password_input.clear()
|
||||
sign_in_view.confirm_password_input.set_value('123456')
|
||||
sign_in_view.next_button.click()
|
||||
sign_in_view.name_input.wait_for_element(45)
|
||||
emoji_name = random.choice(list(emoji.EMOJI_UNICODE))
|
||||
username = 'user'
|
||||
sign_in_view.name_input.click()
|
||||
sign_in_view.name_input.send_keys(emoji.emojize('%s %s' % (username, emoji_name)))
|
||||
sign_in_view.next_button.click()
|
||||
sign_in_view.do_not_share.wait_for_element(10)
|
||||
sign_in_view.do_not_share.click_until_presence_of_element(sign_in_view.home_button)
|
||||
profile_view = sign_in_view.profile_button.click()
|
||||
assert profile_view.username_text.text == '%s %s' % (username, emoji.EMOJI_UNICODE[emoji_name])
|
||||
profile_view.logout_button.click()
|
||||
profile_view.confirm_logout_button.click()
|
||||
sign_in_view.click_account_by_position(0)
|
||||
sign_in_view.password_input.send_keys('123455')
|
||||
sign_in_view.sign_in_button.click()
|
||||
sign_in_view.find_full_text('Wrong password')
|
||||
|
|
|
@ -18,12 +18,8 @@ class TestSanity(SingleDeviceTestCase):
|
|||
new_username = 'NewUserName!'
|
||||
profile_view.username_input.send_keys(new_username)
|
||||
profile_view.confirm_button.click()
|
||||
sign_in_view = profile_view.logout_button.click()
|
||||
sign_in_view.first_account_button.click()
|
||||
sign_in_view.password_input.send_keys('qwerty1234')
|
||||
home_view = sign_in_view.sign_in_button.click()
|
||||
home_view.find_full_text('Wallet', 60)
|
||||
home_view.profile_button.click()
|
||||
profile_view.relogin()
|
||||
sign_in_view.profile_button.click()
|
||||
profile_view.edit_button.click()
|
||||
profile_view.find_full_text(new_username, 5)
|
||||
|
||||
|
@ -86,7 +82,7 @@ class TestSanity(SingleDeviceTestCase):
|
|||
sign_in_view.status_app_icon.scroll_to_element()
|
||||
sign_in_view.status_app_icon.click()
|
||||
sign_in_view.ok_button.click()
|
||||
sign_in_view.first_account_button.click()
|
||||
sign_in_view.click_account_by_position(0)
|
||||
sign_in_view.password_input.send_keys('qwerty1234')
|
||||
sign_in_view.sign_in_button.click()
|
||||
contact_name.wait_for_element(30)
|
||||
|
@ -106,7 +102,7 @@ class TestSanity(SingleDeviceTestCase):
|
|||
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.click_account_by_position(0)
|
||||
sign_in_view.password_input.send_keys(input_text)
|
||||
sign_in_view.sign_in_button.click()
|
||||
sign_in_view.find_full_text(outcome, 60)
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
import base64
|
||||
from io import BytesIO
|
||||
import os
|
||||
from PIL import Image, ImageChops
|
||||
from appium.webdriver.common.mobileby import MobileBy
|
||||
from selenium.common.exceptions import NoSuchElementException
|
||||
from selenium.common.exceptions import TimeoutException
|
||||
|
@ -7,7 +11,6 @@ from tests import info
|
|||
|
||||
|
||||
class BaseElement(object):
|
||||
|
||||
class Locator(object):
|
||||
|
||||
def __init__(self, by, value):
|
||||
|
@ -50,7 +53,7 @@ class BaseElement(object):
|
|||
|
||||
def wait_for_element(self, seconds=10):
|
||||
try:
|
||||
return WebDriverWait(self.driver, seconds)\
|
||||
return WebDriverWait(self.driver, seconds) \
|
||||
.until(expected_conditions.presence_of_element_located((self.locator.by, self.locator.value)))
|
||||
except TimeoutException as exception:
|
||||
exception.msg = "'%s' is not found on screen, using: '%s', during '%s' seconds" % (self.name, self.locator,
|
||||
|
@ -59,7 +62,7 @@ class BaseElement(object):
|
|||
|
||||
def wait_for_visibility_of_element(self, seconds=10):
|
||||
try:
|
||||
return WebDriverWait(self.driver, seconds)\
|
||||
return WebDriverWait(self.driver, seconds) \
|
||||
.until(expected_conditions.visibility_of_element_located((self.locator.by, self.locator.value)))
|
||||
except TimeoutException as exception:
|
||||
exception.msg = "'%s' is not found on screen, using: '%s', during '%s' seconds" % (self.name, self.locator,
|
||||
|
@ -92,6 +95,24 @@ class BaseElement(object):
|
|||
def text(self):
|
||||
return self.find_element().text
|
||||
|
||||
@property
|
||||
def template(self):
|
||||
try:
|
||||
return self.__template
|
||||
except FileNotFoundError:
|
||||
raise FileNotFoundError('Please add %s image as template' % self.name)
|
||||
|
||||
@template.setter
|
||||
def template(self, value):
|
||||
self.__template = Image.open(os.sep.join(__file__.split(os.sep)[:-1]) + '/elements_templates/%s' % value)
|
||||
|
||||
@property
|
||||
def image(self):
|
||||
return Image.open(BytesIO(base64.b64decode(self.find_element().screenshot_as_base64)))
|
||||
|
||||
def is_element_image_equals_template(self):
|
||||
return not ImageChops.difference(self.image, self.template).getbbox()
|
||||
|
||||
|
||||
class BaseEditBox(BaseElement):
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ class BackButton(BaseButton):
|
|||
class AllowButton(BaseButton):
|
||||
def __init__(self, driver):
|
||||
super(AllowButton, self).__init__(driver)
|
||||
self.locator = self.Locator.xpath_selector("//*[@text='Allow']")
|
||||
self.locator = self.Locator.xpath_selector("//*[@text='Allow' or @text='ALLOW']")
|
||||
|
||||
def click(self):
|
||||
try:
|
||||
|
@ -290,3 +290,24 @@ class BaseView(object):
|
|||
def public_key_to_address(self, public_key):
|
||||
raw_public_key = bytearray.fromhex(public_key.replace('0x04', ''))
|
||||
return datatypes.PublicKey(raw_public_key).to_address()[2:]
|
||||
|
||||
def get_back_to_home_view(self):
|
||||
counter = 0
|
||||
while not self.home_button.is_element_displayed(2):
|
||||
try:
|
||||
if counter >= 5:
|
||||
return
|
||||
self.back_button.click()
|
||||
except (NoSuchElementException, TimeoutException):
|
||||
counter += 1
|
||||
|
||||
def relogin(self):
|
||||
self.get_back_to_home_view()
|
||||
profile_view = self.profile_button.click()
|
||||
profile_view.logout_button.click()
|
||||
profile_view.confirm_logout_button.click()
|
||||
sign_in_view = self.get_sign_in_view()
|
||||
sign_in_view.click_account_by_position(0)
|
||||
sign_in_view.password_input.send_keys('qwerty1234')
|
||||
sign_in_view.sign_in_button.click()
|
||||
sign_in_view.home_button.wait_for_visibility_of_element()
|
||||
|
|
|
@ -42,6 +42,25 @@ class RequestCommand(BaseButton):
|
|||
self.locator = self.Locator.accessibility_id('request-payment-button')
|
||||
|
||||
|
||||
class DebugCommand(BaseButton):
|
||||
def __init__(self, driver):
|
||||
super(DebugCommand, self).__init__(driver)
|
||||
self.locator = self.Locator.xpath_selector(
|
||||
"//*[contains(@text,'Starts/stops')]/preceding-sibling::*[@text='/debug']")
|
||||
|
||||
|
||||
class DebugOnCommand(BaseButton):
|
||||
def __init__(self, driver):
|
||||
super(DebugOnCommand, self).__init__(driver)
|
||||
self.locator = self.Locator.xpath_selector("//*[@text='On']")
|
||||
|
||||
|
||||
class DebugOffCommand(BaseButton):
|
||||
def __init__(self, driver):
|
||||
super(DebugOffCommand, self).__init__(driver)
|
||||
self.locator = self.Locator.xpath_selector("//*[@text='Off']")
|
||||
|
||||
|
||||
class ChatMenuButton(BaseButton):
|
||||
def __init__(self, driver):
|
||||
super(ChatMenuButton, self).__init__(driver)
|
||||
|
@ -99,12 +118,6 @@ class MoreUsersButton(BaseButton):
|
|||
self.locator = self.Locator.xpath_selector("//android.widget.TextView[contains(@text, 'MORE')]")
|
||||
|
||||
|
||||
class UserProfileDetails(BaseButton):
|
||||
def __init__(self, driver):
|
||||
super(UserProfileDetails, self).__init__(driver)
|
||||
self.locator = self.Locator.xpath_selector("//*[@text='Profile']")
|
||||
|
||||
|
||||
class OpenInBrowserButton(BaseButton):
|
||||
def __init__(self, driver):
|
||||
super(OpenInBrowserButton, self).__init__(driver)
|
||||
|
@ -127,6 +140,18 @@ class ViewProfileButton(BaseButton):
|
|||
self.locator = self.Locator.xpath_selector('//*[@text="View profile"]')
|
||||
|
||||
|
||||
class ProfileSendMessageButton(BaseButton):
|
||||
def __init__(self, driver):
|
||||
super(ProfileSendMessageButton, self).__init__(driver)
|
||||
self.locator = self.Locator.accessibility_id('start-conversation-button')
|
||||
|
||||
|
||||
class ProfileSendTransactionButton(BaseButton):
|
||||
def __init__(self, driver):
|
||||
super(ProfileSendTransactionButton, self).__init__(driver)
|
||||
self.locator = self.Locator.accessibility_id('send-transaction-button')
|
||||
|
||||
|
||||
class ChatView(BaseView):
|
||||
def __init__(self, driver):
|
||||
super(ChatView, self).__init__(driver)
|
||||
|
@ -138,6 +163,9 @@ class ChatView(BaseView):
|
|||
self.commands_button = CommandsButton(self.driver)
|
||||
self.send_command = SendCommand(self.driver)
|
||||
self.request_command = RequestCommand(self.driver)
|
||||
self.debug_command = DebugCommand(self.driver)
|
||||
self.debug_on_command = DebugOnCommand(self.driver)
|
||||
self.debug_off_command = DebugOffCommand(self.driver)
|
||||
|
||||
self.chat_options = ChatMenuButton(self.driver)
|
||||
self.members_button = MembersButton(self.driver)
|
||||
|
@ -151,10 +179,12 @@ class ChatView(BaseView):
|
|||
|
||||
self.first_recipient_button = FirstRecipient(self.driver)
|
||||
|
||||
self.user_profile_details = UserProfileDetails(self.driver)
|
||||
|
||||
self.open_in_browser_button = OpenInBrowserButton(self.driver)
|
||||
|
||||
# Contact's profile
|
||||
self.profile_send_message = ProfileSendMessageButton(self.driver)
|
||||
self.profile_send_transaction = ProfileSendTransactionButton(self.driver)
|
||||
|
||||
def wait_for_syncing_complete(self):
|
||||
info('Waiting for syncing complete:')
|
||||
while True:
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 16 KiB |
|
@ -82,16 +82,6 @@ class HomeView(BaseView):
|
|||
def get_chat_with_user(self, username):
|
||||
return ChatElement(self.driver, username)
|
||||
|
||||
def get_back_to_home_view(self):
|
||||
counter = 0
|
||||
while not self.home_button.is_element_displayed(2):
|
||||
try:
|
||||
if counter >= 5:
|
||||
return
|
||||
self.back_button.click()
|
||||
except (NoSuchElementException, TimeoutException):
|
||||
counter += 1
|
||||
|
||||
def add_contact(self, public_key):
|
||||
start_new_chat = self.plus_button.click()
|
||||
start_new_chat.start_new_chat_button.click()
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
import time
|
||||
|
||||
from tests import info
|
||||
from views.base_element import BaseText, BaseButton, BaseEditBox
|
||||
from tests.base_test_case import AbstractTestCase
|
||||
from views.base_element import BaseText, BaseButton, BaseEditBox, BaseElement
|
||||
from views.base_view import BaseView
|
||||
|
||||
|
||||
|
@ -74,14 +76,12 @@ class LogoutButton(BaseButton):
|
|||
super(LogoutButton, self).__init__(driver)
|
||||
self.locator = self.Locator.accessibility_id('log-out-button')
|
||||
|
||||
def click(self):
|
||||
self.scroll_to_element()
|
||||
for _ in range(2):
|
||||
self.find_element().click()
|
||||
time.sleep(2)
|
||||
info('Tap on %s' % self.name)
|
||||
from views.sign_in_view import SignInView
|
||||
return SignInView(self.driver)
|
||||
|
||||
class ConfirmLogoutButton(BaseButton):
|
||||
|
||||
def __init__(self, driver):
|
||||
super(ConfirmLogoutButton, self).__init__(driver)
|
||||
self.locator = self.Locator.xpath_selector("//*[@text='LOG OUT']")
|
||||
|
||||
|
||||
class UserNameText(BaseText):
|
||||
|
@ -105,6 +105,19 @@ class EditButton(BaseButton):
|
|||
self.locator = self.Locator.accessibility_id('edit-button')
|
||||
|
||||
|
||||
class ProfilePictureElement(BaseElement):
|
||||
def __init__(self, driver):
|
||||
super(ProfilePictureElement, self).__init__(driver)
|
||||
self.locator = self.Locator.accessibility_id('chat-icon')
|
||||
|
||||
|
||||
class EditPictureButton(BaseButton):
|
||||
|
||||
def __init__(self, driver):
|
||||
super(EditPictureButton, self).__init__(driver)
|
||||
self.locator = self.Locator.accessibility_id('edit-profile-photo-button')
|
||||
|
||||
|
||||
class ConfirmButton(BaseButton):
|
||||
|
||||
def __init__(self, driver):
|
||||
|
@ -131,6 +144,72 @@ class AdvancedButton(BaseButton):
|
|||
return self.navigate()
|
||||
|
||||
|
||||
class BackupSeedPhraseButton(BaseButton):
|
||||
|
||||
def __init__(self, driver):
|
||||
super(BackupSeedPhraseButton, self).__init__(driver)
|
||||
self.locator = self.Locator.xpath_selector("//*[@text='Backup your Seed Phrase']")
|
||||
|
||||
|
||||
class OkContinueButton(BaseButton):
|
||||
|
||||
def __init__(self, driver):
|
||||
super(OkContinueButton, self).__init__(driver)
|
||||
self.locator = self.Locator.xpath_selector("//*[@text='OK, CONTINUE']")
|
||||
|
||||
|
||||
class SeedPhraseTable(BaseText):
|
||||
|
||||
def __init__(self, driver):
|
||||
super(SeedPhraseTable, self).__init__(driver)
|
||||
self.locator = self.Locator.xpath_selector(
|
||||
'//android.widget.FrameLayout/android.view.ViewGroup[3]/android.widget.TextView')
|
||||
|
||||
|
||||
class SeedPhraseWordNumberText(BaseText):
|
||||
|
||||
def __init__(self, driver):
|
||||
super(SeedPhraseWordNumberText, self).__init__(driver)
|
||||
self.locator = self.Locator.xpath_selector("//*[contains(@text,'#')]")
|
||||
|
||||
@property
|
||||
def text(self):
|
||||
time.sleep(1)
|
||||
return self.find_element().text.split('#')[1]
|
||||
|
||||
|
||||
class SeedPhraseWordInput(BaseEditBox):
|
||||
|
||||
def __init__(self, driver):
|
||||
super(SeedPhraseWordInput, self).__init__(driver)
|
||||
self.locator = self.Locator.xpath_selector('//android.widget.EditText')
|
||||
|
||||
|
||||
class OkGotItButton(BaseButton):
|
||||
|
||||
def __init__(self, driver):
|
||||
super(OkGotItButton, self).__init__(driver)
|
||||
self.locator = self.Locator.xpath_selector("//*[@text='OK, GOT IT']")
|
||||
|
||||
|
||||
class DebugModeToggle(BaseButton):
|
||||
|
||||
def __init__(self, driver):
|
||||
super(DebugModeToggle, self).__init__(driver)
|
||||
self.locator = self.Locator.xpath_selector("//android.widget.Switch")
|
||||
|
||||
def click(self):
|
||||
self.scroll_to_element()
|
||||
super(DebugModeToggle, self).click()
|
||||
|
||||
|
||||
class SelectFromGalleryButton(BaseButton):
|
||||
|
||||
def __init__(self, driver):
|
||||
super(SelectFromGalleryButton, self).__init__(driver)
|
||||
self.locator = self.Locator.xpath_selector("//*[@text='Select from gallery']")
|
||||
|
||||
|
||||
class ProfileView(BaseView):
|
||||
|
||||
def __init__(self, driver):
|
||||
|
@ -148,15 +227,28 @@ class ProfileView(BaseView):
|
|||
self.network_settings_button = NetworkSettingsButton(self.driver)
|
||||
self.connect_button = NetworkSettingsButton.ConnectButton(self.driver)
|
||||
self.logout_button = LogoutButton(self.driver)
|
||||
self.confirm_logout_button = ConfirmLogoutButton(self.driver)
|
||||
|
||||
# new design
|
||||
|
||||
self.username_text = UserNameText(self.driver)
|
||||
self.share_my_contact_key_button = ShareMyContactKeyButton(self.driver)
|
||||
self.edit_button = EditButton(self.driver)
|
||||
self.profile_picture = ProfilePictureElement(self.driver)
|
||||
self.edit_picture_button = EditPictureButton(self.driver)
|
||||
self.confirm_button = ConfirmButton(self.driver)
|
||||
self.cross_icon = CrossIcon(self.driver)
|
||||
self.advanced_button = AdvancedButton(self.driver)
|
||||
self.debug_mode_toggle = DebugModeToggle(self.driver)
|
||||
|
||||
# Backup seed phrase
|
||||
self.backup_seed_phrase_button = BackupSeedPhraseButton(self.driver)
|
||||
self.ok_continue_button = OkContinueButton(self.driver)
|
||||
self.seed_phrase_table = SeedPhraseTable(self.driver)
|
||||
self.seed_phrase_word_number = SeedPhraseWordNumberText(self.driver)
|
||||
self.seed_phrase_word_input = SeedPhraseWordInput(self.driver)
|
||||
self.ok_got_it_button = OkGotItButton(self.driver)
|
||||
self.select_from_gallery_button = SelectFromGalleryButton(self.driver)
|
||||
|
||||
def switch_network(self, network):
|
||||
self.network_settings_button.scroll_to_element()
|
||||
|
@ -170,3 +262,20 @@ class ProfileView(BaseView):
|
|||
def get_address(self):
|
||||
profile_view = self.profile_button.click()
|
||||
return profile_view.profile_address_text.text
|
||||
|
||||
def get_seed_phrase(self):
|
||||
text = [i.text for i in self.seed_phrase_table.find_elements()]
|
||||
return dict(zip(text[::2], text[1::2]))
|
||||
|
||||
def edit_profile_picture(self, file_name: str):
|
||||
if AbstractTestCase().environment == 'sauce':
|
||||
self.profile_picture.template = file_name
|
||||
self.edit_button.click()
|
||||
self.edit_picture_button.click()
|
||||
self.select_from_gallery_button.click()
|
||||
if self.allow_button.is_element_displayed(sec=10):
|
||||
self.allow_button.click()
|
||||
self.element_by_text(file_name).click()
|
||||
self.confirm_button.click()
|
||||
else:
|
||||
raise NotImplementedError('Test case is implemented to run on SauceLabs only')
|
||||
|
|
|
@ -1,14 +1,13 @@
|
|||
from tests import get_current_time
|
||||
from views.base_element import BaseButton, BaseEditBox
|
||||
from views.base_view import BaseView
|
||||
import time
|
||||
|
||||
|
||||
class FirstAccountButton(BaseButton):
|
||||
class AccountButton(BaseButton):
|
||||
|
||||
def __init__(self, driver):
|
||||
super(FirstAccountButton, self).__init__(driver)
|
||||
self.locator = self.Locator.xpath_selector("//android.widget.ScrollView//android.widget.TextView")
|
||||
super(AccountButton, self).__init__(driver)
|
||||
self.locator = self.Locator.xpath_selector("//*[contains(@text,'0x')]")
|
||||
|
||||
|
||||
class PasswordInput(BaseEditBox):
|
||||
|
@ -44,7 +43,8 @@ class RecoverAccessButton(BaseButton):
|
|||
class CreateAccountButton(BaseButton):
|
||||
def __init__(self, driver):
|
||||
super(CreateAccountButton, self).__init__(driver)
|
||||
self.locator = self.Locator.xpath_selector("//android.widget.TextView[@text='CREATE ACCOUNT']")
|
||||
self.locator = self.Locator.xpath_selector(
|
||||
"//android.widget.TextView[@text='CREATE ACCOUNT' or @text='CREATE NEW ACCOUNT']")
|
||||
|
||||
|
||||
class IHaveAccountButton(RecoverAccessButton):
|
||||
|
@ -68,7 +68,7 @@ class ConfirmPasswordInput(BaseEditBox):
|
|||
class NameInput(BaseEditBox):
|
||||
def __init__(self, driver):
|
||||
super(NameInput, self).__init__(driver)
|
||||
self.locator = self.Locator.xpath_selector("//android.widget.TextView[@text='Name']")
|
||||
self.locator = self.Locator.xpath_selector("//android.widget.EditText")
|
||||
|
||||
|
||||
class DonNotShare(BaseButton):
|
||||
|
@ -84,7 +84,7 @@ class SignInView(BaseView):
|
|||
super(SignInView, self).__init__(driver)
|
||||
self.driver = driver
|
||||
|
||||
self.first_account_button = FirstAccountButton(self.driver)
|
||||
self.account_button = AccountButton(self.driver)
|
||||
self.password_input = PasswordInput(self.driver)
|
||||
self.sign_in_button = SignInButton(self.driver)
|
||||
self.recover_access_button = RecoverAccessButton(self.driver)
|
||||
|
@ -104,7 +104,7 @@ class SignInView(BaseView):
|
|||
self.confirm_password_input.set_value(password)
|
||||
self.next_button.click()
|
||||
self.name_input.wait_for_element(45)
|
||||
self.name_input.set_value('user_%s' % get_current_time())
|
||||
self.name_input.send_keys('user_%s' % get_current_time())
|
||||
self.next_button.click()
|
||||
self.do_not_share.wait_for_element(10)
|
||||
self.do_not_share.click_until_presence_of_element(self.home_button)
|
||||
|
@ -118,3 +118,6 @@ class SignInView(BaseView):
|
|||
recover_access_view.sign_in_button.click()
|
||||
self.do_not_share.wait_for_element(10)
|
||||
self.do_not_share.click_until_presence_of_element(self.home_button)
|
||||
|
||||
def click_account_by_position(self, position: int):
|
||||
self.account_button.find_elements()[position].click()
|
||||
|
|
|
@ -98,6 +98,18 @@ class DoneButton(BaseButton):
|
|||
self.locator = self.Locator.accessibility_id('done-button')
|
||||
|
||||
|
||||
class QRCodeImage(BaseButton):
|
||||
def __init__(self, driver):
|
||||
super(QRCodeImage, self).__init__(driver)
|
||||
self.locator = self.Locator.accessibility_id('qr-code-image')
|
||||
|
||||
|
||||
class AddressText(BaseButton):
|
||||
def __init__(self, driver):
|
||||
super(AddressText, self).__init__(driver)
|
||||
self.locator = self.Locator.accessibility_id('address-text')
|
||||
|
||||
|
||||
class WalletView(BaseView):
|
||||
def __init__(self, driver):
|
||||
super(WalletView, self).__init__(driver)
|
||||
|
@ -117,6 +129,9 @@ class WalletView(BaseView):
|
|||
self.stt_check_box = STTCheckBox(self.driver)
|
||||
self.done_button = DoneButton(self.driver)
|
||||
|
||||
self.qr_code_image = QRCodeImage(self.driver)
|
||||
self.address_text = AddressText(self.driver)
|
||||
|
||||
def get_usd_total_value(self):
|
||||
return float(self.usd_total_value.text)
|
||||
|
||||
|
|
Loading…
Reference in New Issue