diff --git a/test/gui/shared/scripts/helpers/SetupClientHelper.py b/test/gui/shared/scripts/helpers/SetupClientHelper.py index 665d785f8a5..7399a29db1b 100644 --- a/test/gui/shared/scripts/helpers/SetupClientHelper.py +++ b/test/gui/shared/scripts/helpers/SetupClientHelper.py @@ -127,6 +127,7 @@ def setUpClient(username, displayName, space="Personal"): 0/url={local_server} 0/user={displayUserFirstName} 0/version=1 + 0/supportsSpaces={supportsSpaces} version=2 ''' @@ -154,6 +155,7 @@ def setUpClient(username, displayName, space="Personal"): 'local_server': server_url, 'oauth': 'true' if is_ocis else 'false', 'vfs': 'wincfapi' if isWindows() else 'off', + 'supportsSpaces': 'true' if is_ocis else 'false', } userSetting = userSetting.format(**args) diff --git a/test/gui/shared/scripts/names.py b/test/gui/shared/scripts/names.py index bf6296724c8..43cbd3eacfd 100644 --- a/test/gui/shared/scripts/names.py +++ b/test/gui/shared/scripts/names.py @@ -49,3 +49,6 @@ o_folderList_Personal_QModelIndex = {"column": 0, "container": stack_folderList_QTreeView, "text": "Personal", "type": "QModelIndex"} add_Folder_Sync_Connection_tableView_QTableView = {"name": "tableView","type": "QTableView","visible": 1,"window": add_Folder_Sync_Connection_OCC_FolderWizard} stack_scrollArea_QScrollArea = {"container": settings_stack_QStackedWidget, "name": "scrollArea", "type": "QScrollArea", "visible": 1} +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} diff --git a/test/gui/shared/scripts/pageObjects/SyncConnectionWizard.py b/test/gui/shared/scripts/pageObjects/SyncConnectionWizard.py index 14c2edb11a7..e71193d0de3 100644 --- a/test/gui/shared/scripts/pageObjects/SyncConnectionWizard.py +++ b/test/gui/shared/scripts/pageObjects/SyncConnectionWizard.py @@ -1,5 +1,6 @@ import names import squish +import object from os import path from helpers.SetupClientHelper import ( getCurrentUserSyncPath, @@ -21,11 +22,17 @@ class SyncConnectionWizard: "visible": 1, "window": names.add_Folder_Sync_Connection_OCC_FolderWizard, } - NEXT_BUTTON = { - "name": "__qt__passive_wizardbutton1", + BACK_BUTTON = { + "window": names.add_Folder_Sync_Connection_OCC_FolderWizard, "type": "QPushButton", + "text": "< &Back", "visible": 1, + } + NEXT_BUTTON = { "window": names.add_Folder_Sync_Connection_OCC_FolderWizard, + "type": "QPushButton", + "text": "&Next >", + "visible": 1, } SELECTIVE_SYNC_ROOT_FOLDER = { "column": 0, @@ -75,6 +82,37 @@ class SyncConnectionWizard: "container": names.add_Folder_Sync_Connection_tableView_QTableView, "type": "QModelIndex", } + CREATE_REMOTE_FOLDER_BUTTON = { + "container": names.add_Folder_Sync_Connection_groupBox_QGroupBox, + "name": "addFolderButton", + "type": "QPushButton", + "visible": 1, + } + CREATE_REMOTE_FOLDER_INPUT = { + "buddy": names.create_Remote_Folder_Enter_the_name_of_the_new_folder_to_be_created_below_QLabel, + "type": "QLineEdit", + "unnamed": 1, + "visible": 1, + } + CREATE_REMOTE_FOLDER_CONFIRM_BUTTON = { + "text": "OK", + "type": "QPushButton", + "unnamed": 1, + "visible": 1, + "window": names.create_Remote_Folder_QInputDialog, + } + REFRESH_BUTTON = { + "container": names.add_Folder_Sync_Connection_groupBox_QGroupBox, + "name": "refreshButton", + "type": "QPushButton", + "visible": 1, + } + REMOTE_FOLDER_SELECTION_INPUT = { + "name": "folderEntry", + "type": "QLineEdit", + "visible": 1, + "window": names.add_Folder_Sync_Connection_OCC_FolderWizard, + } @staticmethod def setSyncPathInSyncConnectionWizardOc10(sync_path=''): @@ -101,6 +139,10 @@ def setSyncPathInSyncConnectionWizard(sync_path=''): def nextStep(): squish.clickButton(squish.waitForObject(SyncConnectionWizard.NEXT_BUTTON)) + @staticmethod + def back(): + squish.clickButton(squish.waitForObject(SyncConnectionWizard.BACK_BUTTON)) + @staticmethod def selectRemoteDestinationFolder(folder): squish.mouseClick( @@ -251,3 +293,60 @@ def syncSpace(spaceName): path.join(getCurrentUserSyncPath(), spaceName) ) SyncConnectionWizard.addSyncConnection() + + @staticmethod + def create_folder_in_remote_destination(folder_name): + squish.clickButton( + squish.waitForObject(SyncConnectionWizard.CREATE_REMOTE_FOLDER_BUTTON) + ) + squish.type( + squish.waitForObject(SyncConnectionWizard.CREATE_REMOTE_FOLDER_INPUT), + folder_name, + ) + squish.clickButton( + squish.waitForObject( + SyncConnectionWizard.CREATE_REMOTE_FOLDER_CONFIRM_BUTTON + ) + ) + + @staticmethod + def refresh_remote(): + squish.clickButton(squish.waitForObject(SyncConnectionWizard.REFRESH_BUTTON)) + + @staticmethod + def generate_remote_folder_selector(folder_name, parent_container=None): + if not parent_container: + parent_container = { + "container": names.groupBox_folderTreeWidget_QTreeWidget, + "text": "ownCloud", + "type": "QModelIndex", + } + return { + "container": parent_container, + "text": folder_name, + "type": "QModelIndex", + } + + @staticmethod + def has_remote_folder(folder_name): + folder_tree = folder_name.strip("/").split("/") + parent_container = None + + for folder in folder_tree: + folder_selector = SyncConnectionWizard.generate_remote_folder_selector( + folder, parent_container + ) + try: + if parent_container: + squish.doubleClick(parent_container) + + squish.waitForObject(folder_selector) + + parent_container = folder_selector + except: + return False, None + return True, parent_container + + @staticmethod + def is_remote_folder_selected(folder_selector): + return squish.waitForObjectExists(folder_selector).selected diff --git a/test/gui/shared/steps/sync_context.py b/test/gui/shared/steps/sync_context.py index 42bc2de2111..0935b29a956 100644 --- a/test/gui/shared/steps/sync_context.py +++ b/test/gui/shared/steps/sync_context.py @@ -237,3 +237,37 @@ def step(context, action): def step(context, folder_name): SyncConnection.choose_what_to_sync() SyncConnection.unselect_folder_in_selective_sync(folder_name) + + +@When('the user navigates back in the sync connection wizard') +def step(context): + SyncConnectionWizard.back() + + +@When('the user creates a folder "|any|" in the remote destination wizard') +def step(context, folder_name): + if not get_config("ocis"): + SyncConnectionWizard.create_folder_in_remote_destination(folder_name) + + +@When('the user refreshes the remote destination in the sync connection wizard') +def step(context): + if not get_config("ocis"): + SyncConnectionWizard.refresh_remote() + + +@Then( + r'the folder "([^"]*)" should be present and (selected|not selected) in the remote destination wizard', + regexp=True, +) +def step(context, folder_name, selected): + if not get_config("ocis"): + has_folder, folder_selector = SyncConnectionWizard.has_remote_folder( + folder_name + ) + test.compare(True, has_folder, "Folder should be in the remote list") + test.compare( + selected == 'selected', + SyncConnectionWizard.is_remote_folder_selected(folder_selector), + "Folder should be selected", + ) diff --git a/test/gui/tst_syncing/test.feature b/test/gui/tst_syncing/test.feature index 5b29f851809..e6a679d7081 100644 --- a/test/gui/tst_syncing/test.feature +++ b/test/gui/tst_syncing/test.feature @@ -68,7 +68,13 @@ Feature: Syncing files When the user selects manual sync folder option in advanced section And the user selects "Personal" space in sync connection wizard And the user sets the sync path in sync connection wizard - And the user selects "ownCloud" as a remote destination folder + And the user navigates back in the sync connection wizard + And the user sets the temp folder "localSyncFolder" as local sync path in sync connection wizard + And the user creates a folder "test-folder" in the remote destination wizard + Then the folder "test-folder" should be present and selected in the remote destination wizard + When the user refreshes the remote destination in the sync connection wizard + Then the folder "test-folder" should be present and not selected in the remote destination wizard + When the user selects "ownCloud" as a remote destination folder And the user disables VFS support for Windows Then the sync all checkbox should be checked When user unselects all the remote folders