public static void GetHiCard(string text)
        {
            try
            {
                var textInputSwich = MobileAndroidDriver.GetElementByXpath(HIMobileH5Element.TextInput);
                textInputSwich.Click();

                var keyBoardSwich = MobileAndroidDriver.GetElementByXpath(HIMobileH5Element.KeyBoardSwichXpath);
                keyBoardSwich.Click();

                var sendMessage = MobileAndroidDriver.GetElementByXpath(HIMobileH5Element.EditTextXpath);
                sendMessage.SendKeys(text);

                var sendButton = MobileAndroidDriver.GetElementByName(HIMobileH5Element.SendButtonXpath);
                sendButton.Click();
                PortalChromeDriver.Wait(TimeSpan.FromSeconds(5));
                ClickHICard();
                PortalChromeDriver.Wait(TimeSpan.FromSeconds(20));
            }
            catch (Exception e)
            {
                var sendMessage = MobileAndroidDriver.GetElementByXpath(HIMobileH5Element.EditTextXpath);
                sendMessage.Click();
                sendMessage.SendKeys(text);

                var sendButton = MobileAndroidDriver.GetElementByName(HIMobileH5Element.SendButtonXpath);
                sendButton.Click();
                PortalChromeDriver.Wait(TimeSpan.FromSeconds(5));
                ClickHICard();
                PortalChromeDriver.Wait(TimeSpan.FromSeconds(20));
            }
        }
示例#2
0
 public static void OpenHiChatWindow()
 {
     try
     {
         PortalChromeDriver.GetElementByXpath(HIPortalPageUIElement.SubTabHiChat).Click();
         PortalChromeDriver.Wait(TimeSpan.FromSeconds(15));
     }
     catch (Exception e)
     {
     }
 }
示例#3
0
 public static void ClickSomewhereToSave()
 {
     try
     {
         var someWhere = PortalChromeDriver.GetElementByXpath(HIPortalPageUIElement.SomewhereToSave);
         someWhere.Click();
         PortalChromeDriver.Wait(TimeSpan.FromSeconds(1));
     }
     catch (Exception e)
     {
     }
 }
示例#4
0
 public static void ClickModifyButton()
 {
     try
     {
         var okButton = PortalChromeDriver.GetElementByXpath(HIPortalPageUIElement.ModifyButton);
         okButton.Click();
         PortalChromeDriver.Wait(TimeSpan.FromSeconds(1));
     }
     catch (Exception e)
     {
     }
 }
示例#5
0
 public static void DeleteTrigger()
 {
     try
     {
         var deleteButton = PortalChromeDriver.GetElementByXpath(HIPortalPageUIElement.DeleteTriggerButton);
         deleteButton.Click();
         PortalChromeDriver.Wait(TimeSpan.FromSeconds(1));
     }
     catch (Exception e)
     {
         throw new Exception(e.Message);
     }
 }
示例#6
0
 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);
     }
 }
