1919from appium .webdriver .common .mobileby import MobileBy
2020from appium .webdriver .common .touch_action import TouchAction
2121
22- from .helper .test_helper import BaseTestCase , wait_for_element
22+ from .helper .test_helper import (
23+ APIDEMO_PKG_NAME ,
24+ BaseTestCase ,
25+ wait_for_element
26+ )
2327
2428
2529class TouchActionTests (BaseTestCase ):
@@ -175,13 +179,13 @@ def test_drag_and_drop(self):
175179 el = wait_for_element (self .driver , MobileBy .ACCESSIBILITY_ID , 'Drag and Drop' )
176180 action .tap (el ).perform ()
177181
178- dd3 = wait_for_element (self .driver , MobileBy .ID , 'com.example.android.apis :id/drag_dot_3' )
179- dd2 = self .driver .find_element_by_id ('com.example.android.apis :id/drag_dot_2' )
182+ dd3 = wait_for_element (self .driver , MobileBy .ID , '{} :id/drag_dot_3' . format ( APIDEMO_PKG_NAME ) )
183+ dd2 = self .driver .find_element_by_id ('{} :id/drag_dot_2' . format ( APIDEMO_PKG_NAME ) )
180184
181185 # dnd is stimulated by longpress-move_to-release
182186 action .long_press (dd3 ).move_to (dd2 ).release ().perform ()
183187
184- el = wait_for_element (self .driver , MobileBy .ID , 'com.example.android.apis :id/drag_text' )
188+ el = wait_for_element (self .driver , MobileBy .ID , '{} :id/drag_text' . format ( APIDEMO_PKG_NAME ) )
185189 self .assertTrue ('drag_dot_3' in el .text )
186190
187191 def test_driver_drag_and_drop (self ):
@@ -196,12 +200,12 @@ def test_driver_drag_and_drop(self):
196200 el = wait_for_element (self .driver , MobileBy .ACCESSIBILITY_ID , 'Drag and Drop' )
197201 action .tap (el ).perform ()
198202
199- dd3 = wait_for_element (self .driver , MobileBy .ID , 'com.example.android.apis :id/drag_dot_3' )
200- dd2 = self .driver .find_element_by_id ('com.example.android.apis :id/drag_dot_2' )
203+ dd3 = wait_for_element (self .driver , MobileBy .ID , '{} :id/drag_dot_3' . format ( APIDEMO_PKG_NAME ) )
204+ dd2 = self .driver .find_element_by_id ('{} :id/drag_dot_2' . format ( APIDEMO_PKG_NAME ) )
201205
202206 self .driver .drag_and_drop (dd3 , dd2 )
203207
204- el = wait_for_element (self .driver , MobileBy .ID , 'com.example.android.apis :id/drag_text' )
208+ el = wait_for_element (self .driver , MobileBy .ID , '{} :id/drag_text' . format ( APIDEMO_PKG_NAME ) )
205209 self .assertTrue ('drag_dot_3' in el .text )
206210
207211 def test_driver_swipe (self ):
0 commit comments