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 Oct 9, 2023
1 parent dda0bfd commit e4b60a6
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 15 deletions.
3 changes: 2 additions & 1 deletion test/gui/shared/scripts/names.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,5 @@
o_folderList_ownCloud_QModelIndex = {"column": 0, "container": stack_folderList_QTreeView, "text": "ownCloud", "type": "QModelIndex"}
contentWidget_contentWidget_QStackedWidget = {"container": setupWizardWindow_contentWidget_QStackedWidget, "name": "contentWidget", "type": "QStackedWidget", "visible": 1}
o_folderList_Personal_QModelIndex = {"column": 0, "container": stack_folderList_QTreeView, "text": "Personal", "type": "QModelIndex"}
add_Folder_Sync_Connection_tableView_QTableView = {"name": "tableView","type": "QTableView","visible": 1,"window": add_Folder_Sync_Connection_OCC_FolderWizard}
add_Folder_Sync_Connection_tableView_QTableView = {"name": "tableView","type": "QTableView","visible": 1,"window": add_Folder_Sync_Connection_OCC_FolderWizard}
quit_ownCloud_QMessageBox = {"type": "QMessageBox", "unnamed": 1, "visible": 1, "windowTitle": "Quit ownCloud"}
2 changes: 1 addition & 1 deletion test/gui/shared/scripts/pageObjects/EnterPassword.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def enterPassword(password):
squish.clickButton(squish.waitForObject(EnterPassword.LOGIN_BUTTON))

@staticmethod
def oidcReLogin(username, password, login_type=None):
def oidcReLogin(username, password, login_type='oidc'):
# wait 500ms for copy button to fully load
squish.snooze(1 / 2)
squish.clickButton(
Expand Down
16 changes: 16 additions & 0 deletions test/gui/shared/scripts/pageObjects/Toolbar.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
import squish
import names


class Toolbar:
QUIT_OWNCLOUD_YES_QPUSHBUTTON = {
"text": "Yes",
"type": "QPushButton",
"unnamed": 1,
"visible": 1,
"window": names.quit_ownCloud_QMessageBox,
}

@staticmethod
def getItemSelector(item_name):
return {
Expand Down Expand Up @@ -31,3 +40,10 @@ def getDisplayedAccountText(displayname, host):
Toolbar.getItemSelector(displayname + "@" + host)
).text
)

@staticmethod
def quitOwncloud():
squish.clickButton(
squish.waitForObject(Toolbar.getItemSelector("Quit ownCloud"))
)
squish.clickButton(squish.waitForObject(Toolbar.QUIT_OWNCLOUD_YES_QPUSHBUTTON))
32 changes: 21 additions & 11 deletions test/gui/shared/steps/account_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ def step(context):
startClient()


@When('the user starts the client')
def step(context):
startClient()


@When(r'^the user adds (the first|another) account with$', regexp=True)
def step(context, accountType):
if accountType == 'another':
Expand All @@ -79,6 +84,11 @@ def step(context):
AccountConnectionWizard.addAccountInformation(account_details)


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


@When('the user "|any|" logs out of the client-UI')
def step(context, username):
AccountSetting.logout()
Expand Down Expand Up @@ -239,6 +249,12 @@ def step(context):
test.compare(True, AccountSetting.isLogDialogVisible(), "Log dialog is opened")


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


@When('the user adds the following account with oauth2 enabled:')
def step(context):
AccountConnectionWizard.addAccountWithOauth2(context)
Expand All @@ -254,20 +270,14 @@ 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'
)


@Given("the user has quitted the client")
def step(context):
Toolbar.quitOwncloud()
4 changes: 2 additions & 2 deletions test/gui/tst_loginLogout/test.feature
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,6 @@ Feature: Logout users
| server | %local_server% |
| user | Alice |
| password | 1234 |
When user quits the client
And user starts the client
And the user has quitted the client
When the user starts the client
Then user "Alice" should be connect to the client-UI

0 comments on commit e4b60a6

Please sign in to comment.