Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
4 changes: 2 additions & 2 deletions test/gui/features/add-account/account.feature
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Feature: adding accounts
| password | 1234 |
Then "Alice Hansen" account should be opened

@smoke @skip
@smoke
Scenario: Add space manually from sync connection window
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.

@prashant-gurung899 @anon-pradip Please, try to run this scenario. It passed once on my machine but refuse to pass now.

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.

In my machine, it didn't pass even once.

Scenario: Add space manually from sync connection window
    Given user "Alice" has been created in the server with default attributes ... passed in 0.107s
    Given user "Alice" has created folder "simple-folder" in the server ... passed in 0.084s
    And the user has started the client ... passed in 1.046s
    And the user has entered the following account information: ... passed in 3.241s
      | server   | %local_server% |
      | user     | Alice          |
      | password | 1234           |
    When the user selects manual sync folder option in advanced section ... passed in 0.640s
    And the user syncs the "Personal" space ... failed in 0.679s
ASSERT FAILED: Next button is not enabled
Deleting folder: Alice

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.

hmm, yeah. that's the error. space is not being selected.
I will skip the test for now and enable with fix later on

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.

this will be fixed by #879, but I need review from the dev team

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.

Cool. Then, we can merge this one.

Given user "Alice" has created folder "simple-folder" in the server
And the user has started the client
Expand All @@ -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