From ded0014f9a9426b08149daccbcc82fc525a3d951 Mon Sep 17 00:00:00 2001 From: Salipa-Gurung Date: Thu, 26 Oct 2023 15:24:19 +0545 Subject: [PATCH] add test step for logging in with incorrect password --- .../shared/scripts/pageObjects/AccountSetting.py | 13 +++++++++++++ test/gui/shared/steps/account_context.py | 15 +++++++++++++++ test/gui/tst_loginLogout/test.feature | 10 ++++++++++ 3 files changed, 38 insertions(+) diff --git a/test/gui/shared/scripts/pageObjects/AccountSetting.py b/test/gui/shared/scripts/pageObjects/AccountSetting.py index b00572c4aca..b0049bca53e 100644 --- a/test/gui/shared/scripts/pageObjects/AccountSetting.py +++ b/test/gui/shared/scripts/pageObjects/AccountSetting.py @@ -40,6 +40,13 @@ class AccountSetting: "type": "OCC::LogBrowser", "visible": 1, } + LOGIN_DIALOG_LOGOUT_BUTTON = { + "text": "Log out", + "type": "QPushButton", + "unnamed": 1, + "visible": 1, + "window": names.loginRequiredDialog_OCC_LoginRequiredDialog, + } @staticmethod def accountAction(action): @@ -72,6 +79,12 @@ def logout(): def login(): AccountSetting.accountAction("Log in") + @staticmethod + def logoutFromLoginRequiredDialog(): + squish.clickButton( + squish.waitForObject(AccountSetting.LOGIN_DIALOG_LOGOUT_BUTTON) + ) + @staticmethod def getAccountConnectionLabel(): return str( diff --git a/test/gui/shared/steps/account_context.py b/test/gui/shared/steps/account_context.py index 21dd050cf85..e9650251db0 100644 --- a/test/gui/shared/steps/account_context.py +++ b/test/gui/shared/steps/account_context.py @@ -114,6 +114,16 @@ def step(context, username): waitForInitialSyncToComplete(getResourcePath('/', username)) +@When('user "|any|" opens login dialog') +def step(context, username): + AccountSetting.login() + + +@When('user "|any|" enters the password "|any|"') +def step(context, username, password): + EnterPassword.reLogin(username, password) + + @Then('user "|any|" should be connect to the client-UI') def step(context, username): displayname = getDisplaynameForUser(username) @@ -257,3 +267,8 @@ def step(context): @Then("the sync folder should not be added") def step(context): test.vp("empty_sync_connection") + + +@When('user "|any|" logs out from the login required dialog') +def step(context, username): + AccountSetting.logoutFromLoginRequiredDialog() diff --git a/test/gui/tst_loginLogout/test.feature b/test/gui/tst_loginLogout/test.feature index 23492acf020..d49dfd70b6e 100644 --- a/test/gui/tst_loginLogout/test.feature +++ b/test/gui/tst_loginLogout/test.feature @@ -19,6 +19,16 @@ Feature: Logout users When user "Alice" logs in to the client-UI Then user "Alice" should be connect to the client-UI + @skipOnOCIS + Scenario: login with incorrect and correct password after log 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" opens login dialog + And user "ALice" enters the password "invalid" + And user "Alice" logs out from the login required dialog + And user "Alice" logs in to the client-UI + Then user "Alice" should be connect to the client-UI + @skipOnOCIS Scenario: login with oauth2 enabled Given app "oauth2" has been "enabled" in the server