Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/5'
Browse files Browse the repository at this point in the history
  • Loading branch information
TheOneRing committed Feb 6, 2024
2 parents 1491514 + e078e1a commit 9c5b244
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 5 deletions.
25 changes: 23 additions & 2 deletions test/gui/shared/scripts/bdd_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,8 @@ def teardown_client():
# remove account from UI
# In Windows, removing only config and sync folders won't help
# so to work around that, remove the account connection
close_open_dialogs()
close_dialogs()
close_widgets()
server_host = urlparse(get_config('localBackendUrl')).netloc
accounts = Toolbar.get_accounts()
for account in accounts:
Expand Down Expand Up @@ -241,7 +242,7 @@ def teardown_client():
test.log(f'Failed to delete{entry.name}. Reason: {e}.')


def close_open_dialogs():
def close_dialogs():
# close the current active dailog if it's not a main client window
while True:
active_window = QApplication.activeModalWidget()
Expand All @@ -253,3 +254,23 @@ def close_open_dialogs():
confirm_dialog = QApplication.activeModalWidget()
if confirm_dialog.visible:
clickButton(waitForObject(AccountSetting.CONFIRMATION_YES_BUTTON))


def close_widgets():
try:
ch = object.children(squish.waitForObject(AccountSetting.DIALOG_STACK, 500))
for obj in ch:
if (
hasattr(obj, "objectName")
and obj.objectName != ''
and obj.objectName != "page"
):
obj.close()
# if the dialog has a confirmation dialog, confirm it
confirm_dialog = QApplication.activeModalWidget()
if str(confirm_dialog) != "<null>" and confirm_dialog.visible:
clickButton(waitForObject(AccountSetting.CONFIRMATION_YES_BUTTON))
except LookupError:
# nothing to close if DIALOG_STACK is not found
# required for client versions <= 5
pass
2 changes: 1 addition & 1 deletion test/gui/shared/scripts/helpers/SetupClientHelper.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from urllib.parse import urlparse
import squish, test
import subprocess
from os import makedirs, path
from os import makedirs
from os.path import exists, join
from helpers.SpaceHelper import get_space_id
from helpers.ConfigHelper import get_config, set_config, isWindows
Expand Down
6 changes: 6 additions & 0 deletions test/gui/shared/scripts/pageObjects/AccountSetting.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ class AccountSetting:
"type": "QWidget",
"visible": 0,
}
DIALOG_STACK = {
"name": "dialogStack",
"type": "QStackedWidget",
"visible": 1,
"window": names.settings_OCC_SettingsDialog,
}
CONFIRMATION_YES_BUTTON = {"text": "Yes", "type": "QPushButton", "visible": 1}

@staticmethod
Expand Down
2 changes: 1 addition & 1 deletion test/gui/shared/steps/account_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ def step(context):
waitForInitialSyncToComplete(getResourcePath('/', account_details["user"]))


@When('the user cancels the sync connection wizard')
@Step('the user cancels the sync connection wizard')
def step(context):
SyncConnectionWizard.cancelFolderSyncConnectionWizard()

Expand Down
2 changes: 1 addition & 1 deletion test/gui/shared/steps/sharing_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ def step(context, permissions, receiver, resource):
SharingDialog.removePermissions(permissions)


@When("the user closes the sharing dialog")
@Step("the user closes the sharing dialog")
def step(context):
SharingDialog.closeSharingDialog()

Expand Down
24 changes: 24 additions & 0 deletions test/gui/tst_sharing/test.feature
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ Feature: Sharing
And the user opens the sharing dialog of "SharedFolder" using the client-UI
And the user searches for collaborator "Brian Murphy" using the client-UI
Then the error "No results for 'Brian Murphy'" should be displayed
And the user closes the sharing dialog


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


Scenario: search for users with minimum autocomplete characters
Expand All @@ -109,6 +111,7 @@ Feature: Sharing
| user |
| TestUser1 |
| TestUser2 |
And the user closes the sharing dialog

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

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

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


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


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


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


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


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

