Skip to content

Commit cfb4876

Browse files
added tests for adding folder to sync (#11668)
1 parent 3d12c7d commit cfb4876

File tree

5 files changed

+147
-3
lines changed

5 files changed

+147
-3
lines changed

test/gui/shared/scripts/helpers/SetupClientHelper.py

+2
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ def setUpClient(username, displayName, space="Personal"):
127127
0/url={local_server}
128128
0/user={displayUserFirstName}
129129
0/version=1
130+
0/supportsSpaces={supportsSpaces}
130131
version=2
131132
'''
132133

@@ -154,6 +155,7 @@ def setUpClient(username, displayName, space="Personal"):
154155
'local_server': server_url,
155156
'oauth': 'true' if is_ocis else 'false',
156157
'vfs': 'wincfapi' if isWindows() else 'off',
158+
'supportsSpaces': 'true' if is_ocis else 'false',
157159
}
158160
userSetting = userSetting.format(**args)
159161

test/gui/shared/scripts/names.py

+3
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,6 @@
4949
o_folderList_Personal_QModelIndex = {"column": 0, "container": stack_folderList_QTreeView, "text": "Personal", "type": "QModelIndex"}
5050
add_Folder_Sync_Connection_tableView_QTableView = {"name": "tableView","type": "QTableView","visible": 1,"window": add_Folder_Sync_Connection_OCC_FolderWizard}
5151
stack_scrollArea_QScrollArea = {"container": settings_stack_QStackedWidget, "name": "scrollArea", "type": "QScrollArea", "visible": 1}
52+
create_Remote_Folder_QInputDialog = {"type": "QInputDialog", "unnamed": 1, "visible": 1, "windowTitle": "Create Remote Folder"}
53+
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}
54+
groupBox_folderTreeWidget_QTreeWidget = {"container": add_Folder_Sync_Connection_groupBox_QGroupBox, "name": "folderTreeWidget", "type": "QTreeWidget", "visible": 1}

test/gui/shared/scripts/pageObjects/SyncConnectionWizard.py

+101-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import names
22
import squish
3+
import object
34
from os import path
45
from helpers.SetupClientHelper import (
56
getCurrentUserSyncPath,
@@ -21,11 +22,17 @@ class SyncConnectionWizard:
2122
"visible": 1,
2223
"window": names.add_Folder_Sync_Connection_OCC_FolderWizard,
2324
}
24-
NEXT_BUTTON = {
25-
"name": "__qt__passive_wizardbutton1",
25+
BACK_BUTTON = {
26+
"window": names.add_Folder_Sync_Connection_OCC_FolderWizard,
2627
"type": "QPushButton",
28+
"text": "< &Back",
2729
"visible": 1,
30+
}
31+
NEXT_BUTTON = {
2832
"window": names.add_Folder_Sync_Connection_OCC_FolderWizard,
33+
"type": "QPushButton",
34+
"text": "&Next >",
35+
"visible": 1,
2936
}
3037
SELECTIVE_SYNC_ROOT_FOLDER = {
3138
"column": 0,
@@ -75,6 +82,37 @@ class SyncConnectionWizard:
7582
"container": names.add_Folder_Sync_Connection_tableView_QTableView,
7683
"type": "QModelIndex",
7784
}
85+
CREATE_REMOTE_FOLDER_BUTTON = {
86+
"container": names.add_Folder_Sync_Connection_groupBox_QGroupBox,
87+
"name": "addFolderButton",
88+
"type": "QPushButton",
89+
"visible": 1,
90+
}
91+
CREATE_REMOTE_FOLDER_INPUT = {
92+
"buddy": names.create_Remote_Folder_Enter_the_name_of_the_new_folder_to_be_created_below_QLabel,
93+
"type": "QLineEdit",
94+
"unnamed": 1,
95+
"visible": 1,
96+
}
97+
CREATE_REMOTE_FOLDER_CONFIRM_BUTTON = {
98+
"text": "OK",
99+
"type": "QPushButton",
100+
"unnamed": 1,
101+
"visible": 1,
102+
"window": names.create_Remote_Folder_QInputDialog,
103+
}
104+
REFRESH_BUTTON = {
105+
"container": names.add_Folder_Sync_Connection_groupBox_QGroupBox,
106+
"name": "refreshButton",
107+
"type": "QPushButton",
108+
"visible": 1,
109+
}
110+
REMOTE_FOLDER_SELECTION_INPUT = {
111+
"name": "folderEntry",
112+
"type": "QLineEdit",
113+
"visible": 1,
114+
"window": names.add_Folder_Sync_Connection_OCC_FolderWizard,
115+
}
78116

79117
@staticmethod
80118
def setSyncPathInSyncConnectionWizardOc10(sync_path=''):
@@ -101,6 +139,10 @@ def setSyncPathInSyncConnectionWizard(sync_path=''):
101139
def nextStep():
102140
squish.clickButton(squish.waitForObject(SyncConnectionWizard.NEXT_BUTTON))
103141

142+
@staticmethod
143+
def back():
144+
squish.clickButton(squish.waitForObject(SyncConnectionWizard.BACK_BUTTON))
145+
104146
@staticmethod
105147
def selectRemoteDestinationFolder(folder):
106148
squish.mouseClick(
@@ -251,3 +293,60 @@ def syncSpace(spaceName):
251293
path.join(getCurrentUserSyncPath(), spaceName)
252294
)
253295
SyncConnectionWizard.addSyncConnection()
296+
297+
@staticmethod
298+
def create_folder_in_remote_destination(folder_name):
299+
squish.clickButton(
300+
squish.waitForObject(SyncConnectionWizard.CREATE_REMOTE_FOLDER_BUTTON)
301+
)
302+
squish.type(
303+
squish.waitForObject(SyncConnectionWizard.CREATE_REMOTE_FOLDER_INPUT),
304+
folder_name,
305+
)
306+
squish.clickButton(
307+
squish.waitForObject(
308+
SyncConnectionWizard.CREATE_REMOTE_FOLDER_CONFIRM_BUTTON
309+
)
310+
)
311+
312+
@staticmethod
313+
def refresh_remote():
314+
squish.clickButton(squish.waitForObject(SyncConnectionWizard.REFRESH_BUTTON))
315+
316+
@staticmethod
317+
def generate_remote_folder_selector(folder_name, parent_container=None):
318+
if not parent_container:
319+
parent_container = {
320+
"container": names.groupBox_folderTreeWidget_QTreeWidget,
321+
"text": "ownCloud",
322+
"type": "QModelIndex",
323+
}
324+
return {
325+
"container": parent_container,
326+
"text": folder_name,
327+
"type": "QModelIndex",
328+
}
329+
330+
@staticmethod
331+
def has_remote_folder(folder_name):
332+
folder_tree = folder_name.strip("/").split("/")
333+
parent_container = None
334+
335+
for folder in folder_tree:
336+
folder_selector = SyncConnectionWizard.generate_remote_folder_selector(
337+
folder, parent_container
338+
)
339+
try:
340+
if parent_container:
341+
squish.doubleClick(parent_container)
342+
343+
squish.waitForObject(folder_selector)
344+
345+
parent_container = folder_selector
346+
except:
347+
return False, None
348+
return True, parent_container
349+
350+
@staticmethod
351+
def is_remote_folder_selected(folder_selector):
352+
return squish.waitForObjectExists(folder_selector).selected

test/gui/shared/steps/sync_context.py

+34
Original file line numberDiff line numberDiff line change
@@ -237,3 +237,37 @@ def step(context, action):
237237
def step(context, folder_name):
238238
SyncConnection.choose_what_to_sync()
239239
SyncConnection.unselect_folder_in_selective_sync(folder_name)
240+
241+
242+
@When('the user navigates back in the sync connection wizard')
243+
def step(context):
244+
SyncConnectionWizard.back()
245+
246+
247+
@When('the user creates a folder "|any|" in the remote destination wizard')
248+
def step(context, folder_name):
249+
if not get_config("ocis"):
250+
SyncConnectionWizard.create_folder_in_remote_destination(folder_name)
251+
252+
253+
@When('the user refreshes the remote destination in the sync connection wizard')
254+
def step(context):
255+
if not get_config("ocis"):
256+
SyncConnectionWizard.refresh_remote()
257+
258+
259+
@Then(
260+
r'the folder "([^"]*)" should be present and (selected|not selected) in the remote destination wizard',
261+
regexp=True,
262+
)
263+
def step(context, folder_name, selected):
264+
if not get_config("ocis"):
265+
has_folder, folder_selector = SyncConnectionWizard.has_remote_folder(
266+
folder_name
267+
)
268+
test.compare(True, has_folder, "Folder should be in the remote list")
269+
test.compare(
270+
selected == 'selected',
271+
SyncConnectionWizard.is_remote_folder_selected(folder_selector),
272+
"Folder should be selected",
273+
)

test/gui/tst_syncing/test.feature

+7-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,13 @@ Feature: Syncing files
6868
When the user selects manual sync folder option in advanced section
6969
And the user selects "Personal" space in sync connection wizard
7070
And the user sets the sync path in sync connection wizard
71-
And the user selects "ownCloud" as a remote destination folder
71+
And the user navigates back in the sync connection wizard
72+
And the user sets the temp folder "localSyncFolder" as local sync path in sync connection wizard
73+
And the user creates a folder "test-folder" in the remote destination wizard
74+
Then the folder "test-folder" should be present and selected in the remote destination wizard
75+
When the user refreshes the remote destination in the sync connection wizard
76+
Then the folder "test-folder" should be present and not selected in the remote destination wizard
77+
When the user selects "ownCloud" as a remote destination folder
7278
And the user disables VFS support for Windows
7379
Then the sync all checkbox should be checked
7480
When user unselects all the remote folders

0 commit comments

Comments
 (0)