Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/owncloud/client.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorsushmita56 <poudelsushmita878@gmail.com>2022-01-28 13:55:29 +0300
committerSawjan Gurung <saw.jan.grg3e@gmail.com>2022-04-19 07:45:18 +0300
commit4b92274d73bd5f403013095b6bcc0951153b8349 (patch)
tree0fc16f8614991667c51bcfab4f7fc925ac0a67ad /test
parent24927143d3924bf37c859a0aad4d6ea00b5bbb3f (diff)
added test for long file name
reword
Diffstat (limited to 'test')
-rw-r--r--test/gui/shared/scripts/bdd_hooks.py11
-rw-r--r--test/gui/shared/scripts/pageObjects/Activity.py10
-rw-r--r--test/gui/shared/steps/steps.py48
-rw-r--r--test/gui/tst_syncing/test.feature61
4 files changed, 124 insertions, 6 deletions
diff --git a/test/gui/shared/scripts/bdd_hooks.py b/test/gui/shared/scripts/bdd_hooks.py
index bcdf2c1a4..b8e8e490c 100644
--- a/test/gui/shared/scripts/bdd_hooks.py
+++ b/test/gui/shared/scripts/bdd_hooks.py
@@ -16,6 +16,7 @@
# See the section 'Performing Actions During Test Execution Via Hooks' in the Squish
# manual for a complete reference of the available API.
import shutil
+from tempfile import gettempdir
import urllib.request
import os
import builtins
@@ -34,18 +35,19 @@ def hook(context):
'middlewareUrl': 'MIDDLEWARE_URL',
'clientConfigFile': 'CLIENT_LOG_FILE',
'clientRootSyncPath': 'CLIENT_ROOT_SYNC_PATH',
+ 'tempFolderPath': 'TEMP_FOLDER_PATH',
}
DEFAULT_CONFIG = {
'localBackendUrl': 'https://localhost:9200/',
'secureLocalBackendUrl': 'https://localhost:9200/',
- 'maxSyncTimeout': 10,
+ 'maxSyncTimeout': 60,
'minSyncTimeout': 5,
'middlewareUrl': 'http://localhost:3000/',
'clientConfigFile': '-',
'clientRootSyncPath': '/tmp/client-bdd/',
+ 'tempFolderPath': gettempdir(),
}
-
# read configs from environment variables
context.userData = {}
for key, value in CONFIG_ENV_MAP.items():
@@ -67,7 +69,7 @@ def hook(context):
context.userData[key] = DEFAULT_CONFIG[key]
elif key == 'maxSyncTimeout' or key == 'minSyncTimeout':
context.userData[key] = builtins.int(value)
- elif key == 'clientRootSyncPath':
+ elif key == 'clientRootSyncPath' or 'tempFolderPath':
# make sure there is always one trailing slash
context.userData[key] = value.rstrip('/') + '/'
@@ -79,6 +81,9 @@ def hook(context):
if not os.path.exists(context.userData['clientRootSyncPath']):
os.makedirs(context.userData['clientRootSyncPath'])
+ if not os.path.exists(context.userData['tempFolderPath']):
+ os.makedirs(context.userData['tempFolderPath'])
+
req = urllib.request.Request(
os.path.join(context.userData['middlewareUrl'], 'init'),
headers={"Content-Type": "application/json"},
diff --git a/test/gui/shared/scripts/pageObjects/Activity.py b/test/gui/shared/scripts/pageObjects/Activity.py
index 518fa7b14..136605c84 100644
--- a/test/gui/shared/scripts/pageObjects/Activity.py
+++ b/test/gui/shared/scripts/pageObjects/Activity.py
@@ -79,3 +79,13 @@ class Activity:
"type": "QModelIndex",
}
)
+
+ def checkAtLeastABlacklistedFile(self):
+ squish.waitForObjectExists(
+ {
+ "column": 6,
+ "container": names.oCC_IssuesWidget_tableView_QTableView,
+ "text": "Blacklisted",
+ "type": "QModelIndex",
+ }
+ )
diff --git a/test/gui/shared/steps/steps.py b/test/gui/shared/steps/steps.py
index 93ded9da8..fe7dc32ee 100644
--- a/test/gui/shared/steps/steps.py
+++ b/test/gui/shared/steps/steps.py
@@ -8,6 +8,7 @@ import re
import urllib.request
import json
import requests
+import builtins
import shutil
from objectmaphelper import RegularExpression
@@ -484,10 +485,14 @@ def step(context, username, foldername):
createFolder(context, foldername, username)
-def createFolder(context, foldername, username=None):
+# To create folders in a temporary directory, we set isTempFolder True
+# And if isTempFolder is True, the createFolder function create folders in tempFolderPath
+def createFolder(context, foldername, username=None, isTempFolder=False):
syncPath = None
- if username:
+ if username and not isTempFolder:
syncPath = getUserSyncPath(context, username)
+ elif isTempFolder:
+ syncPath = context.userData['tempFolderPath']
else:
syncPath = context.userData['currentUserSyncPath']
path = join(syncPath, foldername)
@@ -500,6 +505,21 @@ def renameFileFolder(context, source, destination):
rename(source, destination)
+@When('user "|any|" creates a file "|any|" with size "|any|" inside the sync folder')
+def step(context, username, filename, filesize):
+ createFileWithSize(context, filename, filesize)
+
+
+def createFileWithSize(context, filename, filesize, isTempFolder=False):
+ if isTempFolder:
+ path = context.userData['tempFolderPath']
+ else:
+ path = context.userData['currentUserSyncPath']
+ file = join(path, filename)
+ cmd = "truncate -s {filesize} {file}".format(filesize=filesize, file=file)
+ os.system(cmd)
+
+
@When('the user copies the folder "|any|" to "|any|"')
def step(context, sourceFolder, destinationFolder):
source_dir = join(context.userData['currentUserSyncPath'], sourceFolder)
@@ -688,6 +708,12 @@ def step(context, filename):
activity.checkBlackListedFileExist(filename)
+@When('the user waits until at least a file is blacklisted')
+def step(context):
+ activity = Activity()
+ activity.checkAtLeastABlacklistedFile()
+
+
@When('the user selects "|any|" tab in the activity')
def step(context, tabName):
activity = Activity()
@@ -1419,3 +1445,21 @@ def step(context, username):
filename = syncPath + row[0]
f = open(join(syncPath, filename), "w")
f.close()
+
+
+@Given(
+ 'the user has created a folder "|any|" with "|any|" files each of size "|any|" bytes in temp folder'
+)
+def step(context, foldername, filenumber, filesize):
+ createFolder(context, foldername, isTempFolder=True)
+ filesize = builtins.int(filesize)
+ for i in range(0, builtins.int(filenumber)):
+ filename = f"file{i}.txt"
+ createFileWithSize(context, join(foldername, filename), filesize, True)
+
+
+@When('user "|any|" moves folder "|any|" from the temp folder into the sync folder')
+def step(context, username, foldername):
+ source_dir = join(context.userData['tempFolderPath'], foldername)
+ destination_dir = getUserSyncPath(context, username)
+ shutil.move(source_dir, destination_dir)
diff --git a/test/gui/tst_syncing/test.feature b/test/gui/tst_syncing/test.feature
index 3e32e59d5..e733019e6 100644
--- a/test/gui/tst_syncing/test.feature
+++ b/test/gui/tst_syncing/test.feature
@@ -327,4 +327,63 @@ Feature: Syncing files
And as "Alice" file "testavatar.jpeg" should exist on the server
And as "Alice" file "testaudio.mp3" should exist on the server
And as "Alice" file "test_video.mp4" should exist on the server
- And as "Alice" file "simple.txt" should exist on the server \ No newline at end of file
+ And as "Alice" file "simple.txt" should exist on the server
+
+
+ Scenario Outline: File with long name can be synced
+ Given user "Alice" has set up a client with default settings
+ When user "Alice" creates a file "<filename>" with the following content inside the sync folder
+ """
+ test content
+ """
+ And the user waits for file "<filename>" to be synced
+ Then as "Alice" file "<filename>" should exist on the server
+ Examples:
+ | filename |
+ | thisIsAVeryLongFileNameToCheckThatItWorks-thisIsAVeryLongFileNameToCheckThatItWorks-thisIsAVeryLongFileNameToCheckThatItWorks-thisIsAVeryLongFileNameToCheckThatItWorks-thisIsAVeryLongFileNameToCheckThatItWorks-thisIs.txt |
+
+
+ Scenario Outline: File with long name (>228 characters) is blacklisted
+ Given user "Alice" has set up a client with default settings
+ When user "Alice" creates a file "<filename>" with the following content inside the sync folder
+ """
+ test contents
+ """
+ And the user clicks on the activity tab
+ And the user selects "Not Synced" tab in the activity
+ And the user waits until at least a file is blacklisted
+ Then the file "<filename>" should be blacklisted
+ Examples:
+ | filename |
+ | aQuickBrownFoxJumpsOverAVeryLazyDog-aQuickBrownFoxJumpsOverAVeryLazyDog-aQuickBrownFoxJumpsOverAVeryLazyDog-aQuickBrownFoxJumpsOverAVeryLazyDog-aQuickBrownFoxJumpsOverAVeryLazyDog-aQuickBrownFoxJumpsOverAVeryLazyDog-aQuickBro.txt |
+
+
+ Scenario: Syncing file of 1 GB size
+ Given user "Alice" has set up a client with default settings
+ When user "Alice" creates a file "newfile.txt" with size "1GB" inside the sync folder
+ And the user waits for file "newfile.txt" to be synced
+ Then as "Alice" file "newfile.txt" should exist on the server
+
+
+ Scenario: File with spaces in the name can sync
+ Given user "Alice" has set up a client with default settings
+ When user "Alice" creates a file "file with space.txt" with the following content inside the sync folder
+ """
+ test contents
+ """
+ And the user waits for file "file with space.txt" to be synced
+ Then as "Alice" file "file with space.txt" should exist on the server
+
+
+ Scenario: Syncing folders each having 500 files
+ Given user "Alice" has set up a client with default settings
+ And 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
+ 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
+ And the user waits for folder "folder1" to be synced
+ And the user waits for folder "folder2" to be synced
+ Then as "Alice" folder "folder1" should exist on the server
+ And as user "Alice" folder "folder1" should contain "500" items on the server
+ And as "Alice" folder "folder2" should exist on the server
+ And as user "Alice" folder "folder2" should contain "500" items on the server \ No newline at end of file