2024-01-09 14:43:56 +00:00
|
|
|
import random
|
|
|
|
import string
|
|
|
|
|
2023-09-14 03:52:27 +00:00
|
|
|
import allure
|
|
|
|
import pytest
|
|
|
|
from allure import step
|
2024-01-09 15:24:54 +00:00
|
|
|
|
|
|
|
from gui.components.toast_message import ToastMessage
|
2024-01-15 11:27:12 +00:00
|
|
|
from gui.screens.wallet import SavedAddressesView
|
2023-12-07 16:47:34 +00:00
|
|
|
from . import marks
|
2023-09-14 03:52:27 +00:00
|
|
|
|
|
|
|
import configs
|
|
|
|
import driver
|
|
|
|
from gui.components.signing_phrase_popup import SigningPhrasePopup
|
|
|
|
from gui.main_window import MainWindow
|
|
|
|
|
2023-12-07 16:47:34 +00:00
|
|
|
pytestmark = marks
|
2024-01-09 14:43:56 +00:00
|
|
|
|
|
|
|
|
2023-09-14 03:52:27 +00:00
|
|
|
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703021', 'Manage a saved address')
|
|
|
|
@pytest.mark.case(703021)
|
2024-01-09 14:43:56 +00:00
|
|
|
@pytest.mark.parametrize('name, address, new_name',
|
|
|
|
[
|
|
|
|
pytest.param(
|
|
|
|
''.join(random.choices(string.ascii_letters, k=24)),
|
|
|
|
'0x8397bc3c5a60a1883174f722403d63a8833312b7',
|
|
|
|
''.join(random.choices(string.ascii_letters, k=24)))
|
|
|
|
])
|
2024-01-19 19:58:08 +00:00
|
|
|
# TODO: https://github.com/status-im/desktop-qa-automation/issues/452
|
2023-09-14 03:52:27 +00:00
|
|
|
def test_manage_saved_address(main_screen: MainWindow, name: str, address: str, new_name: str):
|
2024-01-19 19:58:08 +00:00
|
|
|
with step('Add new saved address'):
|
2023-09-14 03:52:27 +00:00
|
|
|
wallet = main_screen.left_panel.open_wallet()
|
2024-01-09 14:43:56 +00:00
|
|
|
SigningPhrasePopup().confirm_phrase()
|
2024-01-10 17:15:38 +00:00
|
|
|
wallet.left_panel.open_saved_addresses().open_add_saved_address_popup().add_saved_address(name, address)
|
2023-09-14 03:52:27 +00:00
|
|
|
|
|
|
|
with step('Verify that saved address is in the list of saved addresses'):
|
|
|
|
assert driver.waitFor(
|
|
|
|
lambda: name in wallet.left_panel.open_saved_addresses().address_names,
|
|
|
|
configs.timeouts.UI_LOAD_TIMEOUT_MSEC), f'Address: {name} not found'
|
|
|
|
|
2024-01-15 11:27:12 +00:00
|
|
|
with step('Verify toast message when adding saved address'):
|
|
|
|
messages = ToastMessage().get_toast_messages
|
|
|
|
assert f'{name} successfully added to your saved addresses' in messages, \
|
|
|
|
f"Toast message about adding saved address is not correct or not present. Current list of messages: {messages}"
|
|
|
|
|
2023-09-14 03:52:27 +00:00
|
|
|
with step('Edit saved address to new name'):
|
2024-01-15 11:27:12 +00:00
|
|
|
SavedAddressesView().open_edit_address_popup(name).edit_saved_address(new_name, address)
|
|
|
|
|
|
|
|
with step('Verify that saved address with new name is in the list of saved addresses'):
|
|
|
|
assert driver.waitFor(
|
|
|
|
lambda: new_name in SavedAddressesView().address_names,
|
|
|
|
configs.timeouts.UI_LOAD_TIMEOUT_MSEC), f'Address: {new_name} not found'
|
2023-09-14 03:52:27 +00:00
|
|
|
|
2024-01-09 15:24:54 +00:00
|
|
|
with step('Verify toast message when editing saved address'):
|
|
|
|
messages = ToastMessage().get_toast_messages
|
|
|
|
assert f'{new_name} saved address successfully edited' in messages, \
|
|
|
|
f"Toast message about editing saved address is not correct or not present. Current list of messages: {messages}"
|
|
|
|
|
2023-09-14 03:52:27 +00:00
|
|
|
with step('Delete address with new name'):
|
|
|
|
wallet.left_panel.open_saved_addresses().delete_saved_address(new_name)
|
|
|
|
|
2024-01-09 15:24:54 +00:00
|
|
|
with step('Verify toast message when deleting saved address'):
|
|
|
|
messages = ToastMessage().get_toast_messages
|
|
|
|
assert f'{new_name} was successfully removed from your saved addresses' in messages, \
|
|
|
|
f"Toast message about deleting saved address is not correct or not present. Current list of messages: {messages}"
|
|
|
|
|
2023-09-14 03:52:27 +00:00
|
|
|
with step('Verify that saved address with new name is not in the list of saved addresses'):
|
2023-10-30 10:00:34 +00:00
|
|
|
assert not driver.waitFor(
|
2024-01-17 08:43:34 +00:00
|
|
|
lambda: new_name in wallet.left_panel.open_saved_addresses().get_saved_addresses_list(),
|
2023-10-30 10:00:34 +00:00
|
|
|
configs.timeouts.UI_LOAD_TIMEOUT_MSEC), f'Address: {new_name} is still present'
|