From f11a98e5de1e7b7bb4da5004e4d80684c6c72885 Mon Sep 17 00:00:00 2001 From: zhanhuasheng Date: Fri, 19 Apr 2024 16:25:22 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E6=96=B0=E5=A2=9E=E5=A4=B1=E8=B4=A5?= =?UTF-8?q?=E9=87=8D=E8=AF=95=E6=9C=BA=E5=88=B6=202=E3=80=81=E7=94=A8?= =?UTF-8?q?=E4=BE=8B=E6=89=A7=E8=A1=8C=E4=B9=8B=E9=97=B4=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E7=AD=89=E5=BE=85=E6=97=B6=E9=97=B4=EF=BC=8C=E9=81=BF=E5=85=8D?= =?UTF-8?q?=E8=BF=9E=E6=8E=A5=E6=B1=A0=E6=89=93=E6=BB=A1=203=E3=80=81?= =?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 --- Config/base_config.ini | 7 +- TestCase/FAQ/test_01_article_info.py | 1 + TestCase/FAQ/test_02_article_opreate.py | 1 + TestCase/FAQ/test_03_article_page_setting.py | 1 + TestCase/account/test_01_account.py | 2 + TestCase/billing/test_01_buyPlan.py | 1 + TestCase/customer/test_01_customer.py | 1 + TestCase/inbox/test_01_livechat.py | 1 + TestCase/inbox/test_02_ticketStatus.py | 1 + TestCase/inbox/test_03_ticketOpreate.py | 1 + TestCase/inbox/test_04_ticketInfo.py | 1 + TestCase/inbox/test_05_team.py | 1 + TestCase/inbox/test_06_channel.py | 1 + TestCase/inbox/test_07_ticketDetail.py | 1 + TestCase/report/test_01_report.py | 1 + TestCase/setting/test_01_emailIntegration.py | 2 + .../setting/test_02_whatsappIntegration.py | 1 + TestCase/setting/test_04_widgetSetting.py | 14 ++ TestData/setting/widget_setting_test_data.py | 66 ++++++++ .../emailIntegration_select.py | 4 +- Utils/global_variate.py | 5 +- Utils/req_handler.py | 1 + Utils/webhook_handler.py | 11 +- YamlCase/setting/widgetSetting.yaml | 141 ++++++++++++++++++ main.py | 5 +- 25 files changed, 262 insertions(+), 10 deletions(-) create mode 100644 TestCase/setting/test_04_widgetSetting.py create mode 100644 TestData/setting/widget_setting_test_data.py create mode 100644 YamlCase/setting/widgetSetting.yaml diff --git a/Config/base_config.ini b/Config/base_config.ini index 2cea0b4..1089f6b 100644 --- a/Config/base_config.ini +++ b/Config/base_config.ini @@ -33,4 +33,9 @@ port = 3306 account = willdesk #密码 -password = uitSElgrwLp6vFG \ No newline at end of file +password = uitSElgrwLp6vFG + +[rerun] +rerun = 1 + +rerun_delay = 3 \ No newline at end of file diff --git a/TestCase/FAQ/test_01_article_info.py b/TestCase/FAQ/test_01_article_info.py index d65f7da..188286e 100644 --- a/TestCase/FAQ/test_01_article_info.py +++ b/TestCase/FAQ/test_01_article_info.py @@ -7,6 +7,7 @@ class TestFAQ: yaml_path = r'FAQ\article_info.yaml' yaml_data = yaml_handler.yaml_handler.get_case(yaml_path) + @pytest.mark.flaky(reruns=articleInfoTestData.rerun, reruns_delay=articleInfoTestData.rerun_delay) @pytest.mark.parametrize('case',yaml_data) def test_article(self,case): req_handler.ReqHandler.send_requests(case=case,var_class=articleInfoTestData) diff --git a/TestCase/FAQ/test_02_article_opreate.py b/TestCase/FAQ/test_02_article_opreate.py index 5cae771..71a7d2d 100644 --- a/TestCase/FAQ/test_02_article_opreate.py +++ b/TestCase/FAQ/test_02_article_opreate.py @@ -7,6 +7,7 @@ class TestArticleOpreate: yaml_path = r'FAQ\article_opreate.yaml' yaml_data = yaml_handler.yaml_handler.get_case(yaml_path) + @pytest.mark.flaky(reruns=articleOperateTestData.rerun, reruns_delay=articleOperateTestData.rerun_delay) @pytest.mark.parametrize('case',yaml_data) def test_article_opreate(self,case): req_handler.ReqHandler.send_requests(case=case,var_class=articleOperateTestData) diff --git a/TestCase/FAQ/test_03_article_page_setting.py b/TestCase/FAQ/test_03_article_page_setting.py index 582059a..d0ed64a 100644 --- a/TestCase/FAQ/test_03_article_page_setting.py +++ b/TestCase/FAQ/test_03_article_page_setting.py @@ -7,6 +7,7 @@ class TestArticleOpreate: yaml_path = r'FAQ\article_page_setting.yaml' yaml_data = yaml_handler.yaml_handler.get_case(yaml_path) + @pytest.mark.flaky(reruns=articlePageSettingTestData.rerun, reruns_delay=articlePageSettingTestData.rerun_delay) @pytest.mark.parametrize('case',yaml_data) def test_article_page_setting(self,case): req_handler.ReqHandler.send_requests(case=case,var_class=articlePageSettingTestData) diff --git a/TestCase/account/test_01_account.py b/TestCase/account/test_01_account.py index f76135d..98d9db7 100644 --- a/TestCase/account/test_01_account.py +++ b/TestCase/account/test_01_account.py @@ -1,12 +1,14 @@ import pytest from Utils import yaml_handler from Utils import req_handler +from Utils.config_handler import configHandler from TestData.account.account_test_data import accountData class TestAccount: yaml_path = r'account/account.yaml' yaml_data = yaml_handler.yaml_handler.get_case(yaml_path) + @pytest.mark.flaky(reruns=accountData.rerun, reruns_delay=accountData.rerun_delay) @pytest.mark.parametrize('case',yaml_data) def test_account(self,case): req_handler.ReqHandler.send_requests(case=case,var_class=accountData) diff --git a/TestCase/billing/test_01_buyPlan.py b/TestCase/billing/test_01_buyPlan.py index c785471..f5ca44a 100644 --- a/TestCase/billing/test_01_buyPlan.py +++ b/TestCase/billing/test_01_buyPlan.py @@ -7,6 +7,7 @@ class TestBuyPlan: yaml_path = r'billing\buyPlan.yaml' yaml_data = yaml_handler.yaml_handler.get_case(yaml_path) + @pytest.mark.flaky(reruns=buyPlanData.rerun, reruns_delay=buyPlanData.rerun_delay) @pytest.mark.parametrize('case',yaml_data) def test_buy_plan(self,case): req_handler.ReqHandler.send_requests(case=case,var_class=buyPlanData) diff --git a/TestCase/customer/test_01_customer.py b/TestCase/customer/test_01_customer.py index c7c3eae..ba46b17 100644 --- a/TestCase/customer/test_01_customer.py +++ b/TestCase/customer/test_01_customer.py @@ -7,6 +7,7 @@ class TestCustomer: yaml_path = r'customer\customer.yaml' yaml_data = yaml_handler.yaml_handler.get_case(yaml_path) + @pytest.mark.flaky(reruns=customerData.rerun, reruns_delay=customerData.rerun_delay) @pytest.mark.parametrize('case',yaml_data) def test_customer(self,case): req_handler.ReqHandler.send_requests(case=case,var_class=customerData) diff --git a/TestCase/inbox/test_01_livechat.py b/TestCase/inbox/test_01_livechat.py index af16f9f..eff3386 100644 --- a/TestCase/inbox/test_01_livechat.py +++ b/TestCase/inbox/test_01_livechat.py @@ -7,6 +7,7 @@ class TestLivechat: yaml_path = r'inbox\livechat.yaml' yaml_data = yaml_handler.yaml_handler.get_case(yaml_path) + @pytest.mark.flaky(reruns=livechatData.rerun, reruns_delay=livechatData.rerun_delay) @pytest.mark.parametrize('case',yaml_data) def test_livechat(self,case): req_handler.ReqHandler.send_requests(case=case,var_class=livechatData) diff --git a/TestCase/inbox/test_02_ticketStatus.py b/TestCase/inbox/test_02_ticketStatus.py index d77b4a2..b04e22d 100644 --- a/TestCase/inbox/test_02_ticketStatus.py +++ b/TestCase/inbox/test_02_ticketStatus.py @@ -7,6 +7,7 @@ class TestTicketStatus: yaml_path = r'inbox\ticketStatus.yaml' yaml_data = yaml_handler.yaml_handler.get_case(yaml_path) + @pytest.mark.flaky(reruns=ticketStatusData.rerun, reruns_delay=ticketStatusData.rerun_delay) @pytest.mark.parametrize('case',yaml_data) def test_ticketStatus(self,case): print(case) diff --git a/TestCase/inbox/test_03_ticketOpreate.py b/TestCase/inbox/test_03_ticketOpreate.py index d55a637..f3870a0 100644 --- a/TestCase/inbox/test_03_ticketOpreate.py +++ b/TestCase/inbox/test_03_ticketOpreate.py @@ -11,6 +11,7 @@ class TestTicketOpreate: yaml_path = r'inbox\ticketOpreate.yaml' yaml_data = yaml_handler.yaml_handler.get_case(yaml_path) + @pytest.mark.flaky(reruns=ticketStatusData.rerun, reruns_delay=ticketStatusData.rerun_delay) @pytest.mark.parametrize('case',yaml_data) def test_ticketOpreate(self,case): print(case) diff --git a/TestCase/inbox/test_04_ticketInfo.py b/TestCase/inbox/test_04_ticketInfo.py index 6159be5..d1226d0 100644 --- a/TestCase/inbox/test_04_ticketInfo.py +++ b/TestCase/inbox/test_04_ticketInfo.py @@ -7,6 +7,7 @@ class TestTicketInfo: yaml_path = r'inbox\ticketInfo.yaml' yaml_data = yaml_handler.yaml_handler.get_case(yaml_path) + @pytest.mark.flaky(reruns=ticketInfoData.rerun, reruns_delay=ticketInfoData.rerun_delay) @pytest.mark.parametrize('case',yaml_data) def test_ticketInfo(self,case): print(case) diff --git a/TestCase/inbox/test_05_team.py b/TestCase/inbox/test_05_team.py index 8ed5844..94a2e7a 100644 --- a/TestCase/inbox/test_05_team.py +++ b/TestCase/inbox/test_05_team.py @@ -7,6 +7,7 @@ class TestTeam: yaml_path = r'inbox\team.yaml' yaml_data = yaml_handler.yaml_handler.get_case(yaml_path) + @pytest.mark.flaky(reruns=teamData.rerun, reruns_delay=teamData.rerun_delay) @pytest.mark.parametrize('case',yaml_data) def test_team(self,case): print(case) diff --git a/TestCase/inbox/test_06_channel.py b/TestCase/inbox/test_06_channel.py index 14c8758..4ccd24e 100644 --- a/TestCase/inbox/test_06_channel.py +++ b/TestCase/inbox/test_06_channel.py @@ -7,6 +7,7 @@ class TestChannel: yaml_path = r'inbox\channel.yaml' yaml_data = yaml_handler.yaml_handler.get_case(yaml_path) + @pytest.mark.flaky(reruns=channelData.rerun, reruns_delay=channelData.rerun_delay) @pytest.mark.parametrize('case',yaml_data) def test_channel(self,case): print(case) diff --git a/TestCase/inbox/test_07_ticketDetail.py b/TestCase/inbox/test_07_ticketDetail.py index f38f36e..68a3de0 100644 --- a/TestCase/inbox/test_07_ticketDetail.py +++ b/TestCase/inbox/test_07_ticketDetail.py @@ -7,6 +7,7 @@ class TestTiocketDetail: yaml_path = r'inbox\ticketDetail.yaml' yaml_data = yaml_handler.yaml_handler.get_case(yaml_path) + @pytest.mark.flaky(reruns=ticketDetailData.rerun, reruns_delay=ticketDetailData.rerun_delay) @pytest.mark.parametrize('case',yaml_data) def test_ticketDetail(self,case): print(case) diff --git a/TestCase/report/test_01_report.py b/TestCase/report/test_01_report.py index 91d8fb4..fd264d5 100644 --- a/TestCase/report/test_01_report.py +++ b/TestCase/report/test_01_report.py @@ -7,6 +7,7 @@ class TestReport: yaml_path = r'report/report.yaml' yaml_data = yaml_handler.yaml_handler.get_case(yaml_path) + @pytest.mark.flaky(reruns=reportData.rerun, reruns_delay=reportData.rerun_delay) @pytest.mark.parametrize('case',yaml_data) def test_report(self,case): req_handler.ReqHandler.send_requests(case=case,var_class=reportData) diff --git a/TestCase/setting/test_01_emailIntegration.py b/TestCase/setting/test_01_emailIntegration.py index c2336ec..dc49148 100644 --- a/TestCase/setting/test_01_emailIntegration.py +++ b/TestCase/setting/test_01_emailIntegration.py @@ -7,6 +7,8 @@ class TestEmailIntegration: yaml_path = r'setting\emailIntegration.yaml' yaml_data = yaml_handler.yaml_handler.get_case(yaml_path) + + @pytest.mark.flaky(reruns=emailIntegrationData.rerun, reruns_delay=emailIntegrationData.rerun_delay) @pytest.mark.parametrize('case',yaml_data) def test_emailIntegration(self,case): print(case) diff --git a/TestCase/setting/test_02_whatsappIntegration.py b/TestCase/setting/test_02_whatsappIntegration.py index 1a76ce2..2106a2e 100644 --- a/TestCase/setting/test_02_whatsappIntegration.py +++ b/TestCase/setting/test_02_whatsappIntegration.py @@ -7,6 +7,7 @@ class TestWhatsappIntegration: yaml_path = r'setting\whatsappIntegration.yaml' yaml_data = yaml_handler.yaml_handler.get_case(yaml_path) + @pytest.mark.flaky(reruns=whatsappIntegrationData.rerun, reruns_delay=whatsappIntegrationData.rerun_delay) @pytest.mark.parametrize('case',yaml_data) def test_whatsappIntegration(self,case): print(case) diff --git a/TestCase/setting/test_04_widgetSetting.py b/TestCase/setting/test_04_widgetSetting.py new file mode 100644 index 0000000..17ffe61 --- /dev/null +++ b/TestCase/setting/test_04_widgetSetting.py @@ -0,0 +1,14 @@ +import pytest +from Utils import yaml_handler +from Utils import req_handler +from TestData.setting.widget_setting_test_data import widgetSettingData + +class TestWidgetSetting: + + yaml_path = r'setting\widgetSetting.yaml' + yaml_data = yaml_handler.yaml_handler.get_case(yaml_path) + @pytest.mark.flaky(reruns=widgetSettingData.rerun, reruns_delay=widgetSettingData.rerun_delay) + @pytest.mark.parametrize('case',yaml_data) + def test_widgetSetting(self,case): + print(case) + req_handler.ReqHandler.send_requests(case=case,var_class=widgetSettingData) diff --git a/TestData/setting/widget_setting_test_data.py b/TestData/setting/widget_setting_test_data.py new file mode 100644 index 0000000..e593163 --- /dev/null +++ b/TestData/setting/widget_setting_test_data.py @@ -0,0 +1,66 @@ +from Utils.global_variate import Global + +class widgetSettingData(Global): + enable = "1" + disable = "0" + whatsapp_phone = '8613699807045' + origin_whatsapp_phone = '' + order_track_day_7 = '7' + order_track_day_14 = '14' + order_track_day_60 = '60' + order_track_day_30 = '30' + random_avatar = "{\"showType\":2,\"buserIdList\":[${userId}]}" + hide_avatar = "{\"showType\":1,\"buserIdList\":[${userId}]}" + appoint_avatar = "{\"showType\":3,\"buserIdList\":[${userId}]}" + origin_greeting_word = 'Hi {first_name} 👋' + greeting_word = 'autotest_greeting_word' + origin_team_introduction = 'Contact us or find help articles for support' + team_introduction = 'autotest_team_introduction' + origin_posting_title = 'Welcome to {website name} 😊' + posting_title = 'autotest_posting_title' + origin_posting_content = 'Hey {first_name} 😊We‘re so glad you’re here, let us know if you have any questions.' + posting_content = 'autotest_posting_content' + origin_posting_button_content = 'Message Us' + posting_button_content = 'autotest_posting_button_content' + origin_font_style = 'Inter' + font_style = 'Auton' + origin_background_color = '#2C23E5' + background_color = '#FF4243' + black_font = 'Dark' + white_font = 'Light' + widget_left = 'Left' + widget_right = 'Right' + origin_spacing_px = '50' + side_spacing_px = '500' + bottom_spacing_px = '600' + origin_widget_type = 'buttonType' + widget_type = 'textOnly' + widget_font = 'autotest_widget_font' + origin_widget_font = 'Help' + widget_small = 'small' + widget_medium = 'medium' + widget_large = 'large' + origin_business_time = '' + business_time_range = 'Everyday' + business_time_start = '15:51' + business_time_end = '19:56' + business_time_zone = '(GMT+09:00) Asia/Seoul' + origin_business_time_zone = '(GMT+08:00) Asia/Shanghai' + origin_reply_time_word = 'Our usual reply time' + origin_chatwelcome_message = '{\"one\":\"Thanks for chatting with us! We usually reply to you here or via email.\",\"two\":\"Our usual reply time\",\"three\":\"a few minutes\"}' + chatwelcome_message = '{\"one\":\"Thanks for chatting with us! We usually reply to you here or via email.\",\"two\":\"autotest_reply_time_word\",\"three\":\"autotest_chat_welcome_word\"}' + origin_waiting_time_message = '{\"one\":\"抱歉,我们暂时不在线。如果您有任何问题,请留言或尝试以下方法解决问题。\",\"two\":\"我们将返回\"}' + waiting_time_message = '{\"one\":\"抱歉,我们暂时不在线。如果您有任何问题,请留言或尝试以下方法解决问题。\",\"two\":\"autotest_waiting_time_message\"}' + origin_waiting_time = 'autotest_waiting_time' + waiting_time = '{Waitingtime}' + back_time_word = 'autotest_back_time_word' + wait_time_word = 'autotest_wait_time_word' + visiable_all_time = 'all' + visiable_business_time = 'business' + widget_show_desktop = 'desktop' + widget_show_mobile = 'mobile' + widget_show_all = 'all' + visiable_url = '[{\"type\":\"0\",\"url\":\"${shopDomain}\"}]' + widget_show_special_page = 'show' + widget_hide_special_page = 'hide' + widget_show_all_page = 'all' \ No newline at end of file diff --git a/TestFile/setting/emailIntegration/emailIntegration_select.py b/TestFile/setting/emailIntegration/emailIntegration_select.py index 872ec4c..9ec9944 100644 --- a/TestFile/setting/emailIntegration/emailIntegration_select.py +++ b/TestFile/setting/emailIntegration/emailIntegration_select.py @@ -21,7 +21,9 @@ else: email_select_sql = f'select * from `email_config` where brand_id = {emailIntegrationData.brandId} and email = "{email_address}"' email_select_result = test_env_conn.select_one_value(sql=email_select_sql) email_id = email_select_result['id'] - email_num = 1 + email_select_sql = f'select * from `email_config` where brand_id = {emailIntegrationData.brandId}' + email_select_result = test_env_conn.select_many_value(sql=email_select_sql) + email_num = len(email_select_result) setattr(emailIntegrationData, 'email_id', email_id) setattr(emailIntegrationData, 'email_address', email_address) diff --git a/Utils/global_variate.py b/Utils/global_variate.py index c68324c..66a6f73 100644 --- a/Utils/global_variate.py +++ b/Utils/global_variate.py @@ -1,6 +1,9 @@ - +from Utils import config_handler class Global: ''' 公用变量类,所有的子变量类继承该类,存取公用变量,公用变量类默认存token等基础信息 ''' + rerun = int(config_handler.base_config.get_value('rerun','rerun')) + rerun_delay = int(config_handler.base_config.get_value('rerun','rerun_delay')) + diff --git a/Utils/req_handler.py b/Utils/req_handler.py index 5fab85b..ac37046 100644 --- a/Utils/req_handler.py +++ b/Utils/req_handler.py @@ -66,6 +66,7 @@ class ReqHandler: if case.get('sleep'): time.sleep(float(case['sleep'])) return 1 + time.sleep(1) #https请求延时1秒,避免打满连接池 url = case['url'] if 'http' in case['url'] else config_handler.base_config.get_value('url','test_address') + case['url'] #判断是否有域名,没有的话给config文件中的默认测试域名 method = case['method'] expected = case['expected'] diff --git a/Utils/webhook_handler.py b/Utils/webhook_handler.py index db213b9..81bc515 100644 --- a/Utils/webhook_handler.py +++ b/Utils/webhook_handler.py @@ -33,13 +33,14 @@ class webhookHandler: }, } res = requests.post(url=self.webhookUrl,json=data) - print(res.json()) + # print(res.json()) - def sendMsg(self,text,msgtype): + def sendMsg(self,title,text): data = { - "msgtype": msgtype, - "text": { - "content": text + "msgtype": 'markdown', + "markdown": { + "title": title, + "text": text } } res = requests.post(url=self.webhookUrl,data=data) diff --git a/YamlCase/setting/widgetSetting.yaml b/YamlCase/setting/widgetSetting.yaml new file mode 100644 index 0000000..eb6f6bd --- /dev/null +++ b/YamlCase/setting/widgetSetting.yaml @@ -0,0 +1,141 @@ +api1: + title: 更改挂件设置 + url: /api/v1/setting/updateShopSetting + method: post + data: {"item":[{"shopId":"${shopId}","itemId":71,"itemValue":"${disable}","itemName":"mainSwitch"},{"shopId":"${shopId}","itemId":37,"itemValue":"${disable}","itemName":"enableLiveChat"},{"shopId":"${shopId}","itemId":39,"itemValue":"${disable}","itemName":"whatsApp"},{"shopId":"${shopId}","itemId":38,"itemValue":"${disable}","itemName":"displayContactForm"},{"shopId":"${shopId}","itemId":42,"itemValue":"${disable}","itemName":"orderTrack"},{"shopId":"${shopId}","itemId":49,"itemValue":"${disable}","itemName":"showFaq"},{"shopId":"${shopId}","itemId":183,"itemValue":"${appoint_avatar}","itemName":"agentAvatarSettings"},{"shopId":"${shopId}","itemId":56,"itemValue":"${greeting_word}","itemName":"welcomeGreetings"},{"shopId":"${shopId}","itemId":57,"itemValue":"${team_introduction}","itemName":"welcomeIntroduction"},{"shopId":"${shopId}","itemId":59,"itemValue":"${disable}","itemName":"welcomeDisplay"},{"shopId":"${shopId}","itemId":52,"itemValue":"${black_font}","itemName":"textColor"},{"shopId":"${shopId}","itemId":53,"itemValue":"${widget_left}","itemName":"launcherPosition"},{"shopId":"${shopId}","itemId":94,"itemValue":"${font_style}","itemName":"fontStyle"},{"shopId":"${shopId}","itemId":50,"itemValue":"${background_color}","itemName":"primaryColor"},{"shopId":"${shopId}","itemId":60,"itemValue":"${posting_title}","itemName":"welcomeTitle"},{"shopId":"${shopId}","itemId":61,"itemValue":"${posting_content}","itemName":"welcomeContent"},{"shopId":"${shopId}","itemId":93,"itemValue":"${posting_button_content}","itemName":"welcomeMessageUs"},{"shopId":"${shopId}","itemId":54,"itemValue":"${side_spacing_px}","itemName":"sideSpacing"},{"shopId":"${shopId}","itemId":55,"itemValue":"${bottom_spacing_px}","itemName":"bottomSpacing"},{"shopId":"${shopId}","itemId":58,"itemValue":"${widget_font}","itemName":"welcomeCTA"},{"shopId":"${shopId}","itemId":113,"itemValue":"${widget_type}","itemName":"buttonType"},{"shopId":"${shopId}","itemId":116,"itemValue":"${widget_medium}","itemName":"iconSize"},{"shopId":"${shopId}","itemId":66,"itemValue":"${business_time_zone}","itemName":"businessTimeZone"},{"shopId":"${shopId}","itemId":73,"itemValue":"${chatwelcome_message}","itemName":"chatWelcomeMsg"},{"shopId":"${shopId}","itemId":69,"itemValue":"${disable}","itemName":"visitorDataName"},{"shopId":"${shopId}","itemId":63,"itemValue":"${business_time_range}","itemName":"businessTimeRange"},{"shopId":"${shopId}","itemId":64,"itemValue":"${business_time_start}","itemName":"businessTimeStart"},{"shopId":"${shopId}","itemId":65,"itemValue":"${business_time_end}","itemName":"businessTimeEnd"},{"shopId":"${shopId}","itemId":70,"itemValue":"${disable}","itemName":"visitorDataEmail"},{"shopId":"${shopId}","itemId":83,"itemValue":"${disable}","itemName":"visitorDataPhone"},{"shopId":"${shopId}","itemId":68,"itemValue":"${disable}","itemName":"visitorDataCollection"},{"shopId":"${shopId}","itemId":106,"itemValue":"${visiable_business_time}","itemName":"visibilityTime"},{"shopId":"${shopId}","itemId":107,"itemValue":"${widget_show_desktop}","itemName":"visibilityDevices"},{"shopId":"${shopId}","itemId":108,"itemValue":"${widget_show_special_page}","itemName":"visibilityPageSetting"},{"shopId":"${shopId}","itemId":109,"itemValue":"${visiable_url}"},{"shopId":"${shopId}","itemId":82,"itemValue":"${order_track_day_14}","itemName":"trackDays"},{"shopId":"${shopId}","itemId":74,"itemValue":"${waiting_time_message}","itemName":"chatNonworkMsg"},{"shopId":"${shopId}","itemId":168,"itemValue":"${waiting_time}","itemName":"chatNonworkMsgTime"}],"v":"${v}"} + expected: + - eq: {"$.code" : 0} + +api2: + title: 检查设置是否成功 + url: /api/v1/setting/getCShopSetting?domain=${shopDomain} + method: get + expected: + - eq: {"$.code" : 0} + - eq: {"$.data.settingInfo[?(@.itemId == 71)].itemValue" : "${disable}"} + - eq: {"$.data.settingInfo[?(@.itemId == 37)].itemValue" : "${disable}"} + - eq: {"$.data.settingInfo[?(@.itemId == 39)].itemValue" : "${disable}"} + - eq: {"$.data.settingInfo[?(@.itemId == 38)].itemValue" : "${disable}"} + - eq: {"$.data.settingInfo[?(@.itemId == 42)].itemValue" : "${disable}"} + - eq: {"$.data.settingInfo[?(@.itemId == 49)].itemValue" : "${disable}"} + - eq: {"$.data.settingInfo[?(@.itemId == 183)].itemValue" : "${appoint_avatar}"} + - eq: {"$.data.settingInfo[?(@.itemId == 56)].itemValue" : "${greeting_word}"} + - eq: {"$.data.settingInfo[?(@.itemId == 57)].itemValue" : "${team_introduction}"} + - eq: {"$.data.settingInfo[?(@.itemId == 59)].itemValue" : "${disable}"} + - eq: {"$.data.settingInfo[?(@.itemId == 52)].itemValue" : "${black_font}"} + - eq: {"$.data.settingInfo[?(@.itemId == 53)].itemValue" : "${widget_left}"} + - eq: {"$.data.settingInfo[?(@.itemId == 94)].itemValue" : "${font_style}"} + - eq: {"$.data.settingInfo[?(@.itemId == 50)].itemValue" : "${background_color}"} + - eq: {"$.data.settingInfo[?(@.itemId == 60)].itemValue" : "${posting_title}"} + - eq: {"$.data.settingInfo[?(@.itemId == 61)].itemValue" : "${posting_content}"} + - eq: {"$.data.settingInfo[?(@.itemId == 54)].itemValue" : "${side_spacing_px}"} + - eq: {"$.data.settingInfo[?(@.itemId == 55)].itemValue" : "${bottom_spacing_px}"} + - eq: {"$.data.settingInfo[?(@.itemId == 58)].itemValue" : "${widget_font}"} + - eq: {"$.data.settingInfo[?(@.itemId == 113)].itemValue" : "${widget_type}"} + - eq: {"$.data.settingInfo[?(@.itemId == 116)].itemValue" : "${widget_medium}"} + - eq: {"$.data.settingInfo[?(@.itemId == 66)].itemValue" : "${business_time_zone}"} + - eq: {"$.data.settingInfo[?(@.itemId == 73)].itemValue" : "${chatwelcome_message}"} + - eq: {"$.data.settingInfo[?(@.itemId == 69)].itemValue" : "${disable}"} + - eq: {"$.data.settingInfo[?(@.itemId == 63)].itemValue" : "${business_time_range}"} + - eq: {"$.data.settingInfo[?(@.itemId == 64)].itemValue" : "${business_time_start}"} + - eq: {"$.data.settingInfo[?(@.itemId == 65)].itemValue" : "${business_time_end}"} + - eq: {"$.data.settingInfo[?(@.itemId == 70)].itemValue" : "${disable}"} + - eq: {"$.data.settingInfo[?(@.itemId == 83)].itemValue" : "${disable}"} + - eq: {"$.data.settingInfo[?(@.itemId == 68)].itemValue" : "${disable}"} + - eq: {"$.data.settingInfo[?(@.itemId == 106)].itemValue" : "${visiable_business_time}"} + - eq: {"$.data.settingInfo[?(@.itemId == 107)].itemValue" : "${widget_show_desktop}"} + - eq: {"$.data.settingInfo[?(@.itemId == 108)].itemValue" : "${widget_show_special_page}"} + - eq: {"$.data.settingInfo[?(@.itemId == 109)].itemValue" : "${visiable_url}"} + - eq: {"$.data.settingInfo[?(@.itemId == 82)].itemValue" : "${order_track_day_14}"} + - eq: {"$.data.settingInfo[?(@.itemId == 74)].itemValue" : "${waiting_time_message}"} + - eq: {"$.data.settingInfo[?(@.itemId == 168)].itemValue" : "${waiting_time}"} + +api3: + title: 更改挂件设置 + url: /api/v1/setting/updateShopSetting + method: post + data: {"item":[{"shopId":"${shopId}","itemId":183,"itemValue":"${hide_avatar}","itemName":"agentAvatarSettings"},{"shopId":"${shopId}","itemId":40,"itemValue":"${whatsapp_phone}","itemName":"contactNumber"},{"shopId":"${shopId}","itemId":82,"itemValue":"${order_track_day_60}","itemName":"trackDays"},{"shopId":"${shopId}","itemId":116,"itemValue":"${widget_small}","itemName":"iconSize"},{"shopId":"${shopId}","itemId":107,"itemValue":"${widget_show_mobile}","itemName":"visibilityDevices"},{"shopId":"${shopId}","itemId":108,"itemValue":"${widget_hide_special_page}","itemName":"visibilityPageSetting"}],"v": "${v}" } + expected: + - eq: {"$.code": 0 } + +api4: + title: 检查设置是否成功 + url: /api/v1/setting/getCShopSetting?domain=${shopDomain} + method: get + expected: + - eq: {"$.code" : 0} + - eq: {"$.data.settingInfo[?(@.itemId == 183)].itemValue": "${hide_avatar}"} + - eq: {"$.data.settingInfo[?(@.itemId == 40)].itemValue": "${whatsapp_phone}"} + - eq: {"$.data.settingInfo[?(@.itemId == 82)].itemValue": "${order_track_day_60}"} + - eq: {"$.data.settingInfo[?(@.itemId == 116)].itemValue": "${widget_small}"} + - eq: {"$.data.settingInfo[?(@.itemId == 107)].itemValue": "${widget_show_mobile}"} + - eq: {"$.data.settingInfo[?(@.itemId == 108)].itemValue": "${widget_hide_special_page}"} + +api5: + title: 更改挂件设置 + url: /api/v1/setting/updateShopSetting + method: post + data: {"item":[{"shopId":"${shopId}","itemId":82,"itemValue":"${order_track_day_7}","itemName":"trackDays"}],"v": "${v}" } + expected: + - eq: {"$.code": 0 } + +api6: + title: 检查设置是否成功 + url: /api/v1/setting/getCShopSetting?domain=${shopDomain} + method: get + expected: + - eq: {"$.code" : 0} + - eq: {"$.data.settingInfo[?(@.itemId == 82)].itemValue": "${order_track_day_7}"} + +api7: + title: 还原挂件设置 + url: /api/v1/setting/updateShopSetting + method: post + data: {"item":[{"shopId":"${shopId}","itemId":71,"itemValue":"${enable}","itemName":"mainSwitch"},{"shopId":"${shopId}","itemId":37,"itemValue":"${enable}","itemName":"enableLiveChat"},{"shopId":"${shopId}","itemId":39,"itemValue":"${enable}","itemName":"whatsApp"},{"shopId":"${shopId}","itemId":38,"itemValue":"${enable}","itemName":"displayContactForm"},{"shopId":"${shopId}","itemId":42,"itemValue":"${enable}","itemName":"orderTrack"},{"shopId":"${shopId}","itemId":49,"itemValue":"${enable}","itemName":"showFaq"},{"shopId":"${shopId}","itemId":183,"itemValue":"${random_avatar}","itemName":"agentAvatarSettings"},{"shopId":"${shopId}","itemId":56,"itemValue":"${origin_greeting_word}","itemName":"welcomeGreetings"},{"shopId":"${shopId}","itemId":57,"itemValue":"${origin_team_introduction}","itemName":"welcomeIntroduction"},{"shopId":"${shopId}","itemId":60,"itemValue":"${origin_posting_title}","itemName":"welcomeTitle"},{"shopId":"${shopId}","itemId":59,"itemValue":"${enable}","itemName":"welcomeDisplay"},{"shopId":"${shopId}","itemId":61,"itemValue":"${origin_posting_content}","itemName":"welcomeContent"},{"shopId":"${shopId}","itemId":93,"itemValue":"${origin_posting_button_content}","itemName":"welcomeMessageUs"},{"shopId":"${shopId}","itemId":50,"itemValue":"${origin_background_color}","itemName":"primaryColor"},{"shopId":"${shopId}","itemId":94,"itemValue":"${origin_font_style}","itemName":"fontStyle"},{"shopId":"${shopId}","itemId":52,"itemValue":"${white_font}","itemName":"textColor"},{"shopId":"${shopId}","itemId":53,"itemValue":"${widget_right}","itemName":"launcherPosition"},{"shopId":"${shopId}","itemId":54,"itemValue":"${origin_spacing_px}","itemName":"sideSpacing"},{"shopId":"${shopId}","itemId":55,"itemValue":"${origin_spacing_px}","itemName":"bottomSpacing"},{"shopId":"${shopId}","itemId":113,"itemValue":"${origin_widget_type}","itemName":"buttonType"},{"shopId":"${shopId}","itemId":58,"itemValue":"${origin_widget_font}","itemName":"welcomeCTA"},{"shopId":"${shopId}","itemId":116,"itemValue":"${widget_large}","itemName":"iconSize"},{"shopId":"${shopId}","itemId":66,"itemValue":"${origin_business_time_zone}","itemName":"businessTimeZone"},{"shopId":"${shopId}","itemId":73,"itemValue":"${origin_chatwelcome_message}","itemName":"chatWelcomeMsg"},{"shopId":"${shopId}","itemId":63,"itemValue":"${origin_business_time}","itemName":"businessTimeRange"},{"shopId":"${shopId}","itemId":64,"itemValue":"${origin_business_time}","itemName":"businessTimeStart"},{"shopId":"${shopId}","itemId":65,"itemValue":"${origin_business_time}","itemName":"businessTimeEnd"},{"shopId":"${shopId}","itemId":69,"itemValue":"${enable}","itemName":"visitorDataName"},{"shopId":"${shopId}","itemId":70,"itemValue":"${enable}","itemName":"visitorDataEmail"},{"shopId":"${shopId}","itemId":83,"itemValue":"${enable}","itemName":"visitorDataPhone"},{"shopId":"${shopId}","itemId":68,"itemValue":"${enable}","itemName":"visitorDataCollection"},{"shopId":"${shopId}","itemId":106,"itemValue":"${visiable_all_time}","itemName":"visibilityTime"},{"shopId":"${shopId}","itemId":107,"itemValue":"${widget_show_all}","itemName":"visibilityDevices"},{"shopId":"${shopId}","itemId":108,"itemValue":"${widget_show_all_page}","itemName":"visibilityPageSetting"},{"shopId":"${shopId}","itemId":82,"itemValue":"${order_track_day_30}","itemName":"trackDays"},{"shopId":"${shopId}","itemId":74,"itemValue":"${origin_waiting_time_message}","itemName":"chatNonworkMsg"},{"shopId":"${shopId}","itemId":168,"itemValue":"${origin_waiting_time}","itemName":"chatNonworkMsgTime"}],"v":"${v}"} + expected: + - eq: {"$.code": 0} + + +api8: + title: 检查设置是否成功 + url: /api/v1/setting/getCShopSetting?domain=${shopDomain} + method: get + expected: + - eq: {"$.code" : 0} + - eq: {"$.data.settingInfo[?(@.itemId == 71)].itemValue" : "${enable}"} + - eq: {"$.data.settingInfo[?(@.itemId == 37)].itemValue" : "${enable}"} + - eq: {"$.data.settingInfo[?(@.itemId == 39)].itemValue" : "${enable}"} + - eq: {"$.data.settingInfo[?(@.itemId == 38)].itemValue" : "${enable}"} + - eq: {"$.data.settingInfo[?(@.itemId == 42)].itemValue" : "${enable}"} + - eq: {"$.data.settingInfo[?(@.itemId == 49)].itemValue" : "${enable}"} + - eq: {"$.data.settingInfo[?(@.itemId == 183)].itemValue" : "${random_avatar}"} + - eq: {"$.data.settingInfo[?(@.itemId == 56)].itemValue" : "${origin_greeting_word}"} + - eq: {"$.data.settingInfo[?(@.itemId == 57)].itemValue" : "${origin_team_introduction}"} + - eq: {"$.data.settingInfo[?(@.itemId == 59)].itemValue" : "${enable}"} + - eq: {"$.data.settingInfo[?(@.itemId == 52)].itemValue" : "${white_font}"} + - eq: {"$.data.settingInfo[?(@.itemId == 53)].itemValue" : "${widget_right}"} + - eq: {"$.data.settingInfo[?(@.itemId == 94)].itemValue" : "${origin_font_style}"} + - eq: {"$.data.settingInfo[?(@.itemId == 50)].itemValue" : "${origin_background_color}"} + - eq: {"$.data.settingInfo[?(@.itemId == 60)].itemValue" : "${origin_posting_title}"} + - eq: {"$.data.settingInfo[?(@.itemId == 61)].itemValue" : "${origin_posting_content}"} + - eq: {"$.data.settingInfo[?(@.itemId == 54)].itemValue" : "${origin_spacing_px}"} + - eq: {"$.data.settingInfo[?(@.itemId == 55)].itemValue" : "${origin_spacing_px}"} + - eq: {"$.data.settingInfo[?(@.itemId == 58)].itemValue" : "${origin_widget_font}"} + - eq: {"$.data.settingInfo[?(@.itemId == 113)].itemValue" : "${origin_widget_type}"} + - eq: {"$.data.settingInfo[?(@.itemId == 116)].itemValue" : "${widget_large}"} + - eq: {"$.data.settingInfo[?(@.itemId == 66)].itemValue" : "${origin_business_time_zone}"} + - eq: {"$.data.settingInfo[?(@.itemId == 73)].itemValue" : "${origin_chatwelcome_message}"} + - eq: {"$.data.settingInfo[?(@.itemId == 69)].itemValue" : "${enable}"} + - eq: {"$.data.settingInfo[?(@.itemId == 63)].itemValue" : "${origin_business_time}"} + - eq: {"$.data.settingInfo[?(@.itemId == 64)].itemValue" : "${origin_business_time}"} + - eq: {"$.data.settingInfo[?(@.itemId == 65)].itemValue" : "${origin_business_time}"} + - eq: {"$.data.settingInfo[?(@.itemId == 70)].itemValue" : "${enable}"} + - eq: {"$.data.settingInfo[?(@.itemId == 83)].itemValue" : "${enable}"} + - eq: {"$.data.settingInfo[?(@.itemId == 68)].itemValue" : "${enable}"} + - eq: {"$.data.settingInfo[?(@.itemId == 106)].itemValue" : "${visiable_all_time}"} + - eq: {"$.data.settingInfo[?(@.itemId == 107)].itemValue" : "${widget_show_all}"} + - eq: {"$.data.settingInfo[?(@.itemId == 108)].itemValue" : "${widget_show_all_page}"} + - eq: {"$.data.settingInfo[?(@.itemId == 109)].itemValue" : "${visiable_url}"} + - eq: {"$.data.settingInfo[?(@.itemId == 82)].itemValue" : "${order_track_day_30}"} + - eq: {"$.data.settingInfo[?(@.itemId == 74)].itemValue" : "${origin_waiting_time_message}"} + - eq: {"$.data.settingInfo[?(@.itemId == 168)].itemValue" : "${origin_waiting_time}"} \ No newline at end of file diff --git a/main.py b/main.py index c1c9c30..93edb7c 100644 --- a/main.py +++ b/main.py @@ -1,11 +1,12 @@ import pytest +import requests.exceptions +from Utils.webhook_handler import webhook 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','./TestCase/setting/test_02_whatsappIntegration.py',f'--html=./report.html']) #allure报告一直生成不了,改用pytest自带报告 - + pytest.main(['-vs','./TestCase',f'--html=./report.html']) #allure报告一直生成不了,改用pytest自带报告 finally: test_env_conn.close_db() #关闭数据库链接 -- GitLab