class TestAndroidJiuai(unittest.TestCase): """ Test: No 1. skip app Guide page No 2. New user register No 3. Home Page refresh No 4. Add Address """ @classmethod def setUpClass(self): #Appium Android settings self.driver = test_start() #mobile swipe self.sw = MobileSwipe() # Swipe:app Guide page def test_initialize(self): sleep(3) for c in range(5): self.sw.left_swipe(self.driver) self.driver.find_element_by_xpath("//android.widget.ImageView").click() sleep(3) self.assertEqual('.activity.MainActivity',self.driver.current_activity) # User Register def test_register(self): register(self.driver,username,identifying_code,password,nickname) # Home Page: Refresh @unittest.skip("NO Run") def test_home_refresh(self): self.driver.find_element_by_id(cfg.get('nav','main')).click() for c in range(100): self.sw.down_swipe(self.driver) # Edit Address def test_add_address(self): add_address(self.driver)
class TestAndroidJiuai(unittest.TestCase): """ Test: No 1. skip app Guide page No 2. New user register No 3. Home Page refresh No 4. Add Address """ @classmethod def setUpClass(self): #Appium Android settings self.driver = test_start() #mobile swipe self.sw = MobileSwipe() # Swipe:app Guide page def test_initialize(self): sleep(3) for c in range(5): self.sw.left_swipe(self.driver) self.driver.find_element_by_xpath("//android.widget.ImageView").click() sleep(3) self.assertEqual('.activity.MainActivity', self.driver.current_activity) # User Register def test_register(self): register(self.driver, username, identifying_code, password, nickname) # Home Page: Refresh @unittest.skip("NO Run") def test_home_refresh(self): self.driver.find_element_by_id(cfg.get('nav', 'main')).click() for c in range(100): self.sw.down_swipe(self.driver) # Edit Address def test_add_address(self): add_address(self.driver)
def setUpClass(self): #Appium Android settings self.driver = test_start() #mobile swipe self.sw = MobileSwipe()
from appium import webdriver from appium.webdriver.common.touch_action import TouchAction from common import screenshot from common import el_click, el_send_keys, el_xpath_click from common import el_text, el_xpath_text from common import MobileSwipe # config.ini cfg = ConfigParser() cfg.read('config.ini') # jiuai_data.dat tdi = ConfigParser() tdi.read('jiuai_data.dat') sw = MobileSwipe() def online_goods(driver): el_click(driver, cfg.get('nav', 'my')) el_click(driver, cfg.get('release', 'option_my_release')) el_xpath_click(driver, '//android.widget.HorizontalScrollView[1]') goods_title = el_xpath_text( driver, '//android.widget.RelativeLayout[1]/android.widget.TextView[1]')