Added DApp public key, transactions filtering, deep link tests

Signed-off-by: yevh-berdnyk <ie.berdnyk@gmail.com>
This commit is contained in:
yevh-berdnyk 2018-07-26 20:58:05 +02:00
parent b9c0bed060
commit 011a7e2218
No known key found for this signature in database
GPG Key ID: E9B425FDFC4DEA9C
11 changed files with 188 additions and 69 deletions

View File

@ -0,0 +1,11 @@
from selenium.common.exceptions import WebDriverException
from tests import info
def start_web_browser(driver):
info('Start web browser')
try:
driver.start_activity('org.chromium.webview_shell', 'WebViewBrowserActivity')
except WebDriverException:
pass

View File

@ -1,13 +1,13 @@
import pytest
from tests import marks, transaction_users, camera_access_error_text
from tests import marks, transaction_users, camera_access_error_text, common_password, transaction_users_wallet
from tests.base_test_case import SingleDeviceTestCase
from views.sign_in_view import SignInView
@marks.all
@marks.account
class TestWallet(SingleDeviceTestCase):
class TestWalletManagement(SingleDeviceTestCase):
@marks.testrail_id(3698)
@marks.smoke_1
@ -46,7 +46,7 @@ class TestWallet(SingleDeviceTestCase):
wallet_view = home_view.wallet_button.click()
wallet_view.set_up_wallet()
transactions_view = wallet_view.transaction_history_button.click()
transaction_details = transactions_view.transactions_table.get_first_transaction().click()
transaction_details = transactions_view.transactions_table.transaction_by_index(0).click()
transaction_hash = transaction_details.get_transaction_hash()
transaction_details.options_button.click()
transaction_details.open_transaction_on_etherscan_button.click()
@ -62,7 +62,7 @@ class TestWallet(SingleDeviceTestCase):
wallet_view = home_view.wallet_button.click()
wallet_view.set_up_wallet()
transactions_view = wallet_view.transaction_history_button.click()
transaction_details = transactions_view.transactions_table.get_first_transaction().click()
transaction_details = transactions_view.transactions_table.transaction_by_index(0).click()
transaction_hash = transaction_details.get_transaction_hash()
transaction_details.options_button.click()
transaction_details.copy_transaction_hash_button.click()
@ -146,3 +146,45 @@ class TestWallet(SingleDeviceTestCase):
send_transaction.chose_recipient_button.click()
send_transaction.scan_qr_code_button.click()
send_transaction.deny_button.wait_for_visibility_of_element(2)
@marks.testrail_id(3730)
def test_filter_transactions_history(self):
user = transaction_users_wallet['C_USER']
sign_in_view = SignInView(self.driver)
sign_in_view.recover_access(passphrase=user['passphrase'], password=user['password'])
wallet_view = sign_in_view.wallet_button.click()
wallet_view.set_up_wallet()
transaction_history = wallet_view.transaction_history_button.click()
transaction_history.filters_button.click()
for filter_name in 'Outgoing', 'Pending', 'Failed':
transaction_history.filter_checkbox(filter_name).click()
wallet_view.done_button.click()
for i in range(transaction_history.transactions_table.get_transactions_number()):
details = transaction_history.transactions_table.transaction_by_index(i).click()
if details.get_recipient_address() != '0x' + user['address'] \
or details.element_by_text('Failed').is_element_displayed():
pytest.fail('Incoming transactions are not filtered')
details.back_button.click()
transaction_history.filters_button.click()
for filter_name in 'Outgoing', 'Incoming':
transaction_history.filter_checkbox(filter_name).click()
wallet_view.done_button.click()
for i in range(transaction_history.transactions_table.get_transactions_number()):
details = transaction_history.transactions_table.transaction_by_index(i).click()
if details.get_sender_address() != '0x' + user['address'] \
or details.element_by_text('Failed').is_element_displayed():
pytest.fail('Outgoing transactions are not filtered')
details.back_button.click()
transaction_history.filters_button.click()
for filter_name in 'Outgoing', 'Failed':
transaction_history.filter_checkbox(filter_name).click()
wallet_view.done_button.click()
for i in range(transaction_history.transactions_table.get_transactions_number()):
details = transaction_history.transactions_table.transaction_by_index(i).click()
if not details.element_by_text('Failed').is_element_displayed():
pytest.fail('Failed transactions are not filtered')
details.back_button.click()
self.verify_no_errors()

View File

@ -21,7 +21,7 @@ class TestBrowsing(SingleDeviceTestCase):
for wiki_text in wiki_texts:
browsing_view.find_text_part(wiki_text, 15)
@marks.testrail_id(1412)
@marks.testrail_id(2174)
def test_open_invalid_link(self):
sign_in = SignInView(self.driver)
home_view = sign_in.create_user()

