Skip to content

Commit d8624a1

Browse files
committed
added tests for adding folder to sync
1 parent ab1746d commit d8624a1

File tree

5 files changed

+126
-0
lines changed

5 files changed

+126
-0
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

+2
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,5 @@
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}

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

+76
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,49 @@ class SyncConnection:
2929
"type": "QPushButton",
3030
"visible": 1,
3131
}
32+
ADD_FOLDER_SYNC_BUTTON = {
33+
"container": names.settings_stack_QStackedWidget,
34+
"name": "addButton",
35+
"type": "QPushButton",
36+
"visible": 1,
37+
}
38+
NAVIGATE_BACK_BUTTON = {
39+
"name": "__qt__passive_wizardbutton0",
40+
"type": "QPushButton",
41+
"visible": 1,
42+
"window": names.add_Folder_Sync_Connection_OCC_FolderWizard,
43+
}
44+
ADD_FOLDER_BUTTON = {
45+
"container": names.add_Folder_Sync_Connection_groupBox_QGroupBox,
46+
"name": "addFolderButton",
47+
"type": "QPushButton",
48+
"visible": 1,
49+
}
50+
ADD_FOLDER_INPUT = {
51+
"buddy": names.create_Remote_Folder_Enter_the_name_of_the_new_folder_to_be_created_below_QLabel,
52+
"type": "QLineEdit",
53+
"unnamed": 1,
54+
"visible": 1,
55+
}
56+
ADD_FOLDER_CONFIRM = {
57+
"text": "OK",
58+
"type": "QPushButton",
59+
"unnamed": 1,
60+
"visible": 1,
61+
"window": names.create_Remote_Folder_QInputDialog,
62+
}
63+
REFRESH_BUTTON = {
64+
"container": names.add_Folder_Sync_Connection_groupBox_QGroupBox,
65+
"name": "refreshButton",
66+
"type": "QPushButton",
67+
"visible": 1,
68+
}
69+
FOLDER_ENTRY_INPUT = {
70+
"name": "folderEntry",
71+
"type": "QLineEdit",
72+
"visible": 1,
73+
"window": names.add_Folder_Sync_Connection_OCC_FolderWizard,
74+
}
3275

3376
@staticmethod
3477
def openMenu():
@@ -111,3 +154,36 @@ def unselect_folder_in_selective_sync(folder_name):
111154
squish.clickButton(
112155
squish.waitForObject(SyncConnection.SELECTIVE_SYNC_APPLY_BUTTON)
113156
)
157+
158+
@staticmethod
159+
def click_on_add_button():
160+
squish.clickButton(squish.waitForObject(SyncConnection.ADD_FOLDER_SYNC_BUTTON))
161+
162+
@staticmethod
163+
def navigate_back():
164+
squish.clickButton(squish.waitForObject(SyncConnection.NAVIGATE_BACK_BUTTON))
165+
166+
@staticmethod
167+
def create_folder_in_remote_destination(folderName):
168+
squish.clickButton(squish.waitForObject(SyncConnection.ADD_FOLDER_BUTTON))
169+
squish.type(squish.waitForObject(SyncConnection.ADD_FOLDER_INPUT), folderName)
170+
squish.clickButton(squish.waitForObject(SyncConnection.ADD_FOLDER_CONFIRM))
171+
172+
@staticmethod
173+
def refresh_add_folder_sync_connection_window():
174+
squish.clickButton(squish.waitForObject(SyncConnection.REFRESH_BUTTON))
175+
176+
@staticmethod
177+
def check_foldername(folderName):
178+
return (
179+
str(
180+
squish.waitForObjectExists(
181+
SyncConnection.FOLDER_ENTRY_INPUT
182+
).displayText
183+
).strip('/')
184+
== folderName
185+
)
186+
187+
@staticmethod
188+
def check_connection_folder_entry(folderName):
189+
return squish.waitFor(lambda: SyncConnection.check_foldername(folderName), 5000)

test/gui/shared/steps/sync_context.py

+28
Original file line numberDiff line numberDiff line change
@@ -237,3 +237,31 @@ 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+
@Given("the user clicks on add folder button")
243+
def step(context):
244+
SyncConnection.click_on_add_button()
245+
246+
247+
@When('the user navigates back to sync local folder')
248+
def step(context):
249+
SyncConnection.navigate_back()
250+
251+
252+
@When('user creates a folder "|any|" in a remote destination')
253+
def step(context, folderName):
254+
SyncConnection.create_folder_in_remote_destination(folderName)
255+
256+
257+
@When('user refreshes the Add Folder Sync connection window')
258+
def step(context):
259+
SyncConnection.refresh_add_folder_sync_connection_window()
260+
261+
262+
@Then(
263+
r'^the sync connection folder entry should contain folder "([^"]*)"$', regexp=True
264+
)
265+
def step(context, folderName):
266+
result = SyncConnection.check_connection_folder_entry(folderName)
267+
test.compare(True, result)

test/gui/tst_syncing/test.feature

+18
Original file line numberDiff line numberDiff line change
@@ -480,3 +480,21 @@ 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+
485+
Scenario: Add folder to sync
486+
Given user "Alice" has set up a client with default settings
487+
And the user clicks on add folder button
488+
When the user sets the temp folder "test-folder1" as local sync path in sync connection wizard
489+
And the user navigates back to sync local folder
490+
And the user sets the temp folder "test-folder2" as local sync path in sync connection wizard
491+
And user creates a folder "test-folder" in a remote destination
492+
Then the sync connection folder entry should contain folder "test-folder"
493+
When user refreshes the Add Folder Sync connection window
494+
Then the sync connection folder entry should contain folder ""
495+
When the user selects "ownCloud" as a remote destination folder
496+
And the user selects the following folders to sync:
497+
| folder |
498+
| test-folder |
499+
Then the folder "test-folder" should exist on the file system
500+
And as "Alice" folder "test-folder" should exist in the server

0 commit comments

Comments
 (0)