How to use do_swipe method in ATX

Best Python code snippet using ATX

test_touch_and_drag.py

Source:test_touch_and_drag.py Github

copy

Full Screen

...24def open_page_for_vertical_check(attach_to_app):25 yield page_to_check_vertical()26 tap_until_visible(back_icon)27def do_drag_horizontal(item1, item2, modifier_value=None):28 def do_swipe(obj1, item_to_check_after_swipe, item_to_check_after_swipe_back, marker=-1):29 # from left to right is positive marker30 hmi.touch_and_drag('settings_page', x=obj1.x, y=obj1.y, dx=obj1.width * 2 * marker, dy=obj1.y,31 modifier=modifier_value)32 assert hmi.obj_exists(item_to_check_after_swipe)33 obj2 = return_obj_if_exist(item_to_check_after_swipe)34 # from right to left is negative marker35 hmi.touch_and_drag('settings_page', x=obj2.x, y=obj2.y, dx=obj2.width * 2 * -marker, dy=obj2.y,36 modifier=modifier_value)37 assert hmi.obj_exists(item_to_check_after_swipe_back)38 obj1 = return_obj_if_exist(item1)39 obj2 = return_obj_if_exist(item2)40 if obj1:41 do_swipe(obj1, item2, item1, -1)42 else:43 do_swipe(obj2, item1, item2, 1)44@jira_test("VHAT-967")45def test_drag_api_horizontally(open_settings_page):46 do_drag_horizontal(marker_for_1st_settings_page, marker_for_2nd_setting_page)47@jira_test("VHAT-968")48def test_drag_api_vertically(open_page_for_vertical_check):49 obj = return_obj_if_exist(vertical_item_bottom)50 obj2 = return_obj_if_exist(vertical_item_top)51 assert obj and obj252 hmi.touch_and_drag('settings_page', x=obj.x, y=obj.y, dx=0, dy=-obj.height * 3)53 assert not hmi.obj_exists(vertical_item_top)54 hmi.touch_and_drag('settings_page', x=obj.x, y=obj.y, dx=0, dy=obj.height * 3)55 assert hmi.obj_exists(vertical_item_top)56@jira_test("VHAT-966")57def test_drag_api_horizontally_with_modifier_state_argument(open_settings_page):...

Full Screen

Full Screen

session_ui_demo.py

Source:session_ui_demo.py Github

copy

Full Screen

1import uiautomator2 as u22import adbutils,threading,time3def do_swipe():4 d = u2.connect_adb_wifi('192.168.0.100:5555')5 d.app_start("com.hlg.daydaytobusiness",stop=True)6 time.sleep(5)7 # if d(text = '同意').exists:8 # print('存在')9 d.watcher('首次启动提醒弹窗').when('同意').click()10 d.watcher.run()11 time.sleep(5)12 d.press('back')13 time.sleep(3)14 d.watcher('允许1').when('允许').click()15 d.watcher.run()16 d.watcher('允许1').when('允许').click()17 d.watcher.run()18 time.sleep(5)19 d.app_clear('com.hlg.daydaytobusiness')20if __name__ == '__main__':...

Full Screen

Full Screen

thread_ui_test.py

Source:thread_ui_test.py Github

copy

Full Screen

...6 while i<=3:7 func()8 i+=19 return wrapper10def do_swipe(device):11 d = u2.connect_adb_wifi(device)12 print(d.info)13 time.sleep(2)14 d.press("home")15 time.sleep(1)16 d.swipe_ext("left", 0.6)17 d.swipe_ext("left", 0.6)18 d.swipe_ext("right", 0.6)19 d.swipe_ext("right", 0.6)20def run(device):21 do_swipe(device)22if __name__ == '__main__':23 for dev in adbutils.adb.device_list():24 t = threading.Thread(target=run,args=(dev.serial,))...

Full Screen

Full Screen

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 ATX 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