|
4 | 4 | from botcity.web import WebBot, By |
5 | 5 | from pytest import xfail |
6 | 6 |
|
7 | | -BROWSER_ERRORS = ['firefox'] |
8 | | - |
9 | 7 |
|
10 | 8 | def test_left_click(web: WebBot): |
11 | 9 | web.browse(conftest.INDEX_PAGE) |
@@ -44,17 +42,17 @@ def test_left_triple_click(web: WebBot): |
44 | 42 |
|
45 | 43 |
|
46 | 44 | def test_triple_click_relative(web: WebBot): |
47 | | - # if web.browser.lower() in BROWSER_ERRORS: |
48 | | - # xfail(reason=f"Error in {web.browser} in decode dict.") |
| 45 | + if web.browser.lower() in 'firefox' and os.getenv('CI') is not None: |
| 46 | + xfail(reason=f"Firefox is not working in CI") |
49 | 47 |
|
50 | 48 | web.browse(conftest.INDEX_PAGE) |
51 | 49 |
|
52 | 50 | web.add_image('mouse', os.path.join(conftest.PROJECT_DIR, 'resources', 'mouse.png')) |
53 | 51 | if not web.find("mouse", matching=0.97, waiting_time=10_000): |
54 | 52 | raise Exception('Image not found: mouse') |
55 | 53 | web.triple_click_relative(16, 140) |
56 | | - web.wait(5000) |
57 | | - result = conftest.get_event_result('element-result', web, test="test_triple_click_relative") |
| 54 | + |
| 55 | + result = conftest.get_event_result('element-result', web) |
58 | 56 | assert result['data'] == ['Left2', 'Left2', 'Left2'] |
59 | 57 |
|
60 | 58 |
|
@@ -83,44 +81,45 @@ def test_right_double_click(web: WebBot): |
83 | 81 |
|
84 | 82 |
|
85 | 83 | def test_left_click_relative(web: WebBot): |
86 | | - # if web.browser.lower() in BROWSER_ERRORS: |
87 | | - # xfail(reason=f"Error in {web.browser} in decode dict.") |
| 84 | + if web.browser.lower() in 'firefox' and os.getenv('CI') is not None: |
| 85 | + xfail(reason=f"Firefox is not working in CI") |
88 | 86 | web.browse(conftest.INDEX_PAGE) |
89 | 87 |
|
90 | 88 | web.add_image('mouse', os.path.join(conftest.PROJECT_DIR, 'resources', 'mouse.png')) |
91 | 89 | if not web.find("mouse", matching=0.97, waiting_time=10_000): |
92 | 90 | raise Exception('Image not found: mouse') |
93 | 91 | web.click_relative(16, 140) |
94 | | - web.wait(5000) |
95 | | - result = conftest.get_event_result('element-result', web, test="test_left_click_relative") |
| 92 | + |
| 93 | + result = conftest.get_event_result('element-result', web) |
96 | 94 | assert result['data'] == ['Left2'] |
97 | 95 |
|
98 | 96 |
|
99 | 97 | def test_left_double_click_relative(web: WebBot): |
100 | | - # if web.browser.lower() in BROWSER_ERRORS: |
101 | | - # xfail(reason=f"Error in {web.browser} in decode dict.") |
| 98 | + if web.browser.lower() in 'firefox' and os.getenv('CI') is not None: |
| 99 | + xfail(reason=f"Firefox is not working in CI") |
| 100 | + |
102 | 101 | web.browse(conftest.INDEX_PAGE) |
103 | 102 |
|
104 | 103 | web.add_image('mouse', os.path.join(conftest.PROJECT_DIR, 'resources', 'mouse.png')) |
105 | 104 | if not web.find("mouse", matching=0.97, waiting_time=10_000): |
106 | 105 | raise Exception('Image not found: mouse') |
107 | 106 | web.double_click_relative(16, 140) |
108 | | - web.wait(5000) |
109 | | - result = conftest.get_event_result('element-result', web, test="test_left_double_click_relative") |
| 107 | + |
| 108 | + result = conftest.get_event_result('element-result', web) |
110 | 109 | assert result['data'] == ['Left2', 'Left2'] |
111 | 110 |
|
112 | 111 |
|
113 | 112 | def test_right_click_relative(web: WebBot): |
114 | | - # if web.browser.lower() in BROWSER_ERRORS: |
115 | | - # xfail(reason=f"Error in {web.browser} visual automation headless") |
| 113 | + if web.browser.lower() in 'firefox' and os.getenv('CI') is not None: |
| 114 | + xfail(reason=f"Firefox is not working in CI") |
116 | 115 | web.browse(conftest.INDEX_PAGE) |
117 | 116 |
|
118 | 117 | web.add_image('mouse', os.path.join(conftest.PROJECT_DIR, 'resources', 'mouse.png')) |
119 | 118 | if not web.find("mouse", matching=0.97, waiting_time=10_000): |
120 | 119 | raise Exception('Image not found: mouse') |
121 | 120 | web.right_click_relative(16, 140) |
122 | | - web.wait(5000) |
123 | | - result = conftest.get_event_result('element-result', web, test="test_right_click_relative") |
| 121 | + |
| 122 | + result = conftest.get_event_result('element-result', web) |
124 | 123 | assert result['data'] == ['Right2'] |
125 | 124 |
|
126 | 125 |
|
@@ -170,7 +169,7 @@ def test_move_relative(web: WebBot): |
170 | 169 | web.add_image('mouse', os.path.join(conftest.PROJECT_DIR, 'resources', 'mouse.png')) |
171 | 170 | if not web.find("mouse", matching=0.97, waiting_time=10_000): |
172 | 171 | raise Exception('Image not found: mouse') |
173 | | - web.move() # posicionando o mouse |
| 172 | + web.move() |
174 | 173 | web.move_relative(16, 140) |
175 | 174 |
|
176 | 175 | result = conftest.get_event_result('element-result', web) |
@@ -247,4 +246,3 @@ def test_get_element_coors_centered(web: WebBot): |
247 | 246 |
|
248 | 247 | result = conftest.get_event_result('element-result', web) |
249 | 248 | assert result['data'] == ['Left'] or result['data'] == ['Left2'] |
250 | | - |
0 commit comments