How to use get_providers method in Airtest

Best Python code snippet using Airtest

test_mouse_hover_event.py

Source: test_mouse_hover_event.py Github

copy

Full Screen

...64 assert self.motion_event.spos == spos65 def assert_no_event(self):66 assert self.etype is None67 assert self.motion_event is None68 def get_providers(self, with_window_children=False):69 from kivy.base import EventLoop70 win = EventLoop.window71 if with_window_children:72 from kivy.uix.button import Button73 button = Button(on_touch_down=self.on_any_touch_event,74 on_touch_move=self.on_any_touch_event,75 on_touch_up=self.on_any_touch_event)76 self.button_widget = button77 win.add_widget(button)78 return win, self.mouse79 def test_no_event_on_cursor_leave(self):80 win, mouse = self.get_providers()81 win.dispatch('on_cursor_leave')82 self.advance_frames(1)83 self.assert_no_event()84 def test_no_event_on_system_size(self):85 win, mouse = self.get_providers()86 w, h = win.system_size87 win.system_size = (w + 10, h + 10)88 self.advance_frames(1)89 self.assert_no_event()90 def test_no_event_on_rotate(self):91 win, mouse = self.get_providers()92 win.rotation = 9093 self.advance_frames(1)94 self.assert_no_event()95 def test_no_event_on_close(self):96 win, mouse = self.get_providers()97 win.dispatch('on_close')98 self.advance_frames(1)99 self.assert_no_event()100 def test_begin_event_on_cursor_enter(self):101 win, mouse = self.get_providers()102 x, y = win.mouse_pos103 win.dispatch('on_cursor_enter')104 self.advance_frames(1)105 self.assert_event('begin', win.to_normalized_pos(x, y))106 # Cleanup107 win.dispatch('on_cursor_leave')108 self.advance_frames(1)109 def test_begin_event_on_mouse_pos(self):110 win, mouse = self.get_providers()111 x, y = win.mouse_pos = (10.0, 10.0)112 self.advance_frames(1)113 self.assert_event('begin', win.to_normalized_pos(x, y))114 # Cleanup115 win.dispatch('on_cursor_leave')116 self.advance_frames(1)117 def test_update_event_with_enter_and_mouse_pos(self):118 win, mouse = self.get_providers()119 win.dispatch('on_cursor_enter')120 x, y = win.mouse_pos = (50.0, 50.0)121 self.advance_frames(1)122 self.assert_event('update', win.to_normalized_pos(x, y))123 # Cleanup124 win.dispatch('on_cursor_leave')125 self.advance_frames(1)126 def test_update_event_with_mouse_pos(self):127 win, mouse = self.get_providers()128 win.mouse_pos = (10.0, 10.0)129 x, y = win.mouse_pos = (50.0, 50.0)130 self.advance_frames(1)131 self.assert_event('update', win.to_normalized_pos(x, y))132 # Cleanup133 win.dispatch('on_cursor_leave')134 self.advance_frames(1)135 def test_update_event_on_rotate(self):136 win, mouse = self.get_providers()137 x, y = win.mouse_pos = (10.0, 10.0)138 win.rotation = 90139 self.advance_frames(1)140 self.assert_event('update', win.to_normalized_pos(x, y))141 # Cleanup142 win.dispatch('on_cursor_leave')143 self.advance_frames(1)144 def test_update_event_on_system_size(self):145 win, mouse = self.get_providers()146 x, y = win.mouse_pos = (10.0, 10.0)147 w, h = win.system_size148 win.system_size = (w + 10, h + 10)149 self.advance_frames(1)150 self.assert_event('update', win.to_normalized_pos(x, y))151 # Cleanup152 win.dispatch('on_cursor_leave')153 self.advance_frames(1)154 def test_end_event_on_cursor_leave(self):155 win, mouse = self.get_providers()156 x, y = win.mouse_pos = (10.0, 10.0)157 win.dispatch('on_cursor_leave')158 self.advance_frames(1)159 self.assert_event('end', win.to_normalized_pos(x, y))160 def test_end_event_on_window_close(self):161 win, mouse = self.get_providers()162 x, y = win.mouse_pos = (10.0, 10.0)163 win.dispatch('on_close')164 self.advance_frames(1)165 self.assert_event('end', win.to_normalized_pos(x, y))166 def test_with_full_cycle_with_cursor_events(self):167 win, mouse = self.get_providers()168 # Test begin event169 win.dispatch('on_cursor_enter')170 x, y = win.mouse_pos171 self.advance_frames(1)172 self.assert_event('begin', win.to_normalized_pos(x, y))173 # Test update event174 x, y = win.mouse_pos = (10.0, 10.0)175 self.advance_frames(1)176 self.assert_event('update', win.to_normalized_pos(x, y))177 # Test end event178 win.dispatch('on_cursor_leave')179 self.advance_frames(1)180 self.assert_event('end', win.to_normalized_pos(x, y))181 def test_with_full_cycle_with_mouse_pos_and_on_close_event(self):182 win, mouse = self.get_providers()183 # Test begin event184 x, y = win.mouse_pos = (5.0, 5.0)185 self.advance_frames(1)186 self.assert_event('begin', win.to_normalized_pos(x, y))187 # Test update event188 x, y = win.mouse_pos = (10.0, 10.0)189 self.advance_frames(1)190 self.assert_event('update', win.to_normalized_pos(x, y))191 # Test end event192 win.dispatch('on_close')193 self.advance_frames(1)194 self.assert_event('end', win.to_normalized_pos(x, y))195 def test_begin_event_no_dispatch_through_on_touch_events(self):196 win, mouse = self.get_providers(with_window_children=True)197 x, y = win.mouse_pos198 win.dispatch('on_cursor_enter')199 self.advance_frames(1)200 self.assert_event('begin', win.to_normalized_pos(x, y))201 assert self.touch_event is None202 # Cleanup203 win.dispatch('on_cursor_leave')204 self.advance_frames(1)205 def test_update_event_no_dispatch_through_on_touch_events(self):206 win, mouse = self.get_providers(with_window_children=True)207 win.dispatch('on_cursor_enter')208 x, y = win.mouse_pos = (10.0, 10.0)209 self.advance_frames(1)210 self.assert_event('update', win.to_normalized_pos(x, y))211 assert self.touch_event is None212 # Cleanup213 win.dispatch('on_cursor_leave')214 self.advance_frames(1)215 def test_end_event_no_dispatch_through_on_touch_events(self):216 win, mouse = self.get_providers(with_window_children=True)217 win.dispatch('on_cursor_enter')218 x, y = win.mouse_pos = (10.0, 10.0)219 win.dispatch('on_cursor_leave')220 self.advance_frames(1)221 self.assert_event('end', win.to_normalized_pos(x, y))...

