public void Rule_Add_Delete_Response_News() { string filePath = PortalChromeDriver.CreateFolder(@"自动回复\添加1个图片素材"); PortalChromeDriver.ClickElementPerXpath(AutoReplyElement.AddAutoReply); var regulationTextes = PortalChromeDriver.GetElementByClassName(AutoReplyElement.RegulationText); regulationTextes.Clear(); regulationTextes.SendKeys("这是rule"); AutoReplyPage.AddTrigger("abc" + "", 1 + ""); AutoReplyPage.AddReply_News(1); Thread.Sleep(3 * 1000); PortalChromeDriver.TakeScreenShot(filePath, "添加1个图片素材"); Assert.IsTrue(Utility.IsAt(AutoReplyElement.PicValidator1, "关于“东方万里行” 相关问题")); MobileAndroidDriver.AndroidInitialize(); Mobile_WeChat_Utility.GetToTestAccount(); Mobile_WeChat_Utility.SendMessageWithMenu("abc"); MobileAndroidDriver.GetScreenshot(filePath, "H5关键词精确匹配"); Assert.IsTrue(Mobile_WeChat_Utility.IsAtPerName("关于“东方万里行” 相关问题")); filePath = PortalChromeDriver.CreateFolder(@"自动回复\删除图文"); AutoReplyPage.DeletePicReply(1); PortalChromeDriver.TakeScreenShot(filePath, "删除图文"); Assert.IsFalse(Utility.IsAt(AutoReplyElement.PicValidator, "关于“东方万里行” 相关问题")); }
public void Rule_Add_Response_Emoj_Weibo() { string filePath = PortalChromeDriver.CreateFolder(@"自动回复\添加表情回复"); WeChatManagermentPage.GoTo_AutoReply_Page(); PortalChromeDriver.ClickElementPerXpath(AutoReplyElement.KeyWordsReply); AutoReplyPage.TurnOnAutoReply(); AutoReplyPage.ClearReply(); PortalChromeDriver.ClickElementPerXpath(AutoReplyElement.AddAutoReply); var regulationTextes = PortalChromeDriver.GetElementByClassName(AutoReplyElement.RegulationText); regulationTextes.Clear(); regulationTextes.SendKeys("我是rule"); AutoReplyPage.AddTrigger("我是trigger", 1 + ""); AutoReplyPage.AddEmoj(); PortalChromeDriver.TakeScreenShot(filePath, "添加表情回复"); Assert.IsTrue(PortalChromeDriver.GetElementByXpath(AutoReplyElement.Emoj).GetAttribute("title") == "发红包啦"); MobileAndroidDriver.AndroidInitialize_Weibo(); Mobile_Weibo_Utility.Follow(); Mobile_Weibo_Utility.ClearAllMessage(); Mobile_Weibo_Utility.SendMessage("我是trigger"); MobileAndroidDriver.GetScreenshot(filePath, "添加表情回复"); Assert.IsTrue(Mobile_Weibo_Utility.GetLatestMessage().Text.Contains("[啊_荀] 说:")); }
public void Rule_Add_Delete_Response_News_Weibo() { string filePath = PortalChromeDriver.CreateFolder(@"自动回复\添加1个图片素材"); WeChatManagermentPage.GoTo_AutoReply_Page(); PortalChromeDriver.ClickElementPerXpath(AutoReplyElement.KeyWordsReply); AutoReplyPage.TurnOnAutoReply(); AutoReplyPage.ClearReply(); PortalChromeDriver.ClickElementPerXpath(AutoReplyElement.AddAutoReply); var regulationTextes = PortalChromeDriver.GetElementByClassName(AutoReplyElement.RegulationText); regulationTextes.Clear(); regulationTextes.SendKeys("这是rule"); AutoReplyPage.AddTrigger(1 + "", 1 + ""); AutoReplyPage.AddReply_News(1); Thread.Sleep(3 * 1000); PortalChromeDriver.TakeScreenShot(filePath, "添加1个图片素材"); Assert.IsTrue(Utility.IsAt(AutoReplyElement.PicValidator1, "g")); MobileAndroidDriver.AndroidInitialize_Weibo(); Mobile_Weibo_Utility.Follow(); Mobile_Weibo_Utility.ClearAllMessage(); Mobile_Weibo_Utility.SendMessage("1"); MobileAndroidDriver.GetScreenshot(filePath, "H5关键词精确匹配"); Assert.IsTrue(Mobile_WeChat_Utility.IsAtPerName("g")); filePath = PortalChromeDriver.CreateFolder(@"自动回复\删除图文"); AutoReplyPage.DeletePicReply(1); PortalChromeDriver.TakeScreenShot(filePath, "删除图文"); Assert.IsFalse(Utility.IsAt(AutoReplyElement.PicValidator, "g")); }
public static void DeleteTriggerByEditButton() { try { PortalChromeDriver.GetElementByXpath(HIPortalPageUIElement.EditTriggerButton).Click(); PortalChromeDriver.GetElementByClassName(HIPortalPageUIElement.EditCurrentTrigger).Clear(); PortalChromeDriver.GetElementByClassName(HIPortalPageUIElement.EditCurrentTrigger).SendKeys(""); PortalChromeDriver.GetElementByXpath(HIPortalPageUIElement.OtherButton).Click(); PortalChromeDriver.Instance.Navigate().Refresh(); } catch (Exception e) { } }
public static void GetLoginCode() { try { MobileAndroidDriver.GetElementByName(SMSElement.TextMessage).Click(); Thread.Sleep(5 * 1000); var text = MobileAndroidDriver.GetElementByXpath(SMSElement.messageContent).Text; string[] texts = text.Split(',', ':'); PortalChromeDriver.GetElementByXpath("//*[@id='verification']").SendKeys(texts[2]); //Click SendButton var loginButton = PortalChromeDriver.GetElementByClassName("sbtn"); loginButton.Click(); } catch (Exception e) { } }
public void Rule_Add_Delete_Response_AllNews() { string filePath = PortalChromeDriver.CreateFolder(@"自动回复\添加5个图片素材"); PortalChromeDriver.ClickElementPerXpath(AutoReplyElement.AddAutoReply); var regulationTextes = PortalChromeDriver.GetElementByClassName(AutoReplyElement.RegulationText); regulationTextes.Clear(); regulationTextes.SendKeys("这是rule"); AutoReplyPage.AddTrigger(1 + "", 1 + ""); AutoReplyPage.AddReply_News(5); Thread.Sleep(3 * 1000); PortalChromeDriver.TakeScreenShot(filePath, "添加5个图片素材"); Assert.IsTrue(Utility.IsAt(AutoReplyElement.PicValidator, "i")); }
public static void EditTrigger(string text) { try { PortalChromeDriver.GetElementByXpath(HIPortalPageUIElement.EditTriggerButton).Click(); PortalChromeDriver.GetElementByClassName(HIPortalPageUIElement.EditCurrentTrigger).Clear(); PortalChromeDriver.GetElementByClassName(HIPortalPageUIElement.EditCurrentTrigger).SendKeys(text); PortalChromeDriver.Wait(TimeSpan.FromSeconds(1)); ClickSomewhereToSave(); //PortalChromeDriver.Instance.Navigate().Refresh(); } catch (Exception e) { throw new Exception(e.Message); } }
public void Rule_Add_Response_Emoj() { string filePath = PortalChromeDriver.CreateFolder(@"自动回复\添加表情回复"); PortalChromeDriver.ClickElementPerXpath(AutoReplyElement.AddAutoReply); var regulationTextes = PortalChromeDriver.GetElementByClassName(AutoReplyElement.RegulationText); regulationTextes.Clear(); regulationTextes.SendKeys("我是rule"); AutoReplyPage.AddTrigger("trigger", 1 + ""); AutoReplyPage.AddEmoj(); PortalChromeDriver.TakeScreenShot(filePath, "添加表情回复"); Assert.IsTrue(PortalChromeDriver.GetElementByXpath(AutoReplyElement.Emoj).GetAttribute("title") == "微笑"); MobileAndroidDriver.AndroidInitialize(); Mobile_WeChat_Utility.GetToTestAccount(); Mobile_WeChat_Utility.SendMessageWithMenu("trigger"); MobileAndroidDriver.GetScreenshot(filePath, "H5关键词精确匹配"); Assert.IsTrue(Mobile_WeChat_Utility.GetLatestMessage("[平台测试账号2] 说:")); }
public void AddReply_AddTrigger_Total_10() { string filePath = PortalChromeDriver.CreateFolder(@"自动回复\添加10个关键词"); PortalChromeDriver.ClickElementPerXpath(AutoReplyElement.AddAutoReply); var regulationTextes = PortalChromeDriver.GetElementByClassName(AutoReplyElement.RegulationText); regulationTextes.Clear(); regulationTextes.SendKeys("这是rule"); for (int i = 1; i <= 10; i++) { AutoReplyPage.AddTrigger(i + "", i + ""); Thread.Sleep(3 * 1000); PortalChromeDriver.ClickElementPerXpath("/html/body/div/div[2]/div[2]/div[2]/div/div[1]/div[1]/div[2]/span"); Assert.IsTrue(Utility.IsAt(AutoReplyElement.TrigerContent.Replace("[{0}]", "[" + i + "]"), i + "")); } PortalChromeDriver.TakeScreenShot(filePath, "添加10个关键词"); AutoReplyPage.AddTrigger(11 + "", 11 + ""); Assert.IsFalse(Utility.IsAt(AutoReplyElement.TrigerContent.Replace("[{0}]", "[" + 11 + "]"), 11 + "")); }
public static void AddAutoReply(string rule, string trigger, string replyContent) { try { //PortalChromeDriver.ClickElementPerXpath(AutoReplyElement.KeyWordsReply); //TurnOnAutoReply(); PortalChromeDriver.ClickElementPerXpath(AutoReplyElement.AddAutoReply); var regulationTextes = PortalChromeDriver.GetElementByClassName(AutoReplyElement.RegulationText); regulationTextes.Clear(); regulationTextes.SendKeys(rule); AddTrigger(trigger, 1 + ""); PortalChromeDriver.ClickElementPerXpath(AutoReplyElement.AddReplyText); var replyInput = PortalChromeDriver.GetElementByXpath(AutoReplyElement.EditReply.Replace("[{0}]", "[" + 1 + "]")); replyInput.SendKeys(replyContent); PortalChromeDriver.ClickElementPerXpath(AutoReplyElement.SaveButton); } catch (Exception e) { } }
public void AddReply_AddReply_Total_5_HalfText() { string filePath = PortalChromeDriver.CreateFolder(@"自动回复\添加2个问题关键词3个图文关键词"); PortalChromeDriver.ClickElementPerXpath(AutoReplyElement.AddAutoReply); var regulationTextes = PortalChromeDriver.GetElementByClassName(AutoReplyElement.RegulationText); regulationTextes.Clear(); regulationTextes.SendKeys("这是rule"); AutoReplyPage.AddTrigger(1 + "", 1 + ""); for (int i = 1; i <= 2; i++) { AutoReplyPage.AddReply_Text(i + "", i + ""); Thread.Sleep(3 * 1000); PortalChromeDriver.ClickElementPerXpath("/html/body/div/div[2]/div[2]/div[2]/div/div[1]/div[1]/div[2]/span"); Assert.IsTrue(Utility.IsAt(AutoReplyElement.ReplyContent.Replace("[{0}]", "[" + i + "]"), i + "")); } AutoReplyPage.AddReply_News(3); PortalChromeDriver.TakeScreenShot(filePath, "添加2个问题关键词3个图文关键词"); Thread.Sleep(3 * 1000); Assert.IsTrue(Utility.IsAt(AutoReplyElement.PicValidator, "h")); }