Ejemplo n.º 1
0
 def test_peizhen(self):
     driver = self.driver
     sleep(2)
     driver.find_element_by_xpath(
         "//*[@resource-id='cn.xinzhili.core:id/tl_home_tabs']/android.widget.LinearLayout[4]"
     ).click()
     sleep(2)
     driver.find_element_by_xpath("//*[@text='我的亲友']").click()
     sleep(3)
     if "自动家属" not in driver.page_source:
         for i in range(0, 2):
             hd = huadong()
             hd.swipLeft(2000)
     if "医生主动服药计划" not in driver.page_source:
         for h in range(0, 3):
             hd.swipeUp(2000)
     element = driver.find_element_by_id(
         "cn.xinzhili.core:id/sw_doctor_advice_switch")
     ima = Appium_Extend()
     linshi = "/Users/yangxiaochen/PycharmProjects/app-autotest/linshi/qinyou.png"
     filepath = "/Users/yangxiaochen/PycharmProjects/app-autotest/testimage/kgopen.png"
     ima.get_screenshot_by_element(linshi, filepath, element)
     sleep(2)
     driver.find_element_by_id(
         "cn.xinzhili.core:id/sw_doctor_advice_switch").click()
     sleep(2)
     ele2 = driver.find_element_by_id(
         "cn.xinzhili.core:id/sw_doctor_advice_switch")
     linshi2 = "/Users/yangxiaochen/PycharmProjects/app-autotest/linshi/qinyou2.png"
     filepath2 = "/Users/yangxiaochen/PycharmProjects/app-autotest/testimage/kgdown.png"
     ima.get_screenshot_by_element(linshi2, filepath2, ele2)
     sleep(2)
     jieguo = ima.same_as(filepath, filepath2)
     self.assertEqual(jieguo, False)
Ejemplo n.º 2
0
 def test_peizhen(self):
     driver = self.driver
     sleep(2)
     driver.find_element_by_xpath(
         "//*[@resource-id='cn.xinzhili.core:id/tl_home_tabs']/android.widget.LinearLayout[4]"
     ).click()
     sleep(2)
     driver.find_element_by_xpath("//*[@text='我的亲友']").click()
     sleep(3)
     driver.find_element_by_xpath("//*[@text='添加']").click()
     sleep(2)
     if "头像" not in driver.page_source:
         driver.find_element_by_id(
             "cn.xinzhili.core:id/iv_relative_delete").click()
         sleep(2)
         driver.find_element_by_xpath("//*[@text='确定']").click()
         sleep(2)
         driver.find_element_by_xpath("//*[@text='添加']").click()
     driver.find_element_by_xpath("//*[@text='头像']").click()
     sleep(1)
     driver.find_element_by_xpath("//*[@text='拍照']").click()
     if "允许" in driver.page_source:
         driver.find_element_by_xpath("//*[@text='允许']").click()
     driver.find_element_by_id(
         "com.android.camera:id/v9_shutter_button_internal").click()
     sleep(4)
     driver.find_element_by_id(
         "com.android.camera:id/inten_done_apply").click()
     sleep(2)
     driver.find_element_by_xpath("//*[@text='确定']").click()
     sleep(2)
     driver.find_element_by_xpath("//*[@text='未填写']").send_keys("自动家属")
     sleep(1)
     driver.find_element_by_xpath("//*[@text='必填项']").send_keys(
         "13818899999")
     sleep(1)
     driver.find_element_by_xpath("//*[@text='子女']").click()
     sleep(2)
     driver.find_element_by_xpath("//*[@text='出生日期']").click()
     sleep(2)
     driver.find_element_by_xpath("//*[@text='确定']").click()
     sleep(2)
     driver.find_element_by_xpath("//*[@text='保存']").click()
     sleep(2)
     hd = huadong()
     for hua in range(0, 3):
         if "自动家属" in driver.page_source:
             self.assertIn("自动家属", driver.page_source)
             sleep(2)
             break
         else:
             hd.swipLeft(2000)
Ejemplo n.º 3
0
 def test_zixun(self):
     driver = self.driver
     sleep(2)
     driver.find_element_by_id("cn.xinzhili.core:id/iv_remind").click()
     sleep(2)
     if ("医生通知" in driver.page_source):
         self.assertIn("医生通知", driver.page_source)
     else:
         hd = huadong()
         for h in range(0, 4):
             hd.swipeUp(2000)
             if ("医生通知" in driver.page_source):
                 self.assertIn("医生通知", driver.page_source)
             break
Ejemplo n.º 4
0
 def test_zixun(self):
     driver = self.driver
     sleep(2)
     driver.find_element_by_xpath("//*[@text='健康资讯']").click()
     sleep(2)
     for h in range(0, 4):
         if ("起搏器植入" in driver.page_source):
             driver.find_element_by_xpath(
                 "//*[@resource-id='cn.xinzhili.core:id/rv_health_news']/android.widget.LinearLayout[4]/android.widget.RelativeLayout/android.widget.TextView"
             ).click()
             break
         else:
             hd = huadong()
             hd.swipeUp(2000)
     sleep(5)
     page_source2 = driver.page_source
     self.assertIn("局部出血" or "事件的发生" or "危险因素", page_source2)
