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
1 change: 1 addition & 0 deletions test/gui/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from helpers.ConfigHelper import set_config, get_config
from helpers.FilesHelper import prefix_path_namespace, cleanup_created_paths
from helpers.SetupClientHelper import app
from step_types.types import * # register all step types


def before_feature(context, feature):
Expand Down
2 changes: 1 addition & 1 deletion test/gui/features/add-account/account.feature
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ Feature: adding accounts
When the user selects download everything option in advanced section
Then the button to open sync connection wizard should be disabled

@smoke @skip
@smoke
Scenario: Re-add an account
Given user "Alice" has created folder "large-folder" in the server
And user "Alice" has uploaded file with content "test content" to "testFile.txt" in the server
Expand Down
1 change: 0 additions & 1 deletion test/gui/helpers/SetupClientHelper.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ def get_client_details(table):
'user': '',
'password': '',
'sync_folder': '',
'oauth': False,
}
for key, value in table.items():
value = substitute_inline_codes(value)
Expand Down
102 changes: 102 additions & 0 deletions test/gui/helpers/TableParser.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
from behave.model import Table


def table_raw(table: Table):
"""
Args:
table (Table): Behave Table object.
Returns:
list: List of lists (including header row) - each row is a list of cells.

Example:
| header1 | header2 | header3 |
| value1 | value2 | value3 |
Output:
[
['header1', 'header2', 'header3'],
['value1', 'value2', 'value3'],
]
"""
data_table = [table.headings]
data_table.extend(table_rows(table))
return data_table


def table_rows(table: Table):
"""
Args:
table (Table): Behave Table object.
Returns:
list: List of lists (excluding header row) - each row is a list of cells.

Example:
| header1 | header2 | header3 |
| value1 | value2 | value3 |
Output:
[
['value1', 'value2', 'value3'],
]
"""
data_table = []
for row in table:
data_table.append(row.cells)
return data_table


def table_rows_hash(table: Table):
"""
Args:
table (Table): Behave Table object. Table MUST have exactly 2 columns.
Returns:
dict: Dictionary where keys are from the first column and values are from the second column.
Raises:
ValueError: If the table does not have exactly 2 columns.

Example:
| key1 | value1 |
| key2 | value2 |
| key3 | value3 |
Output:
{
'key1': 'value1',
'key2': 'value2',
'key3': 'value3',
}
"""
if len(table.headings) != 2:
raise ValueError(
"table_rows_hash() can only be called on a data table where all rows have exactly two columns."
)

data_table = {
table.headings[0]: table.headings[1],
}
for row in table:
data_table[row[0]] = row[1]
return data_table


