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
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 @@ -33,18 +33,17 @@ Feature: Syncing files
And the folder "simple-folder" should exist on the file system
And the folder "large-folder" should exist on the file system

@issue-9733 @skip
@issue-9733
Scenario: Syncing a file from the server and creating a conflict
Given user "Alice" has uploaded file with content "server content" to "/conflict.txt" in the server
And user "Alice" has set up a client with default settings
And the user has paused the file sync
And the user has changed the content of local file "conflict.txt" to:
"""
client content
"""
And user "Alice" has uploaded file with content "changed server content" to "/conflict.txt" in the server
And the user has waited for "5" seconds
When the user resumes the file sync on the client
When the user waits for the files to sync
Comment thread
saw-jan marked this conversation as resolved.
And the user opens the activity tab
And the user selects "Not Synced" tab in the activity
Then the table of conflict warnings should include file "conflict.txt"
Expand Down
2 changes: 1 addition & 1 deletion test/gui/helpers/SyncHelper.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ def wait_for_resource_to_sync(
synced = wait_for(
lambda: has_sync_pattern(patterns, resource),
timeout - initial_timeout,
)
)

messages = read_and_update_socket_messages()
messages = filter_messages_for_item(messages, resource)
Expand Down
16 changes: 11 additions & 5 deletions test/gui/pageObjects/Activity.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class Activity:
NOT_SYNCED_FILTER_OPTION_SELECTOR = SimpleNamespace(by=None, selector=None)
SYNCED_ACTIVITY_TABLE_HEADER_SELECTOR = SimpleNamespace(by=None, selector=None)
NOT_SYNCED_ACTIVITY_TABLE_HEADER_SELECTOR = SimpleNamespace(by=None, selector=None)
NOT_SYNCED_ACTIVITY_CONFLICT_FILE = SimpleNamespace(by=By.XPATH, selector="//*[starts-with(@name, '{filename} (conflicted copy')]")
SYNCED_ACTIVITY_STATUS = SimpleNamespace(by=By.NAME, selector=None)


Expand Down Expand Up @@ -59,12 +60,17 @@ def open_tab(tab_name):
app().find_element(Activity.SUBTAB_CONTAINER.by, selector).click()

@staticmethod
def check_file_exist(filename):
squish.waitForObjectExists(
Activity.get_not_synced_file_selector(
RegularExpression(build_conflicted_regex(filename))
)
def has_conflict_file(filename):
filename = filename.rsplit(".", 1)[0]
has_activity = wait_for(
lambda: app().find_element(
Activity.NOT_SYNCED_ACTIVITY_CONFLICT_FILE.by,
Activity.NOT_SYNCED_ACTIVITY_CONFLICT_FILE.selector.format(filename=filename)
).is_displayed(),
get_config('max_timeout')
)
Comment thread
saw-jan marked this conversation as resolved.
if not has_activity:
raise AssertionError(f"File conflict activity not found")

@staticmethod
def is_resource_blacklisted(filename):
Expand Down
30 changes: 24 additions & 6 deletions test/gui/pageObjects/SyncConnection.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class SyncConnection:
)
FOLDER_SYNC_CONNECTION_MENU_BUTTON = SimpleNamespace(
by=By.NAME,
selector="{sync_folder},Success,Local folder: {sync_path}{sync_folder}",
selector="{sync_folder},{status},Local folder: {sync_path}{sync_folder}",
)
MENU_ITEM = SimpleNamespace(by=By.NAME, selector=None)
SELECTIVE_SYNC_APPLY_BUTTON = SimpleNamespace(by=None, selector=None)
Expand All @@ -39,23 +39,40 @@ def get_current_account_connection():
return None

@staticmethod
def open_menu(sync_folder=None):
def open_menu(sync_folder=None, sync_state="success"):
if sync_folder is None:
sync_folder = get_config('syncConnectionName')

if sync_state == "success":
status = "Success"
elif sync_state == "paused":
status = "Sync paused"
elif sync_state == "queued":
status = "Queued"
else:
raise ValueError(f"Unknown sync_state: {sync_state}")

connection = SyncConnection.get_current_account_connection()
print(
SyncConnection.FOLDER_SYNC_CONNECTION_MENU_BUTTON.selector.format(
sync_folder=sync_folder,
sync_path=get_config("currentUserSyncPath"),
status=status,
)
)
menu_button = connection.find_element(
SyncConnection.FOLDER_SYNC_CONNECTION_MENU_BUTTON.by,
SyncConnection.FOLDER_SYNC_CONNECTION_MENU_BUTTON.selector.format(
sync_folder=sync_folder,
sync_path=get_config('currentUserSyncPath'),
sync_path=get_config("currentUserSyncPath"),
status=status,
),
)
menu_button.native_click(button='right')

@staticmethod
def perform_action(action):
SyncConnection.open_menu()
def perform_action(action, sync_state="success"):
SyncConnection.open_menu(sync_state=sync_state)
app().find_element(SyncConnection.MENU_ITEM.by, action).click()

@staticmethod
Expand All @@ -68,7 +85,7 @@ def pause_sync():

@staticmethod
def resume_sync():
SyncConnection.perform_action("Resume sync")
SyncConnection.perform_action("Resume sync", "paused")

@staticmethod
def has_menu_item(item):
Expand All @@ -94,6 +111,7 @@ def has_sync_connection(sync_folder):
SyncConnection.FOLDER_SYNC_CONNECTION_MENU_BUTTON.selector.format(
sync_folder=sync_folder,
sync_path=get_config('currentUserSyncPath'),
status="success"
),
)
return True
Expand Down
8 changes: 4 additions & 4 deletions test/gui/steps/file_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,17 +239,17 @@ def step(context, resource_type, resource):
exists(resource_path).should.be.false


@Given('the user has changed the content of local file "|any|" to:')
@Given('the user has changed the content of local file "{filename}" to:')
def step(context, filename):
file_content = '\n'.join(context.multiLineText)
file_content = context.text
wait_and_write_file(get_resource_path(filename), file_content)


@Then(
'a conflict file for "|any|" should exist on the file system with the following content'
'a conflict file for "{filename}" should exist on the file system with the following content'
)
def step(context, filename):
expected = '\n'.join(context.multiLineText)
expected = context.text

onlyfiles = [
f for f in os.listdir(get_resource_path()) if isfile(get_resource_path(f))
Expand Down
11 changes: 6 additions & 5 deletions test/gui/steps/sync_context.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from behave import when as When, then as Then
import time
from behave import when as When, then as Then, given as Given
Comment thread
prashant-gurung899 marked this conversation as resolved.
from sure import ensure

from pageObjects.SyncConnectionWizard import SyncConnectionWizard
Expand Down Expand Up @@ -108,9 +109,9 @@ def step(context):
Toolbar.open_settings_tab()


@Then('the table of conflict warnings should include file "|any|"')
@Then('the table of conflict warnings should include file "{filename}"')
def step(context, filename):
Activity.check_file_exist(filename)
Activity.has_conflict_file(filename)


@Then('the file "{filename}" should be blacklisted')
Expand Down Expand Up @@ -345,9 +346,9 @@ def step(context):
expected_error_message.should.equal(actual_error_message)


@Given('the user has waited for "|any|" seconds')
@Given('the user has waited for "{wait_for}" seconds')
def step(context, wait_for):
squish.snooze(float(wait_for))
time.sleep(float(wait_for))


@When(
Expand Down