Best Python code snippet using Airtest
touch_proxy.py
Source:touch_proxy.py
...49 def pinch(self, center=None, percent=0.5, duration=0.5, steps=5, in_or_out='in'):50 if center:51 center = self.ori_transformer(center)52 self.base_touch.pinch(center=center, percent=percent, duration=duration, steps=steps, in_or_out=in_or_out)53 def swipe_along(self, coordinates_list, duration=0.8, steps=5):54 pos_list = [self.ori_transformer(xy) for xy in coordinates_list]55 self.base_touch.swipe_along(pos_list, duration=duration, steps=steps)56 def two_finger_swipe(self, tuple_from_xy, tuple_to_xy, duration=0.8, steps=5, offset=(0, 50)):57 tuple_from_xy = self.ori_transformer(tuple_from_xy)58 tuple_to_xy = self.ori_transformer(tuple_to_xy)59 self.base_touch.two_finger_swipe(tuple_from_xy, tuple_to_xy, duration=duration, steps=steps, offset=offset)60@register_touch61class MaxtouchImplementation(MinitouchImplementation):62 METHOD_NAME = "MAXTOUCH"63 def __init__(self, maxtouch, ori_transformer):...
test_game.py
Source:test_game.py
...25for i in range(number_play):26 print(" count-" + str(i))27 while not exists(Template(r"game_over_btn.png", record_pos=(0.011, 0.742), resolution=(1080, 2340))):28 # swipe left29 dev.swipe_along([(543, 1577), (150, 1534)])30 sleep(1.0)31 32 # swipe up33 dev.swipe_along([(525, 1544), (522, 1344)])34 35 sleep(1.0)36 37 # swipe right38 dev.swipe_along([(543, 1577), (840, 1451)])39 sleep(1.0)40 # swipe up41 dev.swipe_along([(525, 1544), (522, 1344)])42 43 dev.touch((475,1970), duration=0.01)44 if i != number_play-1:45 touch(Template(r"run_btn.png", record_pos=(0.006, 0.606), resolution=(1080, 2340)))46 47 else: 48 touch(Template(r"main_menu_btn.png", record_pos=(-0.003, 0.305), resolution=(1080, 2340)))49 50 51 ...
06-16demo.py
Source:06-16demo.py
...7touch(Template(r"tpl1623846274479.png", threshold=0.5999999999999999, rgb=False, target_pos=4, record_pos=(-0.105, -0.293), resolution=(1079, 2340)))8touch(Template(r"tpl1623846675198.png", record_pos=(0.006, -0.148), resolution=(1079, 2340)))9wait(Template(r"tpl1623851905998.png", record_pos=(0.025, -0.621), resolution=(1079, 2340)))10dev =device()...
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!