public void CheckReplyBackFromHI_NotInH5()
        {
            //Portal确保HI是Turn on的状态
            WeChatManagermentPage.GoToHIPage();
            HIPage.TurnOnSetup();
            //H5页面进入平台测试账号对话窗口
            Mobile_WeChat_Utility.GetToTestAccount();
            //Thread.Sleep(5*1000);
            //H5呼叫客服
            Mobile_WeChat_Utility.GetHiCard("客服");
            Mobile_WeChat_Utility.XB_SendMessage("这里是测试账号");

            //退出当前对话窗口
            Mobile_WeChat_Utility.BackButtonClick();

            //Portal端客服回复
            HIPage.OpenHiChatWindow();
            HIPage.GetTestUserFromUserList();
            Thread.Sleep(90 * 1000);
            Mobile_WeChat_Utility.SendMessage("a");
            Thread.Sleep(10 * 1000);;
            HIPage.SendMessage("这里是客服");
            Thread.Sleep(2 * 1000);
            //验证最后一条消息是不是客服回复的消息
            string foler = PortalChromeDriver.CreateFolder(@"HI\H5.11.当用户不在H5对话窗口时, 是否可以收到客服的回复");

            MobileAndroidDriver.GetScreenshot(foler, "H5");
            Assert.IsTrue(Mobile_WeChat_Utility.IsAt(HIMobileH5Element.ReplyCardFromHI));
            Mobile_WeChat_Utility.ClickReplyCard();
            Assert.IsTrue(Mobile_WeChat_Utility.IsAtPerXpath(string.Format(HIMobileH5Element.ReplyFromHi, "这里是客服")));
            Mobile_WeChat_Utility.BackButtonClick();
        }
        public void Can_EditTriger_InHI_ComeFirst()
        {
            string foler = PortalChromeDriver.CreateFolder(@"HI\19.[接入条件设置]是否可以正常保存,当编辑已有的触发关键词内容与自定义关键词回复相同的内容时");

            LoginPage.GoTo();
            HomePage.ClickWeChatApp("平台测试账号2");
            //Go to AI AutoReply Page
            WeChatManagermentPage.GoTo_AutoReply_Page();
            //AutoReplyPage.TurnOnAutoReply();\
            AutoReplyPage.AddAutoReply("A", "Hi", "这里是自动回复");

            PortalChromeDriver.TakeScreenShot(foler, "添加自动回复关键词");
            WeChatManagermentPage.GoToHIPage();
            HIPage.ClickSettings();
            HIPage.SwichHISettingTab(HIPortalPageUIElement.SubTabHITrigger);
            HIPage.ClearTriggers();
            HIPage.InputTrigger("Hello");
            HIPage.EditTrigger("Hi");
            PortalChromeDriver.TakeScreenShot(foler, "编辑HITrigger");
            //Trigger Card In H5
            //H5页面进入平台测试账号对话窗口
            Mobile_WeChat_Utility.GetToTestAccount();
            //H5呼叫客服
            Mobile_WeChat_Utility.SendMessage("Hi");
            MobileAndroidDriver.GetScreenshot(foler, "19.[接入条件设置]是否可以正常保存,当编辑已有的触发关键词内容与自定义关键词回复相同的内容时");
            Assert.IsTrue(Mobile_WeChat_Utility.IsAt(HIMobileH5Element.HiCardXpath), "编辑已有触发关键词后,HI触发关键词应优先");
        }
        public void TriggerHiCardAfterEditTriger()
        {
            //Portal确保HI是Turn on的状态
            WeChatManagermentPage.GoToHIPage();
            HIPage.TurnOnSetup();
            HIPage.ClearTriggers();
            #region 修改设置好的关键词
            HIPage.InputTrigger("Hi");
            HIPage.EditTrigger("append");
            HIPage.ClickSomewhereToSave();
            #endregion

            //H5页面进入平台测试账号对话窗口
            Mobile_WeChat_Utility.GetToTestAccount();
            Mobile_WeChat_Utility.ClearAllRecord();
            //H5呼叫客服
            Mobile_WeChat_Utility.SendMessage("append");
            Assert.IsTrue(Mobile_WeChat_Utility.IsAt(HIMobileH5Element.HiCardXpath));

            Mobile_WeChat_Utility.ClearAllRecord();
            Thread.Sleep(5 * 1000);
            Mobile_WeChat_Utility.SendMessage("Hi");
            Thread.Sleep(5 * 1000);
            string foler = PortalChromeDriver.CreateFolder(@"HI\H5.4.修改设置好的关键词后,能否正常触发人工客服card");
            MobileAndroidDriver.GetScreenshot(foler, "H5");
            Assert.IsFalse(Mobile_WeChat_Utility.IsAt(HIMobileH5Element.HiCardXpath));
        }
        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 IsHICardAvailableAfterHITurnOff()
        {
            //Portal确保HI是Turn on的状态
            WeChatManagermentPage.GoToHIPage();
            HIPage.TurnOnSetup();
            //H5页面进入平台测试账号对话窗口
            Mobile_WeChat_Utility.GetToTestAccount();
            //清空聊天记录
            Mobile_WeChat_Utility.ClearAllRecord();
            //H5呼叫客服
            Mobile_WeChat_Utility.SendMessage("客服");
            //关闭HI
            Utility.TurnOff();
            Mobile_WeChat_Utility.ClickHICard();
            string foler = PortalChromeDriver.CreateFolder(@"HI\H5.23.人工客服功能关闭,是否可以打开H5对话窗口");

            MobileAndroidDriver.GetScreenshot(foler, "H5");
            //Assert.IsTrue(HIMobileH5.IsAtPerXpath(HIMobileH5Element.HIOffError));
            Assert.IsFalse(Mobile_WeChat_Utility.IsAt(HIMobileH5Element.HiCardXpath));
            Mobile_WeChat_Utility.BackButtonClick();
        }
        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));
        }
        public void FaceRanking_TurnOff_Weibo()
        {
            string filePath = PortalChromeDriver.CreateFolder(@"拼颜值\14.检查是否可以正常关闭”拼颜值“的功能");

            MobileAndroidDriver.AndroidInitialize_Weibo();
            Mobile_Weibo_Utility.Follow();
            FaceRankingMobilePage_Weibo.ClickFaceRanking();
            FaceRankingMobilePage_Weibo.FaceRankingFromFile(SecretRelationshipTest.美男美女);
            MobileAndroidDriver.GetScreenshot(filePath, "关闭前拼颜值正常使用,图片显示描述语");
            Assert.IsTrue(Mobile_WeChat_Utility.IsAtPerXpath(FaceRankingMobileElement.Comment), "关闭前拼颜值正常使用,图片显示描述语");
            //停用拼颜值
            Utility.TurnOff();
            string turnOffPath = PortalChromeDriver.CreateFolder(@"拼颜值\19.是否可以停用'拼颜值'功能");

            PortalChromeDriver.TakeScreenShot(turnOffPath, "Portal是否能正常关闭拼颜值");
            Assert.IsTrue(!Utility.IsTurnOn(), "Portal是否能正常关闭拼颜值");

            Mobile_Weibo_Utility.BackWards();
            MobileAndroidDriver.ClickElemnetPerName(FaceRankingMobileElement.Menuitem);
            MobileAndroidDriver.GetScreenshot(filePath, "关闭拼颜值技能后H5端是否能正常使用");
            Assert.IsFalse(Mobile_WeChat_Utility.IsAt(FaceRankingMobileElement.AccountFaceRanking), "关闭拼颜值技能后H5端是否能正常使用");
        }