@smokeTest
Scenario: simple sharing of file and folder by public link without password
Expand All @@ -437,6 +450,7 @@ Feature: Sharing
When the user creates a new public link with permissions "Download / View" for folder "simple-folder" without password using the client-UI
Then as user "Alice" the folder "simple-folder" should have a public link in the server
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
And the user closes the sharing dialog


Scenario Outline: simple sharing of file and folder by public link with password
Expand All @@ -450,6 +464,7 @@ Feature: Sharing
When the user creates a new public link with permissions "Download / View" for folder "simple-folder" with password "<password>" using the client-UI
Then as user "Alice" the folder "simple-folder" should have a public link in the server
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
And the user closes the sharing dialog
Examples:
| password |
| password1234 |
Expand All @@ -463,6 +478,7 @@ Feature: Sharing
| name | Public-link |
And user "Alice" has set up a client with default settings
When the user deletes the public link for file "textfile0.txt"
And the user closes the sharing dialog
Then as user "Alice" the file "/textfile0.txt" should not have any public link in the server


Expand All @@ -477,6 +493,7 @@ Feature: Sharing
And the user changes the password of public link "Public-link" to "password1234" using the client-UI
Then as user "Alice" the file "textfile0.txt" should have a public link in the server
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
And the user closes the sharing dialog


Scenario: simple sharing of a file by public link with default expiration date
Expand Down Expand Up @@ -504,6 +521,7 @@ Feature: Sharing
And the user creates a new public link with following settings using the client-UI:
| path | FOLDER |
| expireDate | 2031-12-30 |
And the user closes the sharing dialog
Then as user "Alice" the folder "FOLDER" should have a public link in the server
And the last public link share response of user "Alice" should include the following fields on the server
| expireDate | 2031-12-30 |
Expand All @@ -516,6 +534,7 @@ Feature: Sharing
| path | textfile.txt |
| password | pass123 |
| expireDate | 2031-10-14 |
And the user closes the sharing dialog
Then as user "Alice" the file "textfile.txt" should have a public link in the server
And the last public link share response of user "Alice" should include the following fields on the server
| expireDate | 2031-10-14 |
Expand All @@ -532,6 +551,7 @@ Feature: Sharing
When the user opens the public links dialog of "textfile0.txt" using the client-UI
And the user edits the public link named "Public link" of file "textfile0.txt" changing following
| expireDate | 2038-07-21 |
And the user closes the sharing dialog
Then the last public link share response of user "Alice" should include the following fields on the server
| expireDate | 2038-07-21 |

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

Expand All @@ -556,6 +577,7 @@ Feature: Sharing
And user "Alice" has set up a client with default settings
When the user creates a new public link for folder "simple-folder" using the client-UI with these details:
| role | <role> |
And the user closes the sharing dialog
Then user "Alice" on the server should have a share with these details:
| field | value |
| share_type | public_link |
Expand All @@ -576,6 +598,7 @@ Feature: Sharing
And user "Alice" has set up a client with default settings
When the user creates a new public link for folder "simple-folder" using the client-UI with these details:
| role | Contributor |
And the user closes the sharing dialog
Then user "Alice" on the server should have a share with these details:
| field | value |
| share_type | public_link |
Expand All @@ -599,6 +622,7 @@ Feature: Sharing
When the user closes the sharing dialog
And the user removes permissions "<permissions>" for user "Brian Murphy" of resource "lorem.txt" using the client-UI
Then "<permissions>" permissions should not be displayed for user "Brian Murphy" for resource "lorem.txt" on the client-UI
And the user closes the sharing dialog
And user "Alice" on the server should have a share with these details:
| field | value |
| uid_owner | Alice |
Expand Down
1 change: 1 addition & 0 deletions test/gui/tst_syncing/test.feature
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ Feature: Syncing files
| aFolder |
| 123Folder |
| bFolder |
And the user cancels the sync connection wizard


Scenario Outline: Syncing a folder to the server
Expand Down

0 comments on commit 9c5b244

Please sign in to comment.