Skip to content

Commit c7871ea

Browse files
committed
Update example tests
1 parent b5613a0 commit c7871ea

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

examples/test_canvas.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,16 @@ def get_pixel_colors(self):
1818
else:
1919
return [color["0"], color["1"], color["2"]]
2020

21-
def test_canvas_actions(self):
21+
def test_canvas_click_from_center(self):
22+
self.open("https://seleniumbase.io/other/canvas")
23+
self.click_with_offset("canvas", 0, 0, center=True)
24+
self.sleep(1) # Not needed (Lets you see the alert pop up)
25+
alert = self.switch_to_alert()
26+
self.assert_equal(alert.text, "You clicked on the square!")
27+
self.accept_alert()
28+
self.sleep(1) # Not needed (Lets you see the alert go away)
29+
30+
def test_click_with_offset(self):
2231
self.open("https://seleniumbase.io/canvas/")
2332
self.highlight("canvas")
2433
rgb = self.get_pixel_colors()
@@ -27,12 +36,3 @@ def test_canvas_actions(self):
2736
self.highlight("canvas", loops=5)
2837
rgb = self.get_pixel_colors()
2938
self.assert_equal(rgb, [39, 42, 56]) # Blue by hamburger
30-
31-
def test_canvas_click(self):
32-
self.open("https://seleniumbase.io/other/canvas")
33-
self.click_with_offset("canvas", 300, 200)
34-
self.sleep(1) # Not needed (Lets you see the alert pop up)
35-
alert = self.switch_to_alert()
36-
self.assert_equal(alert.text, "You clicked on the square!")
37-
self.accept_alert()
38-
self.sleep(1) # Not needed (Lets you see the alert go away)

0 commit comments

Comments
 (0)