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

[gui-tests][full-ci] added tests for adding folder to sync #11668

Merged
merged 1 commit into from
Jun 12, 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
2 changes: 2 additions & 0 deletions test/gui/shared/scripts/helpers/SetupClientHelper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
'''

Expand Down Expand Up @@ -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)

Expand Down
3 changes: 3 additions & 0 deletions test/gui/shared/scripts/names.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}
saw-jan marked this conversation as resolved.
Show resolved Hide resolved
103 changes: 101 additions & 2 deletions test/gui/shared/scripts/pageObjects/SyncConnectionWizard.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import names
import squish
import object
from os import path
from helpers.SetupClientHelper import (
getCurrentUserSyncPath,
Expand All @@ -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,
Expand Down Expand Up @@ -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=''):
Expand All @@ -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(
Expand Down Expand Up @@ -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
34 changes: 34 additions & 0 deletions test/gui/shared/steps/sync_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
)
8 changes: 7 additions & 1 deletion test/gui/tst_syncing/test.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading