Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[tests-only] [full-ci] Add test coverage to copy and paste virtual file in same location #11530

Merged
merged 1 commit into from
Feb 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions test/gui/shared/steps/file_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,14 @@ def extractZip(zip_file_path, destination_dir):
zipFile.extractall(destination_dir)


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"


@When(
'user "|any|" creates a file "|any|" with the following content inside the sync folder'
)
Expand Down Expand Up @@ -123,12 +131,14 @@ def step(context, username, filename, filesize):

@When(r'the user copies the (file|folder) "([^"]*)" to "([^"]*)"', regexp=True)
def step(context, resource_type, source_dir, destination_dir):
source_dir = getResourcePath(source_dir)
destination_dir = getResourcePath(destination_dir)
source = getResourcePath(source_dir)
destination = getResourcePath(destination_dir)
if source == destination and destination_dir != '/':
destination = addCopySuffix(source, resource_type)
if resource_type == 'folder':
return shutil.copytree(source_dir, destination_dir)
return shutil.copytree(source, destination)
else:
return shutil.copy2(source_dir, destination_dir)
return shutil.copy2(source, destination)


@When(r'the user renames a (?:file|folder) "([^"]*)" to "([^"]*)"', regexp=True)
Expand Down
7 changes: 7 additions & 0 deletions test/gui/tst_vfs/test.feature
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,26 @@ Feature: Enable/disable virtual file support
Given user "Alice" has been created on the server with default attributes and without skeleton files
And user "Alice" has uploaded file with content "sample file" to "sampleFile.txt" in the server
And user "Alice" has uploaded file with content "lorem file" to "lorem.txt" in the server
And user "Alice" has uploaded file with content "test file" to "testFile.txt" in the server
And user "Alice" has created folder "Folder" in the server
And user "Alice" has set up a client with default settings
Then the placeholder of file "lorem.txt" should exist on the file system
And the placeholder of file "sampleFile.txt" should exist on the file system
And the placeholder of file "testFile.txt" should exist on the file system
When user "Alice" copies file "sampleFile.txt" to temp folder
And the user copies the file "lorem.txt" to "Folder"
And the user copies the file "testFile.txt" to "testFile.txt"
And the user waits for file "Folder/lorem.txt" to be synced
Then the file "sampleFile.txt" should be downloaded
And the file "Folder/lorem.txt" should be downloaded
And the file "lorem.txt" should be downloaded
And the file "testFile.txt" should be downloaded
And the file "testFile - Copy.txt" should be downloaded
And as "Alice" file "Folder/lorem.txt" should exist in the server
And as "Alice" file "lorem.txt" should exist in the server
And as "Alice" file "sampleFile.txt" should exist in the server
And as "Alice" file "testFile.txt" should exist in the server
And as "Alice" file "testFile - Copy.txt" should exist in the server


Scenario: Move virtual file
Expand Down
Loading