diff --git a/TestData/account/account_test_data.py b/TestData/account/account_test_data.py index cbe8d8cbb03361a6345ceeac42ab6bf1b540647a..151f6dfde4b874daaa6183c4dbdecfb56e88592f 100644 --- a/TestData/account/account_test_data.py +++ b/TestData/account/account_test_data.py @@ -5,10 +5,7 @@ from Utils.config_handler import base_config class accountData(Global): origin_language = 'en' #原始语言 target_language = 'zh-CN' #要翻译的语言 - old_name = 'zhs' #旧名字 new_name = 'auto_test' #新名字 - trans_key = 'account.account' - accountData_sql_handler = SqlHandler(address=base_config.get_value('mysql','address'),port=int(base_config.get_value('mysql','port')),account=base_config.get_value('mysql','account'),password=base_config.get_value('mysql','password')) diff --git a/TestFile/automation/rule/rule_select.py b/TestFile/automation/rule/rule_select.py index 9ba75597ed94055a9f69afd369879c1e55bbadcc..d654c4228c5aa73f71d71f4371f8bd6d9624c4cb 100644 --- a/TestFile/automation/rule/rule_select.py +++ b/TestFile/automation/rule/rule_select.py @@ -2,6 +2,7 @@ from TestData.automation.rule_test_data import ruleData rule_select_sql = f'select * from `rule_define` where brand_id = {ruleData.brandId} and status != 3 and tpl_id = "{ruleData.rule_parent_template_id}" and child_rule = 0' rule_select_result = ruleData.rule_db.select_many_value(sql=rule_select_sql) + if rule_select_result: rule_num = len(rule_select_result) @@ -30,4 +31,8 @@ setattr(ruleData, 'select_rule_status', select_rule_status) setattr(ruleData, 'select_rule_sort', select_rule_sort) setattr(ruleData, 'select_rule_describe', select_rule_describe) setattr(ruleData, 'rule_num_less', rule_num - 1) +if getattr(ruleData, 'create_rule_id'): + pass +else: + ruleData.create_rule_id = select_rule_id ruleData.rule_db.close_db() \ No newline at end of file diff --git a/TestFile/inbox/ticketStatus_selectStatus.py b/TestFile/inbox/ticketStatus_selectStatus.py index 57f306bc0d045a2fe854b9ca2901bee850874ec7..0c8ff5e89ea2cabcd817e249259a14529f7f45ec 100644 --- a/TestFile/inbox/ticketStatus_selectStatus.py +++ b/TestFile/inbox/ticketStatus_selectStatus.py @@ -5,7 +5,7 @@ all_ticket_select_sql = f'select * from `im_room` where `cate_id` = {ticketStatu your_ticket_select_sql = f'select * from `im_room` where `cate_id` = {ticketStatusData.brandId} and `status` = 1 and `allocation_uid` = {ticketStatusData.userId} and `is_ignore` = 0 and room_type != 2' unread_ticket_select_sql = f'select * from `im_room` where `cate_id` = {ticketStatusData.brandId} and `status` = 1 and `read_status` = 1 and `is_ignore` = 0 and room_type != 2' unassigned_ticket_select_sql = f'select * from `im_room` where `cate_id` = {ticketStatusData.brandId} and `status` = 1 and `allocation_uid` = 0 and `is_ignore` = 0 and room_type != 2' -chatbot_ticket_select_sql = f'select * from `im_room` where `cate_id` = {ticketStatusData.brandId} and `status` = 1 and `is_ignore` = 0 and room_type = 2' +chatbot_ticket_select_sql = f'select * from `im_room` where `cate_id` = {ticketStatusData.brandId} and `status` = 1 and `is_ignore` = 0 and room_type in (2,3)' all_ticket_num = len(test_env_conn.select_many_value(sql=all_ticket_select_sql)) diff --git a/Utils/req_handler.py b/Utils/req_handler.py index 8ff2dde0fe8f093e3d2880e3bdf1e99427de1b5c..09cfa2cea2a3b6ea396c143aea547ff00c2c7ee6 100644 --- a/Utils/req_handler.py +++ b/Utils/req_handler.py @@ -91,7 +91,8 @@ class ReqHandler: data = case['data'] else: data = {} - headers = {'Authorization' : getattr(global_variate.Global,'access_token'),'User-Agent' : 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36'} #如果没有请求头,默认赋予一个带token的head + auth = getattr(global_variate.Global,'access_token') if 'c端' not in title else getattr(global_variate.Global,'customerToken') + headers = {'Authorization' : auth,'User-Agent' : 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36'} #如果没有请求头,默认赋予一个带token的head if case.get('headers'): headers.update(case['headers']) if method == 'post': @@ -128,8 +129,12 @@ class ReqHandler: raise pymysql.err.InterfaceError except urllib3.exceptions.MaxRetryError: time.sleep(30) #超限时,暂停30秒 + print('接口超限1') + self.send_requests(case,var_class) except requests.exceptions.ConnectionError: time.sleep(30) #超限时,暂停30秒 + print('接口超限2') + self.send_requests(case,var_class) except Exception as e: import traceback print(traceback.print_exc()) diff --git a/Utils/sql_handler.py b/Utils/sql_handler.py index a6a61c9cff6fe79a8787f73c502a229dda37645e..283b1633e98d7582e32fd3f02dbdac9187166c8d 100644 --- a/Utils/sql_handler.py +++ b/Utils/sql_handler.py @@ -9,7 +9,7 @@ class SqlHandler: self.password = password self.account = account self.database = database - self.conn = pymysql.connect(host=address,port=port,user=account,password=password,database=database,cursorclass=pymysql.cursors.DictCursor,connect_timeout=60) + self.conn = pymysql.connect(host=address,port=port,user=account,password=password,database=database,cursorclass=pymysql.cursors.DictCursor,connect_timeout=60,read_timeout=120) self.cursor = self.conn.cursor() def select_one_value(self,sql): diff --git a/Utils/websocket_handler.py b/Utils/websocket_handler.py index b696172749a227520ee07a7ea3ad6969621b6db7..69c46e2640e2f967a6e42a5ba610470abfcb7466 100644 --- a/Utils/websocket_handler.py +++ b/Utils/websocket_handler.py @@ -16,7 +16,7 @@ class ws: self.attr = attr async def get_client_id(self): if not self.websocket: - self.websocket = await websockets.connect(self.url) + self.websocket = await websockets.connect(self.url,open_timeout=60) enter_res = json.loads(await self.websocket.recv()) if enter_res.get('action'): if enter_res['action'] in ['readMsg', 'tipmsg']: diff --git a/YamlCase/automation/ai.yaml b/YamlCase/automation/ai.yaml index c109ef114d1bebc867306e6049153cc0c5cc375f..e6eac21510a46fc32545ccd459ba461b5841a6b8 100644 --- a/YamlCase/automation/ai.yaml +++ b/YamlCase/automation/ai.yaml @@ -1,4 +1,4 @@ -api3: +api1: title: 打开AI开关 url: api/v1/setting/local/updateShopSetting method: post @@ -6,7 +6,7 @@ api3: expected: - eq: {"$.code": 0} -api4: +api2: title: 检查AI开关状态 url: api/v1/setting/local/getShopSetting method: post @@ -16,7 +16,7 @@ api4: - eq: {"$.data.settingInfoMap.mapList['${shopId}'].[?(@.itemId == 202)].itemValue": '1'} - eq: {"$.data.settingInfoMap.mapList['${shopId}'].[?(@.itemId == 203)].itemValue": '1'} -api5: +api3: title: 检查产品接口 url: api/v1/shopify/local/productList method: post @@ -30,7 +30,7 @@ api5: - eq: {"$.data.list[?(@.productId == '${product_id}')].totalQuantity": '${product_quantity}'} - eq: {"$.data.total": "${product_num}"} -api6: +api4: title: 查询已学习的FAQ url: api/v1/willai/local/getKbFaqs method: post @@ -39,7 +39,7 @@ api6: expected: - eq: {"$.code": 0} -api7: +api5: title: 查询已学习到的文档数量 url: api/v1/willai/local/docCount method: post @@ -49,7 +49,7 @@ api7: - eq: {"$.code": 0} - exec: {"code": "assert res.json()['data']['faqCount'] == len(${faq_list})"} -api8: +api6: title: 查询url接口 url: api/v1/willai/local/aiUrlList method: post @@ -58,7 +58,7 @@ api8: expected: - eq: {"$.code": 0} -api9: +api7: title: 新增url url: api/v1/willai/local/addAiUrl method: post @@ -66,7 +66,7 @@ api9: expected: - eq: {"$.code": 0} -api10: +api8: title: 查询url接口 url: api/v1/willai/local/aiUrlList method: post @@ -75,7 +75,7 @@ api10: - eq: {"$.code": 0} - exec: {"code": "assert res.json()['data']['total'] == str(int('${url_num}') + 1)"} -api11: +api9: title: 编辑url url: api/v1/willai/local/editAiUrl method: post @@ -83,7 +83,7 @@ api11: expected: - eq: {"$.code": 0} -api12: +api10: title: 查询url接口 url: api/v1/willai/local/aiUrlList method: post @@ -92,7 +92,7 @@ api12: - eq: {"$.code": 0} - eq: {"$.data.list[?(@.id == '${url_id}')].url": "${edit_url}"} -api13: +api11: title: 刷新url url: api/v1/willai/local/reloadAiUrl method: post @@ -100,7 +100,7 @@ api13: expected: - eq: {"$.code": 0} -api14: +api12: title: 删除url url: api/v1/willai/local/deleteAiUrl method: post @@ -108,7 +108,7 @@ api14: expected: - eq: {"$.code": 0} -api15: +api13: title: 查询url接口 url: api/v1/willai/local/aiUrlList method: post @@ -118,7 +118,7 @@ api15: - not_in_list: {"$.data.list[*].id": "${url_id}"} - exec: {"code": "assert res.json()['data']['total'] == str(${url_num})"} -api16: +api14: title: 查询QA接口 url: api/v1/willai/local/aiQAList method: post @@ -127,7 +127,7 @@ api16: expected: - eq: {"$.code": 0} -api17: +api15: title: 新增QA url: api/v1/willai/local/addAiQa method: post @@ -135,7 +135,7 @@ api17: expected: - eq: {"$.code": 0} -api18: +api16: title: 查询QA接口 url: api/v1/willai/local/aiQAList method: post @@ -145,7 +145,7 @@ api18: - eq: {"$.code": 0} - exec: {"code": "assert res.json()['data']['total'] == str(int('${qa_num}') + 1)"} -api19: +api17: title: 编辑QA url: api/v1/willai/local/modifyAiQa method: post @@ -153,7 +153,7 @@ api19: expected: - eq: {"$.code": 0} -api20: +api18: title: 查询QA接口 url: api/v1/willai/local/aiQAList method: post @@ -163,7 +163,7 @@ api20: - eq: {"$.data.list[?(@.id == '${qa_id}')].question": "${edit_question}"} - eq: {"$.data.list[?(@.id == '${qa_id}')].answer": "${edit_answer}"} -api21: +api19: title: 删除QA url: api/v1/willai/local/deleteAiQa method: post @@ -171,7 +171,7 @@ api21: expected: - eq: {"$.code": 0} -api22: +api20: title: 查询QA接口 url: api/v1/willai/local/aiQAList method: post @@ -180,7 +180,7 @@ api22: - eq: {"$.code": 0} - not_in_list: {"$.data.list[*].id": "${qa_id}"} -api23: +api21: title: 编辑Email和推荐问题开关 url: api/v1/setting/local/updateShopSetting method: post @@ -188,7 +188,7 @@ api23: expected: - eq: {"$.code": 0} -api24: +api22: title: 检查Email和推荐问题开关是否编辑成功 url: api/v1/setting/local/getShopSetting method: post @@ -198,7 +198,7 @@ api24: - eq: {"$.data.settingInfoMap.mapList['${shopId}'].[?(@.itemId == 204)].itemValue": "${new_email}"} - eq: {"$.data.settingInfoMap.mapList['${shopId}'].[?(@.itemId == 205)].itemValue": "0"} -api25: +api23: title: 新增推荐问题 url: api/v1/willai/local/addAiQa method: post @@ -206,7 +206,7 @@ api25: expected: - eq: {"$.code": 0} -api26: +api24: title: 查看推荐问题列表 url: api/v1/willai/local/aiQAList method: post @@ -216,7 +216,7 @@ api26: - eq: {"$.code": 0} - eq: {"$.data.list[?(@.question == '${new_suggest_question}')].answer": "${new_suggest_answer}"} -api27: +api25: title: 编辑推荐问题 url: api/v1/willai/local/modifyAiQa method: post @@ -224,7 +224,7 @@ api27: expected: - eq: {"$.code": 0} -api28: +api26: title: 查看推荐问题列表 url: api/v1/willai/local/aiQAList method: post @@ -234,7 +234,7 @@ api28: - eq: {"$.data.list[?(@.id == '${suggest_qa_id}')].answer": "${edit_suggest_answer}"} - eq: {"$.data.list[?(@.id == '${suggest_qa_id}')].question": "${edit_suggest_question}"} -api29: +api27: title: 删除推荐问题 url: api/v1/willai/local/deleteAiQa method: post @@ -242,7 +242,7 @@ api29: expected: - eq: {"$.code": 0} -api30: +api28: title: 查看推荐问题列表 url: api/v1/willai/local/aiQAList method: post @@ -251,7 +251,7 @@ api30: - eq: {"$.code": 0} - not_in_list: {"$.data.list[*].id": "${suggest_qa_id}"} -api31: +api29: title: AI训练页面聊天 url: api/v1/willai/local/knowledgeTestChat method: post @@ -259,7 +259,7 @@ api31: expected: - eq: {"$.code": 0} -api32: +api30: title: 编辑Email和推荐问题开关 url: api/v1/setting/local/updateShopSetting method: post @@ -267,7 +267,7 @@ api32: expected: - eq: {"$.code": 0} -api33: +api31: title: 检查Email和推荐问题开关是否编辑成功 url: api/v1/setting/local/getShopSetting method: post @@ -277,7 +277,7 @@ api33: - eq: {"$.data.settingInfoMap.mapList['${shopId}'].[?(@.itemId == 204)].itemValue": ""} - eq: {"$.data.settingInfoMap.mapList['${shopId}'].[?(@.itemId == 205)].itemValue": "1"} -api1: +api32: title: 关闭AI开关 url: api/v1/setting/local/updateShopSetting method: post @@ -285,7 +285,7 @@ api1: expected: - eq: {"$.code": 0} -api2: +api33: title: 检查AI开关状态 url: api/v1/setting/local/getShopSetting method: post diff --git a/YamlCase/automation/orderflow.yaml b/YamlCase/automation/orderflow.yaml index 7c322a36818e4e0c7471a0ea60f5a0ecc454ff18..849308e9d5c6bbce1fa330f57cc7f5f9176606cd 100644 --- a/YamlCase/automation/orderflow.yaml +++ b/YamlCase/automation/orderflow.yaml @@ -76,23 +76,23 @@ api8: expected: - eq: {"$.code": 0} -api9: - title: 获取订单列表 - url: /api/v1/order/local/getOrdersByCustomer - method: post - data: {"email":"${email}","shopId":"${shopId}","pageNum":1,"pageSize":20,"v":"${v}"} - before_sql: automation/orderflow/orderflow_order_select.py - expected: - - eq: {"$.code": 0} - - eq: {"$.data.orderList[?(@.orderNumber == '${order_number}')].cancelReason": "${cancel_reason}"} - - eq: {"$.data.orderList[?(@.orderNumber == '${order_number}')].userId": "${order_shop_id}"} - - eq: {"$.data.orderList[?(@.orderNumber == '${order_number}')].trackingNumbers": "${tracking_number}"} - - eq: {"$.data.orderList[?(@.orderNumber == '${order_number}')].totalAmount": "${total_amount}"} - - eq: {"$.data.orderList[?(@.orderNumber == '${order_number}')].shipTo": "${ship_to}"} - - eq: {"$.data.orderList[?(@.orderNumber == '${order_number}')].orderItems": "${order_items}"} - - eq: {"$.data.orderList[?(@.orderNumber == '${order_number}')].financialStatus": "${financial_status}"} - - eq: {"$.data.orderList[?(@.orderNumber == '${order_number}')].orderName": "${order_name}"} - - eq: {"$.data.orderList[?(@.orderNumber == '${order_number}')].currency": "${currency}"} - - eq: {"$.data.orderList[?(@.orderNumber == '${order_number}')].orderId": "${order_id}"} +#api9: +# title: 获取订单列表 +# url: /api/v1/order/local/getOrdersByCustomer +# method: post +# data: {"email":"${email}","shopId":"${shopId}","pageNum":1,"pageSize":20,"v":"${v}"} +# before_sql: automation/orderflow/orderflow_order_select.py +# expected: +# - eq: {"$.code": 0} +# - eq: {"$.data.orderList[?(@.orderNumber == '${order_number}')].cancelReason": "${cancel_reason}"} +# - eq: {"$.data.orderList[?(@.orderNumber == '${order_number}')].userId": "${order_shop_id}"} +# - eq: {"$.data.orderList[?(@.orderNumber == '${order_number}')].trackingNumbers": "${tracking_number}"} +# - eq: {"$.data.orderList[?(@.orderNumber == '${order_number}')].totalAmount": "${total_amount}"} +# - eq: {"$.data.orderList[?(@.orderNumber == '${order_number}')].shipTo": "${ship_to}"} +# - eq: {"$.data.orderList[?(@.orderNumber == '${order_number}')].orderItems": "${order_items}"} +# - eq: {"$.data.orderList[?(@.orderNumber == '${order_number}')].financialStatus": "${financial_status}"} +# - eq: {"$.data.orderList[?(@.orderNumber == '${order_number}')].orderName": "${order_name}"} +# - eq: {"$.data.orderList[?(@.orderNumber == '${order_number}')].currency": "${currency}"} +# - eq: {"$.data.orderList[?(@.orderNumber == '${order_number}')].orderId": "${order_id}"} # - eq: {"$.data.orderList[?(@.orderNumber == '${order_number}')].cancelable": "${cancel_able}"} # - eq: {"$.data.orderList[?(@.orderNumber == '${order_number}')].returnable": "${return_able}"} diff --git a/YamlCase/automation/robot.yaml b/YamlCase/automation/robot.yaml index 6d6d42b0fbef8e516c46c79775827306feb5ca60..bbdd27712e3d991379992bf5f307051a060a7382 100644 --- a/YamlCase/automation/robot.yaml +++ b/YamlCase/automation/robot.yaml @@ -20,7 +20,7 @@ api3: title: 恢复机器人信息 url: /api/v1/autoanswer/updateRobotInfo method: post - data: {"brandId":"${brandId}","robotIcon":"${robot_origin_icon}","robotName":"${robot_origin_name}","v":"${v}"} + data: {"brandId":"${brandId}","robotIcon":"${robot_icon}","robotName":"${robot_origin_name}","v":"${v}"} expected: - eq: {"$.code":0} @@ -31,5 +31,5 @@ api4: expected: - eq: {"$.code":0} - eq: {"$.data.robotName":"${robot_origin_name}"} - - eq: {"$.data.robotIcon":"${robot_origin_icon}"} + - eq: {"$.data.robotIcon":"${robot_icon}"} - eq: {"$.data.brandId":"${brandId}"} diff --git a/YamlCase/billing/buyPlan.yaml b/YamlCase/billing/buyPlan.yaml index 7ace928f452e2de22d0ac5e6d4903c2d3f46fa96..69925b603cd1efe54677f3f6a4f592aa97351b05 100644 --- a/YamlCase/billing/buyPlan.yaml +++ b/YamlCase/billing/buyPlan.yaml @@ -18,7 +18,7 @@ api3: url: /api/v1/businessPlan/buyBasicPlan method: post before_sql: billing/buyPlan_deleteNowPlan.py - data: {"shopId":"${shopId}","planId":"${FreePlanId}","v":"${v}"} + data: {"shopId":"${shopId}","planId":"${FreePlanId}","v":"${v}","openedAi": false} expected: - eq: {"$.code": 0} @@ -50,7 +50,7 @@ api6: title: 购买付费套餐 - 检查是否返回shopify付款链接 url: /api/v1/businessPlan/buyBasicPlan method: post - data: { "shopId": "${shopId}","planId": "${ProPlanId}","v": "${v}" } + data: { "shopId": "${shopId}","planId": "${ProPlanId}","v": "${v}","openedAi": false,"selectedItems":[{"itemId":1,"id":4044},{"itemId":2,"id":4062},{"itemId":6,"id":4323}]} expected: - eq: { "$.code": 0 } - in: { "$.data.confirmationUrl" : "https://zhs-test.myshopify.com/admin/charges/4794771/"}