Skip to content
Merged
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
11 changes: 5 additions & 6 deletions test/gui/features/add-account/account.feature
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Feature: adding accounts
| server | %local_server% |
| user | Alice |
| password | 1234 |
Then the account with displayname "Alice Hansen" should be displayed
Then "Alice" account should be added

@smoke
Scenario: Adding multiple accounts
Expand All @@ -35,9 +35,8 @@ Feature: adding accounts
| server | %local_server% |
| user | Brian |
| password | AaBb2Cc3Dd4 |
Then "Brian Murphy" account should be opened
And the account with displayname "Alice Hansen" should be displayed
And the account with displayname "Brian Murphy" should be displayed
Then "Brian" account should be opened
And "Alice" account should be added


Scenario: Adding account with self signed certificate for the first time
Expand All @@ -48,7 +47,7 @@ Feature: adding accounts
When the user adds the following account:
| user | Alice |
| password | 1234 |
Then "Alice Hansen" account should be opened
Then "Alice" account should be opened

@smoke
Scenario: Add space manually from sync connection window
Expand Down Expand Up @@ -87,6 +86,6 @@ Feature: adding accounts
| server | %local_server% |
| user | Alice |
| password | 1234 |
Then the account with displayname "Alice Hansen" should be displayed
Then "Alice" account should be added
And the folder "large-folder" should exist on the file system
And the file "testFile.txt" should exist on the file system
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,17 @@ Feature: remove account connection
I want to remove my account
So that I won't be using any client-UI services

@smoke @skip
@smoke
Scenario: remove an account connection
Given user "Alice" has been created in the server with default attributes
And user "Brian" has been created in the server with default attributes
And the user has set up the following accounts with default settings:
| users |
| Alice |
| Brian |
When the user removes the connection for user "Brian"
Then the account with displayname "Brian Murphy" should not be displayed
But the account with displayname "Alice Hansen" should be displayed
Then "Brian" account should not be displayed
But "Alice" account should be added


Scenario: remove the only account connection
Expand Down
27 changes: 19 additions & 8 deletions test/gui/pageObjects/AccountSetting.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@


class AccountSetting:
ACCOUNT_CONNECTION_CONTAINER = SimpleNamespace(
by=By.NAME, selector="Sync connections"
)
MANAGE_ACCOUNT_BUTTON = SimpleNamespace(by=By.NAME, selector="Manage Account")
ACCOUNT_MENU = SimpleNamespace(by=By.NAME, selector="{menu_item}")
CONFIRM_REMOVE_CONNECTION_BUTTON = SimpleNamespace(
Expand All @@ -21,10 +24,20 @@ class AccountSetting:

@staticmethod
def account_action(action):
app().find_element(
AccountSetting.MANAGE_ACCOUNT_BUTTON.by,
AccountSetting.MANAGE_ACCOUNT_BUTTON.selector,
).click()
connections = app().find_elements(
AccountSetting.ACCOUNT_CONNECTION_CONTAINER.by,
AccountSetting.ACCOUNT_CONNECTION_CONTAINER.selector,
)
manage_button = None
for connection in connections:
# use the active connection
if connection.get_attribute("showing") == "true":
manage_button = connection.find_element(
AccountSetting.MANAGE_ACCOUNT_BUTTON.by,
AccountSetting.MANAGE_ACCOUNT_BUTTON.selector,
)
break
manage_button.click()
app().find_element(
AccountSetting.ACCOUNT_MENU.by,
AccountSetting.ACCOUNT_MENU.selector.format(menu_item=action),
Expand Down Expand Up @@ -129,9 +142,7 @@ def is_log_dialog_visible():

@staticmethod
def remove_connection_for_user(username):
displayname = get_displayname_for_user(username)
displayname = substitute_inline_codes(displayname)
Toolbar.open_account(displayname)
Toolbar.open_account(username)
AccountSetting.remove_account_connection()

@staticmethod
Expand All @@ -140,7 +151,7 @@ def wait_until_account_is_removed(username, timeout=10000):
displayname = substitute_inline_codes(displayname)

def account_removed():
account = Toolbar.get_account(displayname)
account = Toolbar.get_account(username)
return account is None

result = wait_for(account_removed, timeout)
Expand Down
3 changes: 2 additions & 1 deletion test/gui/pageObjects/SyncConnectionWizard.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,8 @@ def select_space(space_name):
),
)
# ISSUE: https://github.com/opencloud-eu/desktop/pull/879
# Workaround until above fix is merged
# Cannot select space by click event
# Select space using keyboard events as a workaround
# TODO: Remove 'send_keys' and uncomment 'click' action
space_item.send_keys(Keys.ARROW_DOWN)
# space_item.click()
Expand Down
25 changes: 17 additions & 8 deletions test/gui/pageObjects/Toolbar.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
from types import SimpleNamespace
from urllib.parse import urlparse
from appium.webdriver.common.appiumby import AppiumBy as By
from selenium.webdriver.common.keys import Keys

