diff options
author | Swoichha Adhikari <swoichhaa@gmail.com> | 2021-10-01 07:15:26 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-01 07:15:26 +0300 |
commit | cb9d41695f495e2db9cf7a98891df09df95f4750 (patch) | |
tree | 2b4a3caa61a99a35d52f868c23246a7de214c293 /test/gui | |
parent | 0a033a6d64eb0dd93268d52c95fe7a6f7ddcda86 (diff) |
[tests-only] add tests for connect-login (#8987)
* [tests-only] add tests for connect-login
* add url object
Diffstat (limited to 'test/gui')
-rw-r--r-- | test/gui/config.ini | 1 | ||||
-rw-r--r-- | test/gui/shared/scripts/bdd_hooks.py | 5 | ||||
-rw-r--r-- | test/gui/shared/scripts/helpers/SetupClientHelper.py | 14 | ||||
-rw-r--r-- | test/gui/shared/scripts/names.py | 6 | ||||
-rw-r--r-- | test/gui/shared/scripts/pageObjects/AccountConnectionWizard.py | 30 | ||||
-rw-r--r-- | test/gui/shared/steps/steps.py | 43 | ||||
-rw-r--r-- | test/gui/tst_addAccount/test.feature | 39 | ||||
-rw-r--r-- | test/gui/tst_addAccount/verificationPoints/urlLock | 6 |
8 files changed, 117 insertions, 27 deletions
diff --git a/test/gui/config.ini b/test/gui/config.ini index 238acfa5b..aeb10729d 100644 --- a/test/gui/config.ini +++ b/test/gui/config.ini @@ -2,6 +2,7 @@ CLIENT_SYNC_PATH_USER1= CLIENT_SYNC_PATH_USER2= BACKEND_HOST=http://localhost/owncloud-core/ +SECURE_BACKEND_HOST=https://localhost/owncloud-core/ CLIENT_SYNC_TIMEOUT= MIDDLEWARE_URL= CLIENT_LOG_FILE= diff --git a/test/gui/shared/scripts/bdd_hooks.py b/test/gui/shared/scripts/bdd_hooks.py index 380847b53..4e500155d 100644 --- a/test/gui/shared/scripts/bdd_hooks.py +++ b/test/gui/shared/scripts/bdd_hooks.py @@ -30,6 +30,9 @@ def hook(context): 'localBackendUrl': os.environ.get( 'BACKEND_HOST', cfg.get('DEFAULT', 'BACKEND_HOST') ), + 'secureLocalBackendUrl': os.environ.get( + 'SECURE_BACKEND_HOST', cfg.get('DEFAULT', 'SECURE_BACKEND_HOST') + ), 'clientSyncPathUser1': os.environ.get( 'CLIENT_SYNC_PATH_USER1', cfg.get('DEFAULT', 'CLIENT_SYNC_PATH_USER1') ), @@ -49,6 +52,8 @@ def hook(context): if context.userData['localBackendUrl'] == '': context.userData['localBackendUrl'] = 'https://localhost:9200' + if context.userData['secureLocalBackendUrl'] == '': + context.userData['secureLocalBackendUrl'] = 'https://localhost:9200' if context.userData['clientSyncPathUser1'] == '': context.userData['clientSyncPathUser1'] = '/tmp/client-bdd-user1/' else: diff --git a/test/gui/shared/scripts/helpers/SetupClientHelper.py b/test/gui/shared/scripts/helpers/SetupClientHelper.py index c054b4d26..6547b5b2e 100644 --- a/test/gui/shared/scripts/helpers/SetupClientHelper.py +++ b/test/gui/shared/scripts/helpers/SetupClientHelper.py @@ -9,6 +9,9 @@ confFilePath = confdir + 'owncloud.cfg' def substituteInLineCodes(context, value): value = value.replace('%local_server%', context.userData['localBackendUrl']) value = value.replace( + '%secure_local_server%', context.userData['secureLocalBackendUrl'] + ) + value = value.replace( '%client_sync_path_user1%', context.userData['clientSyncPathUser1'] ) value = value.replace( @@ -22,21 +25,22 @@ def substituteInLineCodes(context, value): def getClientDetails(context): + clientDetails = {'server': '', 'user': '', 'password': '', 'localfolder': ''} for row in context.table[0:]: row[1] = substituteInLineCodes(context, row[1]) if row[0] == 'server': - server = row[1] + clientDetails.update({'server': row[1]}) elif row[0] == 'user': - user = row[1] + clientDetails.update({'user': row[1]}) elif row[0] == 'password': - password = row[1] + clientDetails.update({'password': row[1]}) elif row[0] == 'localfolder': - localfolder = row[1] + clientDetails.update({'localfolder': row[1]}) try: os.makedirs(localfolder, 0o0755) except: pass - return server, user, password, localfolder + return clientDetails def startClient(context): diff --git a/test/gui/shared/scripts/names.py b/test/gui/shared/scripts/names.py index 966a89a56..65c66f215 100644 --- a/test/gui/shared/scripts/names.py +++ b/test/gui/shared/scripts/names.py @@ -102,4 +102,8 @@ sharingDialog_Close_QPushButton = {"text": "Close", "type": "QPushButton", "unna stack_Enable_experimental_placeholder_mode_QPushButton = {"container": settings_stack_QStackedWidget, "text": "Enable experimental placeholder mode", "type": "QPushButton", "unnamed": 1, "visible": 1} disable_virtual_file_support_QMessageBox = {"type": "QMessageBox", "unnamed": 1, "visible": 1, "windowTitle": "Disable virtual file support?"} disable_virtual_file_support_Disable_support_QPushButton = {"text": "Disable support", "type": "QPushButton", "unnamed": 1, "visible": 1, "window": disable_virtual_file_support_QMessageBox} -error_QMessageBox = {"type": "QMessageBox", "unnamed": 1, "visible": 1, "windowTitle": "Error"}
\ No newline at end of file +error_QMessageBox = {"type": "QMessageBox", "unnamed": 1, "visible": 1, "windowTitle": "Error"} +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} diff --git a/test/gui/shared/scripts/pageObjects/AccountConnectionWizard.py b/test/gui/shared/scripts/pageObjects/AccountConnectionWizard.py index 2d56c124b..264dadba2 100644 --- a/test/gui/shared/scripts/pageObjects/AccountConnectionWizard.py +++ b/test/gui/shared/scripts/pageObjects/AccountConnectionWizard.py @@ -25,6 +25,12 @@ class AccountConnectionWizard: "visible": 1, "window": names.error_QMessageBox, } + ERROR_LABEL = { + "name": "errorLabel", + "type": "QLabel", + "visible": 1, + "window": names.owncloudWizard_OCC_OwncloudWizard, + } def __init__(self): pass @@ -32,27 +38,35 @@ class AccountConnectionWizard: def sanitizeFolderPath(self, folderPath): return folderPath.rstrip("/") - def addAccount(self, context): - server, user, password, localfolder = getClientDetails(context) - + def addServer(self, serverAddress): squish.mouseClick(squish.waitForObject(self.SERVER_ADDRESS_BOX)) - squish.type(squish.waitForObject(self.SERVER_ADDRESS_BOX), server) + squish.type(squish.waitForObject(self.SERVER_ADDRESS_BOX), serverAddress) squish.clickButton(squish.waitForObject(self.NEXT_BUTTON)) + + def addAccount(self, context): + clientDetails = getClientDetails(context) + self.addServer(clientDetails['server']) squish.mouseClick(squish.waitForObject(self.SERVER_ADDRESS_BOX)) - squish.type(squish.waitForObject(self.USERNAME_BOX), user) + squish.type(squish.waitForObject(self.USERNAME_BOX), clientDetails['user']) squish.type(squish.waitForObject(self.USERNAME_BOX), "<Tab>") - squish.type(squish.waitForObject(self.PASSWORD_BOX), password) + squish.type(squish.waitForObject(self.PASSWORD_BOX), clientDetails['password']) squish.clickButton(squish.waitForObject(self.NEXT_BUTTON)) + + def selectSyncFolder(self, context): + clientDetails = getClientDetails(context) + try: squish.clickButton(squish.waitForObject(self.ERROR_OK_BUTTON)) except LookupError: pass squish.clickButton(squish.waitForObject(self.SELECT_LOCAL_FOLDER)) squish.mouseClick(squish.waitForObject(self.DIRECTORY_NAME_BOX)) - squish.type(squish.waitForObject(self.DIRECTORY_NAME_BOX), localfolder) + squish.type( + squish.waitForObject(self.DIRECTORY_NAME_BOX), clientDetails['localfolder'] + ) squish.clickButton(squish.waitForObject(self.CHOOSE_BUTTON)) test.compare( str(squish.waitForObjectExists(self.SELECT_LOCAL_FOLDER).text), - self.sanitizeFolderPath(localfolder), + self.sanitizeFolderPath(clientDetails['localfolder']), ) squish.clickButton(squish.waitForObject(self.FINISH_BUTTON)) diff --git a/test/gui/shared/steps/steps.py b/test/gui/shared/steps/steps.py index 6657825ca..a3835b660 100644 --- a/test/gui/shared/steps/steps.py +++ b/test/gui/shared/steps/steps.py @@ -63,17 +63,27 @@ def hook(context): pass +def addAccount(context): + newAccount = AccountConnectionWizard() + newAccount.addAccount(context) + newAccount.selectSyncFolder(context) + + @Given('the user has added an account with') def step(context): toolbar = Toolbar() toolbar.clickAddAccount() - newAccount = AccountConnectionWizard() - newAccount.addAccount(context) + addAccount(context) @When('the user adds the first account with') def step(context): + addAccount(context) + + +@When('the user adds the account with wrong credentials') +def step(context): newAccount = AccountConnectionWizard() newAccount.addAccount(context) @@ -125,8 +135,18 @@ def step(context): toolbar = Toolbar() toolbar.clickAddAccount() + addAccount(context) + + +@When('the user adds an account with the following secure server address') +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.addAccount(context) + newAccount.addServer(server) def isItemSynced(type, itemName): @@ -806,3 +826,20 @@ def step(context): clickButton( waitForObject(names.disable_virtual_file_support_Disable_support_QPushButton) ) + + +@When('the user accepts the certificate') +def step(context): + clickButton(waitForObject(names.oCC_SslErrorDialog_cbTrustConnect_QCheckBox)) + clickButton(waitForObject(names.oCC_SslErrorDialog_OK_QPushButton)) + + +@Then('the lock shown should be closed') +def step(context): + test.vp("urlLock") + + +@Then('error "|any|" should be displayed') +def step(context, errorMsg): + newAccount = AccountConnectionWizard() + test.compare(str(waitForObjectExists(newAccount.ERROR_LABEL).text), errorMsg) diff --git a/test/gui/tst_addAccount/test.feature b/test/gui/tst_addAccount/test.feature index 448f5d48c..bea654339 100644 --- a/test/gui/tst_addAccount/test.feature +++ b/test/gui/tst_addAccount/test.feature @@ -5,26 +5,45 @@ Feature: adding accounts So that I can sync data with various organisations - Background: + Background: Given user "Alice" has been created on the server with default attributes and without skeleton files Scenario: Adding normal Account Given the user has started the client When the user adds the first account with - | server | %local_server% | - | user | Alice | - | password | 1234 | - | localfolder | %client_sync_path_user1% | + | server | %local_server% | + | user | Alice | + | password | 1234 | + | localfolder | %client_sync_path_user1% | Then an account should be displayed with the displayname Alice Hansen and host %local_server_hostname% - Scenario: Adding multiple 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 - | server | %local_server% | - | user | Brian | - | password | AaBb2Cc3Dd4 | - | localfolder | %client_sync_path_user2% | + | server | %local_server% | + | user | Brian | + | password | AaBb2Cc3Dd4 | + | localfolder | %client_sync_path_user2% | Then an account should be displayed with the displayname Alice Hansen and host %local_server_hostname% And an account should be displayed with the displayname Brian Murphy and host %local_server_hostname% + + + 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 | + 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 + | server | %secure_local_server% | + And the user accepts the certificate + Then the lock shown should be closed + + diff --git a/test/gui/tst_addAccount/verificationPoints/urlLock b/test/gui/tst_addAccount/verificationPoints/urlLock new file mode 100644 index 000000000..0faaa167c --- /dev/null +++ b/test/gui/tst_addAccount/verificationPoints/urlLock @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<VerificationPoint type="Screenshot" version="4"> +<Description/> +<Verification object="owncloudWizard_urlLabel_QLabel" options="12" type="PNG">iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAV1BMVEVDVnFEV3JFV3JFWHNGWHNGWXNJW3VTZH1UZH1VZn5XZ39ZaYFkc4lnd4xxf5N5hpiCjZ+LlqaSnKuTnqyWoK2YorCmrrqss77EyM/V2Nza3N/a3eDv7++tKicuAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAZElEQVQYla2O3QqAIAxGp2ZpmuZfWvn+z1kqBOVtB8a+HRgb5JtzW8Zx2c6S4a6koaJTE8eKqTBGULweVURJ1J7zroiMVYR5cmXbTXOownPui2i9F5YheEDMwgAvPuNfdFe+f1xFYQkhIG7dgQAAAABJRU5ErkJggg==<Mask/> +</Verification> +</VerificationPoint> |