Skip to content

Commit

Permalink
[gui-tests][full-ci] update account connection scenario (#11321)
Browse files Browse the repository at this point in the history
* Combine similar steps and remove unused ones

* fix account imformation step
  • Loading branch information
saw-jan authored Oct 31, 2023
1 parent c67f35c commit 610b293
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 50 deletions.
4 changes: 3 additions & 1 deletion test/gui/shared/scripts/helpers/SetupClientHelper.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def substituteInLineCodes(value):


def getClientDetails(context):
clientDetails = {'server': '', 'user': '', 'password': ''}
clientDetails = {'server': '', 'user': '', 'password': '', 'sync_folder': ''}
for row in context.table[0:]:
row[1] = substituteInLineCodes(row[1])
if row[0] == 'server':
Expand All @@ -29,6 +29,8 @@ def getClientDetails(context):
clientDetails.update({'user': row[1]})
elif row[0] == 'password':
clientDetails.update({'password': row[1]})
elif row[0] == 'sync_folder':
clientDetails.update({'sync_folder': row[1]})
return clientDetails


Expand Down
46 changes: 38 additions & 8 deletions test/gui/shared/scripts/pageObjects/AccountConnectionWizard.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import names
import squish
from helpers.SetupClientHelper import getClientDetails, createUserSyncPath
from helpers.WebUIHelper import authorize_via_webui
from helpers.ConfigHelper import get_config
from helpers.SetupClientHelper import (
createUserSyncPath,
getTempResourcePath,
setCurrentUserSyncPath,
)
import test


Expand Down Expand Up @@ -223,20 +227,46 @@ def selectSyncFolder(user):
)
squish.clickButton(squish.waitForObject(AccountConnectionWizard.CHOOSE_BUTTON))

@staticmethod
def set_temp_folder_as_sync_folder(folder_name):
sync_path = getTempResourcePath(folder_name)

# clear the current path
squish.mouseClick(
squish.waitForObject(AccountConnectionWizard.SELECT_LOCAL_FOLDER)
)
squish.nativeType("<Ctrl+a>")
squish.nativeType("<Backspace>")

squish.type(
squish.waitForObject(AccountConnectionWizard.SELECT_LOCAL_FOLDER),
sync_path,
)
setCurrentUserSyncPath(sync_path)

@staticmethod
def addAccount(account_details):
AccountConnectionWizard.addAccountInformation(account_details)
AccountConnectionWizard.nextStep()

@staticmethod
def addAccountInformation(account_details):
AccountConnectionWizard.addServer(account_details['server'])
if get_config('ocis'):
AccountConnectionWizard.acceptCertificate()
AccountConnectionWizard.addUserCreds(
account_details['user'], account_details['password']
)
AccountConnectionWizard.selectSyncFolder(account_details['user'])
if account_details['server']:
AccountConnectionWizard.addServer(account_details['server'])
if get_config('ocis'):
AccountConnectionWizard.acceptCertificate()
if account_details['user']:
AccountConnectionWizard.addUserCreds(
account_details['user'], account_details['password']
)

if account_details['sync_folder']:
AccountConnectionWizard.selectAdvancedConfig()
AccountConnectionWizard.set_temp_folder_as_sync_folder(
account_details['sync_folder']
)
elif account_details['user']:
AccountConnectionWizard.selectSyncFolder(account_details['user'])

@staticmethod
def selectManualSyncFolderOption():
Expand Down
35 changes: 8 additions & 27 deletions test/gui/shared/steps/account_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,18 @@ def step(context):
startClient()


@When(r'^the user adds (the first|another) account with$', regexp=True)
def step(context, accountType):
if accountType == 'another':
Toolbar.openNewAccountSetup()
@When('the user opens the add-account dialog')
def step(context):
Toolbar.openNewAccountSetup()


@When('the user adds the following account:')
def step(context):
account_details = getClientDetails(context)
AccountConnectionWizard.addAccount(account_details)


@Given('the user has added the following account information:')
@Given('the user has entered the following account information:')
def step(context):
account_details = getClientDetails(context)
AccountConnectionWizard.addAccountInformation(account_details)
Expand Down Expand Up @@ -163,17 +166,6 @@ def step(context, errorMsg):
test.compare(AccountConnectionWizard.getErrorMessage(), errorMsg)


@Given('the user has added the server "|any|"')
def step(context, server):
server_url = substituteInLineCodes(server)
AccountConnectionWizard.addServer(server_url)
test.compare(
AccountConnectionWizard.isCredentialWindowVisible(),
True,
"Assert credentials page is visible",
)


@When('the user adds the server "|any|"')
def step(context, server):
server_url = substituteInLineCodes(server)
Expand Down Expand Up @@ -209,17 +201,6 @@ def step(context, action):
AccountConnectionWizard.nextStep()


