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:
authorSwoichha Adhikari <swoichhaa@gmail.com>2021-06-07 12:15:13 +0300
committerGitHub <noreply@github.com>2021-06-07 12:15:13 +0300
commitfe113b75ce6a69dc876a9fdfd1eebac4ddcbd626 (patch)
treeb0486e41249b6a68270e09049d19576d0a90c452 /test
parenta2c2a29a8fae8300917eb0414b49cf1007a8bfde (diff)
[tests-only] remove connection (#8682)
Diffstat (limited to 'test')
-rw-r--r--test/gui/shared/scripts/names.py2
-rw-r--r--test/gui/shared/scripts/pageObjects/AccountStatus.py48
-rw-r--r--test/gui/shared/scripts/pageObjects/Toolbar.py50
-rw-r--r--test/gui/shared/steps/steps.py82
-rw-r--r--test/gui/suite.conf2
-rw-r--r--test/gui/tst_removeAccountConnection/test.feature25
-rw-r--r--test/gui/tst_removeAccountConnection/test.py9
7 files changed, 164 insertions, 54 deletions
diff --git a/test/gui/shared/scripts/names.py b/test/gui/shared/scripts/names.py
index 3d06adeb6..ec3fabf4d 100644
--- a/test/gui/shared/scripts/names.py
+++ b/test/gui/shared/scripts/names.py
@@ -3,7 +3,6 @@
from objectmaphelper import *
settings_OCC_SettingsDialog = {"name": "Settings", "type": "OCC::SettingsDialog", "visible": 1}
-settings_settingsdialog_toolbutton_Add_account_QToolButton = {"name": "settingsdialog_toolbutton_Add account", "type": "QToolButton", "visible": 1, "window": settings_OCC_SettingsDialog}
owncloudWizard_OCC_OwncloudWizard = {"name": "owncloudWizard", "type": "OCC::OwncloudWizard", "visible": 1}
owncloudWizard_label_2_QLabel = {"name": "label_2", "type": "QLabel", "visible": 1, "window": owncloudWizard_OCC_OwncloudWizard}
leUrl_OCC_PostfixLineEdit = {"buddy": owncloudWizard_label_2_QLabel, "name": "leUrl", "type": "OCC::PostfixLineEdit", "visible": 1}
@@ -24,7 +23,6 @@ settings_settingsdialog_toolbutton_admin_localhost_QToolButton = {"name": "setti
settings_stack_QStackedWidget = {"name": "stack", "type": "QStackedWidget", "visible": 1, "window": settings_OCC_SettingsDialog}
stack_accountToolbox_QToolButton = {"container": settings_stack_QStackedWidget, "name": "_accountToolbox", "type": "QToolButton", "visible": 1}
settings_QMenu = {"type": "QMenu", "unnamed": 1, "visible": 1, "window": settings_OCC_SettingsDialog}
-stack_Remove_connection_QPushButton = {"container": settings_stack_QStackedWidget, "text": "Remove connection", "type": "QPushButton", "unnamed": 1, "visible": 1}
owncloudWizard_usernameLabel_QLabel = {"name": "usernameLabel", "type": "QLabel", "visible": 1, "window": owncloudWizard_OCC_OwncloudWizard}
owncloudWizard_passwordLabel_QLabel = {"name": "passwordLabel", "type": "QLabel", "visible": 1, "window": owncloudWizard_OCC_OwncloudWizard}
qFileDialog_fileNameLabel_QLabel = {"name": "fileNameLabel", "type": "QLabel", "visible": 1, "window": qFileDialog_QFileDialog}
diff --git a/test/gui/shared/scripts/pageObjects/AccountStatus.py b/test/gui/shared/scripts/pageObjects/AccountStatus.py
new file mode 100644
index 000000000..dda7ec92c
--- /dev/null
+++ b/test/gui/shared/scripts/pageObjects/AccountStatus.py
@@ -0,0 +1,48 @@
+import names
+import squish
+
+
+class AccountStatus:
+ ACCOUNT_BUTTON = {
+ "container": names.settings_stack_QStackedWidget,
+ "name": "_accountToolbox",
+ "type": "QToolButton",
+ "visible": 1,
+ }
+ ACCOUNT_MENU = {
+ "type": "QMenu",
+ "unnamed": 1,
+ "visible": 1,
+ "window": names.settings_OCC_SettingsDialog,
+ }
+ SIGNED_OUT_TEXT_BAR = {
+ "container": names.settings_stack_QStackedWidget,
+ "name": "connectLabel",
+ "type": "QLabel",
+ "visible": 1,
+ }
+
+ REMOVE_CONNECTION_BUTTON = {
+ "container": names.settings_stack_QStackedWidget,
+ "text": "Remove connection",
+ "type": "QPushButton",
+ "unnamed": 1,
+ "visible": 1,
+ }
+
+ def accountAction(self, action):
+ squish.sendEvent(
+ "QMouseEvent",
+ squish.waitForObject(self.ACCOUNT_BUTTON),
+ squish.QEvent.MouseButtonPress,
+ 0,
+ 0,
+ squish.Qt.LeftButton,
+ 0,
+ 0,
+ )
+ squish.activateItem(squish.waitForObjectItem(self.ACCOUNT_MENU, action))
+
+ def removeConnection(self):
+ self.accountAction("Remove")
+ squish.clickButton(squish.waitForObject(self.REMOVE_CONNECTION_BUTTON))
diff --git a/test/gui/shared/scripts/pageObjects/Toolbar.py b/test/gui/shared/scripts/pageObjects/Toolbar.py
index 6516cdbce..291e38df2 100644
--- a/test/gui/shared/scripts/pageObjects/Toolbar.py
+++ b/test/gui/shared/scripts/pageObjects/Toolbar.py
@@ -9,50 +9,26 @@ class Toolbar:
"visible": 1,
"window": names.settings_OCC_SettingsDialog,
}
- ACCOUNT_BUTTON = {
- "container": names.settings_stack_QStackedWidget,
- "name": "_accountToolbox",
+ ADD_ACCOUNT_BUTTON = {
+ "name": "settingsdialog_toolbutton_Add account",
"type": "QToolButton",
"visible": 1,
- }
- ACCOUNT_MENU = {
- "type": "QMenu",
- "unnamed": 1,
- "visible": 1,
"window": names.settings_OCC_SettingsDialog,
}
- SIGNED_OUT_TEXT_BAR = {
- "container": names.settings_stack_QStackedWidget,
- "name": "connectLabel",
- "type": "QLabel",
- "visible": 1,
- }
def clickActivity(self):
squish.clickButton(squish.waitForObject(self.ACTIVITY_BUTTON))
- def userLogout(self):
- squish.sendEvent(
- "QMouseEvent",
- squish.waitForObject(self.ACCOUNT_BUTTON),
- squish.QEvent.MouseButtonPress,
- 0,
- 0,
- squish.Qt.LeftButton,
- 0,
- 0,
- )
- squish.activateItem(squish.waitForObjectItem(self.ACCOUNT_MENU, "Log out"))
+ def clickAddAccount(self):
+ squish.clickButton(squish.waitForObject(self.ADD_ACCOUNT_BUTTON))
- def userLogsIn(self):
- squish.sendEvent(
- "QMouseEvent",
- squish.waitForObject(self.ACCOUNT_BUTTON),
- squish.QEvent.MouseButtonPress,
- 0,
- 0,
- squish.Qt.LeftButton,
- 0,
- 0,
+ def getDisplayedAccountText(self, displayname, host):
+ return str(
+ squish.waitForObjectExists(
+ {
+ "name": "settingsdialog_toolbutton_" + displayname + "@" + host,
+ "type": "QToolButton",
+ "visible": 1,
+ }
+ ).text
)
- squish.activateItem(squish.waitForObjectItem(self.ACCOUNT_MENU, "Log in"))
diff --git a/test/gui/shared/steps/steps.py b/test/gui/shared/steps/steps.py
index 50edc14bf..0b80a96f4 100644
--- a/test/gui/shared/steps/steps.py
+++ b/test/gui/shared/steps/steps.py
@@ -18,7 +18,7 @@ from pageObjects.SharingDialog import SharingDialog
from pageObjects.SyncWizard import SyncWizard
from pageObjects.Toolbar import Toolbar
from pageObjects.Activity import Activity
-
+from pageObjects.AccountStatus import AccountStatus
# the script needs to use the system wide python
# to switch from the built-in interpreter see https://kb.froglogic.com/squish/howto/using-external-python-interpreter-squish-6-6/
@@ -67,6 +67,15 @@ def hook(context):
pass
+@Given('the user has added an account with')
+def step(context):
+ toolbar = Toolbar()
+ toolbar.clickAddAccount()
+
+ newAccount = AccountConnectionWizard()
+ newAccount.addAccount(context)
+
+
@When('the user adds the first account with')
def step(context):
newAccount = AccountConnectionWizard()
@@ -117,9 +126,8 @@ def step(context):
@When('the user adds an account with')
def step(context):
- clickButton(
- waitForObject(names.settings_settingsdialog_toolbutton_Add_account_QToolButton)
- )
+ toolbar = Toolbar()
+ toolbar.clickAddAccount()
newAccount = AccountConnectionWizard()
newAccount.addAccount(context)
@@ -516,16 +524,16 @@ def step(context, resource, role):
@When('the user logs out of the client-UI')
def step(context):
- toolbar = Toolbar()
- toolbar.userLogout()
+ accountStatus = AccountStatus()
+ accountStatus.accountAction("Log out")
def isUserSignedOut(context, username):
displayname = getDisplayname(username)
server = context.userData['localBackendUrl']
- toolbar = Toolbar()
+ accountStatus = AccountStatus()
test.compare(
- str(waitForObjectExists(toolbar.SIGNED_OUT_TEXT_BAR).text),
+ str(waitForObjectExists(accountStatus.SIGNED_OUT_TEXT_BAR).text),
'Signed out from <a href="'
+ server
+ '">'
@@ -539,10 +547,10 @@ def isUserSignedOut(context, username):
def isUserSignedIn(context, username):
displayname = getDisplayname(username)
server = context.userData['localBackendUrl']
- toolbar = Toolbar()
+ accountStatus = AccountStatus()
test.compare(
- str(waitForObjectExists(toolbar.SIGNED_OUT_TEXT_BAR).text),
+ str(waitForObjectExists(accountStatus.SIGNED_OUT_TEXT_BAR).text),
'Connected '
+ 'to <a href="'
+ server
@@ -568,15 +576,15 @@ def step(context, username):
# TODO: find some way to dynamically to check if files are synced
# It might take some time for all files to sync
snooze(5)
- toolbar = Toolbar()
- toolbar.userLogout()
+ accountStatus = AccountStatus()
+ accountStatus.accountAction("Log out")
isUserSignedOut(context, username)
@When('user "|any|" logs in to the client-UI')
def step(context, username):
- toolbar = Toolbar()
- toolbar.userLogsIn()
+ accountStatus = AccountStatus()
+ accountStatus.accountAction("Log in")
password = getPasswordForUser(username)
enterUserPassword = EnterPassword()
enterUserPassword.enterPassword(password)
@@ -588,3 +596,49 @@ def step(context, username):
# It might take some time for all files to sync and connect to ther server
snooze(5)
isUserSignedIn(context, username)
+
+
+@When('the user removes the connection for user "|any|" and host |any|')
+def step(context, username, host):
+ displayname = getDisplayname(username)
+ displayname = substituteInLineCodes(context, displayname)
+ host = substituteInLineCodes(context, host)
+
+ clickButton(
+ waitForObject(
+ {
+ "name": "settingsdialog_toolbutton_" + displayname + "@" + host,
+ "type": "QToolButton",
+ "visible": 1,
+ }
+ )
+ )
+
+ waitFor(
+ lambda: isFolderSynced(context.userData['clientSyncPath']),
+ context.userData['clientSyncTimeout'] * 1000,
+ )
+ accountStatus = AccountStatus()
+ accountStatus.removeConnection()
+
+
+@Then('an account with the displayname |any| and host |any| should not be displayed')
+def step(context, displayname, host):
+ displayname = substituteInLineCodes(context, displayname)
+ host = substituteInLineCodes(context, host)
+ toolbar = Toolbar()
+ displayedAccountText = toolbar.getDisplayedAccountText(displayname, host)
+
+ test.compare(
+ displayedAccountText,
+ displayname + "\n" + host,
+ )
+
+
+@Then('connection wizard should be visible')
+def step(context):
+ test.compare(
+ str(waitForObjectExists(names.owncloudWizard_label_2_QLabel).text),
+ 'Ser&ver Address',
+ )
+ waitForObject(AccountConnectionWizard.SERVER_ADDRESS_BOX)
diff --git a/test/gui/suite.conf b/test/gui/suite.conf
index 43ef4cf94..fa37fda90 100644
--- a/test/gui/suite.conf
+++ b/test/gui/suite.conf
@@ -4,6 +4,6 @@ HOOK_SUB_PROCESSES=false
IMPLICITAUTSTART=0
LANGUAGE=Python
OBJECTMAPSTYLE=script
-TEST_CASES=tst_addAccount tst_sharing tst_syncing tst_loginLogout
+TEST_CASES=tst_addAccount tst_sharing tst_syncing tst_loginLogout tst_removeAccountConnection
VERSION=3
WRAPPERS=Qt
diff --git a/test/gui/tst_removeAccountConnection/test.feature b/test/gui/tst_removeAccountConnection/test.feature
new file mode 100644
index 000000000..cae2a92d2
--- /dev/null
+++ b/test/gui/tst_removeAccountConnection/test.feature
@@ -0,0 +1,25 @@
+Feature: remove account connection
+
+ As a user
+ I want to remove my account
+ So that I won't be using any client-UI services
+
+
+ Scenario: remove an 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 |
+ | localfolder | %client_sync_path% |
+ 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%
+
+
+ Scenario: remove the only account connection
+ Given user "Alice" 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 removes the connection for user "Alice" and host %local_server_hostname%
+ Then connection wizard should be visible
diff --git a/test/gui/tst_removeAccountConnection/test.py b/test/gui/tst_removeAccountConnection/test.py
new file mode 100644
index 000000000..d6224b99e
--- /dev/null
+++ b/test/gui/tst_removeAccountConnection/test.py
@@ -0,0 +1,9 @@
+source(findFile('scripts', 'python/bdd.py'))
+
+setupHooks('../shared/scripts/bdd_hooks.py')
+collectStepDefinitions('./steps', '../shared/steps')
+
+
+def main():
+ testSettings.throwOnFailure = True
+ runFeatureFile('test.feature')