Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions test/gui/features/add-account/account.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replaced the single combined step with two separate steps to avoid opening the Advanced Configuration UI, which caused unnecessary overhead because it performed extra activities for Advanced Configuration.

| 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

Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
59 changes: 36 additions & 23 deletions test/gui/pageObjects/AccountConnectionWizard.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,14 @@ class AccountConnectionWizard:
by=By.NAME,
selector="Yes",
)
SELECT_LOCAL_FOLDER = SimpleNamespace(by=None, selector=None)
SELECT_LOCAL_FOLDER_MEATBALL_MENU = SimpleNamespace(
by=By.ACCESSIBILITY_ID,
selector="QApplication.Settings.centralwidget.dialogStack.SetupWizardWidget.contentWidget.AccountConfiguredWizardPage.advancedConfigGroupBox.advancedConfigGroupBoxContentWidget.localDirectoryGroupBox.chooseLocalDirectoryButton"
)
SELECT_LOCAL_FOLDER = 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",
Expand All @@ -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):
Expand Down Expand Up @@ -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():
Expand Down Expand Up @@ -207,28 +216,32 @@ def select_advanced_config():

@staticmethod
def can_change_local_sync_dir():
can_change = False
try:
squish.waitForObjectExists(AccountConnectionWizard.SELECT_LOCAL_FOLDER)
squish.clickButton(
squish.waitForObject(AccountConnectionWizard.DIRECTORY_NAME_BOX)
)
squish.waitForObjectExists(AccountConnectionWizard.CHOOSE_FOLDER_BUTTON)
can_change = True
except:
pass
return can_change
app().find_element(
AccountConnectionWizard.SELECT_LOCAL_FOLDER_MEATBALL_MENU.by,
AccountConnectionWizard.SELECT_LOCAL_FOLDER_MEATBALL_MENU.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
)
return True

@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.SELECT_LOCAL_FOLDER.by,
AccountConnectionWizard.SELECT_LOCAL_FOLDER.selector
)
return str(element.text)
19 changes: 11 additions & 8 deletions test/gui/pageObjects/SyncConnectionWizard.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class SyncConnectionWizard:
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)

Expand Down Expand Up @@ -180,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.get_attribute("enabled") == "true"

@staticmethod
def select_or_unselect_folders_to_sync(folders, select=True):
Expand Down
37 changes: 12 additions & 25 deletions test/gui/steps/account_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@
listen_sync_status_for_item,
)
from helpers.UserHelper import get_displayname_for_user, get_password_for_user
from helpers.ConfigHelper import get_config
from helpers.ConfigHelper import get_config, set_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')
Expand All @@ -33,7 +34,7 @@ def step(context):

@When('the user adds the following user credentials:')
def step(context):
account_details = get_client_details(context)
account_details = get_client_details(table_rows_hash(context.table))
set_config('syncConnectionName', get_displayname_for_user(account_details['user']))
AccountConnectionWizard.add_user_credentials(
account_details['user'], account_details['password']
Expand Down Expand Up @@ -198,11 +199,6 @@ def step(context):
):
AccountConnectionWizard.is_credential_window_visible().should.be.true

@When('the user selects download everything option in advanced section')
def step(context):
AccountConnectionWizard.select_download_everything_option()
AccountConnectionWizard.next_step()


@When('the user opens the advanced configuration')
def step(context):
Expand All @@ -211,17 +207,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)
Expand Down Expand Up @@ -251,10 +244,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)

Expand All @@ -264,13 +254,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('Compare sync path did not contains the expected path' ):
assert actual_sync_path == convert_path_separators_for_os(sync_path)


@Then('the warning "|any|" should appear in the sync connection wizard')
def step(context, warn_message):
Expand Down
2 changes: 1 addition & 1 deletion test/gui/steps/file_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
9 changes: 3 additions & 6 deletions test/gui/steps/sync_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,13 +292,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}"')
Expand Down