Ejemplo n.º 5
0
 def test_fengxian(self):
     driver = self.driver
     driver.find_element_by_xpath(
         "//*[@resource-id='cn.xinzhili.core:id/tl_home_tabs']/android.widget.LinearLayout[3]"
     ).click()
     sleep(2)
     driver.find_element_by_xpath("//*[@text='冠心病']").click()
     sleep(2)
     hua = huadong()
     for i in range(0, 2):
         if '痛风' in driver.page_source:
             self.asserIn('风险因素', driver.page_source)
             break
         else:
             hua.swipeUp(2000)
     sleep(2)
     driver.find_element_by_id("cn.xinzhili.core:id/iv_title_left").click()
Ejemplo n.º 6
0
 def test_updelqinyou(self):
     driver = self.driver
     sleep(2)
     driver.find_element_by_xpath(
         "//*[@resource-id='cn.xinzhili.core:id/tl_home_tabs']/android.widget.LinearLayout[4]"
     ).click()
     sleep(2)
     driver.find_element_by_xpath("//*[@text='我的亲友']").click()
     sleep(3)
     hd = huadong()
     for i in range(0, 2):
         if "自动家属" in driver.page_source:
             driver.find_element_by_id(
                 "cn.xinzhili.core:id/iv_relative_edit").click()
             sleep(1)
             driver.find_element_by_xpath("//*[@text='自动家属']").clear()
             sleep(1)
             driver.find_element_by_xpath("//*[@text='未填写']").send_keys(
                 "修改后")
             sleep(1)
             driver.find_element_by_xpath(
                 "//*[@text='13818899999']").clear()
             sleep(1)
             driver.find_element_by_xpath("//*[@text='必填项']").send_keys(
                 "13776666666")
             sleep(1)
             driver.find_element_by_xpath("//*[@text='配偶']").click()
             sleep(1)
             driver.find_element_by_xpath("//*[@text='保存']").click()
             self.assertIn("13776666666", driver.page_source)
             self.assertIn("修改后", driver.page_source)
             sleep(2)
             driver.find_element_by_id(
                 "cn.xinzhili.core:id/iv_relative_delete").click()
             sleep(2)
             driver.find_element_by_xpath("//*[@text='确定']").click()
             sleep(2)
             self.assertNotIn("13776666666", driver.page_source)
             self.assertNotIn("修改后", driver.page_source)
             break
     else:
         hd.swipLeft(2000)
Ejemplo n.º 7
0
 def test_dsjnews(self):
     driver = self.driver
     sleep(2)
     driver.find_element_by_accessibility_id("对话").click()
     sleep(3)
     driver.find_element_by_accessibility_id("提醒").click()
     sleep(2)
     self.assertIn("您好", driver.page_source)
     sleep(2)
     driver.find_element_by_accessibility_id("back").click()
     sleep(2)
     driver.find_element_by_xpath(
         "//XCUIElementTypeButton[@name='健康资讯']").click()
     sleep(2)
     for i in range(0, 11):
         hd = huadong()
         hd.swipeDown(2000)
     sleep(4)
     driver.find_element_by_accessibility_id("搭桥手术的时间和过程").click()
     sleep(8)
     self.assertIn("家属需耐心等待", driver.page_source)
     sleep(2)
