tests: rework e2e tests according to product changes (#15990)

* tests: rework e2e tests according to product changes
This commit is contained in:
Anton Danchenko 2024-08-06 11:43:08 +02:00 committed by GitHub
parent 2352a96b7e
commit a0d540c558
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 55 additions and 69 deletions

View File

@ -14,33 +14,48 @@ from gui.main_window import MainWindow
pytestmark = marks pytestmark = marks
def _verify_account_order(account_order, main_screen, default_name, order):
with step('Verify the account order'):
with step('Account order is correct in wallet settings'):
assert driver.waitFor(lambda: account_order.accounts[0].name == order[0],
configs.timeouts.UI_LOAD_TIMEOUT_MSEC)
assert driver.waitFor(lambda: account_order.accounts[1].name == order[1],
configs.timeouts.UI_LOAD_TIMEOUT_MSEC)
assert driver.waitFor(lambda: account_order.accounts[2].name == order[2],
configs.timeouts.UI_LOAD_TIMEOUT_MSEC)
with step('Account order is correct in wallet'):
wallet = main_screen.left_panel.open_wallet()
wallet.left_panel.select_account(default_name)
assert driver.waitFor(lambda: wallet.left_panel.accounts[0].name == order[0],
configs.timeouts.UI_LOAD_TIMEOUT_MSEC)
assert driver.waitFor(lambda: wallet.left_panel.accounts[1].name == order[1],
configs.timeouts.UI_LOAD_TIMEOUT_MSEC)
assert driver.waitFor(lambda: wallet.left_panel.accounts[2].name == order[2],
configs.timeouts.UI_LOAD_TIMEOUT_MSEC)
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703415', @allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703415',
'Account order: account order could be changed with drag&drop') 'Account order: account order could be changed with drag&drop')
@pytest.mark.case(703415) @pytest.mark.case(703415)
@pytest.mark.parametrize( @pytest.mark.takoe2
'address, default_name, name, color, emoji, acc_emoji, second_name, second_color, second_emoji, second_acc_emoji', def test_change_account_order_by_drag_and_drop(main_screen: MainWindow, user_account):
[
pytest.param('0xea123F7beFF45E3C9fdF54B324c29DBdA14a639A', 'Account 1',
'WatchOnly', '#2a4af5', 'sunglasses', '😎 ', 'Generated', '#216266', 'thumbsup', '👍 ') default_name = 'Account 1'
]) name_1, color_1, emoji_1, acc_emoji_1 = 'WatchOnly', '#ffffff', 'sunglasses', '😎 '
def test_change_account_order_by_drag_and_drop(main_screen: MainWindow, user_account, address: str, default_name, name_2, color_2, emoji_2, acc_emoji_2 = 'Generated', '#cc6438', 'thumbsup', '👍 '
name: str, color: str, emoji: str, acc_emoji: str, second_name: str,
second_color: str, second_emoji: str, second_acc_emoji: str):
with step('Create watch-only wallet account'):
wallet = main_screen.left_panel.open_wallet() wallet = main_screen.left_panel.open_wallet()
SigningPhrasePopup().wait_until_appears().confirm_phrase() SigningPhrasePopup().wait_until_appears().confirm_phrase()
account_popup = wallet.left_panel.open_add_account_popup()
account_popup.set_name(name).set_emoji(emoji).set_color(color).set_origin_watched_address(address) for account in (
assert account_popup.get_emoji_from_account_title() == EmojiCodes.SMILING_FACE_WITH_SUNGLASSES.value, \ (name_1, color_1, emoji_1, acc_emoji_1),
f'Emoji was not set or does not match' (name_2, color_2, emoji_2, acc_emoji_2)
account_popup.save_changes() ):
account_popup.wait_until_hidden()
with step('Create generated wallet account'): with step('Create generated wallet account'):
account_popup = wallet.left_panel.open_add_account_popup() account_popup = wallet.left_panel.open_add_account_popup()
account_popup.set_name(second_name).set_emoji(second_emoji).set_color(second_color) account_popup.set_name(account[0]).set_emoji(account[2]).set_color(account[1])
assert account_popup.get_emoji_from_account_title() == EmojiCodes.THUMBSUP_SIGN.value, \
f'Emoji was not set or does not match'
account_popup.save_changes() account_popup.save_changes()
AuthenticatePopup().wait_until_appears().authenticate(user_account.password) AuthenticatePopup().wait_until_appears().authenticate(user_account.password)
account_popup.wait_until_hidden() account_popup.wait_until_hidden()
@ -49,58 +64,28 @@ def test_change_account_order_by_drag_and_drop(main_screen: MainWindow, user_acc
account_order = main_screen.left_panel.open_settings().left_panel.open_wallet_settings().open_account_order() account_order = main_screen.left_panel.open_settings().left_panel.open_wallet_settings().open_account_order()
with step('Account order is correct'): with step('Account order is correct'):
assert account_order.accounts[0].name == default_name assert account_order.accounts[0].name == default_name
assert account_order.accounts[1].name == name assert account_order.accounts[1].name == name_1
assert account_order.accounts[2].name == second_name assert account_order.accounts[2].name == name_2
with step('Eye icon is displayed on watch-only account'):
account_order.get_eye_icon(name)
with step('Icons on accounts are correct'): with step('Icons on accounts are correct'):
assert account_order.accounts[1].icon_color == color assert account_order.accounts[1].icon_color == color_1
assert account_order.accounts[1].icon_emoji == acc_emoji assert account_order.accounts[1].icon_emoji == acc_emoji_1
assert account_order.accounts[2].icon_color == second_color assert account_order.accounts[2].icon_color == color_2
assert account_order.accounts[2].icon_emoji == second_acc_emoji assert account_order.accounts[2].icon_emoji == acc_emoji_2
with step('Drag first account to the end of the list'): with step('Drag first account to the end of the list'):
account_order.drag_account(default_name, 2) account_order.drag_account(default_name, 2)
with step('Verify the account order'): _verify_account_order(
with step('Account order is correct in wallet settings'): account_order, main_screen, default_name, (name_1, name_2, default_name)
assert driver.waitFor(lambda: account_order.accounts[0].name == name, configs.timeouts.UI_LOAD_TIMEOUT_MSEC) )
assert driver.waitFor(lambda: account_order.accounts[1].name == second_name,
configs.timeouts.UI_LOAD_TIMEOUT_MSEC)
assert driver.waitFor(lambda: account_order.accounts[2].name == default_name,
configs.timeouts.UI_LOAD_TIMEOUT_MSEC)
with step('Account order is correct in wallet'):
wallet = main_screen.left_panel.open_wallet()
wallet.left_panel.select_account(default_name)
assert driver.waitFor(lambda: wallet.left_panel.accounts[0].name == name,
configs.timeouts.UI_LOAD_TIMEOUT_MSEC)
assert driver.waitFor(lambda: wallet.left_panel.accounts[1].name == second_name,
configs.timeouts.UI_LOAD_TIMEOUT_MSEC)
assert driver.waitFor(lambda: wallet.left_panel.accounts[2].name == default_name,
configs.timeouts.UI_LOAD_TIMEOUT_MSEC)
with step('Drag second account to the top of the list'): with step('Drag second account to the top of the list'):
account_order = main_screen.left_panel.open_settings().left_panel.open_wallet_settings().open_account_order() account_order = main_screen.left_panel.open_settings().left_panel.open_wallet_settings().open_account_order()
account_order.drag_account(second_name, 0) account_order.drag_account(name_2, 0)
with step('Verify the account order'): _verify_account_order(
with step('Account order is correct in wallet settings'): account_order, main_screen, default_name, (name_2, name_1, default_name)
assert driver.waitFor(lambda: account_order.accounts[0].name == second_name, )
configs.timeouts.UI_LOAD_TIMEOUT_MSEC)
assert driver.waitFor(lambda: account_order.accounts[1].name == name, configs.timeouts.UI_LOAD_TIMEOUT_MSEC)
assert driver.waitFor(lambda: account_order.accounts[2].name == default_name,
configs.timeouts.UI_LOAD_TIMEOUT_MSEC)
with step('Account order is correct in wallet'):
wallet = main_screen.left_panel.open_wallet()
wallet.left_panel.select_account(default_name)
assert driver.waitFor(lambda: wallet.left_panel.accounts[0].name == second_name,
configs.timeouts.UI_LOAD_TIMEOUT_MSEC)
assert driver.waitFor(lambda: wallet.left_panel.accounts[1].name == name,
configs.timeouts.UI_LOAD_TIMEOUT_MSEC)
assert driver.waitFor(lambda: wallet.left_panel.accounts[2].name == default_name,
configs.timeouts.UI_LOAD_TIMEOUT_MSEC)
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/edit/703416', @allure.testcase('https://ethstatus.testrail.net/index.php?/cases/edit/703416',

View File

@ -15,6 +15,7 @@ pytestmark = marks
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703026', 'Manage a watch-only account') @allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703026', 'Manage a watch-only account')
@pytest.mark.case(703026) @pytest.mark.case(703026)
@pytest.mark.skip(reason="https://github.com/status-im/status-desktop/issues/15933")
@pytest.mark.parametrize('address, name, color, emoji, emoji_unicode', [ @pytest.mark.parametrize('address, name, color, emoji, emoji_unicode', [
pytest.param('0xea123F7beFF45E3C9fdF54B324c29DBdA14a639A', 'AccWatch1', '#2a4af5', pytest.param('0xea123F7beFF45E3C9fdF54B324c29DBdA14a639A', 'AccWatch1', '#2a4af5',
'sunglasses', '1f60e') 'sunglasses', '1f60e')