Skip to content

Commit b1ebfb9

Browse files
PrajwolAmatyasaw-jan
authored andcommitted
added tests for adding folder to sync (#11668)
1 parent ec71468 commit b1ebfb9

File tree

5 files changed

+144
-9
lines changed

5 files changed

+144
-9
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
@@ -51,3 +51,6 @@
5151
scrollView_ListView = {"container": quickWidget_scrollView_ScrollView, "type": "ListView", "unnamed": 1, "visible": True}
5252
settings_dialogStack_QStackedWidget = {"name": "dialogStack", "type": "QStackedWidget", "visible": 1, "window": settings_OCC_SettingsDialog}
5353
dialogStack_quickWidget_QQuickWidget = {"container": settings_dialogStack_QStackedWidget, "name": "quickWidget", "type": "QQuickWidget", "visible": 1}
54+
create_Remote_Folder_QInputDialog = {"type": "QInputDialog", "unnamed": 1, "visible": 1, "windowTitle": "Create Remote Folder"}
55+
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}
56+
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
"type": "Label",
7683
"visible": True,
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(
@@ -239,3 +281,60 @@ def syncSpace(spaceName):
239281
path.join(getCurrentUserSyncPath(), spaceName)
240282
)
241283
SyncConnectionWizard.addSyncConnection()
284+
285+
@staticmethod
286+
def create_folder_in_remote_destination(folder_name):
287+
squish.clickButton(
288+
squish.waitForObject(SyncConnectionWizard.CREATE_REMOTE_FOLDER_BUTTON)
289+
)
290+
squish.type(
291+
squish.waitForObject(SyncConnectionWizard.CREATE_REMOTE_FOLDER_INPUT),
292+
folder_name,
293+
)
294+
squish.clickButton(
295+
squish.waitForObject(
296+
SyncConnectionWizard.CREATE_REMOTE_FOLDER_CONFIRM_BUTTON
297+
)
298+
)
299+
300+
@staticmethod
301+
def refresh_remote():
302+
squish.clickButton(squish.waitForObject(SyncConnectionWizard.REFRESH_BUTTON))
303+
304+
@staticmethod
305+
def generate_remote_folder_selector(folder_name, parent_container=None):
306+
if not parent_container:
307+
parent_container = {
308+
"container": names.groupBox_folderTreeWidget_QTreeWidget,
309+
"text": "ownCloud",
310+
"type": "QModelIndex",
311+
}
312+
return {
313+
"container": parent_container,
314+
"text": folder_name,
315+
"type": "QModelIndex",
316+
}
317+
318+
@staticmethod
319+
def has_remote_folder(folder_name):
320+
folder_tree = folder_name.strip("/").split("/")
321+
parent_container = None
322+
323+
for folder in folder_tree:
324+
folder_selector = SyncConnectionWizard.generate_remote_folder_selector(
325+
folder, parent_container
326+
)
327+
try:
328+
if parent_container:
329+
squish.doubleClick(parent_container)
330+
331+
squish.waitForObject(folder_selector)
332+
333+
parent_container = folder_selector
334+
except:
335+
return False, None
336+
return True, parent_container
337+
338+
@staticmethod
339+
def is_remote_folder_selected(folder_selector):
340+
return squish.waitForObjectExists(folder_selector).selected

test/gui/shared/steps/sync_context.py

+31-6
Original file line numberDiff line numberDiff line change
@@ -239,10 +239,35 @@ def step(context, folder_name):
239239
SyncConnection.unselect_folder_in_selective_sync(folder_name)
240240

241241

242-
@Then("the sync folder should not be added")
242+
@When('the user navigates back in the sync connection wizard')
243243
def step(context):
244-
test.compare(
245-
0,
246-
SyncConnection.get_folder_connection_count(),
247-
"Sync connections should be empty",
248-
)
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)