View File

@ -0,0 +1,38 @@
import pytest
from tests import marks, basic_user
from tests.base_test_case import SingleDeviceTestCase
from views.sign_in_view import SignInView
@pytest.mark.all
class TestDApps(SingleDeviceTestCase):
@marks.testrail_id(3782)
@marks.smoke_1
def test_filters_from_daap(self):
sign_in_view = SignInView(self.driver)
sign_in_view.create_user()
status_test_dapp = sign_in_view.open_status_test_dapp()
status_test_dapp.wait_for_d_aap_to_load()
status_test_dapp.transactions_button.click()
status_test_dapp.test_filters_button.click()
for element in status_test_dapp.element_by_text('eth_uninstallFilter'), status_test_dapp.ok_button:
if element.is_element_displayed(10):
pytest.fail("'Test filters' button produced an error")
@marks.testrail_id(3789)
def test_request_public_key_status_test_daap(self):
user = basic_user
sign_in_view = SignInView(self.driver)
sign_in_view.recover_access(passphrase=user['passphrase'], password=user['password'])
status_test_dapp = sign_in_view.open_status_test_dapp()
status_test_dapp.wait_for_d_aap_to_load()
status_test_dapp.status_api_button.click()
status_test_dapp.request_contact_code_button.click()
status_test_dapp.do_not_allow_button.click()
if status_test_dapp.element_by_text(user['public_key']).is_element_displayed():
pytest.fail('Public key is returned but access was not allowed')
status_test_dapp.request_contact_code_button.click()
status_test_dapp.ok_button.click()
if not status_test_dapp.element_by_text(user['public_key']).is_element_displayed():
pytest.fail('Public key is not returned')

View File

@ -0,0 +1,29 @@
import pytest
from selenium.common.exceptions import NoSuchElementException
from support.device_apps import start_web_browser
from tests import marks
from tests.base_test_case import SingleDeviceTestCase
from views.sign_in_view import SignInView
class TestDeepLinks(SingleDeviceTestCase):
@marks.testrail_id(3781)
def test_open_public_chat_using_deep_link(self):
sign_in_view = SignInView(self.driver)
sign_in_view.create_user()
self.driver.close_app()
start_web_browser(self.driver)
chat_name = sign_in_view.get_public_chat_name()
sign_in_view.send_as_keyevent('https://get.status.im/chat/public/%s' % chat_name)
sign_in_view.confirm()
open_button = sign_in_view.element_by_text('Open in Status')
open_button.wait_for_visibility_of_element()
open_button.click()
sign_in_view.sign_in()
chat_view = sign_in_view.get_chat_view()
try:
assert chat_view.user_name_text.text == '#' + chat_name
except (AssertionError, NoSuchElementException):
pytest.fail("Public chat '%s' is not opened" % chat_name)

View File

@ -55,19 +55,6 @@ class TestTransactionDApp(SingleDeviceTestCase):
if not status_test_dapp.element_by_text(text).is_element_displayed(120):
pytest.fail('Contract was not created')
@marks.testrail_id(3782)
@marks.smoke_1
def test_filters_from_daap(self):
sign_in_view = SignInView(self.driver)
sign_in_view.create_user()
status_test_dapp = sign_in_view.open_status_test_dapp()
status_test_dapp.wait_for_d_aap_to_load()
status_test_dapp.transactions_button.click()
status_test_dapp.test_filters_button.click()
for element in status_test_dapp.element_by_text('eth_uninstallFilter'), status_test_dapp.ok_button:
if element.is_element_displayed(10):
pytest.fail("'Test filters' button produced an error")
@marks.logcat
@marks.testrail_id(3772)
def test_logcat_send_transaction_from_daap(self):

View File

