def setup_class(cls): log.info('清除服务器缓存文件') run_bat('clear_session.bat') log.info('导入数据库测试数据') read_sql('mirrormx_customer_chat_talk2.sql') read_sql('mirrormx_customer_chat_message2.sql') read_sql('mirrormx_customer_chat_data.sql') read_sql('mirrormx_customer_chat_shared_file.sql') read_sql('mirrormx_customer_chat_upload.sql') # 主测试机的初始化设置 cls.driver = GetDriver.get_app_driver() cls.user = PageUserList(cls.driver) cls.fwq = PageFwq(cls.driver) cls.login = PageLogin(cls.driver) cls.user.base_if_app_is_install('net.mirrormx.livechat') cls.driver.start_activity('net.mirrormx.livechat', '.MainActivity') if float(cap2['platformVersion']) >= 8: log.info('正在处理高版本系统的弹窗') cls.driver.switch_to.alert.accept() cls.fwq.page_hand_add_fwq( '我的服务器', 'http://192.168.1.10/kefu/php/app.php?mobile-api') cls.login.page_login('我的服务器', 'http://192.168.1.10/kefu/php/app.php?mobile-api', username='******', password='******') # 辅助测试机初始化设置 cls.driver2 = GetDriver.get_app_driver2() cls.driver3 = GetDriver.get_app_driver3() cls.user.page_other_help(cls.driver2, cls.driver3)
def setup_class(cls): WinRM().run_bat_file() read_sql('tp_order.sql') read_sql('tp_order_goods.sql') print('初始化用户订单') cls.driver = GetDriver.get_web_driver(page.URL) cls.order = PageOrder(cls.driver) cls.login = PageLogin(cls.driver) cls.login.page_login() cls.login.page_keep_return_FP() cls.driver2 = GetDriver.get_web_driver2(page.URL2) cls.ms = PageOrder(cls.driver2) cls.order_number = None
def setup_class(self): # 1:获取driver driver = GetDriver.get_web_driver(page.url_mp) # 2:获取统一入口类获取类 self.mp = PageIn(driver).page_get_PageMpLogin() pass
def setup_class(cls): WinRM().run_bat_file() cls.driver = GetDriver.get_web_driver(page.URL) cls.cart = PageCart(cls.driver) cls.login = PageLogin(cls.driver) cls.login.page_login() cls.login.page_keep_return_FP()
def setup_class(self): # 获取driver self.driver = GetDriver().get_driver() # 实例化PageLogin self.login = PageLogin(self.driver) # 点击登录连接 self.login.page_click_login_link()
def teardown_class(self): # 关闭driver GetDriver().quit_driver() # 测试方法 @allure.step(title="正在调用新增地址测试用例") @pytest.mark.run(order=1) @pytest.mark.parametrize("name,phone,province,city,area,info,code", get_data()) def test_post_address(self, name, phone, province, city, area, info, code): # 调用新增地址业务方法 self.address.page_add_address(name, phone, province, city, area, info, code) try: # 组合 收件人和电话 result_person = name + " " + phone # 断言 收件人和电话 assert result_person in self.address.page_get_person_phone_list() # 组合 地址 address = province + city + area + info # 断言地址 assert address in self.address.page_get_address_list() except: # 截图 sys.address.base_get_img() # 抛异常 raise
def setup_class(cls): cls.driver = GetDriver.get_app_driver() cls.fwq = PageFwq(cls.driver) cls.fwq.base_if_app_is_install('net.mirrormx.livechat') cls.driver.start_activity('net.mirrormx.livechat', '.MainActivity') if float(cap2['platformVersion']) >= 8: log.info('正在处理高版本系统的弹窗') cls.driver.switch_to.alert.accept()
def setup_class(cls): cls.driver = GetDriver.get_app_driver() cls.login = PageLogin(cls.driver) cls.fwq = PageFwq(cls.driver) cls.login.base_if_app_is_install('net.mirrormx.livechat') cls.driver.start_activity('net.mirrormx.livechat', '.MainActivity') if float(cap2['platformVersion']) >= 8: log.info('正在处理高版本系统的弹窗') cls.driver.switch_to.alert.accept() cls.fwq.page_hand_add_fwq( '我的服务器', 'http://192.168.1.10/kefu/php/app.php?mobile-api')
class PageIn: driver = GetDriver().get_driver() # 获取PageLogin对象 @allure.step(title='正在获取PageLogin对象') def page_get_PageLogin(self): return PageLogin(self.driver) # 获取PageAddress对象 def page_get_PageAddress(self): return PageAddress(self.driver)
def setup_class(self): self.driver = GetDriver.get_driver() # 获取PageIndex对象 self.index = PageIndex() # 获取PageLogin对象 self.login = PageLogin() # 获取PageTitle对象 self.title = PageTitle() #点击 登录 链接 self.index.page_login_link()
def setup_class(self): # 1:获取driver driver = GetDriver.get_web_driver(page.url_mp) # 2:获取统一入口类获取类 self.page_in = PageIn(driver) # 获取PageMpLogin对象并调用登录成功依赖方法 self.page_in.page_get_PageMpLogin().page_mp_login_success("13812345678", 246810) # 获取PageMpLogin页面对象 self.article = self.page_in.page_get_PageMpArticle() pass
def setup_class(cls): log.info('导入数据库测试数据') read_sql('mirrormx_customer_chat_talk_history.sql') read_sql('mirrormx_customer_chat_message_history.sql') read_sql('mirrormx_customer_chat_data.sql') read_sql('mirrormx_customer_chat_shared_file.sql') read_sql('mirrormx_customer_chat_upload.sql') cls.driver = GetDriver.get_app_driver() cls.history = PageHistory(cls.driver) cls.fwq = PageFwq(cls.driver) cls.login = PageLogin(cls.driver) cls.history.base_if_app_is_install('net.mirrormx.livechat') cls.driver.start_activity('net.mirrormx.livechat', '.MainActivity') if float(cap2['platformVersion']) >= 8: log.info('正在处理高版本系统的弹窗') cls.driver.switch_to.alert.accept() cls.fwq.page_hand_add_fwq( '我的服务器', 'http://192.168.1.10/kefu/php/app.php?mobile-api') cls.login.page_login('我的服务器', 'http://192.168.1.10/kefu/php/app.php?mobile-api', username='******', password='******') cls.history.page_history_enter()
def __init__(self): """初始化driver对象""" self.driver = GetDriver.get_driver() GetLog.get_log().info("初始化driver对象: {}".format(self.driver))
def __init__(self): self.driver = GetDriver.get_driver() try: self.driver.find_elements_by_id('xxx:id/permission_allow_xxx').click() except: pass
def tearDownClass(cls) -> None: GetDriver().driver_quit() logger.info("完成测试pay模块")
def setUpClass(cls) -> None: logger.info("正在测试pay模块") cls.driver = GetDriver().get_driver() cls.login = PageLogin(cls.driver) cls.pay = PagePay(cls.driver) cls.login.page_click_login_link()
return self.base_get_text(page.logout) def page_click_logout(self): self.base_click_element(page.logout) def page_return_FP(self): self.base_click_element(page.login_return) def page_keep_return_FP(self): self.base_click_element(page.cart_user_back) def page_login(self, username='******', password="******", code="8888"): log.info(f'调用组合业务登录方法,登录用户名为{username},密码{password},验证码{code}') self.page_click_login() self.page_input_username(username) self.page_input_password(password) self.page_input_code(code) self.page_click_login_btn() if __name__ == "__main__": driver = GetDriver().get_web_driver(page.URL) PageLogin(driver).page_login() b = 0 b = PageLogin(driver).page_get_error_text() print(b) GetDriver().quit_web_driver()
def teardown_class(self): # 关闭调用driver驱动对象 GetDriver.quit_driver()
def teardown_class(self): # 关闭driver驱动对象 # 坑 2 只能调用 关闭driver GetDriver.quit_driver()
def teardown_class(cls): GetDriver().quit_web_driver()
def setup_class(cls): WinRM().run_bat_file() cls.driver = GetDriver.get_web_driver(page.URL) cls.login = PageLogin(cls.driver)
def teardown_class(self): """退出driver对象""" GetDriver.quit_driver()
def __init__(self): self.driver = GetDriver.get_driver()
def teardown_class(self): # 调用关闭driver GetDriver.quit_web_driver() pass
def teardown_class(cls): GetDriver.quit_app_driver() GetDriver.quit_app_driver2() GetDriver.quit_app_driver3()
def setup_class(cls): cls.driver = GetDriver.get_app_driver() cls.xx = PageXx(cls.driver) cls.xx.base_click_element(page.approve) PageLogin(cls.driver).pagelogin() cls.xx.base_click_element(page.xx_menu)
def teardown_class(self): GetDriver.quit_driver()
class PageIn: driver = GetDriver().get_driver() # 获取PageLogin对象 def page_get_PageLogin(self): return PageLogin(self.driver)
def teardown_class(self): # 关闭driver对象 GetDriver.quit_driver()
def teardown(self): # 关闭driver GetDriver().quit_driver()