Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/owncloud/client.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSaw-jan Gurung <saw.jan.grg3e@gmail.com>2021-10-26 13:08:26 +0300
committerGitHub <noreply@github.com>2021-10-26 13:08:26 +0300
commitd4f52b107fe5a066662a060bdbc2e7357f8be084 (patch)
tree90f304c83dd973fb504e79392e072ef7088bfa4f /test
parent4479ec828b6d7ee497147c7f4120c02dcf897360 (diff)
add gui tests for selective sync scenarios (#9009)
add more tests for selective sync scenarios address reviews refactor test steps address reviews
Diffstat (limited to 'test')
-rw-r--r--test/gui/shared/scripts/names.py7
-rw-r--r--test/gui/shared/scripts/pageObjects/AccountConnectionWizard.py97
-rw-r--r--test/gui/shared/steps/steps.py220
-rw-r--r--test/gui/tst_addAccount/test.feature13
-rw-r--r--test/gui/tst_removeAccountConnection/test.feature8
-rw-r--r--test/gui/tst_syncing/test.feature106
6 files changed, 401 insertions, 50 deletions
diff --git a/test/gui/shared/scripts/names.py b/test/gui/shared/scripts/names.py
index d0e955dbe..f17255648 100644
--- a/test/gui/shared/scripts/names.py
+++ b/test/gui/shared/scripts/names.py
@@ -106,4 +106,9 @@ error_QMessageBox = {"type": "QMessageBox", "unnamed": 1, "visible": 1, "windowT
oCC_SslErrorDialog_OCC_SslErrorDialog = {"name": "OCC__SslErrorDialog", "type": "OCC::SslErrorDialog", "visible": 1}
oCC_SslErrorDialog_cbTrustConnect_QCheckBox = {"name": "_cbTrustConnect", "type": "QCheckBox", "visible": 1, "window": oCC_SslErrorDialog_OCC_SslErrorDialog}
oCC_SslErrorDialog_OK_QPushButton = {"text": "OK", "type": "QPushButton", "unnamed": 1, "visible": 1, "window": oCC_SslErrorDialog_OCC_SslErrorDialog}
-owncloudWizard_urlLabel_QLabel = {"name": "urlLabel", "type": "QLabel", "visible": 1, "window": owncloudWizard_OCC_OwncloudWizard} \ No newline at end of file
+owncloudWizard_urlLabel_QLabel = {"name": "urlLabel", "type": "QLabel", "visible": 1, "window": owncloudWizard_OCC_OwncloudWizard}
+owncloudWizard_urlLabel_QLabel = {"name": "urlLabel", "type": "QLabel", "visible": 1, "window": owncloudWizard_OCC_OwncloudWizard}
+choose_What_to_Sync_OCC_SelectiveSyncDialog = {"type": "OCC::SelectiveSyncDialog", "unnamed": 1, "visible": 1, "windowTitle": "Choose What to Sync"}
+choose_What_to_Sync_Deselect_remote_folders_you_do_not_wish_to_synchronize_QLabel = {"text": "Deselect remote folders you do not wish to synchronize.", "type": "QLabel", "unnamed": 1, "visible": 1, "window": choose_What_to_Sync_OCC_SelectiveSyncDialog}
+choose_What_To_Synchronize_QTreeWidget = {"aboveWidget": choose_What_to_Sync_Deselect_remote_folders_you_do_not_wish_to_synchronize_QLabel, "type": "QTreeWidget", "unnamed": 1, "visible": 1, "window": choose_What_to_Sync_OCC_SelectiveSyncDialog}
+deselect_remote_folders_you_do_not_wish_to_synchronize_QHeaderView = {"container": choose_What_To_Synchronize_QTreeWidget, "orientation": 1, "type": "QHeaderView", "unnamed": 1, "visible": 1}
diff --git a/test/gui/shared/scripts/pageObjects/AccountConnectionWizard.py b/test/gui/shared/scripts/pageObjects/AccountConnectionWizard.py
index 264dadba2..4fa2f233c 100644
--- a/test/gui/shared/scripts/pageObjects/AccountConnectionWizard.py
+++ b/test/gui/shared/scripts/pageObjects/AccountConnectionWizard.py
@@ -31,6 +31,45 @@ class AccountConnectionWizard:
"visible": 1,
"window": names.owncloudWizard_OCC_OwncloudWizard,
}
+ CREDENTIAL_PAGE = {
+ "name": "OwncloudHttpCredsPage",
+ "type": "OCC::OwncloudHttpCredsPage",
+ "visible": 1,
+ "window": names.owncloudWizard_OCC_OwncloudWizard,
+ }
+ ADVANCE_SETUP_PAGE = {
+ "name": "OwncloudAdvancedSetupPage",
+ "type": "OCC::OwncloudAdvancedSetupPage",
+ "visible": 1,
+ "window": names.owncloudWizard_OCC_OwncloudWizard,
+ }
+ MANUAL_SYNC_FOLDER_OPTION = {
+ "name": "rManualFolder",
+ "type": "QRadioButton",
+ "visible": 1,
+ "window": names.owncloudWizard_OCC_OwncloudWizard,
+ }
+ CHOOSE_WHAT_TO_SYNC_BUTTON = {
+ "name": "bSelectiveSync",
+ "type": "QPushButton",
+ "visible": 1,
+ "window": names.owncloudWizard_OCC_OwncloudWizard,
+ }
+ SELECTIVE_SYNC_DIALOG = names.choose_What_to_Sync_OCC_SelectiveSyncDialog
+ SYNC_DIALOG_FOLDER_TREE = names.choose_What_To_Synchronize_QTreeWidget
+ SYNC_DIALOG_ROOT_FOLDER = {
+ "column": 0,
+ "container": SYNC_DIALOG_FOLDER_TREE,
+ "text": "/",
+ "type": "QModelIndex",
+ }
+ SYNC_DIALOG_OK_BUTTON = {
+ "text": "OK",
+ "type": "QPushButton",
+ "unnamed": 1,
+ "visible": 1,
+ "window": SELECTIVE_SYNC_DIALOG,
+ }
def __init__(self):
pass
@@ -38,15 +77,16 @@ class AccountConnectionWizard:
def sanitizeFolderPath(self, folderPath):
return folderPath.rstrip("/")
- def addServer(self, serverAddress):
+ def addServer(self, context):
+ clientDetails = getClientDetails(context)
squish.mouseClick(squish.waitForObject(self.SERVER_ADDRESS_BOX))
- squish.type(squish.waitForObject(self.SERVER_ADDRESS_BOX), serverAddress)
+ squish.type(
+ squish.waitForObject(self.SERVER_ADDRESS_BOX), clientDetails['server']
+ )
squish.clickButton(squish.waitForObject(self.NEXT_BUTTON))
- def addAccount(self, context):
+ def addUserCreds(self, context):
clientDetails = getClientDetails(context)
- self.addServer(clientDetails['server'])
- squish.mouseClick(squish.waitForObject(self.SERVER_ADDRESS_BOX))
squish.type(squish.waitForObject(self.USERNAME_BOX), clientDetails['user'])
squish.type(squish.waitForObject(self.USERNAME_BOX), "<Tab>")
squish.type(squish.waitForObject(self.PASSWORD_BOX), clientDetails['password'])
@@ -69,4 +109,51 @@ class AccountConnectionWizard:
str(squish.waitForObjectExists(self.SELECT_LOCAL_FOLDER).text),
self.sanitizeFolderPath(clientDetails['localfolder']),
)
+
+ def connectAccount(self):
squish.clickButton(squish.waitForObject(self.FINISH_BUTTON))
+
+ def addAccount(self, context):
+ self.addServer(context)
+ self.addUserCreds(context)
+ self.selectSyncFolder(context)
+ self.connectAccount()
+
+ def openSyncDialog(self):
+ squish.clickButton(squish.waitForObject(self.CHOOSE_WHAT_TO_SYNC_BUTTON))
+
+ def selectManualSyncFolder(self):
+ squish.clickButton(squish.waitForObject(self.MANUAL_SYNC_FOLDER_OPTION))
+
+ def selectFoldersToSync(self, context):
+ self.openSyncDialog()
+
+ # first deselect all
+ squish.mouseClick(
+ squish.waitForObject(self.SYNC_DIALOG_ROOT_FOLDER),
+ 11,
+ 11,
+ squish.Qt.NoModifier,
+ squish.Qt.LeftButton,
+ )
+ for row in context.table[1:]:
+ squish.mouseClick(
+ squish.waitForObjectItem(self.SYNC_DIALOG_FOLDER_TREE, "/." + row[0]),
+ 11,
+ 11,
+ squish.Qt.NoModifier,
+ squish.Qt.LeftButton,
+ )
+ squish.clickButton(squish.waitForObject(self.SYNC_DIALOG_OK_BUTTON))
+
+ def sortBy(self, headerText):
+ squish.mouseClick(
+ squish.waitForObject(
+ {
+ "container": names.deselect_remote_folders_you_do_not_wish_to_synchronize_QHeaderView,
+ "text": headerText,
+ "type": "HeaderViewItem",
+ "visible": True,
+ }
+ )
+ )
diff --git a/test/gui/shared/steps/steps.py b/test/gui/shared/steps/steps.py
index ee7db0304..879466b15 100644
--- a/test/gui/shared/steps/steps.py
+++ b/test/gui/shared/steps/steps.py
@@ -3,7 +3,7 @@ import names
import os
import sys
from os import listdir
-from os.path import isfile, join
+from os.path import isfile, join, isdir
import re
import urllib.request
import json
@@ -64,29 +64,20 @@ def hook(context):
pass
-def addAccount(context):
+@Given(r'the user has added (the first|another) account with', regexp=True)
+def step(context, accountType):
newAccount = AccountConnectionWizard()
- newAccount.addAccount(context)
- newAccount.selectSyncFolder(context)
-
-
-@Given('the user has added an account with')
-def step(context):
- toolbar = Toolbar()
- toolbar.clickAddAccount()
-
- addAccount(context)
+ if accountType == 'another':
+ toolbar = Toolbar()
+ toolbar.clickAddAccount()
-
-@When('the user adds the first account with')
-def step(context):
- addAccount(context)
+ newAccount.addAccount(context)
-@When('the user adds the account with wrong credentials')
+@When('the user adds the following wrong user credentials:')
def step(context):
newAccount = AccountConnectionWizard()
- newAccount.addAccount(context)
+ newAccount.addUserCreds(context)
@Then('an account should be displayed with the displayname |any| and host |any|')
@@ -131,23 +122,22 @@ def step(context):
startClient(context)
-@When('the user adds an account with')
-def step(context):
- toolbar = Toolbar()
- toolbar.clickAddAccount()
+@When(r'the user adds (the first|another) account with', regexp=True)
+def step(context, accountType):
+ newAccount = AccountConnectionWizard()
+ if accountType == 'another':
+ toolbar = Toolbar()
+ toolbar.clickAddAccount()
- addAccount(context)
+ newAccount.addAccount(context)
-@When('the user adds an account with the following secure server address')
+@Given('the user has added the following account information:')
def step(context):
- for row in context.table[0:]:
- row[1] = substituteInLineCodes(context, row[1])
- if row[0] == 'server':
- server = row[1]
-
newAccount = AccountConnectionWizard()
- newAccount.addServer(server)
+ newAccount.addServer(context)
+ newAccount.addUserCreds(context)
+ newAccount.selectSyncFolder(context)
def isItemSynced(type, itemName):
@@ -191,6 +181,20 @@ def waitForFolderToBeSynced(context, folderName):
)
+def folderExists(folderPath, timeout=1000):
+ return waitFor(
+ lambda: isdir(sanitizePath(folderPath)),
+ timeout,
+ )
+
+
+def fileExists(filePath, timeout=1000):
+ return waitFor(
+ lambda: isfile(sanitizePath(filePath)),
+ timeout,
+ )
+
+
def sanitizePath(path):
return path.replace('//', '/')
@@ -346,6 +350,46 @@ def step(context, filePath):
)
+@Then(r'^the (file|folder) "([^"]*)" should exist on the file system$', regexp=True)
+def step(context, resourceType, resource):
+ resourcePath = join(context.userData['clientSyncPathUser1'], resource)
+ resourceExists = False
+ if resourceType == 'file':
+ resourceExists = fileExists(
+ resourcePath, context.userData['clientSyncTimeout'] * 1000
+ )
+ elif resourceType == 'folder':
+ resourceExists = folderExists(
+ resourcePath, context.userData['clientSyncTimeout'] * 1000
+ )
+ else:
+ raise Exception("Unsupported resource type '" + resourceType + "'")
+
+ test.compare(
+ True,
+ resourceExists,
+ "Assert " + resourceType + " '" + resource + "' exists on the system",
+ )
+
+
+@Then(r'^the (file|folder) "([^"]*)" should not exist on the file system$', regexp=True)
+def step(context, resourceType, resource):
+ resourcePath = join(context.userData['clientSyncPathUser1'], resource)
+ resourceExists = False
+ if resourceType == 'file':
+ resourceExists = fileExists(resourcePath, 1000)
+ elif resourceType == 'folder':
+ resourceExists = folderExists(resourcePath, 1000)
+ else:
+ raise Exception("Unsupported resource type '" + resourceType + "'")
+
+ test.compare(
+ False,
+ resourceExists,
+ "Assert " + resourceType + " '" + resource + "' doesn't exist on the system",
+ )
+
+
@Given('the user has paused the file sync')
def step(context):
waitForFolderToBeSynced(context, '/')
@@ -884,3 +928,119 @@ def step(context, resource, receiver):
str(waitForObjectExists(names.scrollArea_sharedWith_QLabel).text), receiver
)
clickButton(waitForObject(names.scrollArea_deleteShareButton_QToolButton))
+
+
+@Given('the user has added the following server address:')
+def step(context):
+ newAccount = AccountConnectionWizard()
+ newAccount.addServer(context)
+ test.compare(
+ waitForObjectExists(newAccount.CREDENTIAL_PAGE).visible,
+ True,
+ "Assert credentials page is visible",
+ )
+
+
+@When('the user adds the following server address:')
+def step(context):
+ newAccount = AccountConnectionWizard()
+ newAccount.addServer(context)
+
+
+@Given('the user has added the following user credentials:')
+def step(context):
+ newAccount = AccountConnectionWizard()
+ newAccount.addUserCreds(context)
+ test.compare(
+ waitForObjectExists(newAccount.ADVANCE_SETUP_PAGE).visible,
+ True,
+ "Assert setup page is visible",
+ )
+
+
+@Given('the user has changed the sync directory')
+def step(context):
+ newAccount = AccountConnectionWizard()
+ newAccount.selectSyncFolder(context)
+
+
+@Given('the user has opened chose_what_to_sync dialog')
+def step(context):
+ newAccount = AccountConnectionWizard()
+ newAccount.openSyncDialog()
+ test.compare(
+ waitForObjectExists(newAccount.SELECTIVE_SYNC_DIALOG).visible,
+ True,
+ "Assert selective sync dialog is visible",
+ )
+
+
+@When('the user opens chose_what_to_sync dialog')
+def step(context):
+ newAccount = AccountConnectionWizard()
+ newAccount.openSyncDialog()
+
+
+@When('the user selects the following folders to sync:')
+def step(context):
+ newAccount = AccountConnectionWizard()
+ newAccount.selectFoldersToSync(context)
+
+
+@When('the user selects manual sync folder option')
+def step(context):
+ newAccount = AccountConnectionWizard()
+ newAccount.selectManualSyncFolder()
+
+
+@When('the user connects the account')
+def step(context):
+ newAccount = AccountConnectionWizard()
+ newAccount.connectAccount()
+
+
+@When('the user sorts the folder list by "|any|"')
+def step(context, headerText):
+ headerText = headerText.capitalize()
+ if headerText in ["Size", "Name"]:
+ newAccount = AccountConnectionWizard()
+ newAccount.sortBy(headerText)
+ else:
+ raise Exception("Sorting by '" + headerText + "' is not supported.")
+
+
+@Then('the dialog chose_what_to_sync should be visible')
+def step(context):
+ newAccount = AccountConnectionWizard()
+ test.compare(
+ waitForObjectExists(newAccount.SELECTIVE_SYNC_DIALOG).visible,
+ True,
+ "Assert selective sync dialog is visible",
+ )
+
+
+@Then('the sync all checkbox should be checked')
+def step(context):
+ newAccount = AccountConnectionWizard()
+ test.compare(
+ waitForObjectExists(newAccount.SYNC_DIALOG_ROOT_FOLDER).checkState,
+ "checked",
+ "Assert sync all checkbox is checked",
+ )
+
+
+@Then("the folders should be in the following order:")
+def step(context):
+ newAccount = AccountConnectionWizard()
+ rowIndex = 0
+ for row in context.table[1:]:
+ FOLDER_TREE_ROW = {
+ "row": rowIndex,
+ "container": newAccount.SYNC_DIALOG_ROOT_FOLDER,
+ "type": "QModelIndex",
+ }
+ expectedFolder = row[0]
+ actualFolder = waitForObjectExists(FOLDER_TREE_ROW).displayText
+ test.compare(actualFolder, expectedFolder)
+
+ rowIndex += 1
diff --git a/test/gui/tst_addAccount/test.feature b/test/gui/tst_addAccount/test.feature
index bea654339..b8828263f 100644
--- a/test/gui/tst_addAccount/test.feature
+++ b/test/gui/tst_addAccount/test.feature
@@ -21,7 +21,7 @@ Feature: adding accounts
Scenario: Adding multiple accounts
Given user "Brian" has been created on the server with default attributes and without skeleton files
And user "Alice" has set up a client with default settings
- When the user adds an account with
+ When the user adds another account with
| server | %local_server% |
| user | Brian |
| password | AaBb2Cc3Dd4 |
@@ -32,16 +32,17 @@ Feature: adding accounts
Scenario: Adding account with wrong credentials
Given the user has started the client
- When the user adds the account with wrong credentials
- | server | %local_server% |
- | user | Alice |
- | password | 12345 |
+ And the user has added the following server address:
+ | server | %local_server% |
+ When the user adds the following wrong user credentials:
+ | user | Alice |
+ | password | 12345 |
Then error "The provided credentials are not correct" should be displayed
Scenario: Adding account with self signed certificate for the first time
Given the user has started the client
- When the user adds an account with the following secure server address
+ When the user adds the following server address:
| server | %secure_local_server% |
And the user accepts the certificate
Then the lock shown should be closed
diff --git a/test/gui/tst_removeAccountConnection/test.feature b/test/gui/tst_removeAccountConnection/test.feature
index 034c917cb..77d4a0559 100644
--- a/test/gui/tst_removeAccountConnection/test.feature
+++ b/test/gui/tst_removeAccountConnection/test.feature
@@ -9,10 +9,10 @@ Feature: remove account connection
Given user "Alice" has been created on the server with default attributes and without skeleton files
And user "Brian" has been created on the server with default attributes and without skeleton files
And user "Alice" has set up a client with default settings
- And the user has added an account with
- | server | %local_server% |
- | user | Brian |
- | password | AaBb2Cc3Dd4 |
+ And the user has added another account with
+ | server | %local_server% |
+ | user | Brian |
+ | password | AaBb2Cc3Dd4 |
| localfolder | %client_sync_path_user2% |
When the user removes the connection for user "Brian" and host %local_server_hostname%
Then an account should be displayed with the displayname Alice Hansen and host %local_server_hostname%
diff --git a/test/gui/tst_syncing/test.feature b/test/gui/tst_syncing/test.feature
index deda71b2c..633bd2fae 100644
--- a/test/gui/tst_syncing/test.feature
+++ b/test/gui/tst_syncing/test.feature
@@ -17,14 +17,21 @@ Feature: Syncing files
And the user waits for file "lorem-for-upload.txt" to be synced
Then as "Alice" the file "lorem-for-upload.txt" on the server should have the content "test content"
- Scenario: Syncing a file from the server
- Given user "Alice" has set up a client with default settings
+
+ Scenario: Syncing all files and folders from the server
+ Given user "Alice" has created folder "simple-folder" on the server
+ And user "Alice" has created folder "large-folder" on the server
And user "Alice" has uploaded file on the server with content "test content" to "uploaded-lorem.txt"
- When the user waits for file "uploaded-lorem.txt" to be synced
- Then the file "uploaded-lorem.txt" should exist on the file system with the following content
+ And user "Alice" has set up a client with default settings
+ When the user waits for the files to sync
+ Then the file "uploaded-lorem.txt" should exist on the file system
+ And the file "uploaded-lorem.txt" should exist on the file system with the following content
"""
test content
"""
+ And the folder "simple-folder" should exist on the file system
+ And the folder "large-folder" should exist on the file system
+
Scenario: Syncing a file from the server and creating a conflict
Given user "Alice" has uploaded file on the server with content "server content" to "/conflict.txt"
@@ -49,3 +56,94 @@ Feature: Syncing files
"""
client content
"""
+
+
+ Scenario: Sync all is selected by default
+ Given user "Alice" has created folder "simple-folder" on the server
+ And user "Alice" has created folder "large-folder" on the server
+ And the user has started the client
+ And the user has added the following account information:
+ | server | %local_server% |
+ | user | Alice |
+ | password | 1234 |
+ | localfolder | %client_sync_path_user1% |
+ When the user opens chose_what_to_sync dialog
+ Then the dialog chose_what_to_sync should be visible
+ And the sync all checkbox should be checked
+
+
+ Scenario: Sync only one folder from the server
+ Given user "Alice" has created folder "simple-folder" on the server
+ And user "Alice" has created folder "large-folder" on the server
+ And the user has started the client
+ And the user has added the following account information:
+ | server | %local_server% |
+ | user | Alice |
+ | password | 1234 |
+ | localfolder | %client_sync_path_user1% |
+ When the user selects the following folders to sync:
+ | folder |
+ | simple-folder |
+ And the user connects the account
+ And the user waits for the files to sync
+ Then the folder "simple-folder" should exist on the file system
+ But the folder "large-folder" should not exist on the file system
+
+
+ Scenario: Connect account with manual sync folder option
+ Given user "Alice" has created folder "simple-folder" on the server
+ And user "Alice" has created folder "large-folder" on the server
+ And user "Alice" has uploaded file on the server with content "test content" to "lorem.txt"
+ And the user has started the client
+ And the user has added the following account information:
+ | server | %local_server% |
+ | user | Alice |
+ | password | 1234 |
+ | localfolder | %client_sync_path_user1% |
+ When the user selects manual sync folder option
+ And the user connects the account
+ Then the folder "simple-folder" should not exist on the file system
+ But the folder "large-folder" should not exist on the file system
+ And the file "lorem.txt" should not exist on the file system
+
+
+ Scenario: sort folders list by name and size
+ Given user "Alice" has created folder "123Folder" on the server
+ And user "Alice" has uploaded file on the server with content "small" to "123Folder/lorem.txt"
+ And user "Alice" has created folder "aFolder" on the server
+ And user "Alice" has uploaded file on the server with content "more contents" to "aFolder/lorem.txt"
+ And user "Alice" has created folder "bFolder" on the server
+ And the user has started the client
+ And the user has added the following account information:
+ | server | %local_server% |
+ | user | Alice |
+ | password | 1234 |
+ | localfolder | %client_sync_path_user1% |
+ When the user opens chose_what_to_sync dialog
+ # folders are sorted by name in ascending order by default
+ Then the folders should be in the following order:
+ | folder |
+ | 123Folder |
+ | aFolder |
+ | bFolder |
+ # sort folder by name in descending order
+ When the user sorts the folder list by "Name"
+ Then the folders should be in the following order:
+ | folder |
+ | bFolder |
+ | aFolder |
+ | 123Folder |
+ # sort folder by size in ascending order
+ When the user sorts the folder list by "Size"
+ Then the folders should be in the following order:
+ | folder |
+ | bFolder |
+ | 123Folder |
+ | aFolder |
+ # sort folder by size in descending order
+ When the user sorts the folder list by "Size"
+ Then the folders should be in the following order:
+ | folder |
+ | aFolder |
+ | 123Folder |
+ | bFolder | \ No newline at end of file