示例#7
0
        public static void AddAutoReplyImage(string image)
        {
            PortalChromeDriver.ClickElementPerXpath(FollowedAutoReplyElement.tabimage);
            PortalChromeDriver.ClickElementPerXpath(FollowedAutoReplyElement.autoreply_content);
            AutoItX3 au3 = new AutoItX3();

            PortalChromeDriver.Wait(TimeSpan.FromSeconds(10));
            au3.ControlFocus("Open", "", "Edit1");
            au3.ControlSetText("Open", "", "Edit1", @"C:\Users\v-haxun\Desktop\Image\" + image);
            PortalChromeDriver.Wait(TimeSpan.FromSeconds(2));
            au3.ControlClick("Open", "", "Button1");
            PortalChromeDriver.Wait(TimeSpan.FromSeconds(5));

            PortalChromeDriver.ClickElementPerXpath(FollowedAutoReplyElement.Bottom_Save);
            //Thread.Sleep(2 * 1000);
        }
示例#8
0
 public static void InputTrigger(string input)
 {
     try
     {
         var inputTrigger = PortalChromeDriver.GetElementByXpath(HIPortalPageUIElement.TriggerAddBox);
         inputTrigger.Clear();
         inputTrigger.SendKeys(input);
         var addTriggerButton = PortalChromeDriver.GetElementByXpath(HIPortalPageUIElement.TriggerAddButton);
         addTriggerButton.Click();
         PortalChromeDriver.Wait(TimeSpan.FromSeconds(1));
     }
     catch (Exception e)
     {
         throw new Exception(e.Message);
     }
 }
示例#9
0
        public static void AddAutoReplyVoice(string video)
        {
            PortalChromeDriver.ClickElementPerXpath(FollowedAutoReplyElement.tabvoice);
            PortalChromeDriver.ClickElementPerXpath(FollowedAutoReplyElement.autoreply_content);
            Thread.Sleep(2 * 1000);
            AutoItX3 au3 = new AutoItX3();

            PortalChromeDriver.Wait(TimeSpan.FromSeconds(10));
            au3.ControlFocus("Open", "", "Edit1");
            au3.ControlSetText("Open", "", "Edit1", @"D:\Test case\Test case\测试素材\Test AMR\" + video);
            PortalChromeDriver.Wait(TimeSpan.FromSeconds(2));
            au3.ControlClick("Open", "", "Button1");
            PortalChromeDriver.Wait(TimeSpan.FromSeconds(5));

            PortalChromeDriver.ClickElementPerXpath(FollowedAutoReplyElement.Bottom_Save);
        }
示例#10
0
 public static void SendImage()
 {
     try
     {
         PortalChromeDriver.GetElementByXpath(HIPortalPageUIElement.addimg_hidden_input).Click();
         AutoItX3 au3 = new AutoItX3();
         PortalChromeDriver.Wait(TimeSpan.FromSeconds(10));
         au3.ControlFocus("Open", "", "Edit1");
         au3.ControlSetText("Open", "", "Edit1", @"C:\Users\v-haxun\Desktop\Test.png");
         PortalChromeDriver.Wait(TimeSpan.FromSeconds(2));
         au3.ControlClick("Open", "", "Button1");
         PortalChromeDriver.Wait(TimeSpan.FromSeconds(5));
     }
     catch (Exception e)
     {
     }
 }
 public static void BindStaff()
 {
     try
     {
         //切换到Hi的设置Tab页
         HIPage.SwichHISettingTab(HIPortalPageUIElement.SubTabHIStaff);
         //判断是否已经绑定客服,如果绑定,则删除客服
         HIPage.DeleteStaff();
         //获取绑定客服验证码
         var value = HIPage.GetLoginCode();
         //H5页面进入平台测试账号对话窗口
         GetToTestAccount();
         PortalChromeDriver.Wait(TimeSpan.FromSeconds(2));
         //发送验证码
         SendMessage(value);
     }
     catch (Exception e) { }
 }
        public void Portal_H5_Chat()
        {
            //Portal确保HI是Turn on的状态
            WeChatManagermentPage.GoToHIPage();
            HIPage.TurnOnSetup();
            HIPage.OpenHiChatWindow();
            HIPage.GetTestUserFromUserList();

            Mobile_WeChat_Utility.GetToTestAccount();
            Mobile_WeChat_Utility.GetHiCard("客服");
            Mobile_WeChat_Utility.XB_SendMessage("我是客户");
            //验证能否收到H5客户端的消息
            HIPage.OpenHiChatWindow();
            string foler = PortalChromeDriver.CreateFolder(@"HI\H5.7.在H5对话窗口, 是否可以发送消息");

            MobileAndroidDriver.GetScreenshot(foler, "H5发送消息");
            Assert.IsTrue(HIPage.Can_ReceiveMesageFromMobile());

            Thread.Sleep(2 * 1000);
            HIPage.SendMessage("我是客服");
            Thread.Sleep(2 * 1000);
            //验证能否收到Portal客服端的消息
            foler = PortalChromeDriver.CreateFolder(@"HI\H5.9.用户在H5对话窗口时,是否可以收到客服回复的消息");
            MobileAndroidDriver.GetScreenshot(foler, "H5");
            Assert.IsTrue(Mobile_WeChat_Utility.GetMessage("我是客服"));

            //验证H5端在未退出当前窗口时,是否会收到客服回复的card
            foler = PortalChromeDriver.CreateFolder(@"HI\H5.10.是否可以收到一条新的客服回复的card,当用户没有退出当前H5对话窗口时");
            MobileAndroidDriver.GetScreenshot(foler, "H5");
            Assert.IsFalse(Mobile_WeChat_Utility.IsAt(HIMobileH5Element.ReplyCardFromHI));
            //验证H5端发送图片
            Mobile_WeChat_Utility.XB_SendPhotoFromFile("mmexport1482395212867.jpg");
            PortalChromeDriver.Wait(TimeSpan.FromSeconds(5));
            Assert.IsTrue(HIPage.Can_ReceiveImageFromMobile());
            //Portal发送图片
            HIPage.SendImage();
            Mobile_WeChat_Utility.GetImageMessage(false);
            foler = PortalChromeDriver.CreateFolder(@"HI\H5.21.发送和接受的图片是否可以可以点击放大");
            MobileAndroidDriver.GetScreenshot(foler, "H5");
            Assert.IsTrue(Mobile_WeChat_Utility.GetMagnifyImage());
            Mobile_WeChat_Utility.BackButtonClick();
        }
        public void TriggerHICardPerCustomize()
        {
            //Portal确保HI是Turn on的状态
            WeChatManagermentPage.GoToHIPage();
            HIPage.TurnOnSetup();
            #region 添加一条触发关键词
            HIPage.ClearTriggers();
            HIPage.InputTrigger("hi");
            PortalChromeDriver.Wait(TimeSpan.FromSeconds(2));
            #endregion

            //H5页面进入平台测试账号对话窗口
            Mobile_WeChat_Utility.GetToTestAccount();
            Mobile_WeChat_Utility.ClearAllRecord();
            //H5呼叫客服

            Mobile_WeChat_Utility.SendMessage("hi");
            Thread.Sleep(5 * 1000);
            string foler = PortalChromeDriver.CreateFolder(@"HI\H5.1.功能开启后,在公众号里是否能触发人工客服card");
            MobileAndroidDriver.GetScreenshot(foler, "H5");
            Assert.IsTrue(Mobile_WeChat_Utility.IsAt(HIMobileH5Element.HiCardXpath));

            HIPage.ClearTriggers();
            Mobile_WeChat_Utility.ClearAllRecord();

            Thread.Sleep(5 * 1000);
            //H5呼叫客服
            Mobile_WeChat_Utility.SendMessage("hi");
            Thread.Sleep(5 * 1000);
            foler = PortalChromeDriver.CreateFolder(@"HI\H5.2.删除设置的关键词,是否还能触发人工客服card");
            MobileAndroidDriver.GetScreenshot(foler, "H5.2.删除设置的关键词,是否还能触发人工客服card");
            Assert.IsFalse(Mobile_WeChat_Utility.IsAt(HIMobileH5Element.HiCardXpath));

            Mobile_WeChat_Utility.ClearAllRecord();
            //H5呼叫客服
            Mobile_WeChat_Utility.SendMessage("客服");
            Thread.Sleep(5 * 1000);
            foler = PortalChromeDriver.CreateFolder(@"HI\H5.3.是否可以触发人工客服card,当输入含有找客服意向的语句");
            MobileAndroidDriver.GetScreenshot(foler, "H5.3.是否可以触发人工客服card,当输入含有找客服意向的语句");
            Assert.IsTrue(Mobile_WeChat_Utility.IsAt(HIMobileH5Element.HiCardXpath));
        }
        public void TriggerHiCardPerHITurnOFF()
        {
            //Portal确保HI是Turn on的状态
            WeChatManagermentPage.GoToHIPage();
            HIPage.TurnOnSetup();

            #region
            HIPage.InputTrigger("Hi");
            PortalChromeDriver.Wait(TimeSpan.FromSeconds(5));
            #endregion
            Utility.TurnOff();

            //H5页面进入平台测试账号对话窗口
            Mobile_WeChat_Utility.GetToTestAccount();
            Mobile_WeChat_Utility.ClearAllRecord();
            //H5呼叫客服
            Mobile_WeChat_Utility.SendMessage("Hi");
            string foler = PortalChromeDriver.CreateFolder(@"HI\H5.5.功能关闭后,在公众号里能否触发人工客服card");
            MobileAndroidDriver.GetScreenshot(foler, "H5");
            Assert.IsFalse(Mobile_WeChat_Utility.IsAt(HIMobileH5Element.xb_chatwith_texttest));
        }
示例#15
0
        public static void AddMenu_Image()
        {
            try
            {
                PortalChromeDriver.ClickElementPerXpath(MenuElement.Send_Message);
                PortalChromeDriver.ClickElementPerXpath(MenuElement.tabImage);
                PortalChromeDriver.ClickElementPerXpath(MenuElement.ImageChoose);

                AutoItX3 au3 = new AutoItX3();
                PortalChromeDriver.Wait(TimeSpan.FromSeconds(10));
                au3.ControlFocus("Open", "", "Edit1");
                au3.ControlSetText("Open", "", "Edit1", @"C:\Users\v-haxun\Desktop\Image\efwe.jpg");
                PortalChromeDriver.Wait(TimeSpan.FromSeconds(2));
                au3.ControlClick("Open", "", "Button1");
                PortalChromeDriver.Wait(TimeSpan.FromSeconds(5));
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }
        }
        public void Is_NewMsg_TopShow_InHIWin()
        {
            //Portal确保HI是Turn on的状态
            WeChatManagermentPage.GoToHIPage();
            HIPage.TurnOnSetup();
            //Portal客服打开Hi对话窗口
            HIPage.OpenHiChatWindow();
            HIPage.GetOtherUserFromUserList();
            //H5页面进入平台测试账号对话窗口
            Mobile_WeChat_Utility.GetToTestAccount();
            //H5呼叫客服
            Mobile_WeChat_Utility.GetHiCard("客服");
            PortalChromeDriver.Wait(TimeSpan.FromSeconds(10));
            //H5用户发送消息
            Mobile_WeChat_Utility.XB_SendMessage("这里是测试账号");
            Mobile_WeChat_Utility.BackButtonClick();
            Thread.Sleep(5 * 1000);
            string foler = PortalChromeDriver.CreateFolder(@"HI\44.[对话窗口]是否可以在用户消息列表上次置顶显示,无论消息的状态是已读或未读,只要收到新的消息");

            PortalChromeDriver.TakeScreenShot(foler, "Portal");
            Assert.IsTrue(HIPage.CheckTheTopUser());
        }
        public static bool GetImageMessage(bool isMagnify)
        {
            try
            {
                var textMessageBefore = MobileAndroidDriver.GetElementsByXpath("//android.view.View[@index='0']");

                List <AppiumWebElement> elements = new List <AppiumWebElement>();
                foreach (var item in textMessageBefore)
                {
                    elements.Add(item);
                }
                if (elements[elements.Count - 3].Location.X == 225)
                {
                    elements[elements.Count - 3].Click();
                    PortalChromeDriver.Wait(TimeSpan.FromSeconds(2));
                    return(true);
                }
                return(false);
            }
            catch (Exception e)
            {
                return(false);
            }
        }
示例#18
0
        public void EditTrigger_Check()
        {
            //确保HI是Turn on的状态
            HIPage.TurnOnSetup();

            #region 12. [接入条件设置]是否可以正常保存,当编辑已有的触发关键词删除所有内容
            folder = PortalChromeDriver.CreateFolder(@"HI\12.[接入条件设置]是否可以正常保存,当编辑已有的触发关键词删除所有内容");
            HIPage.ClearTriggers();
            HIPage.InputTrigger("Hi");
            HIPage.DeleteTriggerByEditButton();
            HIPage.ClickSomewhereToSave();
            PortalChromeDriver.TakeScreenShot(folder, @"12.[接入条件设置]是否可以正常保存,当编辑已有的触发关键词删除所有内容");
            Assert.IsTrue(HIPage.iskeywordAdded("Hi"), "编辑已有的触发关键词删除所有内容");
            #endregion

            #region 13.	[接入条件设置]是否可以正常保存,当编辑已有的触发关键词输入空格
            folder = PortalChromeDriver.CreateFolder(@"HI\13.[接入条件设置]是否可以正常保存,当编辑已有的触发关键词输入空格");
            HIPage.ClearTriggers();
            HIPage.InputTrigger("Hi");
            HIPage.EditTrigger(" ");
            PortalChromeDriver.Refresh();
            PortalChromeDriver.TakeScreenShot(folder, @"13.[接入条件设置]是否可以正常保存,当编辑已有的触发关键词输入空格");
            Assert.IsTrue(HIPage.iskeywordAdded("Hi"), "编辑已有的触发关键词输入空格");
            PortalChromeDriver.Refresh();
            PortalChromeDriver.Wait(TimeSpan.FromSeconds(5));
            #endregion

            #region 14.	[接入条件设置]是否可以正常保存,当编辑已有的触发关键词输入html标签时
            folder = PortalChromeDriver.CreateFolder(@"HI\14.[接入条件设置]是否可以正常保存,当编辑已有的触发关键词输入html标签时");
            HIPage.ClearTriggers();
            HIPage.InputTrigger("Hi");
            PortalChromeDriver.Refresh();
            HIPage.EditTrigger("<div class='body'>");
            HIPage.ClickSomewhereToSave();
            PortalChromeDriver.TakeScreenShot(folder, @"14.[接入条件设置]是否可以正常保存,当编辑已有的触发关键词输入html标签时");
            Assert.IsTrue(HIPage.iskeywordAdded("<div class='body'>"), "编辑已有的触发关键词输入html标签时");
            #endregion

            #region 15.	[接入条件设置]是否可以正常保存,当编辑已有的触发关键词超过20个字
            folder = PortalChromeDriver.CreateFolder(@"HI\15.[接入条件设置]是否可以正常保存,当编辑已有的触发关键词超过20个字");
            HIPage.ClearTriggers();
            HIPage.InputTrigger("Hi");
            HIPage.EditTrigger("012345678901234567890");
            HIPage.ClickSomewhereToSave();
            PortalChromeDriver.TakeScreenShot(folder, @"15.[接入条件设置]是否可以正常保存,当编辑已有的触发关键词超过20个字");
            Assert.IsTrue(HIPage.iskeywordAdded("01234567890123456789"), "编辑已有的触发关键词超过20个字");
            #endregion

            #region 16.	[接入条件设置]是否可以正常保存,当编辑已有的触发关键词跟其他的触发关键词重复时
            folder = PortalChromeDriver.CreateFolder(@"HI\16.[接入条件设置]是否可以正常保存,当编辑已有的触发关键词跟其他的触发关键词重复时");
            HIPage.ClearTriggers();
            HIPage.InputTrigger("Hi");
            HIPage.InputTrigger("Hello");
            HIPage.EditTrigger("Hi");
            HIPage.ClickSomewhereToSave();
            PortalChromeDriver.TakeScreenShot(folder, @"16.[接入条件设置]是否可以正常保存,当编辑已有的触发关键词跟其他的触发关键词重复时");
            Assert.IsTrue(HIPage.iskeywordAdded("Hello"), "编辑已有的触发关键词跟其他的触发关键词重复时");
            #endregion

            #region 17.	[接入条件设置]是否可以正常保存,当编辑已有的触发关键词包含非法词语
            folder = PortalChromeDriver.CreateFolder(@"HI\17.[接入条件设置]是否可以正常保存,当编辑已有的触发关键词包含非法词语");
            HIPage.ClearTriggers();
            HIPage.InputTrigger("Hi");
            HIPage.EditTrigger("赌博");
            HIPage.ByPassAlert();
            PortalChromeDriver.Refresh();
            PortalChromeDriver.TakeScreenShot(folder, @"17.[接入条件设置]是否可以正常保存,当编辑已有的触发关键词包含非法词语");
            Assert.IsTrue(HIPage.iskeywordAdded("Hi"), "编辑已有的触发关键词包含非法词语");
            #endregion
        }