diff --git a/test/gui/shared/scripts/helpers/SetupClientHelper.py b/test/gui/shared/scripts/helpers/SetupClientHelper.py index b7d803571f0..7d2a45e5195 100644 --- a/test/gui/shared/scripts/helpers/SetupClientHelper.py +++ b/test/gui/shared/scripts/helpers/SetupClientHelper.py @@ -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': @@ -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 diff --git a/test/gui/shared/scripts/pageObjects/AccountConnectionWizard.py b/test/gui/shared/scripts/pageObjects/AccountConnectionWizard.py index 5267c7598ee..d4409506555 100644 --- a/test/gui/shared/scripts/pageObjects/AccountConnectionWizard.py +++ b/test/gui/shared/scripts/pageObjects/AccountConnectionWizard.py @@ -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 @@ -223,6 +227,23 @@ 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("") + squish.nativeType("") + + squish.type( + squish.waitForObject(AccountConnectionWizard.SELECT_LOCAL_FOLDER), + sync_path, + ) + setCurrentUserSyncPath(sync_path) + @staticmethod def addAccount(account_details): AccountConnectionWizard.addAccountInformation(account_details) @@ -230,13 +251,22 @@ def addAccount(account_details): @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(): diff --git a/test/gui/shared/steps/account_context.py b/test/gui/shared/steps/account_context.py index e9650251db0..2b09d61c250 100644 --- a/test/gui/shared/steps/account_context.py +++ b/test/gui/shared/steps/account_context.py @@ -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) @@ -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) @@ -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() diff --git a/test/gui/tst_addAccount/test.feature b/test/gui/tst_addAccount/test.feature index 097be3cdfa4..8bf5ff9db69 100644 --- a/test/gui/tst_addAccount/test.feature +++ b/test/gui/tst_addAccount/test.feature @@ -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 | @@ -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 | @@ -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 | @@ -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 | @@ -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 | @@ -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 | diff --git a/test/gui/tst_sharing/test.feature b/test/gui/tst_sharing/test.feature index abb31c06b1c..62f377c886d 100644 --- a/test/gui/tst_sharing/test.feature +++ b/test/gui/tst_sharing/test.feature @@ -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 | diff --git a/test/gui/tst_syncing/test.feature b/test/gui/tst_syncing/test.feature index fa36a6fac22..e43a40f37c0 100644 --- a/test/gui/tst_syncing/test.feature +++ b/test/gui/tst_syncing/test.feature @@ -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 | @@ -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 | @@ -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 | @@ -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 | @@ -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 |