Skip to content

Commit e078e1a

Browse files
authored
[gui-tests][full-ci] Update account cleanup via UI for client 5 and 6 (#11505)
* enabled account cleanup via UI * handle closing of widgets in the stack * close sharing dialog at the end * fix sharing dialog tests * fix widget stack lookup * fix step name
1 parent 04eda65 commit e078e1a

File tree

7 files changed

+57
-5
lines changed

7 files changed

+57
-5
lines changed

test/gui/shared/scripts/bdd_hooks.py

+23-2
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,8 @@ def teardown_client():
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()
213+
close_widgets()
213214
server_host = urlparse(get_config('localBackendUrl')).netloc
214215
accounts = Toolbar.get_accounts()
215216
for account in accounts:
@@ -241,7 +242,7 @@ def teardown_client():
241242
test.log(f'Failed to delete{entry.name}. Reason: {e}.')
242243

243244

244-
def close_open_dialogs():
245+
def close_dialogs():
245246
# close the current active dailog if it's not a main client window
246247
while True:
247248
active_window = QApplication.activeModalWidget()
@@ -253,3 +254,23 @@ def close_open_dialogs():
253254
confirm_dialog = QApplication.activeModalWidget()
254255
if confirm_dialog.visible:
255256
clickButton(waitForObject(AccountSetting.CONFIRMATION_YES_BUTTON))
257+
258+
259+
def close_widgets():
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

test/gui/shared/scripts/pageObjects/AccountSetting.py

+6
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,12 @@ class AccountSetting:
5353
"type": "QWidget",
5454
"visible": 0,
5555
}
56+
DIALOG_STACK = {
57+
"name": "dialogStack",
58+
"type": "QStackedWidget",
59+
"visible": 1,
60+
"window": names.settings_OCC_SettingsDialog,
61+
}
5662
CONFIRMATION_YES_BUTTON = {"text": "Yes", "type": "QPushButton", "visible": 1}
5763

5864
@staticmethod

test/gui/shared/steps/account_context.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ def step(context):
262262
waitForInitialSyncToComplete(getResourcePath('/', account_details["user"]))
263263

264264

265-
@When('the user cancels the sync connection wizard')
265+
@Step('the user cancels the sync connection wizard')
266266
def step(context):
267267
SyncConnectionWizard.cancelFolderSyncConnectionWizard()
268268

test/gui/shared/steps/sharing_context.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ def step(context, permissions, receiver, resource):
285285
SharingDialog.removePermissions(permissions)
286286

287287

288-
@When("the user closes the sharing dialog")
288+
@Step("the user closes the sharing dialog")
289289
def step(context):
290290
SharingDialog.closeSharingDialog()
291291

test/gui/tst_sharing/test.feature

+24
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ Feature: Sharing
8383
And the user opens the sharing dialog of "SharedFolder" using the client-UI
8484
And the user searches for collaborator "Brian Murphy" using the client-UI
8585
Then the error "No results for 'Brian Murphy'" should be displayed
86+
And the user closes the sharing dialog
8687

8788

8889
Scenario: try to self share a file/folder
@@ -96,6 +97,7 @@ Feature: Sharing
9697
And the user opens the sharing dialog of "OwnFolder" using the client-UI
9798
And the user selects "Alice Hansen" as collaborator of resource "OwnFolder" using the client-UI
9899
Then the error "Can't share with yourself" should be displayed
100+
And the user closes the sharing dialog
99101

100102

101103
Scenario: search for users with minimum autocomplete characters
@@ -109,6 +111,7 @@ Feature: Sharing
109111
| user |
110112
| TestUser1 |
111113
| TestUser2 |
114+
And the user closes the sharing dialog
112115

113116
Scenario: autocomplete offers a list of users followed by a list of groups
114117
And user "Alice" has uploaded file with content "ownCloud test text file" to "textfile.txt" in the server
@@ -119,6 +122,7 @@ Feature: Sharing
119122
| user |
120123
| admin |
121124
| admin (group) |
125+
And the user closes the sharing dialog
122126

123127
Scenario: collaborators are listed in chronological order
124128
Given user "Brian" has been created on the server with default attributes and without skeleton files
@@ -141,6 +145,7 @@ Feature: Sharing
141145
| TestUser1 |
142146
| TestUser3 |
143147
| TestUser2 |
148+
And the user closes the sharing dialog
144149

