Skip to content
Draft
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
5 changes: 2 additions & 3 deletions test/gui/features/sync-resources/syncResources.feature
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Feature: Syncing files
client content
"""

@skipOnWindows @skip
@skipOnWindows
Scenario: Sync all is selected by default
Given user "Alice" has created folder "simple-folder" in the server
And user "Alice" has created folder "large-folder" in the server
Expand Down Expand Up @@ -110,7 +110,7 @@ Feature: Syncing files
And the file "large-folder/lorem.txt" should not exist on the file system
And as "Alice" file "simple-folder/localFile.txt" should exist in the server

@issue-9733 @skipOnWindows @skip
@issue-9733 @skipOnWindows
Scenario: sort folders list by name and size
Given user "Alice" has created folder "123Folder" in the server
And user "Alice" has uploaded file with content "small" to "123Folder/lorem.txt" in the server
Expand Down Expand Up @@ -152,7 +152,6 @@ Feature: Syncing files
| aFolder |
| 123Folder |
| bFolder |
And the user cancels the sync connection wizard

@smoke
Scenario Outline: Syncing a folder to the server
Expand Down
58 changes: 35 additions & 23 deletions test/gui/pageObjects/SyncConnectionWizard.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

from helpers.SetupClientHelper import get_current_user_sync_path
from helpers.AppHelper import app
from helpers.SyncHelper import wait_for


class SyncConnectionWizard:
Expand All @@ -12,12 +13,19 @@ class SyncConnectionWizard:
)
BACK_BUTTON = SimpleNamespace(by=By.NAME, selector="< Back")
NEXT_BUTTON = SimpleNamespace(by=By.NAME, selector="Next >")
SELECTIVE_SYNC_ROOT_FOLDER = SimpleNamespace(by=None, selector=None)
SELECTIVE_SYNC_ROOT_FOLDER = SimpleNamespace(
by=By.NAME,
selector="Personal"
)
SELECTIVE_SYNC_TREE_FOLDER = SimpleNamespace(
by=By.XPATH,
selector="//table_cell[@name and contains(@states,'checkable') and @name!='Personal']"
)
ADD_SYNC_CONNECTION_BUTTON = SimpleNamespace(
by=By.XPATH, selector="//dialog[@name='Add Space']//*[@name='Add Space']"
)
REMOTE_FOLDER_TREE = SimpleNamespace(by=None, selector=None)
SELECTIVE_SYNC_TREE_HEADER = SimpleNamespace(by=None, selector=None)
SELECTIVE_SYNC_TREE_HEADER = SimpleNamespace(by=By.NAME, selector='{header_text}')
CANCEL_FOLDER_SYNC_CONNECTION_WIZARD = SimpleNamespace(
by=By.NAME, selector="Cancel"
)
Expand Down Expand Up @@ -60,7 +68,10 @@ def next_step():

@staticmethod
def back():
squish.clickButton(squish.waitForObject(SyncConnectionWizard.BACK_BUTTON))
app().find_element(
SyncConnectionWizard.BACK_BUTTON.by,
SyncConnectionWizard.BACK_BUTTON.selector
).click()

@staticmethod
def select_remote_destination_folder(folder):
Expand All @@ -80,16 +91,16 @@ def deselect_all_remote_folders():

@staticmethod
def sort_by(header_text):
squish.mouseClick(
squish.waitForObject(
{
"container": SyncConnectionWizard.SELECTIVE_SYNC_TREE_HEADER,
"text": header_text,
"type": "HeaderViewItem",
"visible": True,
}
)
element = app().find_element(
SyncConnectionWizard.SELECTIVE_SYNC_TREE_HEADER.by,
SyncConnectionWizard.SELECTIVE_SYNC_TREE_HEADER.selector.format(header_text=header_text)
)
# ISSUE: https://github.com/opencloud-eu/desktop/pull/879
# Cannot select table header element by click event
# Select the table header element using keyboard events as a workaround
# TODO: Remove the workaround and uncomment 'click' action
# element.click()
element.native_click()

@staticmethod
def add_sync_connection():
Expand All @@ -100,20 +111,21 @@ def add_sync_connection():

@staticmethod
def get_item_name_from_row(row_index):
folder_row = {
"row": row_index,
"container": SyncConnectionWizard.SELECTIVE_SYNC_ROOT_FOLDER,
"type": "QModelIndex",
}
return str(squish.waitForObjectExists(folder_row).displayText)
elements = app().find_elements(
SyncConnectionWizard.SELECTIVE_SYNC_TREE_FOLDER.by,
SyncConnectionWizard.SELECTIVE_SYNC_TREE_FOLDER.selector
)
return str(elements[row_index].text)


@staticmethod
def is_root_folder_checked():
state = squish.waitForObject(SyncConnectionWizard.SELECTIVE_SYNC_ROOT_FOLDER)[
"checkState"
]
return state == "checked"

element = app().find_element(
SyncConnectionWizard.SELECTIVE_SYNC_ROOT_FOLDER.by,
SyncConnectionWizard.SELECTIVE_SYNC_ROOT_FOLDER.selector
)
return element.get_attribute("checked") == "true"

@staticmethod
def cancel_folder_sync_connection_wizard():
app().find_element(
Expand Down
15 changes: 7 additions & 8 deletions test/gui/steps/sync_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def step(context):
)


@When('the user sorts the folder list by "|any|"')
@When('the user sorts the folder list by "{header_text}"')
def step(context, header_text):
if (header_text := header_text.capitalize()) in ['Size', 'Name']:
SyncConnectionWizard.sort_by(header_text)
Expand All @@ -164,20 +164,19 @@ def step(context, header_text):

@Then('the sync all checkbox should be checked')
def step(context):
test.compare(
SyncConnectionWizard.is_root_folder_checked(),
True,
with ensure(
'Sync all checkbox is checked',
)
):
SyncConnectionWizard.is_root_folder_checked().should.be.true


@Then('the folders should be in the following order:')
def step(context):
row_index = 0
for row in context.table[1:]:
for row in context.table:
expected_folder = row[0]
actual_folder = SyncConnectionWizard.get_item_name_from_row(row_index)
test.compare(actual_folder, expected_folder)
assert (actual_folder).should.be.equal(expected_folder)

row_index += 1

Expand All @@ -195,7 +194,7 @@ def step(context):


@When(
'the user sets the temp folder "|any|" as local sync path in sync connection wizard'
'the user sets the temp folder "{folder_name}" as local sync path in sync connection wizard'
)
def step(context, folder_name):
sync_path = get_temp_resource_path(folder_name)
Expand Down