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/gui
diff options
context:
space:
mode:
authorSwoichha Adhikari <swoichhaa@gmail.com>2021-06-03 09:33:45 +0300
committerGitHub <noreply@github.com>2021-06-03 09:33:45 +0300
commita2c2a29a8fae8300917eb0414b49cf1007a8bfde (patch)
tree6f0aabefea7b5f12904d1edfb7935c2a1e15f2a2 /test/gui
parent93cd5462138c6c7067d720af071f394efc3000d8 (diff)
[tests-only]logout user from client (#8663)
* [tests-only]logout user from client * add snooze
Diffstat (limited to 'test/gui')
-rw-r--r--test/gui/shared/scripts/pageObjects/Toolbar.py44
-rw-r--r--test/gui/shared/steps/steps.py76
-rw-r--r--test/gui/suite.conf2
-rw-r--r--test/gui/tst_loginLogout/test.feature18
-rw-r--r--test/gui/tst_loginLogout/test.py9
5 files changed, 148 insertions, 1 deletions
diff --git a/test/gui/shared/scripts/pageObjects/Toolbar.py b/test/gui/shared/scripts/pageObjects/Toolbar.py
index 6a46e534e..6516cdbce 100644
--- a/test/gui/shared/scripts/pageObjects/Toolbar.py
+++ b/test/gui/shared/scripts/pageObjects/Toolbar.py
@@ -9,6 +9,50 @@ class Toolbar:
"visible": 1,
"window": names.settings_OCC_SettingsDialog,
}
+ 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,
+ }
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 userLogsIn(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 in"))
diff --git a/test/gui/shared/steps/steps.py b/test/gui/shared/steps/steps.py
index 3cef9e9a4..50edc14bf 100644
--- a/test/gui/shared/steps/steps.py
+++ b/test/gui/shared/steps/steps.py
@@ -512,3 +512,79 @@ def step(context, resource):
)
def step(context, resource, role):
createPublicShareWithRole(context, resource, role)
+
+
+@When('the user logs out of the client-UI')
+def step(context):
+ toolbar = Toolbar()
+ toolbar.userLogout()
+
+
+def isUserSignedOut(context, username):
+ displayname = getDisplayname(username)
+ server = context.userData['localBackendUrl']
+ toolbar = Toolbar()
+ test.compare(
+ str(waitForObjectExists(toolbar.SIGNED_OUT_TEXT_BAR).text),
+ 'Signed out from <a href="'
+ + server
+ + '">'
+ + server
+ + '</a> as <i>'
+ + displayname
+ + '</i>.',
+ )
+
+
+def isUserSignedIn(context, username):
+ displayname = getDisplayname(username)
+ server = context.userData['localBackendUrl']
+ toolbar = Toolbar()
+
+ test.compare(
+ str(waitForObjectExists(toolbar.SIGNED_OUT_TEXT_BAR).text),
+ 'Connected '
+ + 'to <a href="'
+ + server
+ + '">'
+ + server
+ + '</a> as <i>'
+ + displayname
+ + '</i>.',
+ )
+
+
+@Then('user "|any|" should be signed out')
+def step(context, username):
+ isUserSignedOut(context, username)
+
+
+@Given('user "|any|" has logged out of the client-UI')
+def step(context, username):
+ waitFor(
+ lambda: isFolderSynced(context.userData['clientSyncPath']),
+ context.userData['clientSyncTimeout'] * 1000,
+ )
+ # 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()
+ isUserSignedOut(context, username)
+
+
+@When('user "|any|" logs in to the client-UI')
+def step(context, username):
+ toolbar = Toolbar()
+ toolbar.userLogsIn()
+ password = getPasswordForUser(username)
+ enterUserPassword = EnterPassword()
+ enterUserPassword.enterPassword(password)
+
+
+@Then('user "|any|" should be connect to the client-UI')
+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 and connect to ther server
+ snooze(5)
+ isUserSignedIn(context, username)
diff --git a/test/gui/suite.conf b/test/gui/suite.conf
index 9433c6148..43ef4cf94 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
+TEST_CASES=tst_addAccount tst_sharing tst_syncing tst_loginLogout
VERSION=3
WRAPPERS=Qt
diff --git a/test/gui/tst_loginLogout/test.feature b/test/gui/tst_loginLogout/test.feature
new file mode 100644
index 000000000..21e3ddb23
--- /dev/null
+++ b/test/gui/tst_loginLogout/test.feature
@@ -0,0 +1,18 @@
+Feature: Logout users
+ As a user
+ I want to be able to login and logout of my account
+ So that I can protect my work and identity and be assured of privacy
+
+ Background:
+ Given user "Alice" has been created on the server with default attributes and without skeleton files
+
+ Scenario: logging out
+ Given user "Alice" has set up a client with default settings
+ When the user logs out of the client-UI
+ Then user "Alice" should be signed out
+
+ Scenario: login after loggin out
+ Given user "Alice" has set up a client with default settings
+ And user "Alice" has logged out of the client-UI
+ When user "Alice" logs in to the client-UI
+ Then user "Alice" should be connect to the client-UI
diff --git a/test/gui/tst_loginLogout/test.py b/test/gui/tst_loginLogout/test.py
new file mode 100644
index 000000000..d6224b99e
--- /dev/null
+++ b/test/gui/tst_loginLogout/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')