Signed-off-by: yevh-berdnyk <ie.berdnyk@gmail.com>
This commit is contained in:
Anton Danchenko 2018-03-28 13:21:39 +03:00 committed by yevh-berdnyk
parent f8e73f8538
commit b2f5146a8a
No known key found for this signature in database
GPG Key ID: E9B425FDFC4DEA9C
15 changed files with 110 additions and 72 deletions

View File

@ -67,17 +67,17 @@ transaction_users['B_USER']['username'] = "Brief Organic Xenops"
transaction_users['B_USER']['address'] = "3d672407a7e1250bbff85b7cfdb456f5015164db" transaction_users['B_USER']['address'] = "3d672407a7e1250bbff85b7cfdb456f5015164db"
transaction_users['B_USER']['public_key'] = "0x0406b17e5cdfadb2a05e84508b1a2916def6395e6295f57e92b85f915d40bca3" \ transaction_users['B_USER']['public_key'] = "0x0406b17e5cdfadb2a05e84508b1a2916def6395e6295f57e92b85f915d40bca3" \
"f4a7e4c6d6b25afa840dd042fac83d3f856181d553f34f1c2b12878e774adde099" "f4a7e4c6d6b25afa840dd042fac83d3f856181d553f34f1c2b12878e774adde099"
transaction_users['С_USER'] = dict() transaction_users['C_USER'] = dict()
transaction_users['С_USER']['password'] = "qwerty" transaction_users['C_USER']['password'] = "qwerty"
transaction_users['С_USER']['passphrase'] = "romance emerge transfer trial enemy average casino decline old bag mandate winner" transaction_users['C_USER']['passphrase'] = "romance emerge transfer trial enemy average casino decline old bag mandate winner"
transaction_users['С_USER']['username'] = "Speedy Occasional Lightningbug" transaction_users['C_USER']['username'] = "Speedy Occasional Lightningbug"
transaction_users['С_USER']['address'] = "853bdd57e881ed09d045ceee53564a00e1da3cf9" transaction_users['C_USER']['address'] = "853bdd57e881ed09d045ceee53564a00e1da3cf9"
transaction_users['С_USER']['public_key'] = "0x04aa3f3977b0c06ce04f4cdfd2ea5baf5560e18aba52324f6d4bf69bbd603b60" \ transaction_users['C_USER']['public_key'] = "0x04aa3f3977b0c06ce04f4cdfd2ea5baf5560e18aba52324f6d4bf69bbd603b60" \
"0e874ed483920d9613882e7345b70b1d95c6ca4ee8b18089da1d064c498355c944" "0e874ed483920d9613882e7345b70b1d95c6ca4ee8b18089da1d064c498355c944"
transaction_users['D_USER'] = dict() transaction_users['D_USER'] = dict()
transaction_users['D_USER']['password'] = "qwerty" transaction_users['D_USER']['password'] = "qwerty"
transaction_users['D_USER']['passphrase'] = "grit half victory alarm code chicken drill worth valve rug clown guess" transaction_users['D_USER']['passphrase'] = "grit half victory alarm code chicken drill worth valve rug clown guess"
transaction_users['D_USER']['username'] = "Frilly Mediumdpringgreen Kingsnake" transaction_users['D_USER']['username'] = "Frilly Mediumspringgreen Kingsnake"
transaction_users['D_USER']['address'] = "1bd914e370a63714ee144692002046c7e6d83348" transaction_users['D_USER']['address'] = "1bd914e370a63714ee144692002046c7e6d83348"
transaction_users['D_USER']['public_key'] = "0x041aa2bbf1cc1253bf658a4a44289cdd0031f0038f8d085b1a43b69550e3467b" \ transaction_users['D_USER']['public_key'] = "0x041aa2bbf1cc1253bf658a4a44289cdd0031f0038f8d085b1a43b69550e3467b" \
"c1f7963c35d0016d9c23d28960b984045c00bd9373b413b1d19aa4370261b8d084" "c1f7963c35d0016d9c23d28960b984045c00bd9373b413b1d19aa4370261b8d084"

View File

@ -57,12 +57,15 @@ class AbstractTestCase:
desired_caps['name'] = test_suite_data.current_test.name desired_caps['name'] = test_suite_data.current_test.name
desired_caps['platformName'] = 'Android' desired_caps['platformName'] = 'Android'
desired_caps['appiumVersion'] = '1.7.2' desired_caps['appiumVersion'] = '1.7.2'
desired_caps['platformVersion'] = '6.0' desired_caps['platformVersion'] = '7.1'
desired_caps['deviceName'] = 'Android GoogleAPI Emulator' desired_caps['deviceName'] = 'Android GoogleAPI Emulator'
desired_caps['deviceOrientation'] = "portrait" desired_caps['deviceOrientation'] = "portrait"
desired_caps['commandTimeout'] = 600 desired_caps['commandTimeout'] = 600
desired_caps['idleTimeout'] = 1000 desired_caps['idleTimeout'] = 1000
desired_caps['unicodeKeyboard'] = True desired_caps['unicodeKeyboard'] = True
desired_caps['automationName'] = 'UiAutomator2'
desired_caps['setWebContentDebuggingEnabled'] = True
desired_caps['ignoreUnimportantViews'] = False
return desired_caps return desired_caps
@property @property
@ -72,10 +75,12 @@ class AbstractTestCase:
desired_caps['deviceName'] = 'nexus_5' desired_caps['deviceName'] = 'nexus_5'
desired_caps['platformName'] = 'Android' desired_caps['platformName'] = 'Android'
desired_caps['appiumVersion'] = '1.7.2' desired_caps['appiumVersion'] = '1.7.2'
desired_caps['platformVersion'] = '6.0' desired_caps['platformVersion'] = '7.1'
desired_caps['newCommandTimeout'] = 600 desired_caps['newCommandTimeout'] = 600
desired_caps['fullReset'] = False desired_caps['fullReset'] = False
desired_caps['unicodeKeyboard'] = True desired_caps['unicodeKeyboard'] = True
desired_caps['automationName'] = 'UiAutomator2'
desired_caps['setWebContentDebuggingEnabled'] = True
return desired_caps return desired_caps
@abstractmethod @abstractmethod

View File

@ -4,7 +4,7 @@ from views.sign_in_view import SignInView
@pytest.mark.all @pytest.mark.all
class TestDappsAnsBrowsing(SingleDeviceTestCase): class TestDAppsAndBrowsing(SingleDeviceTestCase):
@pytest.mark.pr @pytest.mark.pr
def test_browse_link_entering_url_in_dapp_view(self): def test_browse_link_entering_url_in_dapp_view(self):
@ -13,12 +13,12 @@ class TestDappsAnsBrowsing(SingleDeviceTestCase):
home_view = sign_in.get_home_view() home_view = sign_in.get_home_view()
start_new_chat = home_view.plus_button.click() start_new_chat = home_view.plus_button.click()
start_new_chat.open_d_app_button.click() start_new_chat.open_d_app_button.click()
start_new_chat.enter_url_editbox.send_keys('status.im') start_new_chat.enter_url_editbox.set_value('status.im')
start_new_chat.confirm() start_new_chat.confirm()
browsing_view = home_view.get_base_web_view() browsing_view = home_view.get_base_web_view()
browsing_view.wait_for_d_aap_to_load() browsing_view.wait_for_d_aap_to_load()
browsing_view.find_full_text('Status, the Ethereum discovery tool.') browsing_view.find_full_text('Status, the Ethereum discovery tool.')
browsing_view.back_to_home_button.click() browsing_view.back_to_home_button.click()
assert home_view.first_chat_element_title.text == 'Status | The Mobile Ethereum Client' assert home_view.chat_name_text.text in 'Status | The Mobile Ethereum Client'
home_view.swipe_and_delete_chat('Status | The Mobile Ethereum Client') assert home_view.chat_url_text.text in 'https://status.im/'

View File

