From b9c05b8ce298ee77766d8c1cd536d2a151fbd6d8 Mon Sep 17 00:00:00 2001 From: Prajwol Amatya <83579989+PrajwolAmatya@users.noreply.github.com> Date: Wed, 3 Jul 2024 09:10:27 +0545 Subject: [PATCH] add gui test to remove folder sync connection (#11725) --- test/gui/shared/scripts/names.py | 1 + .../scripts/pageObjects/SyncConnection.py | 30 +++++++++++++++++++ test/gui/shared/steps/account_context.py | 5 ++++ test/gui/shared/steps/sync_context.py | 16 ++++++++++ test/gui/tst_syncing/test.feature | 13 +++++++- 5 files changed, 64 insertions(+), 1 deletion(-) diff --git a/test/gui/shared/scripts/names.py b/test/gui/shared/scripts/names.py index 6794a0d80bf..b11d842a3e5 100644 --- a/test/gui/shared/scripts/names.py +++ b/test/gui/shared/scripts/names.py @@ -54,3 +54,4 @@ create_Remote_Folder_QInputDialog = {"type": "QInputDialog", "unnamed": 1, "visible": 1, "windowTitle": "Create Remote Folder"} create_Remote_Folder_Enter_the_name_of_the_new_folder_to_be_created_below_QLabel = {"text": "Enter the name of the new folder to be created below '/':", "type": "QLabel", "unnamed": 1, "visible": 1, "window": create_Remote_Folder_QInputDialog} groupBox_folderTreeWidget_QTreeWidget = {"container": add_Folder_Sync_Connection_groupBox_QGroupBox, "name": "folderTreeWidget", "type": "QTreeWidget", "visible": 1} +confirm_Folder_Sync_Connection_Removal_QMessageBox = {"type": "QMessageBox", "unnamed": 1, "visible": 1, "windowTitle": "Confirm Folder Sync Connection Removal"} diff --git a/test/gui/shared/scripts/pageObjects/SyncConnection.py b/test/gui/shared/scripts/pageObjects/SyncConnection.py index 568f06f4111..318d92a8985 100644 --- a/test/gui/shared/scripts/pageObjects/SyncConnection.py +++ b/test/gui/shared/scripts/pageObjects/SyncConnection.py @@ -39,6 +39,20 @@ class SyncConnection: "type": "QPushButton", "visible": 1, } + CANCEL_FOLDER_SYNC_CONNECTION_DIALOG = { + "text": "Cancel", + "type": "QPushButton", + "unnamed": 1, + "visible": 1, + "window": names.confirm_Folder_Sync_Connection_Removal_QMessageBox, + } + REMOVE_FOLDER_SYNC_CONNECTION_BUTTON = { + "text": "Remove Folder Sync Connection", + "type": "QPushButton", + "unnamed": 1, + "visible": 1, + "window": names.confirm_Folder_Sync_Connection_Removal_QMessageBox, + } @staticmethod def openMenu(): @@ -122,3 +136,19 @@ def unselect_folder_in_selective_sync(folder_name): @staticmethod def get_folder_connection_count(): return squish.waitForObject(SyncConnection.FOLDER_SYNC_CONNECTION_LIST).count + + @staticmethod + def remove_folder_sync_connection(): + SyncConnection.performAction("Remove folder sync connection") + + @staticmethod + def cancel_folder_sync_connection_removal(): + squish.clickButton( + squish.waitForObject(SyncConnection.CANCEL_FOLDER_SYNC_CONNECTION_DIALOG) + ) + + @staticmethod + def confirm_folder_sync_connection_removal(): + squish.clickButton( + squish.waitForObject(SyncConnection.REMOVE_FOLDER_SYNC_CONNECTION_BUTTON) + ) diff --git a/test/gui/shared/steps/account_context.py b/test/gui/shared/steps/account_context.py index 709514a8e38..ebedaf09da6 100644 --- a/test/gui/shared/steps/account_context.py +++ b/test/gui/shared/steps/account_context.py @@ -277,6 +277,11 @@ def step(context): SyncConnectionWizard.cancelFolderSyncConnectionWizard() +@Then("the sync folder list should be empty") +def step(context): + test.vp("empty_sync_connection") + + @When('user "|any|" logs out from the login required dialog') def step(context, username): EnterPassword.logout() diff --git a/test/gui/shared/steps/sync_context.py b/test/gui/shared/steps/sync_context.py index 812eeffc10c..7431b4942cd 100644 --- a/test/gui/shared/steps/sync_context.py +++ b/test/gui/shared/steps/sync_context.py @@ -271,3 +271,19 @@ def step(context, folder_name, selected): SyncConnectionWizard.is_remote_folder_selected(folder_selector), "Folder should be selected", ) + + +@When('the user selects remove folder sync connection option') +def step(context): + SyncConnection.remove_folder_sync_connection() + + +@When('the user cancels the folder sync connection removal dialog') +def step(context): + SyncConnection.cancel_folder_sync_connection_removal() + + +@When('the user removes the folder sync connection') +def step(context): + SyncConnection.remove_folder_sync_connection() + SyncConnection.confirm_folder_sync_connection_removal() diff --git a/test/gui/tst_syncing/test.feature b/test/gui/tst_syncing/test.feature index e6a679d7081..60231a51b84 100644 --- a/test/gui/tst_syncing/test.feature +++ b/test/gui/tst_syncing/test.feature @@ -435,7 +435,7 @@ Feature: Syncing files When the user selects manual sync folder option in advanced section And the user cancels the sync connection wizard Then the account with displayname "Alice Hansen" and host "%local_server_hostname%" should be displayed - And the sync folder should not be added + And the sync folder list should be empty Scenario: extract a zip file in the sync folder @@ -486,3 +486,14 @@ Feature: Syncing files Then the folder "simple-folder" should not exist on the file system And the folder "test-folder/sub-folder2" should exist on the file system And the folder "test-folder/sub-folder1" should not exist on the file system + + + Scenario: remove folder sync connection + Given user "Alice" has created folder "simple-folder" in the server + And user "Alice" has set up a client with default settings + When the user selects remove folder sync connection option + And the user cancels the folder sync connection removal dialog + And the user removes the folder sync connection + Then the sync folder list should be empty + And the folder "simple-folder" should exist on the file system + And as "Alice" folder "simple-folder" should exist in the server