MCPcopy Create free account
hub / github.com/e2b-dev/desktop / test_right_click

Function test_right_click

packages/python-sdk/tests/test_controls.py:22–45  ·  view source on GitHub ↗
(sandbox: Sandbox)

Source from the content-addressed store, hash-verified

20
21
22def test_right_click(sandbox: Sandbox):
23 # Capture the initial screenshot
24 time.sleep(5) # Wait for UI to load
25
26 initial_screenshot_bytes = sandbox.screenshot()
27 initial_image = Image.open(io.BytesIO(initial_screenshot_bytes))
28
29 # Get cursor position and perform right click
30 cursor_pos = sandbox.get_cursor_position()
31 sandbox.right_click()
32 time.sleep(5) # Wait for UI to respond
33
34 # Capture and process the second screenshot
35 post_click_screenshot_bytes = sandbox.screenshot()
36 post_click_image = Image.open(io.BytesIO(post_click_screenshot_bytes))
37
38 # Crop both images around the cursor position
39 cropped_image_1 = crop_around_point(initial_image, cursor_pos)
40 cropped_image_2 = crop_around_point(post_click_image, cursor_pos)
41
42 # Compare the cropped images
43 assert not images_are_equal(cropped_image_1, cropped_image_2), (
44 "The image around the cursor did not change after right-click."
45 )
46
47
48def test_screenshot(sandbox: Sandbox):

Callers

nothing calls this directly

Calls 6

crop_around_pointFunction · 0.85
images_are_equalFunction · 0.85
get_cursor_positionMethod · 0.80
right_clickMethod · 0.80
screenshotMethod · 0.45
openMethod · 0.45

Tested by

no test coverage detected