@ -62,6 +62,7 @@ class TestMessages(MultipleDeviceTestCase):
device_2_chat.send_message_button.click() device_2_chat.send_message_button.click()
device_1_chat.wait_for_message_in_one_to_one_chat('%s %s' % (message_with_emoji, emoji_unicode_1), self.errors) device_1_chat.wait_for_message_in_one_to_one_chat('%s %s' % (message_with_emoji, emoji_unicode_1), self.errors)
device_1_chat.chat_message_input.click()
device_1_chat.send_as_keyevent(message_with_new_line) device_1_chat.send_as_keyevent(message_with_new_line)
device_1_chat.send_message_button.click() device_1_chat.send_message_button.click()
device_2_chat.wait_for_message_in_one_to_one_chat(message_with_new_line, self.errors) device_2_chat.wait_for_message_in_one_to_one_chat(message_with_new_line, self.errors)
@ -73,13 +74,13 @@ class TestMessages(MultipleDeviceTestCase):
if device_1_chat.element_by_text(url_message, 'button').is_element_present(): if device_1_chat.element_by_text(url_message, 'button').is_element_present():
device_1_chat.element_by_text(url_message, 'button').click() device_1_chat.element_by_text(url_message, 'button').click()
web_view = device_1_chat.open_in_browser_button.click() web_view = device_1_chat.open_in_browser_button.click()
web_view.find_full_text('Browse, chat and make payments securely on the decentralized web.') web_view.find_full_text('Status, the Ethereum discovery tool.')
device_1_chat.back_button.click() device_1_chat.back_button.click()
device_1_chat.delete_chat(device_2_username[:25], self.errors) device_1_chat.delete_chat(device_2_username[:25], self.errors)
self.verify_no_errors() self.verify_no_errors()
@pytest.mark.pr @pytest.mark.skip
def test_group_chat_messages_and_delete_chat(self): def test_group_chat_messages_and_delete_chat(self):
self.create_drivers(3) self.create_drivers(3)
@ -168,6 +169,7 @@ class TestMessages(MultipleDeviceTestCase):
for message in messages_to_send_2: for message in messages_to_send_2:
chat_2.chat_message_input.send_keys(message) chat_2.chat_message_input.send_keys(message)
chat_2.send_message_button.click() chat_2.send_message_button.click()
chat_2.chat_message_input.click()
chat_2.send_as_keyevent(message_with_new_line) chat_2.send_as_keyevent(message_with_new_line)
chat_2.send_message_button.click() chat_2.send_message_button.click()
chat_1.wait_for_messages(users[1], messages_to_receive_2, self.errors) chat_1.wait_for_messages(users[1], messages_to_receive_2, self.errors)

View File

@ -41,7 +41,7 @@ class TestSanity(SingleDeviceTestCase):
if basic_user['password'] in str(home_view.logcat): if basic_user['password'] in str(home_view.logcat):
pytest.fail('Password in logcat!!!', pytrace=False) pytest.fail('Password in logcat!!!', pytrace=False)
@pytest.mark.gorup_chat @pytest.mark.group_chat
def test_group_chat_members(self): def test_group_chat_members(self):
sign_in_view = SignInView(self.driver) sign_in_view = SignInView(self.driver)
sign_in_view.create_user() sign_in_view.create_user()

View File

@ -62,7 +62,7 @@ class TestTransaction(SingleDeviceTestCase):
send_transaction_view.sign_transaction_button.click() send_transaction_view.sign_transaction_button.click()
send_transaction_view.find_full_text('Wrong password', 20) send_transaction_view.find_full_text('Wrong password', 20)
@pytest.mark.pr @pytest.mark.skip
def test_transaction_send_command_group_chat(self): def test_transaction_send_command_group_chat(self):
recipient = transaction_users['A_USER'] recipient = transaction_users['A_USER']
sign_in_view = SignInView(self.driver) sign_in_view = SignInView(self.driver)
@ -101,6 +101,7 @@ class TestTransaction(SingleDeviceTestCase):
start_new_chat_view.open_d_app_button.click() start_new_chat_view.open_d_app_button.click()
auction_house = start_new_chat_view.auction_house_button.click() auction_house = start_new_chat_view.auction_house_button.click()
start_new_chat_view.open_button.click() start_new_chat_view.open_button.click()
auction_house.wait_for_d_aap_to_load() auction_house.wait_for_d_aap_to_load()
auction_house.toggle_navigation_button.click() auction_house.toggle_navigation_button.click()
auction_house.new_auction_button.click() auction_house.new_auction_button.click()
@ -108,9 +109,12 @@ class TestTransaction(SingleDeviceTestCase):
auction_name = time.strftime('%Y-%m-%d-%H-%M') auction_name = time.strftime('%Y-%m-%d-%H-%M')
auction_house.send_as_keyevent(auction_name) auction_house.send_as_keyevent(auction_name)
auction_house.register_name_button.click() auction_house.register_name_button.click()
send_transaction_view = home_view.get_send_transaction_view() send_transaction_view = home_view.get_send_transaction_view()
send_transaction_view.sign_transaction(sender['password']) send_transaction_view.sign_transaction(sender['password'])
auction_house.find_full_text('You are the proud owner of the name: ' + auction_name, 120) auction_house.find_full_text('You are the proud owner of the name: ' + auction_name, 120)
api_requests.verify_balance_is_updated(initial_balance, address) api_requests.verify_balance_is_updated(initial_balance, address)
@pytest.mark.pr @pytest.mark.pr
@ -197,7 +201,7 @@ class TestTransaction(SingleDeviceTestCase):
@pytest.mark.all @pytest.mark.all
class TestTransactions(MultipleDeviceTestCase): class TestTransactions(MultipleDeviceTestCase):
@pytest.mark.pr @pytest.mark.skip
def test_send_eth_to_request_in_group_chat(self): def test_send_eth_to_request_in_group_chat(self):
recipient = transaction_users['E_USER'] recipient = transaction_users['E_USER']
sender = transaction_users['F_USER'] sender = transaction_users['F_USER']
@ -246,6 +250,11 @@ class TestTransactions(MultipleDeviceTestCase):
device_2_chat = device_2_home.get_chat_view() device_2_chat = device_2_home.get_chat_view()
amount = device_1_chat.get_unique_amount() amount = device_1_chat.get_unique_amount()
one_to_one_chat_device_2 = device_2_chat.element_by_text_part(recipient['username'][:25], 'button') one_to_one_chat_device_2 = device_2_chat.element_by_text_part(recipient['username'][:25], 'button')
try:
one_to_one_chat_device_2.wait_for_visibility_of_element(120)
except TimeoutException:
device_1_chat.chat_message_input.send_keys('ping')
device_1_chat.send_message_button.click()
one_to_one_chat_device_2.click() one_to_one_chat_device_2.click()
device_1_chat.commands_button.click_until_presence_of_element(device_1_chat.request_command) device_1_chat.commands_button.click_until_presence_of_element(device_1_chat.request_command)
device_1_chat.request_command.click() device_1_chat.request_command.click()
@ -288,6 +297,7 @@ class TestTransactions(MultipleDeviceTestCase):
wallet_view_device_1.send_request_button.click() wallet_view_device_1.send_request_button.click()
device_2_chat = device_2_home.get_chat_view() device_2_chat = device_2_home.get_chat_view()
one_to_one_chat_device_2 = device_2_chat.element_by_text_part(recipient['username'][:25], 'button') one_to_one_chat_device_2 = device_2_chat.element_by_text_part(recipient['username'][:25], 'button')
one_to_one_chat_device_2.wait_for_visibility_of_element(120)
one_to_one_chat_device_2.click() one_to_one_chat_device_2.click()
initial_balance_recipient = api_requests.get_balance(recipient['address']) initial_balance_recipient = api_requests.get_balance(recipient['address'])
request_button = device_2_chat.element_by_text_part('Requesting %s ETH' % amount, 'button') request_button = device_2_chat.element_by_text_part('Requesting %s ETH' % amount, 'button')

View File

@ -139,7 +139,7 @@ class BaseButton(BaseElement):
def click_until_presence_of_element(self, desired_element, attempts=3): def click_until_presence_of_element(self, desired_element, attempts=3):
counter = 0 counter = 0
while not desired_element.is_element_present() and counter <= attempts: while not desired_element.is_element_present(1) and counter <= attempts:
try: try:
info('Tap on %s' % self.name) info('Tap on %s' % self.name)
self.find_element().click() self.find_element().click()

View File

@ -45,13 +45,13 @@ class DenyButton(BaseButton):
class DeleteButton(BaseButton): class DeleteButton(BaseButton):
def __init__(self, driver): def __init__(self, driver):
super(DeleteButton, self).__init__(driver) super(DeleteButton, self).__init__(driver)
self.locator = self.Locator.xpath_selector("//*[@text='Delete']") self.locator = self.Locator.xpath_selector("//*[@text='DELETE']")
class YesButton(BaseButton): class YesButton(BaseButton):
def __init__(self, driver): def __init__(self, driver):
super(YesButton, self).__init__(driver) super(YesButton, self).__init__(driver)
self.locator = self.Locator.xpath_selector("//*[@text='Yes']") self.locator = self.Locator.xpath_selector("//*[@text='YES']")
class NoButton(BaseButton): class NoButton(BaseButton):
@ -69,7 +69,7 @@ class OkButton(BaseButton):
class ContinueButton(BaseButton): class ContinueButton(BaseButton):
def __init__(self, driver): def __init__(self, driver):
super(ContinueButton, self).__init__(driver) super(ContinueButton, self).__init__(driver)
self.locator = self.Locator.xpath_selector("//*[@text='Continue']") self.locator = self.Locator.xpath_selector("//*[@text='CONTINUE']")
class HomeButton(BaseButton): class HomeButton(BaseButton):
@ -128,12 +128,6 @@ class DoneButton(BaseButton):
"//android.widget.TextView[@text='DONE']") "//android.widget.TextView[@text='DONE']")
class DeleteButton(BaseButton):
def __init__(self, driver):
super(DeleteButton, self).__init__(driver)
self.locator = self.Locator.xpath_selector("//android.widget.Button[@text='Delete']")
class AppsButton(BaseButton): class AppsButton(BaseButton):
def __init__(self, driver): def __init__(self, driver):
super(AppsButton, self).__init__(driver) super(AppsButton, self).__init__(driver)
@ -189,10 +183,10 @@ class BaseView(object):
} }
def accept_agreements(self): def accept_agreements(self):
for i in self.ok_button, self.continue_button: for button in self.ok_button, self.continue_button:
try: try:
i.wait_for_element(4) button.wait_for_element(15)
i.click() button.click()
except (NoSuchElementException, TimeoutException): except (NoSuchElementException, TimeoutException):
pass pass
@ -202,7 +196,7 @@ class BaseView(object):
def confirm(self): def confirm(self):
info("Tap 'Confirm' on native keyboard") info("Tap 'Confirm' on native keyboard")
self.driver.keyevent(66) self.driver.press_keycode(66)
def send_as_keyevent(self, string): def send_as_keyevent(self, string):
keys = {'0': 7, '1': 8, '2': 9, '3': 10, '4': 11, '5': 12, '6': 13, '7': 14, '8': 15, '9': 16, keys = {'0': 7, '1': 8, '2': 9, '3': 10, '4': 11, '5': 12, '6': 13, '7': 14, '8': 15, '9': 16,
@ -216,7 +210,7 @@ class BaseView(object):
for i in string: for i in string:
info("Tap '%s' on native keyboard" % i) info("Tap '%s' on native keyboard" % i)
time.sleep(1) time.sleep(1)
self.driver.keyevent(keys[i]) self.driver.press_keycode(keys[i])
def find_full_text(self, text, wait_time=60): def find_full_text(self, text, wait_time=60):
info("Looking for full text: '%s'" % text) info("Looking for full text: '%s'" % text)

View File

@ -14,15 +14,14 @@ class ChatMessageInput(BaseEditBox):
class AddToContacts(BaseButton): class AddToContacts(BaseButton):
def __init__(self, driver): def __init__(self, driver):
super(AddToContacts, self).__init__(driver) super(AddToContacts, self).__init__(driver)
self.locator = self.Locator.xpath_selector("//*[@text='Add to contacts']") self.locator = self.Locator.accessibility_id('add-to-contacts-button')
class UserNameText(BaseText): class UserNameText(BaseText):
def __init__(self, driver): def __init__(self, driver):
super(UserNameText, self).__init__(driver) super(UserNameText, self).__init__(driver)
self.locator = \ self.locator = \
self.Locator.xpath_selector('(//android.view.ViewGroup[@content-desc="toolbar-back-button"]' self.Locator.accessibility_id('chat-name-text')
'//..//android.widget.TextView)[1]')
class TransactionPopupText(BaseText): class TransactionPopupText(BaseText):
@ -34,19 +33,19 @@ class TransactionPopupText(BaseText):
class SendCommand(BaseButton): class SendCommand(BaseButton):
def __init__(self, driver): def __init__(self, driver):
super(SendCommand, self).__init__(driver) super(SendCommand, self).__init__(driver)
self.locator = self.Locator.xpath_selector("//*[@text='/send']") self.locator = self.Locator.accessibility_id('send-payment-button')
class RequestCommand(BaseButton): class RequestCommand(BaseButton):
def __init__(self, driver): def __init__(self, driver):
super(RequestCommand, self).__init__(driver) super(RequestCommand, self).__init__(driver)
self.locator = self.Locator.xpath_selector("//*[@text='/request']") self.locator = self.Locator.accessibility_id('request-payment-button')
class ChatOptions(BaseButton): class ChatMenuButton(BaseButton):
def __init__(self, driver): def __init__(self, driver):
super(ChatOptions, self).__init__(driver) super(ChatMenuButton, self).__init__(driver)
self.locator = self.Locator.xpath_selector('(//android.view.ViewGroup[@content-desc="icon"])[2]') self.locator = self.Locator.accessibility_id('chat-menu-button')
class MembersButton(BaseButton): class MembersButton(BaseButton):
@ -72,8 +71,7 @@ class ChatSettings(BaseButton):
class UserOptions(BaseButton): class UserOptions(BaseButton):
def __init__(self, driver): def __init__(self, driver):
super(UserOptions, self).__init__(driver) super(UserOptions, self).__init__(driver)
self.locator = self.Locator.xpath_selector('//android.widget.ImageView[@content-desc="chat-icon"]' self.locator = self.Locator.accessibility_id('options')
'/../..//android.view.View')
class RemoveButton(BaseButton): class RemoveButton(BaseButton):
@ -85,15 +83,14 @@ class RemoveButton(BaseButton):
class FirstRecipient(BaseButton): class FirstRecipient(BaseButton):
def __init__(self, driver): def __init__(self, driver):
super(FirstRecipient, self).__init__(driver) super(FirstRecipient, self).__init__(driver)
self.locator = self.Locator.xpath_selector("//*[@text='Choose recipient']/.." self.locator = self.Locator.accessibility_id('contact-item')
"//android.widget.ImageView[@content-desc='chat-icon']")
class MessageByUsername(BaseText): class MessageByUsername(BaseText):
def __init__(self, driver, username): def __init__(self, driver, username):
super(MessageByUsername, self).__init__(driver) super(MessageByUsername, self).__init__(driver)
self.locator = self.Locator.xpath_selector('//*[@text="' + username + '"]' self.locator = self.Locator.xpath_selector(
'/following-sibling::android.widget.TextView') '//*[@text="%s"]/following-sibling::android.widget.TextView' % username)
class MoreUsersButton(BaseButton): class MoreUsersButton(BaseButton):
@ -121,8 +118,7 @@ class OpenInBrowserButton(BaseButton):
class CommandsButton(BaseButton): class CommandsButton(BaseButton):
def __init__(self, driver): def __init__(self, driver):
super(CommandsButton, self).__init__(driver) super(CommandsButton, self).__init__(driver)
self.locator = self.Locator.xpath_selector( self.locator = self.Locator.accessibility_id('chat-commands-button')
'//*[@content-desc="chat-message-input"]/..//android.view.ViewGroup[@content-desc="icon"]')
class ViewProfileButton(BaseButton): class ViewProfileButton(BaseButton):
@ -143,7 +139,7 @@ class ChatView(BaseView):
self.send_command = SendCommand(self.driver) self.send_command = SendCommand(self.driver)
self.request_command = RequestCommand(self.driver) self.request_command = RequestCommand(self.driver)
self.chat_options = ChatOptions(self.driver) self.chat_options = ChatMenuButton(self.driver)
self.members_button = MembersButton(self.driver) self.members_button = MembersButton(self.driver)
self.delete_chat_button = DeleteChatButton(self.driver) self.delete_chat_button = DeleteChatButton(self.driver)

View File

@ -8,7 +8,7 @@ from views.base_view import BaseView
class PlusButton(BaseButton): class PlusButton(BaseButton):
def __init__(self, driver): def __init__(self, driver):
super(PlusButton, self).__init__(driver) super(PlusButton, self).__init__(driver)
self.locator = self.Locator.xpath_selector("//*[@text='+']") self.locator = self.Locator.accessibility_id("new-chat-button")
def navigate(self): def navigate(self):
from views.start_new_chat_view import StartNewChatView from views.start_new_chat_view import StartNewChatView
@ -39,6 +39,7 @@ class ChatElement(BaseButton):
@property @property
def swipe_delete_button(self): def swipe_delete_button(self):
class DeleteButton(BaseButton): class DeleteButton(BaseButton):
def __init__(self, driver, parent_locator: str): def __init__(self, driver, parent_locator: str):
super(DeleteButton, self).__init__(driver) super(DeleteButton, self).__init__(driver)
@ -48,10 +49,16 @@ class ChatElement(BaseButton):
return DeleteButton(self.driver, self.locator.value) return DeleteButton(self.driver, self.locator.value)
class FirstChatElementTitle(BaseText): class ChatNameText(BaseText):
def __init__(self, driver): def __init__(self, driver):
super(FirstChatElementTitle, self).__init__(driver) super(ChatNameText, self).__init__(driver)
self.locator = self.Locator.xpath_selector('(//android.widget.ScrollView//android.widget.TextView)[1]') self.locator = self.Locator.accessibility_id('chat-name-text')
class ChatUrlText(BaseText):
def __init__(self, driver):
super(ChatUrlText, self).__init__(driver)
self.locator = self.Locator.accessibility_id('chat-url-text')
class HomeView(BaseView): class HomeView(BaseView):
@ -60,7 +67,8 @@ class HomeView(BaseView):
self.plus_button = PlusButton(self.driver) self.plus_button = PlusButton(self.driver)
self.console_button = ConsoleButton(self.driver) self.console_button = ConsoleButton(self.driver)
self.first_chat_element_title = FirstChatElementTitle(self.driver) self.chat_name_text = ChatNameText(self.driver)
self.chat_url_text = ChatUrlText(self.driver)
def wait_for_syncing_complete(self): def wait_for_syncing_complete(self):
info('Waiting for syncing complete:') info('Waiting for syncing complete:')
@ -123,5 +131,11 @@ class HomeView(BaseView):
x, y = location['x'], location['y'] x, y = location['x'], location['y']
size = chat_element.find_element().size size = chat_element.find_element().size
width, height = size['width'], size['height'] width, height = size['width'], size['height']
counter = 0
while counter < 10:
self.driver.swipe(start_x=x + width / 2, start_y=y + height / 2, end_x=x, end_y=y + height / 2) self.driver.swipe(start_x=x + width / 2, start_y=y + height / 2, end_x=x, end_y=y + height / 2)
if chat_element.swipe_delete_button.is_element_present():
break
time.sleep(10)
counter += 1
chat_element.swipe_delete_button.click() chat_element.swipe_delete_button.click()

View File

@ -41,7 +41,7 @@ class OptionsButton(BaseButton):
def __init__(self, driver): def __init__(self, driver):
super(OptionsButton.UsernameInput, self).__init__(driver) super(OptionsButton.UsernameInput, self).__init__(driver)
self.locator = self.Locator.xpath_selector('//android.widget.EditText') self.locator = self.Locator.accessibility_id('username-input')
class UserStatusInput(BaseEditBox): class UserStatusInput(BaseEditBox):
@ -72,7 +72,7 @@ class LogoutButton(BaseButton):
def __init__(self, driver): def __init__(self, driver):
super(LogoutButton, self).__init__(driver) super(LogoutButton, self).__init__(driver)
self.locator = self.Locator.xpath_selector('//*[@text="Log out"]') self.locator = self.Locator.accessibility_id('log-out-button')
def click(self): def click(self):
self.scroll_to_element() self.scroll_to_element()

View File

@ -1,6 +1,7 @@
from tests import get_current_time from tests import get_current_time
from views.base_element import BaseButton, BaseEditBox from views.base_element import BaseButton, BaseEditBox
from views.base_view import BaseView from views.base_view import BaseView
import time
class FirstAccountButton(BaseButton): class FirstAccountButton(BaseButton):
@ -70,6 +71,13 @@ class NameInput(BaseEditBox):
self.locator = self.Locator.xpath_selector("//android.widget.TextView[@text='Name']") self.locator = self.Locator.xpath_selector("//android.widget.TextView[@text='Name']")
class DonNotShare(BaseButton):
def __init__(self, driver):
super(DonNotShare, self).__init__(driver)
self.locator = self.Locator.xpath_selector('//*[@text="NO, I DON%sT WANT TO SHARE"]' % "'")
class SignInView(BaseView): class SignInView(BaseView):
def __init__(self, driver): def __init__(self, driver):
@ -87,8 +95,10 @@ class SignInView(BaseView):
self.add_existing_account_button = AddExistingAccountButton(self.driver) self.add_existing_account_button = AddExistingAccountButton(self.driver)
self.confirm_password_input = ConfirmPasswordInput(self.driver) self.confirm_password_input = ConfirmPasswordInput(self.driver)
self.name_input = NameInput(self.driver) self.name_input = NameInput(self.driver)
self.do_not_share = DonNotShare(self.driver)
def create_user(self): def create_user(self):
time.sleep(30) # wait for "Shake to provide your feedback" popup to disappear, it's not possible to interact with the element
self.create_account_button.click() self.create_account_button.click()
self.password_input.set_value('qwerty1234') self.password_input.set_value('qwerty1234')
self.next_button.click() self.next_button.click()
@ -97,11 +107,15 @@ class SignInView(BaseView):
self.name_input.wait_for_element(45) self.name_input.wait_for_element(45)
self.name_input.set_value('user_%s' % get_current_time()) self.name_input.set_value('user_%s' % get_current_time())
self.next_button.click() self.next_button.click()
self.element_by_text("NO, I DON'T WANT TO SHARE").click() self.do_not_share.wait_for_element(10)
self.do_not_share.click_until_presence_of_element(self.home_button)
def recover_access(self, passphrase, password): def recover_access(self, passphrase, password):
time.sleep(30) # wait for "Shake to provide your feedback" popup to disappear, it's not possible to interact with the element
recover_access_view = self.i_have_account_button.click() recover_access_view = self.i_have_account_button.click()
recover_access_view.passphrase_input.set_value(passphrase) recover_access_view.passphrase_input.set_value(passphrase)
recover_access_view.password_input.click() recover_access_view.password_input.click()
recover_access_view.password_input.set_value(password) recover_access_view.password_input.set_value(password)
recover_access_view.sign_in_button.click() 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)

View File

@ -28,9 +28,9 @@ class ChatNameEditBox(BaseEditBox):
self.locator = self.Locator.accessibility_id('chat-name-input') self.locator = self.Locator.accessibility_id('chat-name-input')
class OpenDAapButton(BaseButton): class OpenDAppButton(BaseButton):
def __init__(self, driver): def __init__(self, driver):
super(OpenDAapButton, self).__init__(driver) super(OpenDAppButton, self).__init__(driver)
self.locator = self.Locator.accessibility_id('open-dapp-button') self.locator = self.Locator.accessibility_id('open-dapp-button')
@ -66,7 +66,7 @@ class StartNewChatView(ContactsView):
self.new_group_chat_button = NewGroupChatButton(self.driver) self.new_group_chat_button = NewGroupChatButton(self.driver)
self.join_public_chat_button = JoinPublicChatButton(self.driver) self.join_public_chat_button = JoinPublicChatButton(self.driver)
self.open_d_app_button = OpenDAapButton(self.driver) self.open_d_app_button = OpenDAppButton(self.driver)
self.open_button = OpenButton(self.driver) self.open_button = OpenButton(self.driver)
self.chat_name_editbox = ChatNameEditBox(self.driver) self.chat_name_editbox = ChatNameEditBox(self.driver)

View File

@ -5,12 +5,12 @@ class ToggleNavigationButton(BaseButton):
def __init__(self, driver): def __init__(self, driver):
super(ToggleNavigationButton, self).__init__(driver) super(ToggleNavigationButton, self).__init__(driver)
self.locator = self.Locator.accessibility_id('Toggle navigation ') self.locator = self.Locator.xpath_selector("//*[@text='Toggle navigation ']")
class NewAuctionButton(BaseButton): class NewAuctionButton(BaseButton):
def __init__(self, driver): def __init__(self, driver):
super(ToggleNavigationButton.NewAuctionButton, self).__init__(driver) super(ToggleNavigationButton.NewAuctionButton, self).__init__(driver)
self.locator = self.Locator.accessibility_id('New Auction') self.locator = self.Locator.xpath_selector("//*[@text='New Auction']")
class ReserveAssetName(BaseElement): class ReserveAssetName(BaseElement):
@ -20,13 +20,20 @@ class ReserveAssetName(BaseElement):
def __init__(self, driver): def __init__(self, driver):
super(ReserveAssetName.NameToReserveInput, self).__init__(driver) super(ReserveAssetName.NameToReserveInput, self).__init__(driver)
self.locator = self.Locator.xpath_selector( self.locator = self.Locator.xpath_selector(
'(//android.widget.EditText[@content-desc="eg MyFamousWallet.eth"])[1]') '(//*[@text="Name To Reserve:"])[2]')
class RegisterNameButton(BaseButton): class RegisterNameButton(BaseButton):
def __init__(self, driver): def __init__(self, driver):
super(ReserveAssetName.RegisterNameButton, self).__init__(driver) super(ReserveAssetName.RegisterNameButton, self).__init__(driver)
self.locator = self.Locator.accessibility_id('Register Name') self.locator = self.Locator.xpath_selector('//*[@text="Register Name"]')
class AssetContract(BaseElement):
def __init__(self, driver):
super(AssetContract, self).__init__(driver)
self.locator = self.Locator.xpath_selector('//*[@text="Asset contract"]')
class AuctionHouseWebView(BaseWebView): class AuctionHouseWebView(BaseWebView):
@ -40,3 +47,4 @@ class AuctionHouseWebView(BaseWebView):
self.name_to_reserve_input = ReserveAssetName.NameToReserveInput(self.driver) self.name_to_reserve_input = ReserveAssetName.NameToReserveInput(self.driver)
self.register_name_button = ReserveAssetName.RegisterNameButton(self.driver) self.register_name_button = ReserveAssetName.RegisterNameButton(self.driver)
self.asset_contract = AssetContract(self.driver)

View File

@ -40,8 +40,3 @@ class BaseWebView(BaseView):
counter += 1 counter += 1
if counter > wait_time: if counter > wait_time:
pytest.fail("Page is not loaded during %s seconds" % wait_time) pytest.fail("Page is not loaded during %s seconds" % wait_time)
def find_full_text(self, text, wait_time=60):
element = BaseElement(self.driver)
element.locator = element.Locator.xpath_selector('//*[@content-desc="' + text + '"]')
return element.wait_for_element(wait_time)