From 7d36611be241171799b372af70941f07fe27a3d7 Mon Sep 17 00:00:00 2001 From: Asmitapaudel Date: Fri, 12 Jun 2026 10:05:44 +0545 Subject: [PATCH] test(gui): port sync resources to appium --- .../features/sync-resources/syncResources.feature | 12 ++++++------ test/gui/pageObjects/SyncConnectionWizard.py | 5 ++--- test/gui/steps/file_context.py | 15 ++++++--------- test/gui/steps/server_context.py | 11 +++-------- test/gui/steps/sync_context.py | 2 +- 5 files changed, 18 insertions(+), 27 deletions(-) diff --git a/test/gui/features/sync-resources/syncResources.feature b/test/gui/features/sync-resources/syncResources.feature index 619b67507..b8f7d4eba 100644 --- a/test/gui/features/sync-resources/syncResources.feature +++ b/test/gui/features/sync-resources/syncResources.feature @@ -393,7 +393,7 @@ Feature: Syncing files And the user waits for file "newfile.txt" to be synced Then as "Alice" file "newfile.txt" should exist in the server - @skip + 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 @@ -403,7 +403,7 @@ Feature: Syncing files And the user waits for file "file with space.txt" to be synced Then as "Alice" file "file with space.txt" should exist in the server - @skip + Scenario: Syncing folders each having large number of files 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 @@ -438,7 +438,7 @@ Feature: Syncing files And for user "Alice" sync folder "Personal" should not be displayed And for user "Alice" sync folder "Shares" should not be displayed - @skip + Scenario: extract a zip file in the sync folder Given the user has created a zip file "archive.zip" with the following resources in the temp folder | resource | type | content | @@ -456,7 +456,7 @@ Feature: Syncing files And as "Alice" the file "file2.txt" should have the content "Test file2" in the server - @skipOnWindows @skip + @skipOnWindows 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 "simple-folder" in the server @@ -503,7 +503,7 @@ Feature: Syncing files And the folder "simple-folder" should exist on the file system And as "Alice" folder "simple-folder" should exist in the server - @skip + Scenario: Sync a received shared folder with Viewer permission role Given user "Brian" has been created in the server with default attributes And user "Alice" has created folder "simple-folder" in the server @@ -547,7 +547,7 @@ Feature: Syncing files | filename | | 𒁰𒁱𒁲𒁳𒁴𒁵𒁶𒁷𒁸𒁹𒁺𒁻𒁼𒁾𒁿𒁰𒁱𒁲𒁳𒁴𒁵𒁶𒁷𒁸𒁹𒁺𒁻𒁼𒁾𒁿𒁰𒁱𒁲𒁳𒁴𒁵𒁶𒁷𒁸𒁹𒁺abôǣฎพฒฆ๘ตกกผพฒณญไใๅำ๊๒๔๗๘รศฬอฮ.txt | - @skip + Scenario: Sync a received shared folder with Editor permission role Given user "Brian" has been created in the server with default attributes And user "Alice" has created folder "simple-folder" in the server diff --git a/test/gui/pageObjects/SyncConnectionWizard.py b/test/gui/pageObjects/SyncConnectionWizard.py index e58917a7b..b20f158fa 100644 --- a/test/gui/pageObjects/SyncConnectionWizard.py +++ b/test/gui/pageObjects/SyncConnectionWizard.py @@ -213,9 +213,8 @@ def select_or_unselect_folders_to_sync(folders, select=True): p_elements = app().find_elements(By.NAME, parent) # select nested folders based on the position of the parent folder for p_element in p_elements: - if ( - p_element.get_attribute("checked") == 'true' - and p_element.rect["x"] > parent_position + if p_element.rect["x"] >= parent_position and ( + select or p_element.get_attribute("checked") == 'true' ): parent_element = p_element parent_position = p_element.rect["x"] diff --git a/test/gui/steps/file_context.py b/test/gui/steps/file_context.py index 80d70b07b..74583e9e0 100644 --- a/test/gui/steps/file_context.py +++ b/test/gui/steps/file_context.py @@ -297,13 +297,13 @@ def step(context, username): wait_and_write_file(file, '') -@Given('the user has created a folder "|any|" in temp folder') +@Given('the user has created a folder "{folder_name}" in temp folder') def step(context, folder_name): create_folder(folder_name, is_temp_folder=True) @Given( - 'the user has created "|any|" files each of size "|any|" bytes inside folder "|any|" in temp folder' + 'the user has created "{file_number}" files each of size "{file_size}" bytes inside folder "{folder_name}" in temp folder' ) def step(context, file_number, file_size, folder_name): current_sync_path = get_temp_resource_path(folder_name) @@ -328,10 +328,7 @@ def step(context, username, file): f.read() -@When( - r'user "([^"]*)" moves (folder|file) "([^"]*)" from the temp folder into the sync folder', - regexp=True, -) +@When(r'user "{username}" moves {resource_type} "{resource_name}" from the temp folder into the sync folder') def step(context, username, resource_type, resource_name): source_dir = join(get_config('tempFolderPath'), resource_name) move_resource(username, resource_type, source_dir, '/', True) @@ -387,12 +384,12 @@ def step(context, user, file_name): @Given( - 'the user has created a zip file "|any|" with the following resources in the temp folder' + 'the user has created a zip file "{zip_file_name}" with the following resources in the temp folder' ) def step(context, zip_file_name): resource_list = [] - for row in context.table[1:]: + for row in context.table: resource_list.append(row[0]) resource = join(get_config('tempFolderPath'), row[0]) if row[1] == 'folder': @@ -405,7 +402,7 @@ def step(context, zip_file_name): create_zip(resource_list, zip_file_name, get_config('tempFolderPath')) -@When('user "|any|" unzips the zip file "|any|" inside the sync root') +@When('user "{username}" unzips the zip file "{zip_file_name}" inside the sync root') def step(context, username, zip_file_name): destination_dir = get_resource_path('/', username) zip_file_path = join(destination_dir, zip_file_name) diff --git a/test/gui/steps/server_context.py b/test/gui/steps/server_context.py index 28513dc46..e323b93a8 100644 --- a/test/gui/steps/server_context.py +++ b/test/gui/steps/server_context.py @@ -32,7 +32,6 @@ def step(context, user_name, resource_type, resource_name): ) def step(context, user_name, resource_type, resource_name): resource_exists = webdav.resource_exists(user_name, resource_name) - with ensure( '{0} "{1}" should exist, but it does not', resource_type.capitalize(), @@ -55,15 +54,11 @@ def step(context, user_name, file_name, content): text_content.should.equal(content) -@Then( - r'as user "([^"].*)" folder "([^"].*)" should contain "([^"].*)" items in the server', - regexp=True, -) +@Then(r'as user "{user_name}" folder "{folder_name}" should contain "{items_number}" items in the server') def step(context, user_name, folder_name, items_number): total_items = webdav.get_folder_items_count(user_name, folder_name) - test.compare( - total_items, items_number, f'Folder should contain {items_number} items' - ) + with ensure(f'Folder should contain {items_number} items'): + total_items.should.equal(items_number) @Given('user "{user}" has created folder "{folder_name}" in the server') diff --git a/test/gui/steps/sync_context.py b/test/gui/steps/sync_context.py index 421ad481b..fdde027a5 100644 --- a/test/gui/steps/sync_context.py +++ b/test/gui/steps/sync_context.py @@ -195,7 +195,7 @@ def step(context): @When( - 'the user sets the temp folder "|any|" as local sync path in sync connection wizard' + 'the user sets the temp folder "{folder_name}" as local sync path in sync connection wizard' ) def step(context, folder_name): sync_path = get_temp_resource_path(folder_name)