class TestYiYao: def setup(self): # self.main = MainPage(types='debug') # self.main.write_cookie_for_json('../datas/cookie.json') self.main = MainPage( url='http://partner.zhyf.sfrog.cn/#/workbench/index') self.main.add_cookie('../datas/cookie.json') self.main.refresh() self.main.set_window_size(1920, 1080) def teardown(self): self.main.quit() @allure.story('测试用例:创建处方成功') def test_add_prescription_success(self): name = 'shen' res = self.main.goto_prescription_center().goto_prescription_create( ).add_prescription_success(patient_name=name, age='18', phone='17365372296', birthday='2011-03-08', detail_address='天台', medicinal_name='c', medicinal_num='2').query_prescription(name) pytest.assume(res == name)
class TestYiYao: def setup(self): # self.main = MainPage(types='debug') # self.main.write_cookie_for_json('../datas/cookie.json') useinghandless = 'true' if useinghandless == 'true': moudle = '无界面' else: moudle = '有界面' loc1 = ("xpath", "//*[contains(text(),'登 录')]") loc2 = ("xpath", "//span[contains(text(),'处方中心')]") self.main = MainPage( url='http://partner.zhyf.sfrog.cn/#/workbench/index', userhadless=useinghandless) print('植入cookie前') print(f'检测未登录页面元素:{self.main.is_visibility_of_element_located(loc1)}') print(f'检测已登录页面元素:{self.main.is_visibility_of_element_located(loc2)}') time.sleep(1) self.main.get_screen_shot(f'{moudle}cookie前截图', '') self.main.add_cookie('../datas/cookie.json') self.main.refresh() # self.main.max_size() self.main.set_window_size(1920, 1080) print('植入cookie后') time.sleep(1) self.main.get_screen_shot(f'{moudle}cookie后截图', '') print(f'检测未登录页面元素:{self.main.is_visibility_of_element_located(loc1)}') print(f'检测已登录页面元素:{self.main.is_visibility_of_element_located(loc2)}') def teardown(self): self.main.quit() @allure.story('测试用例:创建处方成功') def test_add_prescription_success(self): pass