Skip to content

Commit

Permalink
test for uploading file in remote folder with selective sync
Browse files Browse the repository at this point in the history
  • Loading branch information
Salipa-Gurung committed Nov 21, 2023
1 parent c65ae36 commit 82b0ae5
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 3 deletions.
8 changes: 8 additions & 0 deletions test/gui/shared/scripts/helpers/api/webdav_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,11 @@ def create_file(user, file_name, contents):
assert (
response.status_code == 201
), f"Could not create file '{file_name}' for user {user}"


def delete_folder(user, folder_name):
url = get_resource_path(user, folder_name)
response = request.delete(url, user=user)
assert (
response.status_code == 204
), f"Could not delete folder '{folder_name}' for user {user}"
8 changes: 6 additions & 2 deletions test/gui/shared/scripts/pageObjects/SyncConnectionWizard.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,15 +107,19 @@ def selectRemoteDestinationFolder(folder):
SyncConnectionWizard.nextStep()

@staticmethod
def selectFoldersToSync(folders):
# first deselect all
def deselectAllRemoteFolders():
squish.mouseClick(
squish.waitForObject(SyncConnectionWizard.SELECTIVE_SYNC_ROOT_FOLDER),
11,
11,
squish.Qt.NoModifier,
squish.Qt.LeftButton,
)

@staticmethod
def selectFoldersToSync(folders):
# first deselect all
SyncConnectionWizard.deselectAllRemoteFolders()
for folder in folders:
# added a new key 'text' to dictionary SYNC_DIALOG_FOLDER_TREE
SyncConnectionWizard.SYNC_DIALOG_FOLDER_TREE['text'] = folder
Expand Down
6 changes: 6 additions & 0 deletions test/gui/shared/steps/account_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,3 +253,9 @@ def step(context):
@When('user "|any|" logs out from the login required dialog')
def step(context, username):
AccountSetting.logoutFromLoginRequiredDialog()


@When("user \"Alice\" unselects all the remote folders")
def step(context):
SyncConnectionWizard.deselectAllRemoteFolders()
SyncConnectionWizard.addSyncConnection()
10 changes: 10 additions & 0 deletions test/gui/shared/steps/server_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,3 +171,13 @@ def step(context, user, file_content, file_name):
@When("the user clicks on the settings tab")
def step(context):
Toolbar.open_settings_tab()


@When('user "|any|" uploads file with content "|any|" to "|any|" in the server')
def step(context, user, file_content, file_name):
webdav.create_file(user, file_name, file_content)


@When('user "|any|" deletes the folder "|any|" in the server')
def step(context, user, folder_name):
webdav.delete_folder(user, folder_name)
28 changes: 27 additions & 1 deletion test/gui/tst_syncing/test.feature
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,11 @@ Feature: Syncing files
"""

@skipOnOCIS
Scenario: Sync all is selected by default
Scenario: Sync all is selected by default and unselect all the remote folders
Given user "Alice" has created folder "simple-folder" in the server
And user "Alice" has created folder "large-folder" in the server
And user "Alice" has uploaded file with content "ownCloud test text file 0" to "testFile.txt" in the server
And user "Alice" has uploaded file with content "ownCloud test text file 1" to "lorem.txt" in the server
And the user has started the client
And the user has entered the following account information:
| server | %local_server% |
Expand All @@ -67,6 +69,10 @@ Feature: Syncing files
And the user sets the sync path in sync connection wizard
And the user selects "ownCloud" as a remote destination folder
Then the sync all checkbox should be checked
When user "Alice" unselects all the remote folders
And the user waits for the files to sync
Then the file "testFile.txt" should exist on the file system
And the file "lorem.txt" should exist on the file system

@skipOnOCIS
Scenario: Sync only one folder from the server
Expand All @@ -85,6 +91,20 @@ Feature: Syncing files
| simple-folder |
Then the folder "simple-folder" should exist on the file system
But the folder "large-folder" should not exist on the file system
When user "Alice" uploads file with content "some content" to "simple-folder/lorem.txt" in the server
And user "Alice" uploads file with content "ownCloud" to "large-folder/lorem.txt" in the server
And user "Alice" creates a file "simple-folder/localFile.txt" with the following content inside the sync folder
"""
test content
"""
And the user waits for the files to sync
Then the file "simple-folder/lorem.txt" should exist on the file system
And the file "large-folder/lorem.txt" should not exist on the file system
And as "Alice" file "simple-folder/localFile.txt" should exist in the server
When the user deletes the folder "simple-folder"
And the user waits for the files to sync
Then as "Alice" folder "simple-folder" should not exist in the server


@issue-9733 @skipOnOCIS
Scenario: sort folders list by name and size
Expand Down Expand Up @@ -390,6 +410,7 @@ Feature: Syncing files
@skipOnOCIS
Scenario: sync remote folder to a local sync folder having special characters
Given user "Alice" has created folder "~`!@#$^&()-_=+{[}];',)" in the server
And user "Alice" has created folder "simple-folder" in the server
And user "Alice" has created folder "~test%" in the server
And the user has created a folder "~`!@#$^&()-_=+{[}];',)PRN%" in temp folder
And the user has started the client
Expand All @@ -403,5 +424,10 @@ Feature: Syncing files
And the user selects the following folders to sync:
| folder |
| ~`!@#$^&()-_=+{[}];',) |
| simple-folder |
Then the folder "~`!@#$^&()-_=+{[}];',)" should exist on the file system
And the folder "simple-folder" should exist on the file system
But the folder "~test%" should not exist on the file system
When user "Alice" deletes the folder "simple-folder" in the server
And the user waits for the files to sync
Then the folder "simple-folder" should not exist on the file system

0 comments on commit 82b0ae5

Please sign in to comment.