145150
@issue-7459
146151
Scenario: Progress indicator should not be visible after unselecting the password protection checkbox while sharing through public link
@@ -150,6 +155,7 @@ Feature: Sharing
150155
And the user toggles the password protection using the client-UI
151156
And the user toggles the password protection using the client-UI
152157
Then the password progress indicator should not be visible in the client-UI - expected to fail
158+
And the user closes the sharing dialog
153159

154160

155161
Scenario: Collaborator should not see to whom a file/folder is shared.
@@ -164,6 +170,7 @@ Feature: Sharing
164170
When the user closes the sharing dialog
165171
And the user opens the sharing dialog of "Folder" using the client-UI
166172
Then the error text "The item is not shared with any users or groups" should be displayed in the sharing dialog
173+
And the user closes the sharing dialog
167174

168175

169176
Scenario: share file and folder to a group
@@ -197,6 +204,7 @@ Feature: Sharing
197204
When the user closes the sharing dialog
198205
And the user tires to share resource "Folder" with the group "grp1" using the client-UI
199206
Then the error "Path already shared with this group" should be displayed
207+
And the user closes the sharing dialog
200208

201209

202210
Scenario: sharee edits content of files shared by sharer
@@ -250,6 +258,7 @@ Feature: Sharing
250258
And the user removes permissions "edit" for user "Brian Murphy" of resource "textfile.txt" using the client-UI
251259
And the user closes the sharing dialog
252260
And the user removes permissions "edit" for user "Brian Murphy" of resource "FOLDER" using the client-UI
261+
And the user closes the sharing dialog
253262
And user "Brian" tries to overwrite the file "textfile.txt" with content "overwrite ownCloud test text file"
254263
And user "Brian" tries to overwrite the file "FOLDER/simple.txt" with content "overwrite some content"
255264
And user "Brian" waits for file "textfile.txt" to have sync error
@@ -376,8 +385,10 @@ Feature: Sharing
376385
And user "Brian" has set up a client with default settings
377386
When the user opens the sharing dialog of "FOLDER" using the client-UI
378387
Then the error text "The file can not be shared because it was shared without sharing permission." should be displayed in the sharing dialog
388+
And the user closes the sharing dialog
379389
When the user opens the sharing dialog of "textfile.txt" using the client-UI
380390
Then the error text "The file can not be shared because it was shared without sharing permission." should be displayed in the sharing dialog
391+
And the user closes the sharing dialog
381392

382393

383394
Scenario: unshare a shared file and folder
@@ -393,6 +404,7 @@ Feature: Sharing
393404
When the user closes the sharing dialog
394405
And the user unshares the resource "simple-folder" for collaborator "Brian Murphy" using the client-UI
395406
Then the text "The item is not shared with any users or groups" should be displayed in the sharing dialog
407+
And the user closes the sharing dialog
396408
And as "Brian" folder "simple-folder" on the server should not exist
397409

398410

@@ -423,6 +435,7 @@ Feature: Sharing
423435
And user "Brian" has set up a client with default settings
424436
When the user unshares the resource "textfile.txt" for collaborator "Carol King" using the client-UI
425437
Then the text "The item is not shared with any users or groups" should be displayed in the sharing dialog
438+
And the user closes the sharing dialog
426439

427440
@smokeTest
428441
Scenario: simple sharing of file and folder by public link without password
@@ -437,6 +450,7 @@ Feature: Sharing
437450
When the user creates a new public link with permissions "Download / View" for folder "simple-folder" without password using the client-UI
438451
Then as user "Alice" the folder "simple-folder" should have a public link in the server
439452
And the public should be able to download the folder "simple-folder/child" without password from the last created public link by "Alice" on the server
453+
And the user closes the sharing dialog
440454

441455