Full Screen

Full Screen

Blogs

Check out the latest blogs from LambdaTest on this topic:

QA’s and Unit Testing – Can QA Create Effective Unit Tests

Unit testing is typically software testing within the developer domain. As the QA role expands in DevOps, QAOps, DesignOps, or within an Agile team, QA testers often find themselves creating unit tests. QA testers may create unit tests within the code using a specified unit testing tool, or independently using a variety of methods.

LIVE With Automation Testing For OTT Streaming Devices ????

People love to watch, read and interact with quality content — especially video content. Whether it is sports, news, TV shows, or videos captured on smartphones, people crave digital content. The emergence of OTT platforms has already shaped the way people consume content. Viewers can now enjoy their favorite shows whenever they want rather than at pre-set times. Thus, the OTT platform’s concept of viewing anything, anytime, anywhere has hit the right chord.

Why Agile Is Great for Your Business

Agile project management is a great alternative to traditional methods, to address the customer’s needs and the delivery of business value from the beginning of the project. This blog describes the main benefits of Agile for both the customer and the business.

Options for Manual Test Case Development & Management

The purpose of developing test cases is to ensure the application functions as expected for the customer. Test cases provide basic application documentation for every function, feature, and integrated connection. Test case development often detects defects in the design or missing requirements early in the development process. Additionally, well-written test cases provide internal documentation for all application processing. Test case development is an important part of determining software quality and keeping defects away from customers.

Test strategy and how to communicate it

I routinely come across test strategy documents when working with customers. They are lengthy—100 pages or more—and packed with monotonous text that is routinely reused from one project to another. Yawn once more— the test halt and resume circumstances, the defect management procedure, entrance and exit criteria, unnecessary generic risks, and in fact, one often-used model replicates the requirements of textbook testing, from stress to systems integration.

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Airtest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful