Skip to content

Commit 88b0d38

Browse files
committed
added test to check for incremented number in bracket while adding new account and folder
1 parent 13f49d9 commit 88b0d38

File tree

8 files changed

+102
-2
lines changed

8 files changed

+102
-2
lines changed

test/gui/envs.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
XDG_CONFIG_HOME=/tmp/owncloudtest/
1+
XDG_CONFIG_HOME=/tmp/owncloudtest/.config
2+
HOME=/tmp/owncloudtest

test/gui/shared/scripts/names.py

+1
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,4 @@
5555
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}
5656
groupBox_folderTreeWidget_QTreeWidget = {"container": add_Folder_Sync_Connection_groupBox_QGroupBox, "name": "folderTreeWidget", "type": "QTreeWidget", "visible": 1}
5757
confirm_Folder_Sync_Connection_Removal_QMessageBox = {"type": "QMessageBox", "unnamed": 1, "visible": 1, "windowTitle": "Confirm Folder Sync Connection Removal"}
58+
stackedWidget_quickWidget_OCC_QmlUtils_OCQuickWidget = {"container": stack_stackedWidget_QStackedWidget, "name": "quickWidget", "type": "OCC::QmlUtils::OCQuickWidget", "visible": 1}

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

+8
Original file line numberDiff line numberDiff line change
@@ -350,3 +350,11 @@ def isVFSOptionChecked():
350350
).checked
351351
== True
352352
)
353+
354+
@staticmethod
355+
def get_local_sync_path():
356+
return str(
357+
squish.waitForObjectExists(
358+
AccountConnectionWizard.SELECT_LOCAL_FOLDER
359+
).displayText
360+
)

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

+28
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,15 @@ class SyncConnectionWizard:
144144
"visible": 1,
145145
"window": names.add_Folder_Sync_Connection_OCC_FolderWizard,
146146
}
147+
ADD_FOLDER_SYNC_BUTTON = {
148+
"checkable": False,
149+
"container": names.stackedWidget_quickWidget_OCC_QmlUtils_OCQuickWidget,
150+
"id": "addSyncButton",
151+
"text": "Add Folder",
152+
"type": "Button",
153+
"unnamed": 1,
154+
"visible": True,
155+
}
147156

148157
@staticmethod
149158
def setSyncPathInSyncConnectionWizardOc10(sync_path=''):
@@ -369,3 +378,22 @@ def has_remote_folder(folder_name):
369378
@staticmethod
370379
def is_remote_folder_selected(folder_selector):
371380
return squish.waitForObjectExists(folder_selector).selected
381+
382+
@staticmethod
383+
def select_space_to_sync(space_name):
384+
SyncConnectionWizard.selectSpaceToSync(space_name)
385+
SyncConnectionWizard.nextStep()
386+
387+
@staticmethod
388+
def open_sync_connection_wizard():
389+
squish.mouseClick(
390+
squish.waitForObject(SyncConnectionWizard.ADD_FOLDER_SYNC_BUTTON)
391+
)
392+
393+
@staticmethod
394+
def get_local_sync_path():
395+
return str(
396+
squish.waitForObjectExists(
397+
SyncConnectionWizard.CHOOSE_LOCAL_SYNC_FOLDER
398+
).displayText
399+
)

test/gui/shared/steps/account_context.py

+17-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def step(context, accountType):
2525
waitForInitialSyncToComplete(getResourcePath('/', account_details["user"], space))
2626

2727

28-
@When('the user adds the following wrong user credentials:')
28+
@When(r'the user adds the following(?: wrong)? user credentials:', regexp=True)
2929
def step(context):
3030
account_details = getClientDetails(context)
3131
AccountConnectionWizard.addUserCreds(
@@ -296,3 +296,19 @@ def step(context, displayname):
296296
has_focus = Toolbar.account_has_focus(account)
297297
if not has_focus:
298298
raise LookupError(f"Account '{displayname}' should be opened, but it is not")
299+
300+
301+
@Then(
302+
r'the default local sync path should be "([^"]*)" in the (configuration|sync connection) wizard',
303+
regexp=True,
304+
)
305+
def step(context, sync_path, wizard):
306+
test.compare(
307+
sync_path,
308+
(
309+
AccountConnectionWizard.get_local_sync_path()
310+
if wizard == 'configuration'
311+
else SyncConnectionWizard.get_local_sync_path()
312+
),
313+
"Default local download directory should have bracket with incremented number",
314+
)

test/gui/shared/steps/file_context.py

+6
Original file line numberDiff line numberDiff line change
@@ -370,3 +370,9 @@ def step(context, username, source):
370370
source_dir = getResourcePath(source, username)
371371
destination_dir = getTempResourcePath(source)
372372
shutil.copy2(source_dir, destination_dir)
373+
374+
375+
@Given('folder "|any|" has been created in the local sync path')
376+
def step(context, folder_name):
377+
folder_path = join(get_config('clientRootSyncPath'), folder_name)
378+
os.makedirs(prefix_path_namespace(folder_path))

test/gui/shared/steps/sync_context.py

+10
Original file line numberDiff line numberDiff line change
@@ -296,3 +296,13 @@ def step(context):
296296
def step(context):
297297
SyncConnection.remove_folder_sync_connection()
298298
SyncConnection.confirm_folder_sync_connection_removal()
299+
300+
301+
@When('the user selects the "|any|" space to sync')
302+
def step(context, space_name):
303+
SyncConnectionWizard.select_space_to_sync(space_name)
304+
305+
306+
@When("the user opens the sync connection wizard")
307+
def step(context):
308+
SyncConnectionWizard.open_sync_connection_wizard()

test/gui/tst_addAccount/test.feature

+30
Original file line numberDiff line numberDiff line change
@@ -81,3 +81,33 @@ Feature: adding accounts
8181
And the user syncs the "Personal" space
8282
Then the folder "simple-folder" should exist on the file system
8383

84+
@skipOnOCIS
85+
Scenario: Check for incremented number in bracket while adding new account and folder (OC10)
86+
Given folder "ownCloud" has been created in the local sync path
87+
And the user has started the client
88+
And the user has entered the following account information:
89+
| server | %local_server% |
90+
When the user adds the following user credentials:
91+
| user | Alice |
92+
| password | 1234 |
93+
And the user opens the advanced configuration
94+
Then the default local sync path should be "/tmp/owncloudtest/ownCloud (2)" in the configuration wizard
95+
When the user selects download everything option in advanced section
96+
And the user opens the sync connection wizard
97+
Then the default local sync path should be "/tmp/owncloudtest/ownCloud (2) (2)" in the sync connection wizard
98+
99+
@skipOnOC10
100+
Scenario: Check for incremented number in bracket while adding new account and folder (oCIS)
101+
Given folder "ownCloud" has been created in the local sync path
102+
And the user has started the client
103+
And the user has entered the following account information:
104+
| server | %local_server% |
105+
When the user adds the following user credentials:
106+
| user | Alice |
107+
| password | 1234 |
108+
And the user opens the advanced configuration
109+
Then the default local sync path should be "/tmp/owncloudtest/ownCloud (2)" in the configuration wizard
110+
When the user selects download everything option in advanced section
111+
And the user opens the sync connection wizard
112+
And the user selects the "Personal" space to sync
113+
Then the default local sync path should be "/tmp/owncloudtest/ownCloud (2)/Personal (2)" in the sync connection wizard

0 commit comments

Comments
 (0)