@When('the user adds the following account information:')
def step(context):
account_details = getClientDetails(context)
AccountConnectionWizard.addServer(account_details['server'])
if get_config('ocis'):
AccountConnectionWizard.acceptCertificate()
AccountConnectionWizard.addUserCreds(
account_details['user'], account_details['password']
)


@When("the user opens the advanced configuration")
def step(context):
AccountConnectionWizard.selectAdvancedConfig()
Expand Down
18 changes: 10 additions & 8 deletions test/gui/tst_addAccount/test.feature
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@ Feature: adding accounts

Scenario: Check default options in advanced configuration
Given the user has started the client
When the user adds the following account information:
And the user has entered the following account information:
| server | %local_server% |
| user | Alice |
| password | 1234 |
And the user opens the advanced configuration
When the user opens the advanced configuration
Then the download everything option should be selected by default
And the user should be able to choose the local download directory


Scenario: Adding normal Account
Given the user has started the client
When the user adds the first account with
When the user adds the following account:
| server | %local_server% |
| user | Alice |
| password | 1234 |
Expand All @@ -32,7 +32,8 @@ Feature: adding accounts
Scenario: Adding multiple accounts
Given user "Brian" has been created on the server with default attributes and without skeleton files
And user "Alice" has set up a client with default settings
When the user adds another account with
When the user opens the add-account dialog
And the user adds the following account:
| server | %local_server% |
| user | Brian |
| password | AaBb2Cc3Dd4 |
Expand All @@ -43,7 +44,8 @@ Feature: adding accounts
@skipOnOCIS
Scenario: Adding account with wrong credentials
Given the user has started the client
And the user has added the server "%local_server%"
And the user has entered the following account information:
| server | %local_server% |
When the user adds the following wrong user credentials:
| user | Alice |
| password | 12345 |
Expand All @@ -59,7 +61,7 @@ Feature: adding accounts

Scenario: Adding account with vfs enabled
Given the user has started the client
And the user has added the following account information:
And the user has entered the following account information:
| server | %local_server% |
| user | Alice |
| password | 1234 |
Expand All @@ -70,7 +72,7 @@ Feature: adding accounts

Scenario: Try to enable experimental vfs option and cancel it
Given the user has started the client
And the user has added the following account information:
And the user has entered the following account information:
| server | %local_server% |
| user | Alice |
| password | 1234 |
Expand All @@ -83,7 +85,7 @@ Feature: adding accounts
Scenario: Add space manually from sync connection window
Given user "Alice" has created folder "simple-folder" in the server
And the user has started the client
And the user has added the following account information:
And the user has entered the following account information:
| server | %local_server% |
| user | Alice |
| password | 1234 |
Expand Down
3 changes: 2 additions & 1 deletion test/gui/tst_sharing/test.feature
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,8 @@ Feature: Sharing
And user "Alice" has shared file "textfile.txt" on the server with user "Brian" with "all" permissions
And user "Alice" has shared folder "FOLDER" on the server with user "Brian" with "all" permissions
And user "Brian" has set up a client with default settings
When the user adds another account with
When the user opens the add-account dialog
And the user adds the following account:
| server | %local_server% |
| user | Alice |
| password | 1234 |
Expand Down
10 changes: 5 additions & 5 deletions test/gui/tst_syncing/test.feature
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Feature: Syncing files
Given user "Alice" has created folder "simple-folder" in the server
And user "Alice" has created folder "large-folder" in the server
And the user has started the client
And the user has added the following account information:
And the user has entered the following account information:
| server | %local_server% |
| user | Alice |
| password | 1234 |
Expand All @@ -73,7 +73,7 @@ Feature: Syncing files
Given user "Alice" has created folder "simple-folder" in the server
And user "Alice" has created folder "large-folder" in the server
And the user has started the client
And the user has added the following account information:
And the user has entered the following account information:
| server | %local_server% |
| user | Alice |
| password | 1234 |
Expand All @@ -94,7 +94,7 @@ Feature: Syncing files
And user "Alice" has uploaded file on the server with content "more contents" to "aFolder/lorem.txt"
And user "Alice" has created folder "bFolder" in the server
And the user has started the client
And the user has added the following account information:
And the user has entered the following account information:
| server | %local_server% |
| user | Alice |
| password | 1234 |
Expand Down Expand Up @@ -360,7 +360,7 @@ Feature: Syncing files

Scenario: Skip sync folder configuration
Given the user has started the client
And the user has added the following account information:
And the user has entered the following account information:
| server | %local_server% |
| user | Alice |
| password | 1234 |
Expand Down Expand Up @@ -393,7 +393,7 @@ Feature: Syncing files
And user "Alice" has created folder "~test%" in the server
And the user has created a folder "~`!@#$^&()-_=+{[}];',)PRN%" in temp folder
And the user has started the client
And the user has added the following account information:
And the user has entered the following account information:
| server | %local_server% |
| user | Alice |
| password | 1234 |
Expand Down

0 comments on commit 610b293

Please sign in to comment.