diff --git a/test/gui/environment.py b/test/gui/environment.py index fca4baa16..05fc197ae 100644 --- a/test/gui/environment.py +++ b/test/gui/environment.py @@ -3,7 +3,7 @@ from behave.model_core import Status from helpers import ScreenRecorder -from helpers.ConfigHelper import init_config +from helpers.ConfigHelper import init_config, reset_sync_connection_name from helpers.api.provisioning import delete_created_users from helpers.SpaceHelper import delete_project_spaces from helpers.ConfigHelper import get_config @@ -69,3 +69,5 @@ def after_scenario(context, scenario): cleanup_current_app_log() clear_socket_messages() + + reset_sync_connection_name() diff --git a/test/gui/features/add-account/account.feature b/test/gui/features/add-account/account.feature index 5294cfab5..91dbc274a 100644 --- a/test/gui/features/add-account/account.feature +++ b/test/gui/features/add-account/account.feature @@ -6,14 +6,15 @@ Feature: adding accounts Background: Given user "Alice" has been created in the server with default attributes - @skip + Scenario: Check default options in advanced configuration Given the user has started the client And the user has entered the following account information: - | server | %local_server% | - | user | Alice | - | password | 1234 | - When the user opens the advanced configuration + | server | %local_server% | + When the user adds the following user credentials: + | user | Alice | + | password | 1234 | + And the user opens the advanced configuration Then the download everything option should be selected by default for Linux And the user should be able to choose the local download directory @@ -25,6 +26,7 @@ Feature: adding accounts | user | Alice | | password | 1234 | Then "Alice" account should be added + Then the add space button should be disabled @smoke Scenario: Adding multiple accounts @@ -61,7 +63,7 @@ Feature: adding accounts And the user syncs the "Personal" space Then the folder "simple-folder" should exist on the file system - @skip + Scenario: Check for suffix when sync path exists Given the user has created folder "OpenCloud" in the default home path And the user has started the client @@ -72,8 +74,6 @@ Feature: adding accounts | password | 1234 | And the user opens the advanced configuration Then the default local sync path should contain "%home%/OpenCloud (2)" in the configuration wizard - When the user selects download everything option in advanced section - Then the button to open sync connection wizard should be disabled @smoke Scenario: Re-add an account diff --git a/test/gui/helpers/ConfigHelper.py b/test/gui/helpers/ConfigHelper.py index 669f3cad9..5b192df36 100644 --- a/test/gui/helpers/ConfigHelper.py +++ b/test/gui/helpers/ConfigHelper.py @@ -10,6 +10,7 @@ APP_CONFIG_FILE = "opencloud.cfg" CUMULATIVE_APP_LOG_FILE = "opencloud.log" CURRENT_APP_LOG_FILE = "app.log" +DEFAULT_SYNC_CONNECTION_NAME = "Personal" def is_windows(): @@ -95,7 +96,7 @@ def get_app_env(): 'tempFolderPath': os.path.join(get_client_root_path(), 'temp'), 'guiTestReportDir': os.path.join(CURRENT_DIR.parent, 'reports'), 'record_video_on_failure': False, - 'syncConnectionName': 'Personal', + 'syncConnectionName': DEFAULT_SYNC_CONNECTION_NAME, ############################### # dynamic configs # ############################### @@ -189,3 +190,6 @@ def set_config(key, value): if key in READONLY_CONFIG: raise KeyError(f'Cannot set read-only config: {key}') CONFIG[key] = value + +def reset_sync_connection_name(): + set_config("syncConnectionName", DEFAULT_SYNC_CONNECTION_NAME) \ No newline at end of file diff --git a/test/gui/pageObjects/AccountConnectionWizard.py b/test/gui/pageObjects/AccountConnectionWizard.py index f4fb1e564..fe0ccb534 100644 --- a/test/gui/pageObjects/AccountConnectionWizard.py +++ b/test/gui/pageObjects/AccountConnectionWizard.py @@ -26,7 +26,14 @@ class AccountConnectionWizard: by=By.NAME, selector="Yes", ) - SELECT_LOCAL_FOLDER = SimpleNamespace(by=None, selector=None) + SELECT_LOCAL_FOLDER_BUTTON = SimpleNamespace( + by=By.ACCESSIBILITY_ID, + selector="QApplication.Settings.centralwidget.dialogStack.SetupWizardWidget.contentWidget.AccountConfiguredWizardPage.advancedConfigGroupBox.advancedConfigGroupBoxContentWidget.localDirectoryGroupBox.chooseLocalDirectoryButton" + ) + LOCAL_DOWNLOAD_DIRECTORY_INPUT = SimpleNamespace( + by=By.ACCESSIBILITY_ID, + selector="QApplication.Settings.centralwidget.dialogStack.SetupWizardWidget.contentWidget.AccountConfiguredWizardPage.advancedConfigGroupBox.advancedConfigGroupBoxContentWidget.localDirectoryGroupBox.localDirectoryLineEdit" + ) DIRECTORY_NAME_BOX = SimpleNamespace( by=By.ACCESSIBILITY_ID, selector="QApplication.Settings.centralwidget.dialogStack.SetupWizardWidget.contentWidget.AccountConfiguredWizardPage.advancedConfigGroupBox.advancedConfigGroupBoxContentWidget.localDirectoryGroupBox.chooseLocalDirectoryButton", @@ -48,7 +55,7 @@ class AccountConnectionWizard: by=By.ACCESSIBILITY_ID, selector="QApplication.QFileDialog.fileNameEdit", ) - SYNC_EVERYTHING_RADIO_BUTTON = SimpleNamespace(by=None, selector=None) + SYNC_EVERYTHING_RADIO_BUTTON = SimpleNamespace(by=By.NAME, selector="Synchronize all existing spaces") @staticmethod def add_server(server_url): @@ -176,9 +183,11 @@ def select_manual_sync_folder_option(): @staticmethod def select_download_everything_option(): - squish.clickButton( - squish.waitForObject(AccountConnectionWizard.SYNC_EVERYTHING_RADIO_BUTTON) - ) + app().find_element( + AccountConnectionWizard.SYNC_EVERYTHING_RADIO_BUTTON.by, + AccountConnectionWizard.SYNC_EVERYTHING_RADIO_BUTTON.selector + ).click() + @staticmethod def is_new_connection_window_visible(): @@ -209,11 +218,18 @@ def select_advanced_config(): def can_change_local_sync_dir(): can_change = False try: - squish.waitForObjectExists(AccountConnectionWizard.SELECT_LOCAL_FOLDER) - squish.clickButton( - squish.waitForObject(AccountConnectionWizard.DIRECTORY_NAME_BOX) + app().find_element( + AccountConnectionWizard.SELECT_LOCAL_FOLDER_BUTTON.by, + AccountConnectionWizard.SELECT_LOCAL_FOLDER_BUTTON.selector + ).click() + app().find_element( + AccountConnectionWizard.DIRECTORY_NAME_BOX.by, + AccountConnectionWizard.DIRECTORY_NAME_BOX.selector, + ) + app().find_element( + AccountConnectionWizard.CHOOSE_FOLDER_BUTTON.by, + AccountConnectionWizard.CHOOSE_FOLDER_BUTTON.selector ) - squish.waitForObjectExists(AccountConnectionWizard.CHOOSE_FOLDER_BUTTON) can_change = True except: pass @@ -221,14 +237,16 @@ def can_change_local_sync_dir(): @staticmethod def is_sync_everything_option_checked(): - return squish.waitForObjectExists( - AccountConnectionWizard.SYNC_EVERYTHING_RADIO_BUTTON - ).checked + element = app().find_element( + AccountConnectionWizard.SYNC_EVERYTHING_RADIO_BUTTON.by, + AccountConnectionWizard.SYNC_EVERYTHING_RADIO_BUTTON.selector + ) + return element.get_attribute("checked") == "true" @staticmethod def get_local_sync_path(): - return str( - squish.waitForObjectExists( - AccountConnectionWizard.SELECT_LOCAL_FOLDER - ).displayText + element = app().find_element( + AccountConnectionWizard.LOCAL_DOWNLOAD_DIRECTORY_INPUT.by, + AccountConnectionWizard.LOCAL_DOWNLOAD_DIRECTORY_INPUT.selector ) + return str(element.text) diff --git a/test/gui/pageObjects/SyncConnectionWizard.py b/test/gui/pageObjects/SyncConnectionWizard.py index 653b75d58..1e56cfea6 100644 --- a/test/gui/pageObjects/SyncConnectionWizard.py +++ b/test/gui/pageObjects/SyncConnectionWizard.py @@ -29,7 +29,7 @@ class SyncConnectionWizard: CREATE_REMOTE_FOLDER_CONFIRM_BUTTON = SimpleNamespace(by=None, selector=None) REFRESH_BUTTON = SimpleNamespace(by=None, selector=None) REMOTE_FOLDER_SELECTION_INPUT = SimpleNamespace(by=None, selector=None) - ADD_FOLDER_SYNC_BUTTON = SimpleNamespace(by=None, selector=None) + ADD_SPACE_BUTTON = SimpleNamespace(by=By.NAME, selector='Add Space') WARN_LABEL = SimpleNamespace(by=None, selector=None) CHOOSE_WHAT_TO_SYNC_FOLDER_TREE = SimpleNamespace(by=None, selector=None) @@ -181,21 +181,23 @@ def open_sync_connection_wizard(): @staticmethod def get_local_sync_path(): - return str( - squish.waitForObjectExists( - SyncConnectionWizard.CHOOSE_LOCAL_SYNC_FOLDER - ).displayText + element = app().find_element( + SyncConnectionWizard.CHOOSE_LOCAL_SYNC_FOLDER.by, + SyncConnectionWizard.CHOOSE_LOCAL_SYNC_FOLDER.selector ) + return str(element.text) @staticmethod def get_warn_label(): return str(squish.waitForObjectExists(SyncConnectionWizard.WARN_LABEL).text) @staticmethod - def is_add_sync_folder_button_enabled(): - return squish.waitForObjectExists( - SyncConnectionWizard.ADD_FOLDER_SYNC_BUTTON - ).enabled + def is_add_space_button_enabled(): + element = app().find_element( + SyncConnectionWizard.ADD_SPACE_BUTTON.by, + SyncConnectionWizard.ADD_SPACE_BUTTON.selector + ) + return element.is_enabled() @staticmethod def get_relative_folder_element(target_folder, parent_row): diff --git a/test/gui/steps/account_context.py b/test/gui/steps/account_context.py index f5d2f6f91..e969aa514 100644 --- a/test/gui/steps/account_context.py +++ b/test/gui/steps/account_context.py @@ -20,10 +20,11 @@ wait_for_initial_sync_to_complete, listen_sync_status_for_item, ) -from helpers.UserHelper import get_displayname_for_user, get_password_for_user +from helpers.UserHelper import get_password_for_user from helpers.ConfigHelper import get_config from helpers.TableParser import table_rows_hash from helpers.AppHelper import close_and_kill_app +from helpers.FilesHelper import convert_path_separators_for_os @Given('the user has started the client') @@ -33,8 +34,7 @@ def step(context): @When('the user adds the following user credentials:') def step(context): - account_details = get_client_details(context) - set_config('syncConnectionName', get_displayname_for_user(account_details['user'])) + account_details = get_client_details(table_rows_hash(context.table)) AccountConnectionWizard.add_user_credentials( account_details['user'], account_details['password'] ) @@ -210,17 +210,14 @@ def step(context): @Then('the user should be able to choose the local download directory') def step(context): - test.compare(True, AccountConnectionWizard.can_change_local_sync_dir()) + with ensure('User can not choose the local download directory'): + AccountConnectionWizard.can_change_local_sync_dir().should.be.true @Then('the download everything option should be selected by default for Linux') def step(context): - if is_linux(): - test.compare( - True, - AccountConnectionWizard.is_sync_everything_option_checked(), - 'Sync everything option is checked', - ) + with ensure('Sync everything option is not checked'): + AccountConnectionWizard.is_sync_everything_option_checked().should.be.true @When(r'^the user presses the "([^"]*)" key(?:s)?', regexp=True) @@ -250,10 +247,7 @@ def step(context, username): expect(Toolbar.account_has_focus(username)).to.be.true -@Then( - r'the default local sync path should contain "([^"]*)" in the (configuration|sync connection) wizard', - regexp=True, -) +@Then('the default local sync path should contain "{sync_path}" in the {wizard} wizard') def step(context, sync_path, wizard): sync_path = substitute_inline_codes(sync_path) @@ -263,13 +257,10 @@ def step(context, sync_path, wizard): actual_sync_path = AccountConnectionWizard.get_local_sync_path() else: actual_sync_path = SyncConnectionWizard.get_local_sync_path() - - test.compare( - actual_sync_path, - convert_path_separators_for_os(sync_path), - 'Compare sync path contains the expected path', - ) - + + with ensure('The actual sync path does not match the expected sync path' ): + actual_sync_path.should.equal(convert_path_separators_for_os(sync_path)) + @Then('the warning "|any|" should appear in the sync connection wizard') def step(context, warn_message): diff --git a/test/gui/steps/file_context.py b/test/gui/steps/file_context.py index f6dddb0bc..c92240280 100644 --- a/test/gui/steps/file_context.py +++ b/test/gui/steps/file_context.py @@ -420,7 +420,7 @@ def step(context, username, source): shutil.copy2(source_dir, destination_dir) -@Given('the user has created folder "|any|" in the default home path') +@Given('the user has created folder "{folder_name}" in the default home path') def step(context, folder_name): folder_path = join(get_config('home_dir'), folder_name) os.makedirs(prefix_path_namespace(folder_path)) diff --git a/test/gui/steps/sync_context.py b/test/gui/steps/sync_context.py index 15945c3ca..27ae6bce3 100644 --- a/test/gui/steps/sync_context.py +++ b/test/gui/steps/sync_context.py @@ -294,13 +294,10 @@ def step(context): SyncConnectionWizard.open_sync_connection_wizard() -@Then('the button to open sync connection wizard should be disabled') +@Then('the add space button should be disabled') def step(context): - test.compare( - False, - SyncConnectionWizard.is_add_sync_folder_button_enabled(), - 'Button to open sync connection wizard should be disabled', - ) + with ensure('Add space Button to open sync connection wizard should be disabled'): + SyncConnectionWizard.is_add_space_button_enabled().should.be.false @When('the user checks the activities of account "{account}"')