test(Wallet) Settings - account reordering not possible with 1 account (#109)

This commit is contained in:
Valentina1133 2023-09-19 15:59:31 +07:00 committed by GitHub
parent cf8a32f72d
commit 181ee8f678
3 changed files with 36 additions and 0 deletions

View File

@ -52,3 +52,6 @@ settingsContentBaseScrollView_Goerli_testnet_active_StatusBaseText = {"container
settingsContentBaseScrollView_accountsList_StatusListView = {"container": settingsContentBase_ScrollView, "id": "accountsList", "type": "StatusListView", "unnamed": 1, "visible": True}
settingsContentBaseScrollView_draggableDelegate_StatusDraggableListItem = {"checkable": False, "container": settingsContentBase_ScrollView, "id": "draggableDelegate", "type": "StatusDraggableListItem", "unnamed": 1, "visible": True}
settingsContentBaseScrollView_accountOrderView_AccountOrderView = {"container": settingsContentBase_ScrollView, "id": "accountOrderView", "type": "AccountOrderView", "unnamed": 1, "visible": True}
settingsContentBaseScrollView_StatusBaseText = {"container": settingsContentBase_ScrollView, "type": "StatusBaseText", "unnamed": 1, "visible": True}
mainWindow_StatusToolBar = {"container": statusDesktop_mainWindow, "objectName": "statusToolBar", "type": "StatusToolBar", "visible": True}
main_toolBar_back_button = {"container": mainWindow_StatusToolBar, "objectName": "toolBarBackButton", "type": "StatusFlatButton", "visible": True}

View File

@ -268,6 +268,16 @@ class EditAccountOrderSettings(WalletSettingsView):
super(EditAccountOrderSettings, self).__init__()
self._account_item = QObject('settingsContentBaseScrollView_draggableDelegate_StatusDraggableListItem')
self._accounts_list = QObject('statusDesktop_mainWindow')
self._text_item = QObject('settingsContentBaseScrollView_StatusBaseText')
self._back_button = Button('main_toolBar_back_button')
@property
@allure.step('Get edit account order recommendations')
def account_recommendations(self):
account_recommendations = []
for obj in driver.findAllObjects(self._text_item.real_name):
account_recommendations.append(obj.text)
return account_recommendations
@property
@allure.step('Get accounts')
@ -306,3 +316,7 @@ class EditAccountOrderSettings(WalletSettingsView):
bounds = [account for account in self.accounts if account.name == name][0].object.bounds
d_bounds = self.accounts[index].object.bounds
driver.mouse.press_and_move(self._accounts_list.object, bounds.x, bounds.y, d_bounds.x, d_bounds.y)
@allure.step('Verify that back button is present')
def is_back_button_present(self) -> bool:
return self._back_button.is_visible

View File

@ -118,3 +118,22 @@ def test_change_account_order_by_drag_and_drop(main_screen: MainWindow, user_acc
assert driver.waitFor(lambda: wallet.left_panel.accounts[0].name == second_name)
assert driver.waitFor(lambda: wallet.left_panel.accounts[1].name == name)
assert driver.waitFor(lambda: wallet.left_panel.accounts[2].name == default_name)
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/edit/703416', 'Account order: reordering is not possible having a single account')
@pytest.mark.case(703416)
@pytest.mark.parametrize('default_name, text_on_top', [
pytest.param('Status account', 'This account looks a little lonely. Add another account'
' to enable re-ordering.')
])
def test_change_account_order_not_possible(main_screen: MainWindow, default_name: str, text_on_top: str):
with step('Open edit account order view'):
account_order = main_screen.left_panel.open_settings().left_panel.open_wallet_settings().open_account_order()
with step('Verify that only default account displayed'):
assert len(account_order.accounts) == 1
assert account_order.accounts[0].name == default_name
with step('Back button is present and text on top is correct'):
assert account_order.text_labels_from_edit_account_order_settings[0] == text_on_top
assert account_order.is_back_button_present() is True