Ejemplo n.º 8
0
 def test_upqinyou(self):
     driver = self.driver
     sleep(2)
     driver.find_element_by_accessibility_id("我的").click()
     sleep(2)
     driver.find_element_by_xpath(
         "//XCUIElementTypeStaticText[@name='我的亲友']").click()
     sleep(2)
     aaa = huadong()
     if "自动化测试" not in driver.page_source:
         for h in range(0, 2):
             aaa.swipLeft(2000)
             sleep(2)
     driver.find_element_by_xpath(
         "//XCUIElementTypeSwitch[@name='短信通知']").click()
     value = driver.find_element_by_xpath(
         "//XCUIElementTypeSwitch[@name='短信通知']").text
     self.assertEqual(value, "0")
     for h in range(0, 3):
         aaa.swipeUp(2000)
         sleep(1)
     driver.find_element_by_xpath(
         "//XCUIElementTypeSwitch[@name='医生主动医嘱, 医生给患者主动发送医嘱']").click()
     value = driver.find_element_by_xpath(
         "//XCUIElementTypeSwitch[@name='医生主动医嘱, 医生给患者主动发送医嘱']").text
     self.assertEqual(value, "0")
     for h in range(0, 3):
         aaa.swipeDown(2000)
         sleep(1)
     driver.find_element_by_accessibility_id("relative edit").click()
     sleep(2)
     driver.find_element_by_xpath(
         "//XCUIElementTypeApplication[@name='心之力']/XCUIElementTypeWindow[1]/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeTable/XCUIElementTypeCell[2]/XCUIElementTypeTextField"
     ).clear()
     sleep(1)
     driver.find_element_by_xpath(
         "//XCUIElementTypeApplication[@name='心之力']/XCUIElementTypeWindow[1]/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeTable/XCUIElementTypeCell[2]/XCUIElementTypeTextField"
     ).send_keys("修改")
     sleep(1)
     driver.find_element_by_xpath(
         "//*[normalize-space(@value)='15666111111']").clear()
     sleep(1)
     driver.find_element_by_xpath(
         "//XCUIElementTypeApplication[@name='心之力']/XCUIElementTypeWindow[1]/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeTable/XCUIElementTypeCell[3]/XCUIElementTypeTextField"
     ).send_keys("15666111112")
     sleep(1)
     driver.find_element_by_xpath(
         "//XCUIElementTypeStaticText[@name='子女']").click()
     sleep(2)
     driver.find_element_by_xpath(
         "//XCUIElementTypeStaticText[@name='保存']").click()
     sleep(2)
     self.assertIn("修改", driver.page_source)
     self.assertIn("15666111112", driver.page_source)
     sleep(1)
     driver.find_element_by_xpath(
         "//XCUIElementTypeButton[@name='del']").click()
     driver.find_element_by_xpath(
         "//XCUIElementTypeStaticText[@name='删除']").click()
     sleep(2)
     self.assertNotIn("修改测试", driver.page_source)
     sleep(2)
Ejemplo n.º 9
0
 def test_qinyou(self):
     driver = self.driver
     sleep(2)
     driver.find_element_by_accessibility_id("我的").click()
     sleep(2)
     driver.find_element_by_xpath(
         "//XCUIElementTypeStaticText[@name='我的亲友']").click()
     sleep(2)
     driver.find_element_by_xpath(
         "//XCUIElementTypeStaticText[@name='添加']").click()
     sleep(2)
     if "保存" not in driver.page_source:
         driver.find_element_by_xpath(
             "//XCUIElementTypeButton[@name='del']").click()
         sleep(2)
         driver.find_element_by_xpath(
             "//XCUIElementTypeStaticText[@name='删除']").click()
         sleep(2)
         driver.find_element_by_xpath(
             "//XCUIElementTypeStaticText[@name='添加']").click()
     driver.find_element_by_xpath(
         "//XCUIElementTypeStaticText[@name='头像']").click()
     driver.find_element_by_accessibility_id("拍照").click()
     driver.find_element_by_accessibility_id("PhotoCapture").click()
     driver.find_element_by_xpath(
         "//XCUIElementTypeStaticText[@name='使用照片']").click()
     sleep(2)
     driver.find_element_by_xpath(
         "//XCUIElementTypeApplication[@name='心之力']/XCUIElementTypeWindow[1]/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeTable/XCUIElementTypeCell[2]/XCUIElementTypeTextField"
     ).click()
     sleep(2)
     driver.find_element_by_xpath(
         "//XCUIElementTypeApplication[@name='心之力']/XCUIElementTypeWindow[1]/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeTable/XCUIElementTypeCell[2]/XCUIElementTypeTextField"
     ).send_keys("自动化测试")
     sleep(2)
     driver.find_element_by_xpath(
         "//XCUIElementTypeApplication[@name='心之力']/XCUIElementTypeWindow[1]/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeTable/XCUIElementTypeCell[3]/XCUIElementTypeTextField"
     ).click()
     sleep(2)
     driver.find_element_by_xpath(
         "//XCUIElementTypeApplication[@name='心之力']/XCUIElementTypeWindow[1]/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeTable/XCUIElementTypeCell[3]/XCUIElementTypeTextField"
     ).send_keys("15666111111")
     sleep(2)
     driver.find_element_by_xpath(
         "//XCUIElementTypeStaticText[@name='配偶']").click()
     sleep(2)
     driver.find_element_by_xpath(
         "//XCUIElementTypeApplication[@name='心之力']/XCUIElementTypeWindow[1]/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeOther/XCUIElementTypeTable/XCUIElementTypeCell[5]"
     ).click()
     sleep(2)
     driver.find_element_by_xpath(
         "//XCUIElementTypeStaticText[@name='确定']").click()
     sleep(2)
     driver.find_element_by_xpath(
         "//XCUIElementTypeStaticText[@name='保存']").click()
     sleep(2)
     if "自动化测试" not in driver.page_source:
         aaa = huadong()
         for h in range(0, 2):
             aaa.swipLeft(2000)
             sleep(1)
     self.assertIn("自动化测试", driver.page_source)
     sleep(1)