diff --git a/test/appium/tests/atomic/account_management/test_wallet_management.py b/test/appium/tests/atomic/account_management/test_wallet_management.py index b47c70d50a..1702195d7b 100644 --- a/test/appium/tests/atomic/account_management/test_wallet_management.py +++ b/test/appium/tests/atomic/account_management/test_wallet_management.py @@ -1,8 +1,6 @@ import pytest -import random -import string -from tests import marks, camera_access_error_text, common_password +from tests import marks, camera_access_error_text from tests.base_test_case import SingleDeviceTestCase from tests.users import wallet_users, transaction_senders, basic_user from views.sign_in_view import SignInView @@ -258,33 +256,3 @@ class TestWalletManagement(SingleDeviceTestCase): if not token_element.is_element_displayed(): self.errors.append('Custom token is not shown on Send Transaction view') self.verify_no_errors() - - @marks.testrail_id(6224) - @marks.critical - def test_add_account_to_multiaccount_instance(self): - sign_in_view = SignInView(self.driver) - sign_in_view.create_user() - wallet_view = sign_in_view.wallet_button.click() - wallet_view.set_up_wallet() - wallet_view.add_account_button.click() - wallet_view.add_an_account_button.click() - wallet_view.generate_new_account_button.click() - wallet_view.generate_account_button.click() - if wallet_view.element_by_text('Account added').is_element_displayed(): - self.driver.fail('Account is added without password') - wallet_view.enter_your_password_input.send_keys('000000') - wallet_view.generate_account_button.click() - if not wallet_view.element_by_text_part('Password seems to be incorrect').is_element_displayed(): - self.driver.fail("Incorrect password validation is not performed") - wallet_view.enter_your_password_input.clear() - wallet_view.enter_your_password_input.send_keys(common_password) - wallet_view.generate_account_button.click() - account_name = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(10)) - wallet_view.account_name_input.send_keys(account_name) - wallet_view.account_color_button.select_color_by_position(1) - wallet_view.finish_button.click() - account_button = wallet_view.get_account_by_name(account_name) - if not account_button.is_element_displayed(): - self.driver.fail('Account was not added') - if not account_button.color_matches('multi_account_color.png'): - self.driver.fail('Account color does not match expected') diff --git a/test/appium/tests/atomic/chats/test_public.py b/test/appium/tests/atomic/chats/test_public.py index a2f704a17a..e7b7552bf6 100644 --- a/test/appium/tests/atomic/chats/test_public.py +++ b/test/appium/tests/atomic/chats/test_public.py @@ -2,7 +2,6 @@ import time import emoji import random -from dateutil import parser from selenium.common.exceptions import TimeoutException from support.utilities import generate_timestamp from tests import marks @@ -224,9 +223,8 @@ class TestPublicChatSingleDevice(SingleDeviceTestCase): @marks.high def test_fetch_more_history_in_empty_chat(self): signin = SignInView(self.driver) - device_time = parser.parse(signin.driver.device_time) - yesterday = (device_time - timedelta(days=1)).strftime("%b %-d, %Y") - before_yesterday = (device_time - timedelta(days=2)).strftime("%b %-d, %Y") + yesterday = (datetime.today() - timedelta(days=1)).strftime("%b %-d, %Y") + before_yesterday = (datetime.today() - timedelta(days=2)).strftime("%b %-d, %Y") quiet_time_yesterday, quiet_time_before_yesterday = '24 hours', '2 days' home_view = signin.create_user() chat = home_view.join_public_chat('montagne-angerufen-two') diff --git a/test/appium/tests/atomic/transactions/test_wallet.py b/test/appium/tests/atomic/transactions/test_wallet.py index 5c89a01c80..faec2cb3b0 100644 --- a/test/appium/tests/atomic/transactions/test_wallet.py +++ b/test/appium/tests/atomic/transactions/test_wallet.py @@ -410,73 +410,16 @@ class TestTransactionWalletSingleDevice(SingleDeviceTestCase): self.verify_no_errors() - @marks.testrail_id(5429) - @marks.medium - def test_set_currency(self): - sign_in_view = SignInView(self.driver) - user_currency = 'Euro (EUR)' - sign_in_view.create_user() - wallet_view = sign_in_view.wallet_button.click() - wallet_view.set_currency(user_currency) - if not wallet_view.find_text_part('EUR'): - self.driver.fail('EUR currency is not displayed') - - @marks.testrail_id(6225) - @marks.high - def test_send_funds_between_accounts_in_multiaccount_instance(self): - sign_in_view = SignInView(self.driver) - sign_in_view.create_user() - wallet_view = sign_in_view.wallet_button.click() - wallet_view.set_up_wallet() - address = wallet_view.get_wallet_address()[2:] - wallet_view.back_button.click() - self.network_api.get_donate(address) - - account_name = 'test account' - wallet_view.add_account(account_name) - wallet_view.accounts_status_account.click() - send_transaction = wallet_view.send_transaction_button.click() - send_transaction.amount_edit_box.click() - transaction_amount = send_transaction.get_unique_amount() - send_transaction.amount_edit_box.set_value(transaction_amount) - send_transaction.confirm() - send_transaction.chose_recipient_button.click() - send_transaction.accounts_button.click() - send_transaction.element_by_text(account_name).click() - send_transaction.sign_transaction_button.click() - send_transaction.sign_transaction() - self.network_api.wait_for_confirmation_of_transaction(address, transaction_amount) - self.network_api.verify_balance_is_updated('0.1', address) - wallet_view.back_button.click() - wallet_view.get_account_by_name(account_name).click() - wallet_view.send_transaction_button.click() - wallet_view.back_button.click() - balance_after_receiving_tx = wallet_view.eth_asset_value.text - if balance_after_receiving_tx != transaction_amount: - self.driver.fail('New account balance %s does not match expected %s after receiving a transaction' % ( - balance_after_receiving_tx, transaction_amount)) - updated_balance = self.network_api.get_balance(address) - - wallet_view.send_transaction_button.click() - send_transaction.amount_edit_box.click() - transaction_amount_1 = float(transaction_amount) * 0.7 - send_transaction.amount_edit_box.set_value(str(transaction_amount_1)) - send_transaction.confirm() - send_transaction.chose_recipient_button.click() - send_transaction.accounts_button.click() - send_transaction.element_by_text('Status account').click() - send_transaction.sign_transaction_button.click() - total_fee = send_transaction.get_transaction_fee_total() - send_transaction.sign_transaction() - if not wallet_view.element_by_text('Transaction sent').is_element_displayed(): - self.driver.fail('Transaction was not sent from the new account') - self.network_api.wait_for_confirmation_of_transaction(address, transaction_amount) - self.network_api.verify_balance_is_updated(updated_balance, address) - balance_after_sending_tx = wallet_view.eth_asset_value.text - expected_balance = str(float(balance_after_receiving_tx) - transaction_amount_1 - float(total_fee)) - if balance_after_sending_tx != expected_balance: - self.driver.fail('New account balance %s does not match expected %s after sending a transaction' % ( - balance_after_sending_tx, transaction_amount)) + @marks.testrail_id(5429) + @marks.medium + def test_set_currency(self): + sign_in_view = SignInView(self.driver) + user_currency = 'Euro (EUR)' + sign_in_view.create_user() + wallet_view = sign_in_view.wallet_button.click() + wallet_view.set_currency(user_currency) + if not wallet_view.find_text_part('EUR'): + pytest.fail('EUR currency is not displayed') @marks.transaction @@ -518,3 +461,4 @@ class TestTransactionWalletMultipleDevice(MultipleDeviceTestCase): if not chat_2.chat_element_by_text(amount).is_element_displayed(): self.errors.append('Transaction message is not shown in 1-1 chat for the recipient') self.verify_no_errors() + diff --git a/test/appium/views/elements_templates/multi_account_color.png b/test/appium/views/elements_templates/multi_account_color.png deleted file mode 100644 index ae7e7c9d50..0000000000 Binary files a/test/appium/views/elements_templates/multi_account_color.png and /dev/null differ diff --git a/test/appium/views/send_transaction_view.py b/test/appium/views/send_transaction_view.py index 3a6a827786..1ced192b02 100644 --- a/test/appium/views/send_transaction_view.py +++ b/test/appium/views/send_transaction_view.py @@ -60,12 +60,6 @@ class ChooseRecipientButton(BaseButton): self.locator = self.Locator.accessibility_id('choose-recipient-button') -class AccountsButton(BaseButton): - def __init__(self, driver): - super(AccountsButton, self).__init__(driver) - self.locator = self.Locator.text_selector('Accounts') - - class EnterRecipientAddressButton(BaseButton): def __init__(self, driver): super(EnterRecipientAddressButton, self).__init__(driver) @@ -196,7 +190,6 @@ class SendTransactionView(BaseView): super(SendTransactionView, self).__init__(driver) self.chose_recipient_button = ChooseRecipientButton(self.driver) - self.accounts_button = AccountsButton(self.driver) self.enter_recipient_address_button = EnterRecipientAddressButton(self.driver) self.scan_qr_code_button = ScanQRCodeButton(self.driver) self.enter_recipient_address_input = EnterRecipientAddressInput(self.driver) diff --git a/test/appium/views/wallet_view.py b/test/appium/views/wallet_view.py index d0d85862b6..b28df47ae3 100644 --- a/test/appium/views/wallet_view.py +++ b/test/appium/views/wallet_view.py @@ -1,8 +1,7 @@ import time - -from tests import common_password -from views.base_element import BaseButton, BaseText, BaseEditBox from views.base_view import BaseView +from views.base_element import BaseButton, BaseText +from selenium.common.exceptions import NoSuchElementException class SendRequestButton(BaseButton): @@ -193,16 +192,10 @@ class MultiaccountMoreOptions(BaseButton): self.locator = self.Locator.accessibility_id('accounts-more-options') -class AccountElementButton(BaseButton): - def __init__(self, driver, account_name): - super(AccountElementButton, self).__init__(driver) - self.locator = self.Locator.xpath_selector( - f"//android.widget.HorizontalScrollView//*[@text='{account_name}']/..") - - def color_matches(self, expected_color_image_name: str): - amount_text = BaseText(self.driver) - amount_text.locator = amount_text.Locator.xpath_selector(self.locator.value + "//*[@text='0 USD']") - return amount_text.is_element_image_equals_template(expected_color_image_name) +class AccountsStatusAccount(BaseButton): + def __init__(self, driver): + super(AccountsStatusAccount, self).__init__(driver) + self.locator = self.Locator.xpath_selector("//android.widget.HorizontalScrollView//*[@text='Status account']") class SendTransactionButton(BaseButton): @@ -237,62 +230,6 @@ class AddCustomTokenButton(BaseButton): return AddCustomTokenView(self.driver) -class AddAccountButton(BaseButton): - def __init__(self, driver): - super(AddAccountButton, self).__init__(driver) - self.locator = self.Locator.text_selector('Add account') - - -class AddAnAccountButton(BaseButton): - def __init__(self, driver): - super(AddAnAccountButton, self).__init__(driver) - self.locator = self.Locator.text_selector('Add an account') - - -class GenerateNewAccountButton(BaseButton): - def __init__(self, driver): - super(GenerateNewAccountButton, self).__init__(driver) - self.locator = self.Locator.text_selector('Generate a new account') - - -class EnterYourPasswordInput(BaseEditBox): - def __init__(self, driver): - super(EnterYourPasswordInput, self).__init__(driver) - self.locator = self.Locator.xpath_selector( - "//android.widget.TextView[@text='Enter your password']/following-sibling::android.widget.EditText") - - -class GenerateAccountButton(BaseButton): - def __init__(self, driver): - super(GenerateAccountButton, self).__init__(driver) - self.locator = self.Locator.text_selector('Generate account') - - -class AccountNameInput(BaseEditBox): - def __init__(self, driver): - super(AccountNameInput, self).__init__(driver) - self.locator = self.Locator.xpath_selector("//android.widget.TextView[@text='Account name']" - "/following-sibling::android.view.ViewGroup/android.widget.EditText") - - -class AccountColorButton(BaseButton): - def __init__(self, driver): - super(AccountColorButton, self).__init__(driver) - self.locator = self.Locator.xpath_selector("//android.widget.TextView[@text='Account color']" - "/following-sibling::android.view.ViewGroup") - - def select_color_by_position(self, position: int): - self.click() - self.driver.find_element_by_xpath( - f"//*[@text='Cancel']/../preceding-sibling::android.widget.ScrollView/*/*[{position}]").click() - - -class FinishButton(BaseButton): - def __init__(self, driver): - super(FinishButton, self).__init__(driver) - self.locator = self.Locator.text_selector('Finish') - - class WalletView(BaseView): def __init__(self, driver): super(WalletView, self).__init__(driver) @@ -328,17 +265,9 @@ class WalletView(BaseView): # elements for multiaccount self.multiaccount_more_options = MultiaccountMoreOptions(self.driver) - self.accounts_status_account = AccountElementButton(self.driver, 'Status account') + self.accounts_status_account = AccountsStatusAccount(self.driver) self.collectibles_button = CollectiblesButton(self.driver) self.set_currency_button = SetCurrencyButton(self.driver) - self.add_account_button = AddAccountButton(self.driver) - self.add_an_account_button = AddAnAccountButton(self.driver) - self.generate_new_account_button = GenerateNewAccountButton(self.driver) - self.enter_your_password_input = EnterYourPasswordInput(self.driver) - self.generate_account_button = GenerateAccountButton(self.driver) - self.account_name_input = AccountNameInput(self.driver) - self.account_color_button = AccountColorButton(self.driver) - self.finish_button = FinishButton(self.driver) def get_usd_total_value(self): import re @@ -473,16 +402,3 @@ class WalletView(BaseView): desired_currency = self.element_by_text_part(desired_currency) desired_currency.scroll_to_element() desired_currency.click() - - def get_account_by_name(self, account_name: str): - return AccountElementButton(self.driver, account_name) - - def add_account(self, account_name: str, password: str = common_password): - self.add_account_button.click() - self.add_an_account_button.click() - self.generate_new_account_button.click() - self.generate_account_button.click() - self.enter_your_password_input.send_keys(password) - self.generate_account_button.click() - self.account_name_input.send_keys(account_name) - self.finish_button.click()