Skip to content

Commit

Permalink
add step implementation for oauth2 login
Browse files Browse the repository at this point in the history
  • Loading branch information
Salipa-Gurung committed Sep 18, 2023
1 parent 5d7cde1 commit 7b102e9
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -321,3 +321,12 @@ def isSyncEverythingOptionChecked():
).checked
== True
)

@staticmethod
def addAccountWithOauth2(context):
account_details = getClientDetails(context)
AccountConnectionWizard.addServer(account_details['server'])
AccountConnectionWizard.oauthLogin(
account_details['user'], account_details['password']
)
AccountConnectionWizard.nextStep()
4 changes: 2 additions & 2 deletions test/gui/shared/scripts/pageObjects/EnterPassword.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ def enterPassword(password):
squish.clickButton(squish.waitForObject(EnterPassword.LOGIN_BUTTON))

@staticmethod
def oidcReLogin(username, password):
def oidcReLogin(username, password, login_type=None):
# wait 500ms for copy button to fully load
squish.snooze(1 / 2)
squish.clickButton(
squish.waitForObject(EnterPassword.COPY_URL_TO_CLIPBOARD_BUTTON)
)
authorize_via_webui(username, password)
authorize_via_webui(username, password, login_type)

@staticmethod
def reLogin(username, password):
Expand Down
26 changes: 20 additions & 6 deletions test/gui/shared/steps/account_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,12 +241,7 @@ def step(context):

@When('the user adds the following account with oauth2 enabled:')
def step(context):
account_details = getClientDetails(context)
AccountConnectionWizard.addServer(account_details['server'])
AccountConnectionWizard.oauthLogin(
account_details['user'], account_details['password']
)
AccountConnectionWizard.nextStep()
AccountConnectionWizard.addAccountWithOauth2(context)


@When('the user cancels the sync connection wizard')
Expand All @@ -257,3 +252,22 @@ def step(context):
@Then("the sync folder should not be added")
def step(context):
test.vp("empty_sync_connection")


@Given('the user has added the following account with oauth2 enabled:')
def step(context):
AccountConnectionWizard.addAccountWithOauth2(context)
squish.snooze(1)


@Given('the user "|any|" has logged out of the client-UI')
def step(context, username):
AccountSetting.logout()


@When('user "|any|" logs in with oauth2 to the client-UI')
def step(context, username):
AccountSetting.login()
EnterPassword.oidcReLogin(
username, getPasswordForUser(username), login_type='oauth'
)
8 changes: 4 additions & 4 deletions test/gui/tst_loginLogout/test.feature
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,19 @@ Feature: Logout users
Scenario: login after loggin out with oauth2 enabled
Given app "oauth2" has been "enabled" in the server
And the user has started the client
And the user adds the following account with oauth2 enabled:
And the user has added the following account with oauth2 enabled:
| server | %local_server% |
| user | Alice |
| password | 1234 |
When user "Alice" has logged out of the client-UI
And user "Alice" logs in with oauth2 to the client-UI
And the user "Alice" has logged out of the client-UI
When user "Alice" logs in with oauth2 to the client-UI
Then user "Alice" should be connect to the client-UI

@skipOnOCIS
Scenario: the client re-auths after restarting
Given app "oauth2" has been "enabled" in the server
And the user has started the client
And the user adds the following account with oauth2 enabled:
And the user has added the following account with oauth2 enabled:
| server | %local_server% |
| user | Alice |
| password | 1234 |
Expand Down

0 comments on commit 7b102e9

Please sign in to comment.