public void Material_Image()
        {
            string filePath = PortalChromeDriver.CreateFolder(@"素材管理\当有图片素材的时候,检查图片库界面是否显示正确");

            PortalChromeDriver.ClickElementPerXpath(MaterialElement.ImageTab);
            Assert.IsTrue(PortalChromeDriver.GetElementsByClassName("cs_appmsg_delete_area").Count == 10, "每个素材下面有“删除”按钮");

            MaterialPage.TurnToNextPage();
            Assert.IsTrue(PortalChromeDriver.GetElementsByClassName("cs_appmsg_delete_area").Count == 10, "翻页后每个素材下面有“删除”按钮");

            PortalChromeDriver.ClickElementPerXpath(MaterialElement.NextPage_SecondPage);
            Assert.IsTrue(PortalChromeDriver.GetElementsByClassName("cs_appmsg_delete_area").Count == 3, "翻页后每个素材下面有“删除”按钮");

            MaterialPage.TurnToNextPage_Input("1");
            Assert.IsTrue(Utility.IsAt(MaterialElement.ImageLink, "u=115503548,1566568049&fm=23&gp=0.jpg"));

            MaterialPage.TurnToNextPage_Input("");
            Assert.IsTrue(Utility.IsAt(MaterialElement.Page_Input_Warning, "输入页码不是数字"));

            MaterialPage.TurnToNextPage_Input("a");
            Assert.IsTrue(Utility.IsAt(MaterialElement.Page_Input_Warning, "输入页码不是数字"));

            MaterialPage.TurnToNextPage_Input("一");
            Assert.IsTrue(Utility.IsAt(MaterialElement.Page_Input_Warning, "输入页码不是数字"));


            MaterialPage.TurnToNextPage_Input("4");
            Assert.IsTrue(Utility.IsAt(MaterialElement.Page_Input_Warning, "输入页码不正确"));

            MaterialPage.TurnToNextPage_Input("0");
            Assert.IsTrue(Utility.IsAt(MaterialElement.Page_Input_Warning, "输入页码不正确"));
        }
        public void Material_Audio()
        {
            string filePath = PortalChromeDriver.CreateFolder(@"素材管理\当有图文素材的时候,检查图文消息界面是否显示正确");

            PortalChromeDriver.ClickElementPerXpath(MaterialElement.AudioTab);
            Assert.IsTrue(PortalChromeDriver.GetElementsByClassName("cs_appmsg_delete_area").Count == 10, "每个素材下面有“删除”按钮");

            MaterialPage.TurnToNextPage();
            Assert.IsTrue(PortalChromeDriver.GetElementsByClassName("cs_appmsg_delete_area").Count == 1, "翻页后每个素材下面有“删除”按钮");

            MaterialPage.TurnToNextPage_Input("1");
            Assert.IsTrue(Utility.IsAt(MaterialElement.AudioLink, "香水有毒.amr"));

            MaterialPage.TurnToNextPage_Input("");
            Assert.IsTrue(Utility.IsAt(MaterialElement.Page_Input_Warning, "输入页码不是数字"));

            MaterialPage.TurnToNextPage_Input("a");
            Assert.IsTrue(Utility.IsAt(MaterialElement.Page_Input_Warning, "输入页码不是数字"));

            MaterialPage.TurnToNextPage_Input("一");
            Assert.IsTrue(Utility.IsAt(MaterialElement.Page_Input_Warning, "输入页码不是数字"));


            MaterialPage.TurnToNextPage_Input("3");
            Assert.IsTrue(Utility.IsAt(MaterialElement.Page_Input_Warning, "输入页码不正确"));

            MaterialPage.TurnToNextPage_Input("0");
            Assert.IsTrue(Utility.IsAt(MaterialElement.Page_Input_Warning, "输入页码不正确"));
        }
        public static void GetTestUserFromUserList()
        {
            try
            {
                if (PortalChromeDriver.GetElementByXpath(HIPortalPageUIElement.LoadingMore).GetAttribute("style") == "")
                {
                    HIPage.ClickLoadingMore();
                }

                var userNames = PortalChromeDriver.GetElementsByClassName("userName");
                foreach (var userName in userNames)
                {
                    if (userName.Text == "chrysanthemum")
                    {
                        userName.Click();
                        Thread.Sleep(2 * 1000);
                        SendMessage("Hi,chrysanthemum");
                    }
                }
                //for (int i = 1; i < 12; i++)
                //{
                //    var user = PortalChromeDriver.GetElementByXpath("//*[@id='msgListDiv']/div[" + i + "]/div[2]/div[1]/div[1]");
                //    if (user.Text == "chrysanthemum")
                //    {
                //        user.Click();
                //    }
                //}
            }
            catch (Exception e)
            {
            }
        }
 public static void ClickOtherUser(int i)
 {
     try
     {
         PortalChromeDriver.GetElementsByClassName("userName")[i].Click();
     }
     catch (Exception e)
     { }
 }
 public static void ClearReply()
 {
     try
     {
         var deleteButtons = PortalChromeDriver.GetElementsByClassName(AutoReplyElement.DeleteButton);
         foreach (var deleteButton in deleteButtons)
         {
             DeleteReply();
         }
     }
     catch (Exception e) { }
 }
