def test05_modify_goods_kinds_number(self, num, result): file_name = 'tp_cart' + num + '.sql' read_sql(file_name) log.info(f"插入{num}件商品") self.driver.refresh() if result == '': try: log.info('正在进行断言,检查购物车中产品数量') assert self.cart.page_cart_get_goods_kinds_number().startswith( num) except Exception as e: log.error(f"商品数量有误,断言失败:{e}") module_name = str(os.path.basename(__file__)).split('.')[0] self.login.base_get_screenshot(module_name) raise else: log.info('逆向用例') try: log.info('正在进行断言,检查购物车中产品数量') assert self.cart.page_cart_get_huasheng_error() == result except Exception as e: log.error(f"无错误提示信息,或者提示信息有误,断言失败:{e}") module_name = str(os.path.basename(__file__)).split('.')[0] self.login.base_get_screenshot(module_name) raise
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 test06_delete_goods_check(self): read_sql('tp_cart2.sql') self.driver.refresh() log.info('执行购物车中商品删除操作') self.cart.page_cart_click_continue_to_shopping() self.cart.page_cart_huasheng_commit() self.cart.page_cart_huasheng_go_to_cart() self.cart.page_cart_delete_by_x() sleep(3) try: log.info('正在进行断言,检测对应产品是否删除') assert self.cart.page_get_cart_huasheng_name() except Exception as e: log.error(f"商品删除错误,未对应商品被删除,断言失败:{e}") module_name = str(os.path.basename(__file__)).split('.')[0] self.login.base_get_screenshot(module_name) raise
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 test10_check_selected_kinds_num(self): log.info('测试购物车选中商品数量') read_sql('tp_cart2.sql') self.driver.refresh() log.info('执行部分选择操作') self.cart.page_cart_click_continue_to_shopping() self.cart.page_cart_huasheng_commit() self.cart.page_cart_huasheng_go_to_cart() self.orginfo = self.cart.page_cart_get_goods_kinds_number() self.cart.page_cart_click_2_in_3() while True: if self.orginfo == self.cart.page_cart_get_goods_kinds_number(): log.info('等待商品数量刷新') sleep(1) else: break try: log.info('正在进行断言,选中2件商品') assert '2件商品' == self.cart.page_cart_get_goods_kinds_number() except Exception as e: log.error(f"断言失败,取消选择后商品数量错误,断言失败:{e}") module_name = str(os.path.basename(__file__)).split('.')[0] self.login.base_get_screenshot(module_name) raise
def setup_class(cls): WinRM().run_bat_file() cls.driver = GetDriver.get_web_driver(page.URL) cls.register = PageRegister(cls.driver) read_sql('tp_users.sql')