Skip to content

test(gui): enable syncing tests - #889

Merged
saw-jan merged 2 commits into
test/port-to-appiumfrom
test/sync-tests
May 6, 2026
Merged

saw-jan merged 2 commits into
test/port-to-appiumfrom
test/sync-tests

Conversation

@prashant-gurung899

@prashant-gurung899 prashant-gurung899 commented Apr 28, 2026 •

Copy link
Copy Markdown
Member

Part of: #861

Enabled the following syncing tests:

Scenario: Sync only one folder from the server
Scenario: Unselected subfolders are excluded from local sync

Added a new Python library called PyAutoGui for GUI automation(mouse, keyboard, screenshots, etc.)

@prashant-gurung899 prashant-gurung899 self-assigned this Apr 28, 2026
@prashant-gurung899
prashant-gurung899 force-pushed the test/sync-tests branch 4 times, most recently from 00c6560 to 60cbb3e Compare April 29, 2026 05:04
Signed-off-by: prashant-gurung899 <[email protected]>
@anon-pradip

anon-pradip commented Apr 29, 2026 •

Copy link
Copy Markdown
Contributor

My findings:

Issue

When testing the selective sync folder selection in the OpenCloud Desktop client, Appium could not toggle the checkboxes in the Qt tree widget. The test would fail with:

selenium.common.exceptions.WebDriverException: Message: element's actions list didn't contain SetFocus. The element may be malformed

Root Cause

The Qt QTreeWidget checkbox is implemented using QTreeWidgetItem::setCheckState(). While the checkbox is visually rendered, the AT-SPI accessibility bridge does not expose the toggle action to automation frameworks.

Investigation showed:

  • checkable: true - element is checkable
  • actions: None - no actions exposed via AT-SPI
  • role: None - role not exposed
  • Standard click() selects the row but doesn't toggle the checkbox
  • send_keys(" ") fails because the element lacks proper AT-SPI action interface

What We Tried

Method Result
element.click() Selects row, doesn't toggle checkbox
TouchAction / app().tap() Not supported in this environment
send_keys(" ") / send_keys(Keys.SPACE) Element doesn't support keyboard actions
execute_script() (JavaScript) Command not supported
XPath to find checkbox child No separate checkbox element exists
pyatspi, pyautogui, Xlib Not available in test environment

Solution

Use xdotool - a command-line X11 automation tool that interacts directly with the X window system, bypassing AT-SPI limitations.

# After Appium click fails, use xdotool:
subprocess.run(['xdotool', 'mousemove', str(x), str(y)], check=True)
subprocess.run(['xdotool', 'click', '1'], check=True)

Where (x, y) is the checkbox position (10-15px from left edge of the row).

Implementation

The fix was added to SyncConnectionWizard.select_or_unselect_folders_to_sync():

  1. Try Appium click (selects row)
  2. If checkbox not toggled, use xdotool to click at checkbox position

@prashant-gurung899
prashant-gurung899 force-pushed the test/sync-tests branch 5 times, most recently from 51c8e03 to 3f85b91 Compare May 6, 2026 05:58
When the user unselects the following folders to sync in "Choose what to sync" window:
| folder |
| test-folder/sub-folder2 |
And the user waits for the files to sync

@prashant-gurung899 prashant-gurung899 May 6, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Had to add this because it would fail on the following step as the synchronization took a little more time:

But the folder "test-folder/sub-folder2" should not exist on the file system

@prashant-gurung899

prashant-gurung899 commented May 6, 2026 •

Copy link
Copy Markdown
Member Author

My findings:

@anon-pradip
Thank you for giving an alternative solution for checking/unchecking on checkboxes.
But for now, we will go on with a python library called PyAutoGui.

@prashant-gurung899
prashant-gurung899 marked this pull request as ready for review May 6, 2026 06:13
@saw-jan
saw-jan merged commit a0e22d7 into test/port-to-appium May 6, 2026
0 of 3 checks passed
@saw-jan
saw-jan deleted the test/sync-tests branch May 6, 2026 06:21
@prashant-gurung899 prashant-gurung899 mentioned this pull request May 6, 2026
30 tasks done
saw-jan pushed a commit that referenced this pull request May 12, 2026
* test(gui): enable syncing tests

Signed-off-by: prashant-gurung899 <[email protected]>

* test: using pyautogui library for selecting checkboxes in resource selection

---------

Signed-off-by: prashant-gurung899 <[email protected]>
Co-authored-by: pradip <[email protected]>
saw-jan pushed a commit that referenced this pull request May 13, 2026
* test(gui): enable syncing tests

Signed-off-by: prashant-gurung899 <[email protected]>

* test: using pyautogui library for selecting checkboxes in resource selection

---------

Signed-off-by: prashant-gurung899 <[email protected]>
Co-authored-by: pradip <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants