Skip to content

Commit cfe8edf

Browse files
committed
fix widget stack lookup
1 parent 3a8fb68 commit cfe8edf

File tree

2 files changed

+21
-16
lines changed

2 files changed

+21
-16
lines changed

test/gui/shared/scripts/bdd_hooks.py

+20-15
Original file line numberDiff line numberDiff line change
@@ -205,11 +205,11 @@ def hook(context):
205205
def teardown_client():
206206
# Cleanup user accounts from UI for Windows platform
207207
# It is not needed for Linux so skipping it in order to save CI time
208-
if not isWindows():
208+
if isWindows():
209209
# remove account from UI
210210
# In Windows, removing only config and sync folders won't help
211211
# so to work around that, remove the account connection
212-
close_open_dialogs()
212+
close_dialogs()
213213
close_widgets()
214214
server_host = urlparse(get_config('localBackendUrl')).netloc
215215
accounts = Toolbar.get_accounts()
@@ -242,7 +242,7 @@ def teardown_client():
242242
test.log(f'Failed to delete{entry.name}. Reason: {e}.')
243243

244244

245-
def close_open_dialogs():
245+
def close_dialogs():
246246
# close the current active dailog if it's not a main client window
247247
while True:
248248
active_window = QApplication.activeModalWidget()
@@ -257,15 +257,20 @@ def close_open_dialogs():
257257

258258

259259
def close_widgets():
260-
ch = object.children(squish.waitForObject(AccountSetting.DIALOG_STACK))
261-
for obj in ch:
262-
if (
263-
hasattr(obj, "objectName")
264-
and obj.objectName != ''
265-
and obj.objectName != "page"
266-
):
267-
obj.close()
268-
# if the dialog has a confirmation dialog, confirm it
269-
confirm_dialog = QApplication.activeModalWidget()
270-
if str(confirm_dialog) != "<null>" and confirm_dialog.visible:
271-
clickButton(waitForObject(AccountSetting.CONFIRMATION_YES_BUTTON))
260+
try:
261+
ch = object.children(squish.waitForObject(AccountSetting.DIALOG_STACK, 500))
262+
for obj in ch:
263+
if (
264+
hasattr(obj, "objectName")
265+
and obj.objectName != ''
266+
and obj.objectName != "page"
267+
):
268+
obj.close()
269+
# if the dialog has a confirmation dialog, confirm it
270+
confirm_dialog = QApplication.activeModalWidget()
271+
if str(confirm_dialog) != "<null>" and confirm_dialog.visible:
272+
clickButton(waitForObject(AccountSetting.CONFIRMATION_YES_BUTTON))
273+
except LookupError:
274+
# nothing to close if DIALOG_STACK is not found
275+
# required for client versions <= 5
276+
pass

test/gui/shared/scripts/helpers/SetupClientHelper.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from urllib.parse import urlparse
22
import squish, test
33
import subprocess
4-
from os import makedirs, path
4+
from os import makedirs
55
from os.path import exists, join
66
from helpers.SpaceHelper import get_space_id
77
from helpers.ConfigHelper import get_config, set_config, isWindows

0 commit comments

Comments
 (0)