Exemple #6
0
        public static bool GetApp(string appName)
        {
            var items = PortalChromeDriver.GetElementsByClassName("body");

            foreach (var item in items)
            {
                if (item.FindElement(By.TagName("a")).Text.Contains(appName))
                {
                    return(true);
                }
            }
            return(false);
        }
Exemple #7
0
 public static void DeleteCampain()
 {
     try
     {
         var campain = PortalChromeDriver.GetElementsByClassName("entity_panel");
         if (campain != null)
         {
             PortalChromeDriver.ClickElementPerXpath(MomentsSnapshotElement.removeCampain);
             PortalChromeDriver.ClickElementPerXpath(CommonElement.Confirm);
         }
     }
     catch (Exception e)
     {
     }
 }
 public static void ClearTriggers()
 {
     try
     {
         var triggers = PortalChromeDriver.GetElementsByClassName("contentText");
         if (triggers != null)
         {
             foreach (var item in triggers)
             {
                 DeleteTrigger();
             }
         }
     }
     catch (Exception e)
     { }
 }
        public static bool CheckTheTopUser()
        {
            try
            {
                //判断置顶的客户为发送消息的客户
                var userName = PortalChromeDriver.GetElementsByClassName("userName");

                if (userName[0].Text == "chrysanthemum")
                {
                    return(true);
                }
                return(false);
            }
            catch (Exception e)
            { return(false); }
        }
        public static bool Can_ReceiveMesageFromMobile()
        {
            try
            {
                var elementChatBody = PortalChromeDriver.GetElementsByClassName("conversation_item");

                foreach (var item in elementChatBody)
                {
                    if (item.Text == "我是客户")
                    {
                        return(true);
                    }
                }
                return(false);
            }
            catch (Exception e) { return(false); }
        }
 public static IWebElement GetTheLastMsg()
 {
     try {
         var elementChatBody        = PortalChromeDriver.GetElementsByClassName("conv_wrap_right");
         List <IWebElement> eleList = new List <IWebElement>();
         foreach (var item in elementChatBody)
         {
             eleList.Add(item);
         }
         if (eleList.Count != 0)
         {
             return(eleList[eleList.Count - 1]);
         }
         return(null);
     }
     catch (Exception e)
     {
         return(null);
     }
 }
        public static bool CanSendVarousPhotos()
        {
            try
            {
                var elementChatBody = PortalChromeDriver.GetElementsByClassName("conversation_item");

                foreach (var item in elementChatBody)
                {
                    if (item.FindElement(By.TagName("img")).GetAttribute("width") == "250")
                    {
                        return(true);
                    }
                }
                return(false);
            }
            catch (Exception e)
            {
                return(false);
            }
        }
 public static void GetOtherUserFromUserList()
 {
     try
     {
         if (Utility.IsAt(HIPortalPageUIElement.LoadingMore))
         {
             HIPage.ClickLoadingMore();
         }
         var userNames = PortalChromeDriver.GetElementsByClassName("userName");
         foreach (var userName in userNames)
         {
             if (userName.Text == "xun")
             {
                 userName.Click();
                 Thread.Sleep(5 * 1000);
                 SendMessage("Hi,xun");
             }
         }
     }
     catch (Exception e)
     {
     }
 }
 public static bool IsLengthWithin300()
 {
     try
     {
         var           elementChatBody = PortalChromeDriver.GetElementsByClassName("conversation_item");
         List <String> list            = new List <string>();
         foreach (var item in elementChatBody)
         {
             if (item.Text != "")
             {
                 list.Add(item.Text);
             }
         }
         if (list[list.Count - 1] == "012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789")
         {
             return(true);
         }
         return(false);
     }
     catch (Exception e)
     {
         return(false);
     }
 }