Skip to content

Commit a3e0cd5

Browse files
committed
added tests for adding folder to sync
1 parent a329436 commit a3e0cd5

File tree

5 files changed

+155
-2
lines changed

5 files changed

+155
-2
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

+27
Original file line numberDiff line numberDiff line change
@@ -237,3 +237,30 @@ 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+
@When('the user navigates back in the sync connection wizard')
242+
def step(context):
243+
SyncConnectionWizard.back()
244+
245+
246+
@When('the user creates a folder "|any|" in the remote destination wizard')
247+
def step(context, folder_name):
248+
SyncConnectionWizard.create_folder_in_remote_destination(folder_name)
249+
250+
@When('the user refreshes the remote destination in the sync connection wizard')
251+
def step(context):
252+
SyncConnectionWizard.refresh_remote()
253+
254+
255+
@Then(
256+
r'the folder "([^"]*)" should be present and (selected|not selected) in the remote destination wizard',
257+
regexp=True,
258+
)
259+
def step(context, folder_name, selected):
260+
has_folder, folder_selector = SyncConnectionWizard.has_remote_folder(folder_name)
261+
test.compare(True, has_folder, "Folder should be in the remote list")
262+
test.compare(
263+
selected == 'selected',
264+
SyncConnectionWizard.is_remote_folder_selected(folder_selector),
265+
"Folder should be selected",
266+
)

test/gui/tst_syncing/test.feature

+22
Original file line numberDiff line numberDiff line change
@@ -480,3 +480,25 @@ Feature: Syncing files
480480
Then the folder "simple-folder" should not exist on the file system
481481
And the folder "test-folder/sub-folder2" should exist on the file system
482482
And the folder "test-folder/sub-folder1" should not exist on the file system
483+
484+
@skipOnOCIS
485+
Scenario: Add sync folder configuration manually
486+
Given the user has started the client
487+
And the user has entered the following account information:
488+
| server | %local_server% |
489+
| user | Alice |
490+
| password | 1234 |
491+
When the user selects manual sync folder option in advanced section
492+
And the user sets the temp folder "tempSyncFolder" as local sync path in sync connection wizard
493+
And the user navigates back in the sync connection wizard
494+
And the user sets the temp folder "localSyncFolder" as local sync path in sync connection wizard
495+
And the user creates a folder "test-folder" in the remote destination wizard
496+
Then the folder "test-folder" should be present and selected in the remote destination wizard
497+
When the user refreshes the remote destination in the sync connection wizard
498+
Then the folder "test-folder" should be present and not selected in the remote destination wizard
499+
When the user selects "ownCloud" as a remote destination folder
500+
And the user selects the following folders to sync:
501+
| folder |
502+
| test-folder |
503+
Then the folder "test-folder" should exist on the file system
504+
And as "Alice" folder "test-folder" should exist in the server

0 commit comments

Comments
 (0)