From d52e1d38d5067771fda3e43b1d737973c87b8c08 Mon Sep 17 00:00:00 2001 From: zhanhuasheng Date: Fri, 29 Mar 2024 18:18:41 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=94=A8=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- TestData/inbox/ticketDetail_test_data.py | 2 +- TestFile/inbox/ticketDetail_select.py | 6 ++ YamlCase/inbox/ticketDetail.yaml | 83 ++++++++++++++++++++++++ main.py | 2 +- 4 files changed, 91 insertions(+), 2 deletions(-) diff --git a/TestData/inbox/ticketDetail_test_data.py b/TestData/inbox/ticketDetail_test_data.py index 3ed2f82..d698a4e 100644 --- a/TestData/inbox/ticketDetail_test_data.py +++ b/TestData/inbox/ticketDetail_test_data.py @@ -1,4 +1,4 @@ from Utils.global_variate import Global class ticketDetailData(Global): - pass \ No newline at end of file + noteMsg = 'test_note' \ No newline at end of file diff --git a/TestFile/inbox/ticketDetail_select.py b/TestFile/inbox/ticketDetail_select.py index 9d444b9..64b86e2 100644 --- a/TestFile/inbox/ticketDetail_select.py +++ b/TestFile/inbox/ticketDetail_select.py @@ -1,3 +1,5 @@ +import random + from Utils.sql_handler import test_env_conn from TestData.inbox.ticketDetail_test_data import ticketDetailData @@ -15,6 +17,7 @@ customer_select_sql = f'select * from `customer` where id = {customer_id}' customer_select_result = test_env_conn.select_one_value(sql=customer_select_sql) customer_time_zone = customer_select_result['time_zone'] customer_location = customer_select_result['location'] +customer_name = customer_select_result['name'] customer_email = customer_select_result['email'] customer_phone = customer_select_result['phone'] customer_is_visitor = customer_select_result['is_visitor'] @@ -25,3 +28,6 @@ setattr(ticketDetailData, 'customer_email', customer_email) setattr(ticketDetailData, 'customer_phone', customer_phone) setattr(ticketDetailData, 'customer_is_visitor', customer_is_visitor) setattr(ticketDetailData, 'customer_last_msg_time', customer_last_msg_time) +setattr(ticketDetailData, 'customer_name', customer_name) + + diff --git a/YamlCase/inbox/ticketDetail.yaml b/YamlCase/inbox/ticketDetail.yaml index 82a26d5..37990fb 100644 --- a/YamlCase/inbox/ticketDetail.yaml +++ b/YamlCase/inbox/ticketDetail.yaml @@ -13,3 +13,86 @@ api1: - eq: {"$.data.isVisitor" : "${customer_is_visitor}"} - eq: {"$.data.customerId" : "${customer_id}"} - eq: {"$.data.lastSeenTime" : "'${customer_last_msg_time}'"} + +api2: + title: 设置笔记注释 + url: /api/v1/note/edit + method: post + data: {"id":0,"uid":"${customer_id}","uType":1,"customerServiceName":"${customer_name}","noteMsg":"${noteMsg}","siteId":"${shopId}","v":"${v}"} + set_value: {"note_id" : "$.data.id"} + expected: + - eq: {"$.code" : 0} + +api3: + title: 检查笔记注释是否设置 + url: /api/v1/note/list + method: post + data: {"uid":"${customer_id}","uType":1,"customerServiceName":"${customer_name}","siteId":"${shopId}","page":1,"pageSize":2,"v":"${v}"} + expected: + - eq: {"$.code" : 0} + - eq: {"$.data.list[0].id" : "${note_id}"} + - eq: {"$.data.list[?(@.id == '${note_id}')].noteMsg" : "${noteMsg}"} + +api4: + title: 删除笔记注释 + url: /api/v1/note/delete + method: post + data: {"id":"${note_id}","v":"${v}"} + expected: + - eq: {"$.code" : 0} + +api5: + title: 检查获取shopify订单的接口是否正常 + url: /api/v1/order/getCustomerOrderList + method: post + data: {"email":"${customer_email}","pageNum":1,"pageSize":2,"shopId":"${shopId}","phone":"${customer_phone}","v":"${v}"} + expected: + - eq: {"$.code" : 0} + +api6: + title: 设置快捷发送为ctrl + enter + url: /api/v1/customerService/updateCustomerServiceAccount + method: post + data: {"id":"${userId}","enterType":2,"v":"${v}"} + expected: + - eq: {"$.code" : 0} + +api7: + title: 检查快捷发送是否设置成功 + url: /api/v1/customerService/getCustomerServiceInfo?v=${v} + method: get + expected: + - eq: {"$.code" : 0} + - eq: {"$.data.enterType" : 2} + +api8: + title: 设置快捷发送为shift + enter + url: /api/v1/customerService/updateCustomerServiceAccount + method: post + data: {"id":"${userId}","enterType":3,"v":"${v}"} + expected: + - eq: {"$.code" : 0} + +api9: + title: 检查快捷发送是否设置成功 + url: /api/v1/customerService/getCustomerServiceInfo?v=${v} + method: get + expected: + - eq: {"$.code" : 0} + - eq: {"$.data.enterType" : 3} + +api10: + title: 设置快捷发送为enter + url: /api/v1/customerService/updateCustomerServiceAccount + method: post + data: {"id":"${userId}","enterType":1,"v":"${v}"} + expected: + - eq: {"$.code" : 0} + +api11: + title: 检查快捷发送是否设置成功 + url: /api/v1/customerService/getCustomerServiceInfo?v=${v} + method: get + expected: + - eq: {"$.code" : 0} + - eq: {"$.data.enterType" : 1} \ No newline at end of file diff --git a/main.py b/main.py index 9c31c9a..9281f4e 100644 --- a/main.py +++ b/main.py @@ -4,7 +4,7 @@ from Utils.sql_handler import test_env_conn if __name__ == '__main__': try: # pytest.main(['-vs',r'C:\Users\rd71\PycharmProjects\willdesk_api_auto\TestCase\inbox\test_06_channel.py',f'--alluredir=./allureReports/json','--clean-alluredir']) - pytest.main(['-vs',r'C:\Users\rd71\PycharmProjects\willdesk_api_auto\TestCase\inbox\test_06_channel.py',f'--html=./report.html']) #allure报告一直生成不了,改用pytest自带报告 + pytest.main(['-vs',r'C:\Users\rd71\PycharmProjects\willdesk_api_auto\TestCase',f'--html=./report.html']) #allure报告一直生成不了,改用pytest自带报告 finally: -- GitLab