diff --git a/test/gui/shared/scripts/helpers/SetupClientHelper.py b/test/gui/shared/scripts/helpers/SetupClientHelper.py index 63be46c917f..a83a3e98e74 100644 --- a/test/gui/shared/scripts/helpers/SetupClientHelper.py +++ b/test/gui/shared/scripts/helpers/SetupClientHelper.py @@ -69,6 +69,10 @@ def getResourcePath(resource='', user='', space=''): ) +def getTempResourcePath(resourceName): + return join(get_config('tempFolderPath'), resourceName) + + def getCurrentUserSyncPath(): return get_config('currentUserSyncPath') diff --git a/test/gui/shared/scripts/pageObjects/SyncConnectionWizard.py b/test/gui/shared/scripts/pageObjects/SyncConnectionWizard.py index 7fceae86b4f..9b8611421bb 100644 --- a/test/gui/shared/scripts/pageObjects/SyncConnectionWizard.py +++ b/test/gui/shared/scripts/pageObjects/SyncConnectionWizard.py @@ -1,7 +1,11 @@ import names import squish from os import path -from helpers.SetupClientHelper import getCurrentUserSyncPath +from helpers.SetupClientHelper import ( + getCurrentUserSyncPath, + getTempResourcePath, + setCurrentUserSyncPath, +) from helpers.ConfigHelper import get_config @@ -67,20 +71,25 @@ class SyncConnectionWizard: } @staticmethod - def setSyncPathInSyncConnectionWizardOc10(): + def setSyncPathInSyncConnectionWizardOc10(folderName=''): squish.waitForObject(SyncConnectionWizard.ADD_FOLDER_SYNC_CONNECTION_WIZARD) - squish.type( - SyncConnectionWizard.CHOOSE_LOCAL_SYNC_FOLDER, - getCurrentUserSyncPath(), - ) + if folderName: + currentSyncPath = getTempResourcePath(folderName) + squish.type(SyncConnectionWizard.CHOOSE_LOCAL_SYNC_FOLDER, currentSyncPath) + setCurrentUserSyncPath(currentSyncPath) + else: + squish.type( + SyncConnectionWizard.CHOOSE_LOCAL_SYNC_FOLDER, + getCurrentUserSyncPath(), + ) SyncConnectionWizard.nextStep() @staticmethod - def setSyncPathInSyncConnectionWizard(spaceName=''): + def setSyncPathInSyncConnectionWizard(folderName=''): if get_config('ocis'): - SyncConnectionWizard.setSyncPathInSyncConnectionWizardOcis(spaceName) + SyncConnectionWizard.setSyncPathInSyncConnectionWizardOcis(folderName) else: - SyncConnectionWizard.setSyncPathInSyncConnectionWizardOc10() + SyncConnectionWizard.setSyncPathInSyncConnectionWizardOc10(folderName) @staticmethod def nextStep(): diff --git a/test/gui/shared/steps/file_context.py b/test/gui/shared/steps/file_context.py index 7547223f906..a8c604b0a72 100644 --- a/test/gui/shared/steps/file_context.py +++ b/test/gui/shared/steps/file_context.py @@ -18,6 +18,9 @@ can_write, read_file_content, ) +from helpers.SetupClientHelper import ( + getTempResourcePath, +) def folderExists(folderPath, timeout=1000): @@ -263,15 +266,23 @@ def step(context, username): writeFile(file, '') +@Given('the user has created a folder "|any|" in temp folder') +def step(context, folderName): + createFolder(folderName, isTempFolder=True) + + @Given( - 'the user has created a folder "|any|" with "|any|" files each of size "|any|" bytes in temp folder' + 'the user has created "|any|" files each of size "|any|" bytes inside folder "|any|" in temp folder' ) -def step(context, foldername, filenumber, filesize): - createFolder(foldername, isTempFolder=True) - filesize = builtins.int(filesize) - for i in range(0, builtins.int(filenumber)): - filename = f"file{i}.txt" - createFileWithSize(join(foldername, filename), filesize, True) +def step(context, fileNumber, fileSize, folderName): + currentSyncPath = getTempResourcePath(folderName) + if folderExists(currentSyncPath): + fileSize = builtins.int(fileSize) + for i in range(0, builtins.int(fileNumber)): + fileName = f"file{i}.txt" + createFileWithSize(join(currentSyncPath, fileName), fileSize, True) + else: + raise Exception(f"Folder '{folderName}' does not exist in the temp folder") @When( diff --git a/test/gui/shared/steps/sync_context.py b/test/gui/shared/steps/sync_context.py index 9890d982875..173b5509cc6 100644 --- a/test/gui/shared/steps/sync_context.py +++ b/test/gui/shared/steps/sync_context.py @@ -158,6 +158,13 @@ def step(context): SyncConnectionWizard.setSyncPathInSyncConnectionWizard() +@When( + 'the user sets the temp folder "|any|" as local sync path in sync connection wizard' +) +def step(context, folderName): + SyncConnectionWizard.setSyncPathInSyncConnectionWizard(folderName) + + @When('the user selects "|any|" as a remote destination folder') def step(context, folderName): SyncConnectionWizard.selectRemoteDestinationFolder(folderName) diff --git a/test/gui/tst_syncing/test.feature b/test/gui/tst_syncing/test.feature index 9e964562fda..fa36a6fac22 100644 --- a/test/gui/tst_syncing/test.feature +++ b/test/gui/tst_syncing/test.feature @@ -343,8 +343,10 @@ Feature: Syncing files Scenario: Syncing folders each having 500 files - Given the user has created a folder "folder1" with "500" files each of size "1048576" bytes in temp folder - And the user has created a folder "folder2" with "500" files each of size "1048576" bytes in temp folder + Given the user has created a folder "folder1" in temp folder + And the user has created "500" files each of size "1048576" bytes inside folder "folder1" in temp folder + And the user has created a folder "folder2" in temp folder + And the user has created "500" files each of size "1048576" bytes inside folder "folder2" in temp folder And user "Alice" has set up a client with default settings When user "Alice" moves folder "folder1" from the temp folder into the sync folder And user "Alice" moves folder "folder2" from the temp folder into the sync folder @@ -383,3 +385,23 @@ Feature: Syncing files And as "Alice" folder "folder2" should exist in the server And as "Alice" the file "file1.txt" should have the content "Test file1" in the server And as "Alice" the file "file2.txt" should have the content "Test file2" in the server + + + @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 "~test%" in the server + And the user has created a folder "~`!@#$^&()-_=+{[}];',)PRN%" in temp folder + And the user has started the client + And the user has added the following account information: + | server | %local_server% | + | user | Alice | + | password | 1234 | + When the user selects manual sync folder option in advanced section + And the user sets the temp folder "~`!@#$^&()-_=+{[}];',)PRN%" as local sync path in sync connection wizard + And the user selects "ownCloud" as a remote destination folder + And the user selects the following folders to sync: + | folder | + | ~`!@#$^&()-_=+{[}];',) | + Then the folder "~`!@#$^&()-_=+{[}];',)" should exist on the file system + But the folder "~test%" should not exist on the file system