diff --git a/test/gui/shared/steps/file_context.py b/test/gui/shared/steps/file_context.py index 3ca54a682..dc2f148a3 100644 --- a/test/gui/shared/steps/file_context.py +++ b/test/gui/shared/steps/file_context.py @@ -9,7 +9,7 @@ from helpers.SetupClientHelper import get_resource_path, get_temp_resource_path from helpers.SyncHelper import wait_for_client_to_be_ready, listen_sync_status_for_item -from helpers.ConfigHelper import get_config +from helpers.ConfigHelper import get_config, is_windows from helpers.FilesHelper import ( build_conflicted_regex, sanitize_path, @@ -97,26 +97,27 @@ def extract_zip(zip_file_path, destination_dir): def add_copy_suffix(resource_path, resource_type): + suffix = ' (Copy)' if resource_type == 'file': source_dir = resource_path.rsplit('.', 1) - return source_dir[0] + ' - Copy.' + source_dir[-1] - return resource_path + ' - Copy' + return source_dir[0] + suffix + '.' + source_dir[-1] + return resource_path + suffix def copy_resource(resource_type, source, destination, from_files_for_upload=False): if from_files_for_upload: - source_dir = get_file_for_upload(source) + source = get_file_for_upload(source) else: - source_dir = get_resource_path(source) - destination_dir = get_resource_path(destination) - if source_dir == destination_dir and destination_dir != '/': - destination_dir = add_copy_suffix(source, resource_type) + source = get_resource_path(source) + destination = get_resource_path(destination) + if source == destination and destination != '/': + destination = add_copy_suffix(source, resource_type) wait_for_client_to_be_ready() - listen_sync_status_for_item(destination_dir, resource_type) + listen_sync_status_for_item(destination, resource_type) if resource_type == 'folder': - return shutil.copytree(source_dir, destination_dir) - return shutil.copy2(source_dir, destination_dir) + return shutil.copytree(source, destination) + return shutil.copy2(source, destination) def move_resource(username, resource_type, source, destination, is_temp_folder=False): @@ -164,9 +165,14 @@ def step(context, _, filename, filesize): create_file_with_size(filename, filesize) -@When(r'the user copies the (file|folder) "([^"]*)" to "([^"]*)"', regexp=True) -def step(context, resource_type, file_name, destination): - copy_resource(resource_type, file_name, destination, False) +@When(r'the user copies (file|folder) "([^"]*)" into folder "([^"]*)"', regexp=True) +def step(context, resource_type, resource_name, destination_dir): + copy_resource(resource_type, resource_name, destination_dir, False) + + +@When(r'the user copies (file|folder) "([^"]*)" into the same folder', regexp=True) +def step(context, resource_type, resource_name): + copy_resource(resource_type, resource_name, resource_name, False) @When(r'the user renames a (?:file|folder) "([^"]*)" to "([^"]*)"', regexp=True) @@ -298,6 +304,16 @@ def step(context, file_number, file_size, folder_name): ) +@When( + r'user "([^"]*)" reads the content of file "([^"]*)"', + regexp=True, +) +def step(context, username, file): + file_path = get_resource_path(file, username) + with open(file_path, 'r') as f: + f.read() + + @When( r'user "([^"]*)" moves (folder|file) "([^"]*)" from the temp folder into the sync folder', regexp=True, @@ -307,6 +323,15 @@ def step(context, username, resource_type, resource_name): move_resource(username, resource_type, source_dir, '/', True) +@When( + r'user "([^"]*)" moves (folder|file) "([^"]*)" to the temp folder', + regexp=True, +) +def step(context, username, resource_type, resource_name): + destination= join(get_config('tempFolderPath'), resource_name) + move_resource(username, resource_type, resource_name, destination) + + @When( r'user "([^"]*)" moves (file|folder) "([^"]*)" to "([^"]*)" in the sync folder', regexp=True, diff --git a/test/gui/shared/steps/vfs_context.py b/test/gui/shared/steps/vfs_context.py index febd6c521..9655a7079 100644 --- a/test/gui/shared/steps/vfs_context.py +++ b/test/gui/shared/steps/vfs_context.py @@ -2,7 +2,7 @@ from helpers.SetupClientHelper import get_resource_path -@Then('the placeholder of file "|any|" should exist on the file system') +@Then('the placeholder file "|any|" should exist on the file system') def step(context, file_name): resource_path = get_resource_path(file_name) size_on_disk = get_file_size_on_disk(resource_path) diff --git a/test/gui/tst_syncing/test.feature b/test/gui/tst_syncing/test.feature index aebe81a11..d79b8ef3f 100644 --- a/test/gui/tst_syncing/test.feature +++ b/test/gui/tst_syncing/test.feature @@ -243,12 +243,12 @@ Feature: Syncing files """ test content """ - And the user copies the folder "original" to "copied" - And the user waits for folder "copied" to be synced + And the user copies folder "original" into the same folder + And the user waits for folder "original (Copy)" to be synced Then as "Alice" folder "original" should exist in the server And as "Alice" the file "original/localFile.txt" should have the content "test content" in the server - And as "Alice" folder "copied" should exist in the server - And as "Alice" the file "copied/localFile.txt" should have the content "test content" in the server + And as "Alice" folder "original (Copy)" should exist in the server + And as "Alice" the file "original (Copy)/localFile.txt" should have the content "test content" in the server @issue-9281 Scenario: Verify that you can create a subfolder with long name(~220 characters) diff --git a/test/gui/tst_vfs/test.feature b/test/gui/tst_vfs/test.feature index 6961f8663..70b35acb2 100644 --- a/test/gui/tst_vfs/test.feature +++ b/test/gui/tst_vfs/test.feature @@ -1,37 +1,50 @@ @skipOnLinux -Feature: Enable/disable virtual file support +Feature: VFS support As a user - I want to enable virtual file support - So that I can synchronize virtual files with local folder + I want to sync files with vfs + So that I can decide which files to download - Scenario: Copy and paste virtual file + Scenario: Default VFS sync + Given user "Alice" has been created in the server with default attributes + And user "Alice" has uploaded file with content "openCloud" to "testFile.txt" in the server + And user "Alice" has created folder "parent" in the server + And user "Alice" has uploaded file with content "some contents" to "parent/lorem.txt" in the server + And user "Alice" has set up a client with default settings + Then the placeholder file "testFile.txt" should exist on the file system + And the placeholder file "parent/lorem.txt" should exist on the file system + When user "Alice" reads the content of file "parent/lorem.txt" + Then the file "parent/lorem.txt" should be downloaded + And the placeholder file "testFile.txt" should exist on the file system + + + Scenario: Copy placeholder file Given user "Alice" has been created in the server with default attributes 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 + Then the placeholder file "lorem.txt" should exist on the file system + And the placeholder file "sampleFile.txt" should exist on the file system + And the placeholder 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 copies file "lorem.txt" into folder "Folder" + And the user copies file "testFile.txt" into the same folder 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 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 + And as "Alice" file "testFile (Copy).txt" should exist in the server - Scenario: Move virtual file + Scenario: Move placeholder file Given user "Alice" has been created in the server with default attributes And user "Alice" has uploaded file with content "lorem file" to "lorem.txt" in the server And user "Alice" has uploaded file with content "some contents" to "sampleFile.txt" in the server @@ -40,7 +53,7 @@ Feature: Enable/disable virtual file support When user "Alice" moves file "lorem.txt" to "Folder" in the sync folder And user "Alice" moves file "sampleFile.txt" to the temp folder And the user waits for file "Folder/lorem.txt" to be synced - Then the placeholder of file "Folder/lorem.txt" should exist on the file system + Then the placeholder file "Folder/lorem.txt" should exist on the file system And as "Alice" file "Folder/lorem.txt" should exist in the server And as "Alice" file "lorem.txt" should not exist in the server And as "Alice" file "sampleFile.txt" should not exist in the server