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/shared | |
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/shared')
-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 |
5 files changed, 81 insertions, 17 deletions
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) |