@@ -209,7 +209,7 @@ def teardown_client():
209
209
# remove account from UI
210
210
# In Windows, removing only config and sync folders won't help
211
211
# so to work around that, remove the account connection
212
- close_open_dialogs ()
212
+ close_dialogs ()
213
213
close_widgets ()
214
214
server_host = urlparse (get_config ('localBackendUrl' )).netloc
215
215
accounts = Toolbar .get_accounts ()
@@ -242,7 +242,7 @@ def teardown_client():
242
242
test .log (f'Failed to delete{ entry .name } . Reason: { e } .' )
243
243
244
244
245
- def close_open_dialogs ():
245
+ def close_dialogs ():
246
246
# close the current active dailog if it's not a main client window
247
247
while True :
248
248
active_window = QApplication .activeModalWidget ()
@@ -257,15 +257,20 @@ def close_open_dialogs():
257
257
258
258
259
259
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
0 commit comments