diff options
author | Swoichha Adhikari <swoichhaa@gmail.com> | 2021-06-03 09:33:45 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-03 09:33:45 +0300 |
commit | a2c2a29a8fae8300917eb0414b49cf1007a8bfde (patch) | |
tree | 6f0aabefea7b5f12904d1edfb7935c2a1e15f2a2 /test/gui/shared/steps | |
parent | 93cd5462138c6c7067d720af071f394efc3000d8 (diff) |
[tests-only]logout user from client (#8663)
* [tests-only]logout user from client
* add snooze
Diffstat (limited to 'test/gui/shared/steps')
-rw-r--r-- | test/gui/shared/steps/steps.py | 76 |
1 files changed, 76 insertions, 0 deletions
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) |