def brfore_func(self): self.driver = get_driver() self.add_page = AddPage(self.driver) self.setting_page = SettingPage(self.driver) yield time.sleep(3) self.driver.quit()
class TestDisplaySearch: def setup(self): self.driver = init_driver() self.display_page = DisplayPage(self.driver) self.display_search_page = DisplaySearchPage(self.driver) self.setting_page = SettingPage(self.driver) # @pytest.mark.skipif(True, reason='未完成方法') def test_display_search(self): self.setting_page.click_display_button() self.display_page.click_search_button() self.display_search_page.input_search() self.display_search_page.click_back_button()
class TestSms: def setup_class(self): #1.初始化driver self.driver = get_driver() #2.初始化smspage类 self.settingpage = SettingPage(self.driver) def teardown_class(self): # 1 退出driver self.driver.quit() #点击搜索圈 @allure.step(title='测试设置搜索') @allure.attach("搜索,增加") def test_click_search_btn(self): # 1.点击新增按钮 self.settingpage.click_search_btn() @pytest.mark.parametrize("content", get_data()) #向搜索框内输入1/2/3 def test_input_number_search(self, content): self.settingpage.input_number_search(content) #按返回键 def test_click_back_butn(self): self.settingpage.click_back_butn()
class TestAdd(object): # 通讯录测试类 @pytest.fixture(autouse=True) def brfore_func(self): self.driver = get_driver() self.add_page = AddPage(self.driver) self.setting_page = SettingPage(self.driver) yield time.sleep(3) self.driver.quit() @pytest.mark.parametrize('name,phone', build_address_func()) def test_func(self, name, phone): # 点击添加按钮 self.setting_page.click_my_btn() # 点击本地保存按钮 self.setting_page.click_local_save() # 输入姓名 self.add_page.input_name(name) # 输入电话 self.add_page.input_phone(phone) # 发送返回键 self.driver.keyevent(4) # # 点击添加按钮 # self.setting_page.click_my_btn() # # 点击本地保存按钮 # self.setting_page.click_local_save() # # 输入姓名 # self.add_page.input_name('李白') # # 输入电话 # self.add_page.input_phone('123456') # # 发送返回键 # self.driver.keyevent(4) # 烘干机会根据韩国
def setup_class(self): self.driver = webdriver.Chrome() self.Login_Page = LoginPage(self.driver) self.Setting_Page = SettingPage(self.driver) self.driver.maximize_window() self.Login_Page.get(self.url + r"login") self.Login_Page.user_input = "test" self.Login_Page.password_input = "123456zxA" self.Login_Page.login_button.click() sleep(self.sleep_time) self.Login_Page.select_hospital.click() self.Login_Page.select_ensure.click() sleep(self.sleep_time) self.Setting_Page.setting_button.click() sleep(self.sleep_time) pass
class TestSetting(): def setup(self): self.driver = init_driver(base.apppackage, base.appactivity) self.setting_page = SettingPage(self.driver) def teardown(self): self.driver.quit() @pytest.mark.parametrize("content", get_setting_data()) def test_setting(self, content): self.setting_page.click_search() self.setting_page.input_content(content) self.setting_page.click_back()
class TestSitting: def setup_class(self): self.driver = init_driver() self.setting_page = SettingPage(self.driver) def teardown_class(self): self.driver.quit() # @pytest.mark.parametrize('test_id,input_text', input_data()) # def test_setting(self, test_id, input_text): # sp = SettingPage(self.driver) # print("test_id:", test_id) # sp.input_src_text() @pytest.mark.parametrize('content', input_data()) def test_setting(self, content): self.setting_page.click_search() self.setting_page.input_src_text(content) self.setting_page.click_back()
def setting_page(self): # 设置页面 return SettingPage(self.driver)
def setting(self): # 返回设置页面 return SettingPage(self.driver)
def get_setting_page_obj(self): return SettingPage(self.driver)
def get_setting_page(self): """返回设置的页面对象""" return SettingPage(self.driver)
def setup(self): self.driver = init_driver(base.apppackage, base.appactivity) self.setting_page = SettingPage(self.driver)
def setup_class(self): self.driver = init_driver() self.setting_page = SettingPage(self.driver)
def create_SettingPage(self): return SettingPage(self.driver)
def get_setting_page_instance(self): return SettingPage(self.driver)
def setting_page(self): """设置页""" return SettingPage(self.driver)
def setup_class(self): #1.初始化driver self.driver = get_driver() #2.初始化smspage类 self.settingpage = SettingPage(self.driver)
def setup(self): self.driver = init_driver() self.display_page = DisplayPage(self.driver) self.display_search_page = DisplaySearchPage(self.driver) self.setting_page = SettingPage(self.driver)
def setting(self): return SettingPage(self.driver)
def enter_in_start_page(self, driver, host, pkUser, pkCompany): '''进入起始页首页''' HomePage(driver).open(host, pkUser, pkCompany) setting = SettingPage(driver) return setting