예제 #1
0
 def testdengLu_01_01(self):
     '''普通用户账号密码登录'''
     self.driver.implicitly_wait(30)
     allLogin(self.driver).yonghulogin()
     time.sleep(2)
     el = self.driver.find_element_by_id("com.wuye:id/phone")
     self.assertEqual(el.text, "15716550311")
예제 #2
0
 def testgerenZhongxin_02_02(self):
     '''服务预约正确填写提交'''
     allLogin(self.driver).yonghulogin()
     # 点击服务预约
     self.driver.find_element_by_xpath(
         '//android.widget.TextView[@text = "服务预约"]').click()
     time.sleep(2)
     self.driver.find_element_by_id("com.wuye:id/content").send_keys(
         "这是一个服务预约")
     time.sleep(1)
     #服务时间
     self.driver.find_element_by_id("com.wuye:id/time").send_keys(
         time.strftime('%Y-%m-%d-%H-%M-%S', time.localtime(time.time())))
     time.sleep(1)
     #选择服务类型
     self.driver.find_element_by_id("com.wuye:id/leixing").click()
     time.sleep(1)
     self.driver.find_elements_by_id("android:id/text1")[3].click()
     time.sleep(1)
     #点击提交
     self.driver.find_element_by_id("com.wuye:id/button").click()
     try:
         # 处理toast方法
         toast_loc = ("xpath", ".//*[contains(@text,'提交成功')]")
         WebDriverWait(self.driver, 20,
                       0.1).until(EC.presence_of_element_located(toast_loc))
         duanyan = True
     except:
         duanyan = False
예제 #3
0
 def testgerenZhongxin_02_04(self):
     '''点击退出登录'''
     self.driver.implicitly_wait(60)
     allLogin(self.driver).yonghulogin()
     time.sleep(3)
     self.driver.find_element_by_xpath('//*[@text="退出登录"]').click()
     time.sleep(2)
     el = self.driver.find_element_by_xpath('//*[@text="没有账号去注册"]')
     self.assertTrue(el.is_displayed())
예제 #4
0
 def testgerenZhongxin_02_01(self):
     '''服务预约不填写直接提交'''
     allLogin(self.driver).yonghulogin()
     # 点击服务预约
     self.driver.find_element_by_xpath(
         '//android.widget.TextView[@text = "服务预约"]').click()
     time.sleep(2)
     self.driver.find_element_by_id("com.wuye:id/button").click()
     try:
         # 处理toast方法
         toast_loc = ("xpath", ".//*[contains(@text,'保修内容不能为空')]")
         WebDriverWait(self.driver, 20,
                       0.1).until(EC.presence_of_element_located(toast_loc))
         duanyan = True
     except:
         duanyan = False
예제 #5
0
 def testgerenZhongxin_01_01(self):
     '''修改地址页面正常修改地址'''
     allLogin(self.driver).yonghulogin()
     self.driver.find_element_by_xpath(
         '//android.widget.TextView[@text = "修改地址"]').click()
     time.sleep(3)
     self.driver.find_element_by_id("com.wuye:id/address").clear()  #清空地址
     time.sleep(1)
     self.driver.find_element_by_id("com.wuye:id/address").send_keys(
         "新的地址" +
         time.strftime('%Y%m%d%H%M%S', time.localtime(time.time())))
     time.sleep(1)
     self.driver.find_element_by_id("com.wuye:id/button").click()  #点击确定
     try:
         # 处理toast方法
         toast_loc = ("xpath", ".//*[contains(@text,'修改成功')]")
         WebDriverWait(self.driver, 20,
                       0.1).until(EC.presence_of_element_located(toast_loc))
         duanyan = True
     except:
         duanyan = False
     self.assertTrue(duanyan)
예제 #6
0
 def testgerenZhongxin_02_03(self):
     '''检查已提交的服务预约是否正确显示在待接单页面'''
     allLogin(self.driver).yonghulogin()
     # 点击服务预约
     self.driver.find_element_by_xpath(
         '//android.widget.TextView[@text = "服务预约"]').click()
     time.sleep(2)
     self.driver.find_element_by_id("com.wuye:id/content").send_keys(
         "这是一个服务预约")
     time.sleep(1)
     #服务时间
     self.driver.find_element_by_id("com.wuye:id/time").send_keys(
         time.strftime('%Y-%m-%d-%H-%M-%S', time.localtime(time.time())))
     shuru = self.driver.find_element_by_id("com.wuye:id/time").text
     time.sleep(1)
     #选择服务类型
     self.driver.find_element_by_id("com.wuye:id/leixing").click()
     time.sleep(1)
     self.driver.find_elements_by_id("android:id/text1")[3].click()
     time.sleep(1)
     #点击提交
     self.driver.find_element_by_id("com.wuye:id/button").click()
     time.sleep(3)
     #进入我的订单页面
     self.driver.find_element_by_xpath(
         '//android.widget.TextView[@text = "我的订单"]').click()
     time.sleep(2)
     el = self.driver.find_elements_by_id("com.wuye:id/tvTime")
     time.sleep(1)
     try:
         self.driver.swipe(500, 1000, 500, 200, 30000)
         yanzheng = (id, "com.wuye:id/tvTime")
         WebDriverWait(300,
                       0.1).until(EC.presence_of_element_located(yanzheng))
         duanyan = True
     except:
         duanyan = False
     self.assertTrue(duanyan)