diff --git a/Config/base_config.ini b/Config/base_config.ini index 2cea0b475be963934a56277db01a95f8675488c7..1089f6b78d4c90fb695f9c4f681198ecc81c5970 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 d65f7da022f7dfa1e1b09ad43ef3a08544bbbd74..188286eb5d67b05a9ebc5ffeb017299184867dbe 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 5cae7714f8f8483fbd38c33e3c698cdf923834d7..71a7d2d89764d9390eaaeb4a4a2c407c372e6bf9 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 582059a195be71f1f92eca1ee9d3f77d58c4ae19..d0ed64af7c66d6372d9d4736b4fea1f96f21754b 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 f76135de7071532d5c05589128a2a1177d1cc1d4..98d9db77ce04fa880bb049be844f216f037d9a5e 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 c785471f571ac1d5e5ae2b300de3f7bee1a9ba93..f5ca44a880bba31798688665dd405f2b904018b0 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 c7c3eaedec5c6d5eacc7ac292eaca05d3691fb7c..ba46b17048ea56d47f4363a13cd6298643c7d2dd 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 af16f9fc3ca41687df0a94309fca37aa1f736b80..eff3386016a11859117e17081dd0941de67f9315 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 d77b4a215d2ce5c52429eee63d5f8fb110493d82..b04e22dfa0328d92801c01359dace85356a3e56f 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 d55a6375b744dba78157df3cd0a4978e4e67a9b7..f3870a0bd8a56da1e6826137ec6866417f968ae7 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 6159be5f70212ca0a236c1ed599229df39e260a5..d1226d000045dde31510588f07f5d667e669141a 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 8ed584480126b270bab9d72b49ebf47e76fb3cc2..94a2e7a97e0efabe4b485b57b5f7aa555bbf15d7 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 14c87584c0888a3608e02301deb468b3843f260a..4ccd24e46ad192871e48577a07984987be992db8 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 f38f36e314cbd990bb1dd59c047122112812dae5..68a3de0f2d22b593b05d7106360c6a5275225fdc 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 91d8fb46d0fee228e21628b666aeca4b697c89c2..fd264d5580993c7450012b5b4343591deaf4f520 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 c2336eca52451aa6b457775c8d9d93c69610ad95..dc4914887bf97a85f9b15e1834db1d6fc34f17f2 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 1a76ce2ee2eea66d7c9ede1dbe0acd4f94895bbe..2106a2eafa3e1e9225f93ece953ef40718c6d418 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 0000000000000000000000000000000000000000..17ffe61b8c47e351d4a708cca8ef03867a703d32 --- /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 0000000000000000000000000000000000000000..e593163dc41e7de0cdba0e2edd6efdd432aeeb7f --- /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 872ec4c910fb1bd16db5992ff1c59637a2863134..9ec99449e4e9500c428da77aa18e621a372f46a7 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 c68324c8f7f705a6a1d92340f3b70c4044361c7f..66a6f735bccf4ad7cbfc4b2b5b50eedcae098cc6 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 5fab85b260f1f928751356467c2daaae3db8d1f4..ac37046b454ebb5c64834caa05df906bbcca28a4 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 db213b9ade1f7a0293c467b8c1b281250b2a3a51..81bc515cc604d0ec52c5db5d8d43303c7d64357b 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 0000000000000000000000000000000000000000..eb6f6bd11f928635631b06f1e02f776c123837a2 --- /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 c1c9c30626397907c99a875951e6a932d5840f60..93edb7c3afe6cad64f8cfc5a9b537571f74ddc60 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() #关闭数据库链接