442456
Scenario Outline: simple sharing of file and folder by public link with password
@@ -450,6 +464,7 @@ Feature: Sharing
450464
When the user creates a new public link with permissions "Download / View" for folder "simple-folder" with password "<password>" using the client-UI
451465
Then as user "Alice" the folder "simple-folder" should have a public link in the server
452466
And the public should be able to download the folder "simple-folder" with password "<password>" from the last created public link by "Alice" on the server
467+
And the user closes the sharing dialog
453468
Examples:
454469
| password |
455470
| password1234 |
@@ -463,6 +478,7 @@ Feature: Sharing
463478
| name | Public-link |
464479
And user "Alice" has set up a client with default settings
465480
When the user deletes the public link for file "textfile0.txt"
481+
And the user closes the sharing dialog
466482
Then as user "Alice" the file "/textfile0.txt" should not have any public link in the server
467483

468484

@@ -477,6 +493,7 @@ Feature: Sharing
477493
And the user changes the password of public link "Public-link" to "password1234" using the client-UI
478494
Then as user "Alice" the file "textfile0.txt" should have a public link in the server
479495
And the public should be able to download the file "textfile0.txt" with password "password1234" from the last created public link by "Alice" on the server
496+
And the user closes the sharing dialog
480497

481498

482499
Scenario: simple sharing of a file by public link with default expiration date
@@ -504,6 +521,7 @@ Feature: Sharing
504521
And the user creates a new public link with following settings using the client-UI:
505522
| path | FOLDER |
506523
| expireDate | 2031-12-30 |
524+
And the user closes the sharing dialog
507525
Then as user "Alice" the folder "FOLDER" should have a public link in the server
508526
And the last public link share response of user "Alice" should include the following fields on the server
509527
| expireDate | 2031-12-30 |
@@ -516,6 +534,7 @@ Feature: Sharing
516534
| path | textfile.txt |
517535
| password | pass123 |
518536
| expireDate | 2031-10-14 |
537+
And the user closes the sharing dialog
519538
Then as user "Alice" the file "textfile.txt" should have a public link in the server
520539
And the last public link share response of user "Alice" should include the following fields on the server
521540
| expireDate | 2031-10-14 |
@@ -532,6 +551,7 @@ Feature: Sharing
532551
When the user opens the public links dialog of "textfile0.txt" using the client-UI
533552
And the user edits the public link named "Public link" of file "textfile0.txt" changing following
534553
| expireDate | 2038-07-21 |
554+
And the user closes the sharing dialog
535555
Then the last public link share response of user "Alice" should include the following fields on the server
536556
| expireDate | 2038-07-21 |
537557

@@ -547,6 +567,7 @@ Feature: Sharing
547567
When the user opens the public links dialog of "simple-folder" using the client-UI
548568
And the user edits the public link named "Public link" of file "simple-folder" changing following
549569
| expireDate | 2038-07-21 |
570+
And the user closes the sharing dialog
550571
Then the last public link share response of user "Alice" should include the following fields on the server
551572
| expireDate | 2038-07-21 |
552573

@@ -556,6 +577,7 @@ Feature: Sharing
556577
And user "Alice" has set up a client with default settings
557578
When the user creates a new public link for folder "simple-folder" using the client-UI with these details:
558579
| role | <role> |
580+
And the user closes the sharing dialog
559581
Then user "Alice" on the server should have a share with these details:
560582
| field | value |
561583
| share_type | public_link |
@@ -576,6 +598,7 @@ Feature: Sharing
576598
And user "Alice" has set up a client with default settings
577599
When the user creates a new public link for folder "simple-folder" using the client-UI with these details:
578600
| role | Contributor |
601+
And the user closes the sharing dialog
579602
Then user "Alice" on the server should have a share with these details:
580603
| field | value |
581604
| share_type | public_link |
@@ -599,6 +622,7 @@ Feature: Sharing
599622
When the user closes the sharing dialog
600623
And the user removes permissions "<permissions>" for user "Brian Murphy" of resource "lorem.txt" using the client-UI
601624
Then "<permissions>" permissions should not be displayed for user "Brian Murphy" for resource "lorem.txt" on the client-UI
625+
And the user closes the sharing dialog
602626
And user "Alice" on the server should have a share with these details:
603627
| field | value |
604628
| uid_owner | Alice |

test/gui/tst_syncing/test.feature

+1
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ Feature: Syncing files
154154
| aFolder |
155155
| 123Folder |
156156
| bFolder |
157+
And the user cancels the sync connection wizard
157158

158159

159160
Scenario Outline: Syncing a folder to the server

0 commit comments

Comments
 (0)