def table_hashes(table: Table):
"""
Args:
table (Table): Behave Table object.
Returns:
list: List of dictionaries, where each dictionary represents a row with keys from the header and values from the corresponding cells.

Example:
| key1 | key2 | key3 |
| value1 | value2 | value3 |
| value4 | value5 | value6 |
Output:
[
{'key1': 'value1', 'key2': 'value2', 'key3': 'value3'},
{'key1': 'value4', 'key2': 'value5', 'key3': 'value6'},
]
"""
data_table = []
for row in table:
row_dict = {}
for idx, heading in enumerate(table.headings):
row_dict[heading] = row.cells[idx]
data_table.append(row_dict)
return data_table
13 changes: 7 additions & 6 deletions test/gui/pageObjects/AccountConnectionWizard.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ class AccountConnectionWizard:
by=By.NAME,
selector="Copy URL",
)
CONF_SYNC_MANUALLY_RADIO_BUTTON = SimpleNamespace(by=None, selector=None)
CONF_SYNC_MANUALLY_RADIO_BUTTON = SimpleNamespace(
by=By.NAME, selector="Configure synchronization manually"
)
ADVANCED_CONFIGURATION_CHECKBOX = SimpleNamespace(
by=By.NAME,
selector="Advanced configuration",
Expand Down Expand Up @@ -164,11 +166,10 @@ def add_account_information(account_details):

@staticmethod
def select_manual_sync_folder_option():
squish.clickButton(
squish.waitForObject(
AccountConnectionWizard.CONF_SYNC_MANUALLY_RADIO_BUTTON
)
)
app().find_element(
AccountConnectionWizard.CONF_SYNC_MANUALLY_RADIO_BUTTON.by,
AccountConnectionWizard.CONF_SYNC_MANUALLY_RADIO_BUTTON.selector,
).click()

@staticmethod
def select_download_everything_option():
Expand Down
93 changes: 30 additions & 63 deletions test/gui/pageObjects/AccountSetting.py
Original file line number Diff line number Diff line change
@@ -1,75 +1,42 @@
import names
import squish

from helpers.UserHelper import get_displayname_for_user
from helpers.SetupClientHelper import substitute_inline_codes
from types import SimpleNamespace
from appium.webdriver.common.appiumby import AppiumBy as By

from pageObjects.Toolbar import Toolbar
from helpers.UserHelper import get_displayname_for_user
from helpers.SetupClientHelper import app, substitute_inline_codes
from helpers.SyncHelper import wait_for


class AccountSetting:
MANAGE_ACCOUNT_BUTTON = {
"container": names.stackedWidget_quickWidget_OCC_QmlUtils_OCQuickWidget,
"id": "manageAccountButton",
"text": "Manage Account",
"type": "Button",
"visible": 1,
}
ACCOUNT_MENU = {
"checkable": False,
"container": names.quickWidget_Overlay,
"text": "",
"enabled": True,
"type": "MenuItem",
"unnamed": 1,
"visible": True
}
CONFIRM_REMOVE_CONNECTION_BUTTON = {
"container": names.settings_dialogStack_QStackedWidget,
"text": "Remove connection",
"type": "QPushButton",
"unnamed": 1,
"visible": 1,
}
ACCOUNT_CONNECTION_LABEL = {
"container": names.stackedWidget_quickWidget_OCC_QmlUtils_OCQuickWidget,
"type": "Label",
"visible": 1
}
LOG_BROWSER_WINDOW = {
"name": "OCC__LogBrowser",
"type": "OCC::LogBrowser",
"visible": 1,
}
ACCOUNT_LOADING = {
"window": names.settings_OCC_SettingsDialog,
"name": "loadingPage",
"type": "QWidget",
"visible": 0,
}
DIALOG_STACK = {
"name": "dialogStack",
"type": "QStackedWidget",
"visible": 1,
"window": names.settings_OCC_SettingsDialog,
}
CONFIRMATION_YES_BUTTON = {"text": "Yes", "type": "QPushButton", "visible": 1}
MANAGE_ACCOUNT_BUTTON = SimpleNamespace(by=By.NAME, selector="Manage Account")
ACCOUNT_MENU = SimpleNamespace(by=By.NAME, selector="{menu_item}")
CONFIRM_REMOVE_CONNECTION_BUTTON = SimpleNamespace(
by=By.NAME, selector="Remove connection"
)
ACCOUNT_CONNECTION_LABEL = SimpleNamespace(by=None, selector=None)
LOG_BROWSER_WINDOW = SimpleNamespace(by=None, selector=None)
ACCOUNT_LOADING = SimpleNamespace(by=None, selector=None)
DIALOG_STACK = SimpleNamespace(by=None, selector=None)
CONFIRMATION_YES_BUTTON = SimpleNamespace(by=None, selector=None)

@staticmethod
def account_action(action):
squish.mouseClick(squish.waitForObject(AccountSetting.MANAGE_ACCOUNT_BUTTON))
selector = AccountSetting.ACCOUNT_MENU.copy()
selector['text'] = action
squish.mouseClick(
squish.waitForObject(selector)
)
app().find_element(
AccountSetting.MANAGE_ACCOUNT_BUTTON.by,
AccountSetting.MANAGE_ACCOUNT_BUTTON.selector,
).click()
app().find_element(
AccountSetting.ACCOUNT_MENU.by,
AccountSetting.ACCOUNT_MENU.selector.format(menu_item=action),
).click()

@staticmethod
def remove_account_connection():
AccountSetting.account_action("Remove")
squish.clickButton(
squish.waitForObject(AccountSetting.CONFIRM_REMOVE_CONNECTION_BUTTON)
)
app().find_element(
AccountSetting.CONFIRM_REMOVE_CONNECTION_BUTTON.by,
AccountSetting.CONFIRM_REMOVE_CONNECTION_BUTTON.selector,
).click()

@staticmethod
def logout():
Expand Down Expand Up @@ -172,11 +139,11 @@ def wait_until_account_is_removed(username, timeout=10000):
displayname = get_displayname_for_user(username)
displayname = substitute_inline_codes(displayname)

def account_gone():
account, _ = Toolbar.get_account(displayname)
def account_removed():
account = Toolbar.get_account(displayname)
return account is None

result = squish.waitFor(account_gone, timeout)
result = wait_for(account_removed, timeout)

if not result:
raise TimeoutError(
Expand Down
Loading
Loading