from helpers.SetupClientHelper import wait_until_app_killed
from helpers.ConfigHelper import get_config
from helpers.SetupClientHelper import app
from helpers.UserHelper import get_displayname_for_user


class Toolbar:
Expand Down Expand Up @@ -49,9 +51,15 @@ def open_new_account_setup():
).click()

@staticmethod
def open_account(displayname):
account_tab = Toolbar.get_account(displayname)
account_tab.click()
def open_account(username):
account_tab = Toolbar.get_account(username)
# ISSUE: https://github.com/opencloud-eu/desktop/pull/879
# Cannot activate account tab by click event
# Select the account tab using keyboard events as a workaround
# TODO: Remove the workaround and uncomment 'click' action
# account_tab.click()
account_tab.send_keys(Keys.TAB)
Comment on lines +56 to +61
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

fix for this is in #879

account_tab.send_keys(Keys.ENTER)

@staticmethod
def get_displayed_account_text(displayname, host):
Expand Down Expand Up @@ -99,7 +107,8 @@ def get_accounts():
return accounts, selectors

@staticmethod
def get_account(display_name):
def get_account(username):
display_name = get_displayname_for_user(username)
server_host = urlparse(get_config('localBackendUrl')).netloc
account_label = f"{display_name}@{server_host}"
account = None
Expand All @@ -118,11 +127,11 @@ def get_active_account():
return None, None

@staticmethod
def account_has_focus(display_name):
account = Toolbar.get_account(display_name)
def account_has_focus(username):
account = Toolbar.get_account(username)
return account.get_attribute("checked") == "true"

@staticmethod
def account_exists(display_name):
account = Toolbar.get_account(display_name)
def account_exists(username):
account = Toolbar.get_account(username)
return account is not None
34 changes: 15 additions & 19 deletions test/gui/steps/account_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,22 +38,16 @@ def step(context):
)


@Then('the account with displayname "{displayname}" should be displayed')
def step(context, displayname):
displayname = substitute_inline_codes(displayname)
expect(Toolbar.account_exists(displayname)).to.be.true

@Then('"{username}" account should be added')
def step(context, username):
username = substitute_inline_codes(username)
expect(Toolbar.account_exists(username)).to.be.true

@Then('the account with displayname "|any|" should not be displayed')
def step(context, displayname):
displayname = substitute_inline_codes(displayname)
timeout = get_config('lowestSyncTimeout') * 1000

test.compare(
False,
Toolbar.has_item(displayname, timeout),
f"Expected account '{displayname}' to be removed",
)
@Then('"{username}" account should not be displayed')
def step(context, username):
username = substitute_inline_codes(username)
expect(Toolbar.account_exists(username)).to.be.false


@Given('user "{username}" has set up a client with default settings')
Expand Down Expand Up @@ -161,8 +155,9 @@ def step(context, _):
AccountSetting.wait_until_sync_folder_is_configured()


@When('the user removes the connection for user "|any|"')
@When('the user removes the connection for user "{username}"')
def step(context, username):
username = substitute_inline_codes(username)
AccountSetting.remove_connection_for_user(username)


Expand Down Expand Up @@ -247,10 +242,10 @@ def step(context):
Toolbar.quit_opencloud()


@Then('"{displayname}" account should be opened')
def step(context, displayname):
displayname = substitute_inline_codes(displayname)
expect(Toolbar.account_has_focus(displayname)).to.be.true
@Then('"{username}" account should be opened')
def step(context, username):
username = substitute_inline_codes(username)
expect(Toolbar.account_has_focus(username)).to.be.true


@Then(
Expand Down Expand Up @@ -286,6 +281,7 @@ def step(context, warn_message):

@Given('the user has removed the connection for user "{username}"')
def step(context, username):
username = substitute_inline_codes(username)
AccountSetting.remove_connection_for_user(username)
AccountSetting.wait_until_account_is_removed(username)
shutil.rmtree(os.path.join(get_config("clientRootSyncPath"), username))
8 changes: 0 additions & 8 deletions test/gui/tst_removeAccountConnection/test.py

This file was deleted.

2 changes: 1 addition & 1 deletion test/gui/tst_syncing/test.feature
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ Feature: Syncing files
| password | 1234 |
When the user selects manual sync folder option in advanced section
And the user cancels the sync connection wizard
Then the account with displayname "Alice Hansen" should be displayed
Then "Alice" account should be added
And the sync folder list should be empty


Expand Down