Skip to content

Commit

Permalink
test(gui): unskip long path scenario
Browse files Browse the repository at this point in the history
  • Loading branch information
saw-jan committed Mar 27, 2024
1 parent f24d9f2 commit a8033a5
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 11 deletions.
5 changes: 3 additions & 2 deletions test/gui/shared/scripts/bdd_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
isLinux,
)
from helpers.api.utils import url_join
from helpers.FilesHelper import prefix_namespace
from datetime import datetime
from pageObjects.Toolbar import Toolbar
from pageObjects.AccountSetting import AccountSetting
Expand Down Expand Up @@ -235,9 +236,9 @@ def teardown_client():
test.log("Deleting: " + entry.name)
try:
if entry.is_file() or entry.is_symlink():
os.unlink(entry.path)
os.unlink(prefix_namespace(entry.path))
elif entry.is_dir():
shutil.rmtree(entry.path)
shutil.rmtree(prefix_namespace(entry.path))
except Exception as e:
test.log(f'Failed to delete{entry.name}. Reason: {e}.')

Expand Down
13 changes: 11 additions & 2 deletions test/gui/shared/scripts/helpers/FilesHelper.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,23 @@ def buildConflictedRegex(filename):
namepart,
extpart,
)
else:
return '%s \(conflicted copy \d{4}-\d{2}-\d{2} \d{6}\)' % (filename)
return '%s \(conflicted copy \d{4}-\d{2}-\d{2} \d{6}\)' % (filename)


def sanitizePath(path):
return path.replace('//', '/')


def prefix_namespace(path):
if isWindows():
# https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file?redirectedfrom=MSDN#win32-file-namespaces
# disable string parsing
# - long path
# - trailing whitespaces
return '\\\\?\\' + path
return path


def can_read(resource):
can_read = False
try:
Expand Down
10 changes: 5 additions & 5 deletions test/gui/shared/steps/file_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
read_file_content,
is_empty_sync_folder,
get_size_in_bytes,
prefix_namespace,
)
from helpers.SetupClientHelper import (
getTempResourcePath,
Expand Down Expand Up @@ -46,7 +47,7 @@ def createFolder(foldername, username=None, isTempFolder=False):
folder_path = join(get_config('tempFolderPath'), foldername)
else:
folder_path = getResourcePath(foldername, username)
os.makedirs(folder_path)
os.makedirs(prefix_namespace(folder_path))


def renameFileFolder(source, destination):
Expand All @@ -60,13 +61,13 @@ def createFileWithSize(filename, filesize, isTempFolder=False):
file = join(get_config('tempFolderPath'), filename)
else:
file = getResourcePath(filename)
with open(file, "wb") as f:
with open(prefix_namespace(file), "wb") as f:
f.seek(get_size_in_bytes(filesize) - 1)
f.write(b'\0')


def writeFile(resource, content):
f = open(resource, "w")
f = open(prefix_namespace(resource), "w")
f.write(content)
f.close()

Expand Down Expand Up @@ -100,8 +101,7 @@ def addCopySuffix(resource_path, resource_type):
if resource_type == "file":
source_dir = resource_path.rsplit('.', 1)
return source_dir[0] + " - Copy." + source_dir[-1]
else:
return resource_path + " - Copy"
return resource_path + " - Copy"


@When(
Expand Down
4 changes: 2 additions & 2 deletions test/gui/tst_syncing/test.feature
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ Feature: Syncing files
And as "Alice" folder "Folder1/subFolder1/subFolder2" should exist in the server

@skipOnWindows
Scenario: Filenames that are rejected by the server are reported
Scenario: Filenames that are rejected by the server are reported (Liux only)
Given user "Alice" has created folder "Folder1" in the server
And user "Alice" has set up a client with default settings
When user "Alice" creates a file "Folder1/a\\a.txt" with the following content inside the sync folder
Expand All @@ -266,7 +266,7 @@ Feature: Syncing files
Then the file "Folder1/a\\a.txt" should exist on the file system
And the file "Folder1/a\\a.txt" should be blacklisted

@skipOnWindows

Scenario Outline: Sync long nested folder
Given user "Alice" has created folder "<foldername>" in the server
And user "Alice" has set up a client with default settings
Expand Down

0 comments on commit a8033a5

Please sign in to comment.