@ -32,11 +32,7 @@ class TestTransactionWalletSingleDevice(SingleDeviceTestCase):
recent_recipient = send_transaction.element_by_text(recipient['username'])
send_transaction.recent_recipients_button.click_until_presence_of_element(recent_recipient)
recent_recipient.click()
send_transaction.sign_transaction_button.click()
send_transaction.enter_password_input.click()
send_transaction.send_as_keyevent(sender['password'])
send_transaction.sign_transaction_button.click()
send_transaction.got_it_button.click()
send_transaction.sign_transaction(sender['password'])
self.network_api.find_transaction_by_unique_amount(sender['address'], transaction_amount)
@marks.testrail_id(767)
@ -57,11 +53,7 @@ class TestTransactionWalletSingleDevice(SingleDeviceTestCase):
send_transaction.enter_recipient_address_button.click()
send_transaction.enter_recipient_address_input.set_value(recipient['address'])
send_transaction.done_button.click()
send_transaction.sign_transaction_button.click()
send_transaction.enter_password_input.click()
send_transaction.send_as_keyevent(sender['password'])
send_transaction.sign_transaction_button.click()
send_transaction.got_it_button.click()
send_transaction.sign_transaction(sender['password'])
self.network_api.find_transaction_by_unique_amount(sender['address'], transaction_amount)
@marks.testrail_id(1430)
@ -88,10 +80,7 @@ class TestTransactionWalletSingleDevice(SingleDeviceTestCase):
send_transaction.enter_recipient_address_button.click()
send_transaction.enter_recipient_address_input.set_value(recipient['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()
send_transaction.sign_transaction(sender['password'])
self.network_api.find_transaction_by_unique_amount(recipient['address'], amount, token=True)
@marks.testrail_id(2164)
@ -140,10 +129,7 @@ class TestTransactionWalletSingleDevice(SingleDeviceTestCase):
send_transaction.enter_recipient_address_button.click()
send_transaction.enter_recipient_address_input.set_value(recipient['address'])
send_transaction.done_button.click()
send_transaction.sign_transaction_button.click()
send_transaction.enter_password_input.send_keys(common_password)
send_transaction.sign_transaction_button.click()
send_transaction.got_it_button.click()
send_transaction.sign_transaction(common_password)
self.network_api.find_transaction_by_unique_amount(recipient['address'], transaction_amount)
transactions_view = wallet_view.transaction_history_button.click()
transactions_view.transactions_table.find_transaction(amount=transaction_amount)
@ -187,11 +173,7 @@ class TestTransactionWalletSingleDevice(SingleDeviceTestCase):
send_transaction.enter_recipient_address_button.click()
send_transaction.enter_recipient_address_input.set_value(recipient['address'])
send_transaction.done_button.click()
send_transaction.sign_transaction_button.click()
send_transaction.enter_password_input.click()
send_transaction.send_as_keyevent(sender['password'])
send_transaction.sign_transaction_button.click()
send_transaction.got_it_button.click()
send_transaction.sign_transaction(sender['password'])
send_transaction.check_no_values_in_logcat(password=sender['password'])
@marks.testrail_id(3746)
@ -222,10 +204,7 @@ class TestTransactionWalletSingleDevice(SingleDeviceTestCase):
send_transaction.enter_recipient_address_button.click()
send_transaction.enter_recipient_address_input.set_value(recipient['address'])
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_until_presence_of_element(send_transaction.got_it_button)
send_transaction.got_it_button.click()
send_transaction.sign_transaction(sender['password'])
self.network_api.find_transaction_by_unique_amount(sender['address'], amount, token=True, decimals=7)
@marks.testrail_id(3747)
@ -283,10 +262,7 @@ class TestTransactionWalletSingleDevice(SingleDeviceTestCase):
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()
send_transaction.sign_transaction(sender['password'])
self.network_api.find_transaction_by_unique_amount(sender['address'], valid_amount)
@marks.testrail_id(3764)

View File

@ -305,7 +305,7 @@ class BaseView(object):
keys = {'0': 7, '1': 8, '2': 9, '3': 10, '4': 11, '5': 12, '6': 13, '7': 14, '8': 15, '9': 16,
',': 55, '-': 69, '+': 81, '.': 56, '/': 76, '\\': 73, ';': 74, ' ': 62,
'[': 71, ']': 72, '=': 70, '\n': 66, '_': [69, 5],
'[': 71, ']': 72, '=': 70, '\n': 66, '_': [69, 5], ':': [74, 5],
'a': 29, 'b': 30, 'c': 31, 'd': 32, 'e': 33, 'f': 34, 'g': 35, 'h': 36, 'i': 37, 'j': 38,
'k': 39, 'l': 40, 'm': 41, 'n': 42, 'o': 43, 'p': 44, 'q': 45, 'r': 46, 's': 47, 't': 48,

View File

@ -51,11 +51,15 @@ class TransactionTable(BaseElement):
def __init__(self, driver):
super(TransactionTable.TransactionElement.TransactionDetailsView, self).__init__(driver)
self.driver = driver
self.locators = dict(transaction_hash="//android.widget.TextView[@text='Hash']/following-sibling::*[1]")
self.locators = dict()
self.options_button = OptionsButton(driver)
self.copy_transaction_hash_button = OptionsButton.CopyTransactionHashButton(driver)
self.open_transaction_on_etherscan_button = OptionsButton.OpenOnEtherscanButton(driver)
self.locators['transaction_hash'] = "//android.widget.TextView[@text='Hash']/following-sibling::*[1]"
self.locators['sender_address'] = "//*[@content-desc='sender-address-text']"
self.locators['recipient_address'] = "//*[@content-desc='recipient-address-text']"
class DetailsTextElement(BaseText):
def __init__(self, driver, locator):
super(TransactionTable.TransactionElement.TransactionDetailsView.DetailsTextElement,
@ -65,16 +69,25 @@ class TransactionTable(BaseElement):
def get_transaction_hash(self) -> str:
return self.DetailsTextElement(driver=self.driver, locator=self.locators['transaction_hash']).text
def get_sender_address(self) -> str:
return self.DetailsTextElement(driver=self.driver, locator=self.locators['sender_address']).text
def get_recipient_address(self) -> str:
return self.DetailsTextElement(driver=self.driver, locator=self.locators['recipient_address']).text
def navigate(self):
return self.TransactionDetailsView(self.driver)
def get_first_transaction(self):
return self.TransactionElement.by_index(self.driver, 0)
def transaction_by_index(self, index: int):
return self.TransactionElement.by_index(self.driver, index=index)
def transaction_by_amount(self, amount: str):
return self.TransactionElement.by_amount(self.driver, amount=amount.replace(',', '.'))
def find_transaction(self, amount: str) -> TransactionElement:
element = self.transaction_by_amount(amount=amount)
for i in range(9):
try:
element = self.TransactionElement.by_amount(self.driver, amount=amount.replace(',', '.'))
element.find_element()
return element
except NoSuchElementException:
@ -85,29 +98,31 @@ class TransactionTable(BaseElement):
def refresh_transactions(self):
self.driver.swipe(500, 500, 500, 1000)
def get_transactions_number(self):
element = self.TransactionElement(self.driver)
element.locator = element.Locator.xpath_selector('//android.view.ViewGroup[@content-desc="transaction-item"]')
return len(element.find_elements())
class HistoryTab(BaseButton):
class FiltersButton(BaseButton):
def __init__(self, driver):
super(HistoryTab, self).__init__(driver)
self.locator = self.Locator.accessibility_id('history-button')
super(FiltersButton, self).__init__(driver)
self.locator = self.Locator.accessibility_id('filters-button')
class UnsignedTab(BaseButton):
def __init__(self, driver):
super(UnsignedTab, self).__init__(driver)
self.locator = self.Locator.accessibility_id('unsigned-transactions-button')
class SignButton(BaseButton):
def __init__(self, driver):
super(UnsignedTab.SignButton, self).__init__(driver)
self.locator = self.Locator.accessibility_id('sign-button')
class FilterCheckbox(BaseButton):
def __init__(self, driver, filter_name):
super(FilterCheckbox, self).__init__(driver)
self.locator = self.Locator.xpath_selector(
"//*[@text='%s']/following-sibling::*[@content-desc='checkbox']" % filter_name)
class TransactionsView(BaseView):
def __init__(self, driver):
super(TransactionsView, self).__init__(driver)
self.driver = driver
self.history_tab = HistoryTab(self.driver)
self.unsigned_tab = UnsignedTab(self.driver)
self.sign_button = UnsignedTab.SignButton(self.driver)
self.filters_button = FiltersButton(self.driver)
self.transactions_table = TransactionTable(self.driver)
def filter_checkbox(self, filter_name):
return FilterCheckbox(self.driver, filter_name)

View File

@ -52,6 +52,23 @@ class TransactionsButton(BaseButton):
self.locator = self.Locator.text_selector('Test filters')
class StatusAPIButton(BaseButton):
def __init__(self, driver):
super(StatusAPIButton, self).__init__(driver)
self.locator = self.Locator.text_selector('Status API')
class RequestContactCodeButton(BaseButton):
def __init__(self, driver):
super(StatusAPIButton.RequestContactCodeButton, self).__init__(driver)
self.locator = self.Locator.text_part_selector('Request contact code')
class DoNotAllowButton(BaseButton):
def __init__(self, driver):
super(StatusAPIButton.DoNotAllowButton, self).__init__(driver)
self.locator = self.Locator.text_selector("DON'T ALLOW")
class StatusTestDAppView(BaseWebView):
def __init__(self, driver):
@ -66,3 +83,7 @@ class StatusTestDAppView(BaseWebView):
self.sign_message_button = TransactionsButton.SignMessageButton(self.driver)
self.deploy_contract_button = TransactionsButton.DeployContractButton(self.driver)
self.test_filters_button = TransactionsButton.TestFiltersButton(self.driver)
self.status_api_button = StatusAPIButton(self.driver)
self.request_contact_code_button = StatusAPIButton.RequestContactCodeButton(self.driver)
self.do_not_allow_button = StatusAPIButton.DoNotAllowButton(self.driver)