Skip to content

Commit

Permalink
add test for manually syncing remote folder with special character (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Salipa-Gurung authored Oct 26, 2023
1 parent 5fbbc7b commit 265321b
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 18 deletions.
4 changes: 4 additions & 0 deletions test/gui/shared/scripts/helpers/SetupClientHelper.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ def getResourcePath(resource='', user='', space=''):
)


def getTempResourcePath(resourceName):
return join(get_config('tempFolderPath'), resourceName)


def getCurrentUserSyncPath():
return get_config('currentUserSyncPath')

Expand Down
27 changes: 18 additions & 9 deletions test/gui/shared/scripts/pageObjects/SyncConnectionWizard.py
Original file line number Diff line number Diff line change
@@ -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


Expand Down Expand Up @@ -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():
Expand Down
25 changes: 18 additions & 7 deletions test/gui/shared/steps/file_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
can_write,
read_file_content,
)
from helpers.SetupClientHelper import (
getTempResourcePath,
)


def folderExists(folderPath, timeout=1000):
Expand Down Expand Up @@ -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(
Expand Down
7 changes: 7 additions & 0 deletions test/gui/shared/steps/sync_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
26 changes: 24 additions & 2 deletions test/gui/tst_syncing/test.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

0 comments on commit 265321b

Please sign in to comment.