Exemplo n.º 1
0
        public void YongHuXinXi008()
        {
            try
            {
                Log.Info("开始执行用例");
                //打开首页
                baseURL = UserHT["url"].ToString();
                driver.Navigate().GoToUrl(baseURL);
                //登录
                LoginOn loginOn = new LoginOn(driver);
                loginOn.CNLoginOn(UserHT["测试用户登录名"].ToString(), UserHT["测试用户登陆密码"].ToString());

                Thread.Sleep(MinSleepTime);

                //验证第三方账号绑定链接存在并点击
                Log.Info("个人中心第三方账号绑定链接");
                driver.FindElement(By.XPath("//ul/li/div[2]/dl[2]/dt/span")).Click();
                Thread.Sleep(MinSleepTime);
                driver.FindElement(By.Id("ctl00_MainContentPlaceHolder_PageLeft1_ThirdBind")).Click();
                //证书判断
                if (SeleniumFun.IsExists(driver, By.Id("overridelink")))
                {
                    driver.FindElement(By.Id("overridelink")).Click();
                    Thread.Sleep(3000);
                }
                Thread.Sleep(MinSleepTime);
                //验证跳转链接正确
                CtripAssert.Contains(driver, driver.FindElement(By.XPath("//div[@class='breadcrumb']")).Text, "第三方账号绑定", "验证跳转链接是否正确");
            }
            catch (Exception e)
            {
                new CtripException(driver, e.ToString(), this.GetType().ToString(), MethodBase.GetCurrentMethod().ToString());
            }
        }
Exemplo n.º 2
0
        public void YongHuXinXi012()
        {
            try
            {
                Log.Info("开始执行用例");
                //打开首页
                baseURL = UserHT["url"].ToString();
                driver.Navigate().GoToUrl(baseURL);
                //登录
                LoginOn loginOn = new LoginOn(driver);
                loginOn.CNLoginOn(UserHT["测试用户登录名"].ToString(), UserHT["测试用户登陆密码"].ToString());

                Thread.Sleep(MinSleepTime);

                //验证常用地址信息链接存在并点击
                Log.Info("验证常用旅客信息链接");
                driver.FindElement(By.Id("ctl00_MainContentPlaceHolder_PageLeft1_menu_manage_id")).Click();
                Thread.Sleep(MinSleepTime);
                driver.FindElement(By.Id("ctl00_MainContentPlaceHolder_PageLeft1_UsefulAddress")).Click();
                //证书判断
                if (SeleniumFun.IsExists(driver, By.Id("overridelink")))
                {
                    driver.FindElement(By.Id("overridelink")).Click();
                    Thread.Sleep(3000);
                }
                Thread.Sleep(MinSleepTime);
                //验证列表显示正常
                driver.FindElement(By.Id("txt_keyword")).SendKeys("公司");
                driver.FindElement(By.Id("bt_Search")).Click();
                Thread.Sleep(MinSleepTime);
                CtripAssert.AreEqual(driver, driver.FindElement(By.XPath("//ul/li/div[3]/div[2]/table/tbody/tr/td[2]")).Text, "公司", "验证列表显示是否正常");
                //修改常用地址
                driver.FindElement(By.XPath("//ul/li/div[3]/div[2]/table/tbody/tr/td[9]/a[1]")).Click();
                Thread.Sleep(MinSleepTime);
                driver.FindElement(By.Id("txt_Rep")).Clear();
                driver.FindElement(By.Id("txt_Rep")).SendKeys("令狐冲");
                driver.FindElement(By.Id("bt_SaveAdd")).Click();
                driver.FindElement(By.Id("input_pwd_check")).SendKeys(UserHT["测试用户登陆密码"].ToString());
                driver.FindElement(By.ClassName("btn_l3")).Click();
                Thread.Sleep(MinSleepTime);
                //验证修改是否成功
                driver.FindElement(By.XPath("//ul/li/div[3]/div[2]/table/tbody/tr/td[9]/a[1]")).Click();
                Thread.Sleep(MinSleepTime);
                CtripAssert.AreEqual(driver, driver.FindElement(By.Id("txt_Rep")).GetAttribute("value"), "令狐冲", "修改成功");
                //数据回滚
                driver.FindElement(By.XPath("//ul/li/div[3]/div[2]/table/tbody/tr/td[9]/a[1]")).Click();
                Thread.Sleep(MinSleepTime);
                driver.FindElement(By.Id("txt_Rep")).Clear();
                driver.FindElement(By.Id("txt_Rep")).SendKeys("测试");
                driver.FindElement(By.Id("bt_SaveAdd")).Click();
                driver.FindElement(By.Id("input_pwd_check")).SendKeys(UserHT["测试用户登陆密码"].ToString());
                driver.FindElement(By.ClassName("btn_l3")).Click();
                Thread.Sleep(MinSleepTime);
            }
            catch (Exception e)
            {
                new CtripException(driver, e.ToString(), this.GetType().ToString(), MethodBase.GetCurrentMethod().ToString());
            }
        }
Exemplo n.º 3
0
        public void PiaoQuanXinXiCase001()
        {
            try
            {
                Log.Info("开始执行用例");
                //打开首页
                baseURL = UserHT["url"].ToString();
                driver.Navigate().GoToUrl(baseURL);
                //登录
                LoginOn loginOn = new LoginOn(driver, LogWrite);
                loginOn.CNLoginOn(UserHT["测试用户登录名"].ToString(), UserHT["测试用户登陆密码"].ToString());

                Thread.Sleep(5000);

                //验证酒店消费卷余额
                Log.Info("验证酒店消费券余额");
                string Balance000 = driver.FindElement(By.XPath("//ul/li/div[3]/div[1]/div[3]/a[2]")).Text.ToString();
                CtripAssert.AreEqual(driver, Balance000, UserHT["酒店消费券余额"].ToString(), "验证酒店消费券余额");

                //验证酒店消费券链接跳转
                Log.Info("验证酒店消费券跳转");
                //driver.FindElement(By.XPath("//ul/li/div[3]/div[1]/div[3]/a[2]")).Click();
                driver.Navigate().GoToUrl("https://sinfo.testp.sh.ctriptravel.com/Balance/zh-cn/Coupon.aspx?type=tab");
                if (SeleniumFun.IsExists(driver, By.Id("overridelink")))
                {
                    driver.FindElement(By.Id("overridelink")).Click();
                }
                Thread.Sleep(5000);
                CtripAssert.Contains(driver, driver.FindElement(By.XPath("//ul/li/div[3]/div/ul[1]/li[1]")).Text, "消费券余额", "验证消费券跳转");
                //验证跳转后数据与跳转前相同
                CtripAssert.AreEqual(driver, driver.FindElement(By.XPath("//ul/li/div[3]/div/ul[1]/li[1]/span/em")).Text, Balance000, "验证消费券跳转余额");
            }
            catch (Exception e)
            {
                new CtripException(driver, e.ToString(), this.GetType().ToString(), MethodBase.GetCurrentMethod().ToString());
            }
        }
Exemplo n.º 4
0
        public void YongHuXinXi011()
        {
            try
            {
                Log.Info("开始执行用例");
                //打开首页
                baseURL = UserHT["url"].ToString();
                driver.Navigate().GoToUrl(baseURL);
                //登录
                LoginOn loginOn = new LoginOn(driver);
                loginOn.CNLoginOn(UserHT["测试用户登录名"].ToString(), UserHT["测试用户登陆密码"].ToString());

                Thread.Sleep(MinSleepTime);

                //验证常用旅客信息链接存在并点击
                Log.Info("验证常住酒店链接");
                driver.FindElement(By.Id("ctl00_MainContentPlaceHolder_PageLeft1_menu_manage_id")).Click();
                Thread.Sleep(MinSleepTime);
                driver.FindElement(By.Id("ctl00_MainContentPlaceHolder_PageLeft1_UsualHotel")).Click();
                //证书判断
                if (SeleniumFun.IsExists(driver, By.Id("overridelink")))
                {
                    driver.FindElement(By.Id("overridelink")).Click();
                    Thread.Sleep(3000);
                }
                Thread.Sleep(MinSleepTime);
                //验证列表显示正常
                driver.FindElement(By.Id("txt_keyword")).SendKeys("6+1");
                driver.FindElement(By.Id("bt_Search")).Click();
                Thread.Sleep(MinSleepTime);
                CtripAssert.AreEqual(driver, driver.FindElement(By.XPath("//ul/li/div[3]/div[5]/table/tbody/tr/td[2]/a")).Text, "6+1酒店连锁(上海陆家嘴店)(原路依斯康商务酒店)", "列表显示正常");
            }
            catch (Exception e)
            {
                new CtripException(driver, e.ToString(), this.GetType().ToString(), MethodBase.GetCurrentMethod().ToString());
            }
        }
Exemplo n.º 5
0
        public void YongHuXinXi006()
        {
            try
            {
                Log.Info("开始执行用例");
                //打开首页
                baseURL = UserHT["url"].ToString();
                driver.Navigate().GoToUrl(baseURL);
                //登录
                LoginOn loginOn = new LoginOn(driver);
                loginOn.CNLoginOn(UserHT["测试用户登录名"].ToString(), UserHT["测试用户登陆密码"].ToString());

                Thread.Sleep(MinSleepTime);

                //验证我的点评链接存在并点击
                Log.Info("个人中心消息提醒链接");
                driver.FindElement(By.Id("menu_person_icon_id")).Click();
                Thread.Sleep(MinSleepTime);
                driver.FindElement(By.Id("ctl00_MainContentPlaceHolder_PageLeft1_MessageRemind")).Click();
                //证书判断
                if (SeleniumFun.IsExists(driver, By.Id("overridelink")))
                {
                    driver.FindElement(By.Id("overridelink")).Click();
                    Thread.Sleep(3000);
                }
                Thread.Sleep(MinSleepTime);
                //验证列表显示正确
                driver.FindElement(By.Id("txt_Key")).SendKeys("奖品");
                driver.FindElement(By.Id("bt_Search")).Click();
                Thread.Sleep(MinSleepTime);
                CtripAssert.AreEqual(driver, driver.FindElement(By.XPath("//ul/li/div[3]/div[2]/div[2]/table/tbody/tr[1]/td[2]")).Text, "申领奖品", "验证消息列表显示正确");
            }
            catch (Exception e)
            {
                new CtripException(driver, e.ToString(), this.GetType().ToString(), MethodBase.GetCurrentMethod().ToString());
            }
        }
Exemplo n.º 6
0
        public void PiaoQuanXinXiCase002()
        {
            try
            {
                Log.Info("开始执行用例");
                //打开首页
                baseURL = UserHT["url"].ToString();
                driver.Navigate().GoToUrl(baseURL);
                //登录
                LoginOn loginOn = new LoginOn(driver, LogWrite);
                loginOn.CNLoginOn(UserHT["测试用户登录名"].ToString(), UserHT["测试用户登陆密码"].ToString());

                Thread.Sleep(15000);

                //验证抵用券余额
                Log.Info("验证抵用券余额");
                string Balance001 = driver.FindElement(By.XPath("//ul/li/div[3]/div[1]/div[3]/a[3]")).Text.ToString();
                CtripAssert.AreEqual(driver, Balance001, UserHT["抵用券余额"].ToString(), "验证抵用券余额");

                //验证抵用券链接跳转
                Log.Info("验证抵用券跳转");
                driver.FindElement(By.XPath("//ul/li/div[3]/div[1]/div[3]/a[3]")).Click();
                if (SeleniumFun.IsExists(driver, By.Id("overridelink")))
                {
                    driver.FindElement(By.Id("overridelink")).Click();
                }
                Thread.Sleep(5000);
                CtripAssert.Contains(driver, driver.FindElement(By.XPath("//ul/li/div[3]/div/ul/li[1]")).Text, "可用金额", "验证抵用券跳转");
                //验证跳转后数据与跳转前相同
                CtripAssert.AreEqual(driver, driver.FindElement(By.XPath("//ul/li/div[3]/div/ul/li[1]/span[1]/em")).Text, Balance001, "验证抵用券跳转余额");
            }
            catch (Exception e)
            {
                new CtripException(driver, e.ToString(), this.GetType().ToString(), MethodBase.GetCurrentMethod().ToString());
            }
        }
Exemplo n.º 7
0
        public void YongHuXinXi002()
        {
            try
            {
                Log.Info("开始执行用例");
                //打开首页
                baseURL = UserHT["url"].ToString();
                driver.Navigate().GoToUrl(baseURL);
                //登录
                LoginOn loginOn = new LoginOn(driver);
                loginOn.CNLoginOn(UserHT["测试用户登录名"].ToString(), UserHT["测试用户登陆密码"].ToString());

                Thread.Sleep(MinSleepTime);

                //展开个人中心菜单
                driver.FindElement(By.Id("menu_person_icon_id")).Click();
                Thread.Sleep(MinSleepTime);
                driver.FindElement(By.Id("ctl00_MainContentPlaceHolder_PageLeft1_MyAccount")).Click();
                //证书判断
                if (SeleniumFun.IsExists(driver, By.Id("overridelink")))
                {
                    driver.FindElement(By.Id("overridelink")).Click();
                    Thread.Sleep(3000);
                }
                Thread.Sleep(MinSleepTime);
                CtripAssert.Contains(driver, driver.FindElement(By.Id("info_title_id")).Text, "个人信息设置", "验证个人账户链接跳转");
                //修改个人信息
                driver.FindElement(By.Id("nickName")).Clear();
                driver.FindElement(By.Id("nickName")).SendKeys("一统江湖");
                driver.FindElement(By.Id("name")).Click();
                driver.FindElement(By.Id("name")).Clear();
                driver.FindElement(By.Id("name")).SendKeys("东方不败");
                driver.FindElement(By.Id("radioSexWoman")).Click();
                driver.FindElement(By.Id("btnSave")).Click();
                Thread.Sleep(MinSleepTime);
                driver.FindElement(By.Id("infoUpdateConfirmPwd")).Click();
                driver.FindElement(By.Id("infoUpdateConfirmPwd")).SendKeys(UserHT["测试用户登陆密码"].ToString());
                driver.FindElement(By.Id("btnInfoUpdateConfirm")).Click();
                Thread.Sleep(MIDSleepTime);
                CtripAssert.Contains(driver, driver.FindElement(By.XPath("//container/div[2]/div[2]/div[1]")).Text, "信息修改成功", "修改个人信息成功");
                Thread.Sleep(MIDSleepTime);
                driver.FindElement(By.Id("btnInfoUpdateSuccessConfirm")).Click();
                Thread.Sleep(MIDSleepTime);
                bool flag = driver.FindElement(By.Id("radioSexWoman")).Selected;
                CtripAssert.AreEqual(driver, flag.ToString(), "True", "");
                CtripAssert.AreEqual(driver, driver.FindElement(By.Id("nickName")).GetAttribute("value"), "一统江湖", "");
                CtripAssert.AreEqual(driver, driver.FindElement(By.Id("name")).GetAttribute("value"), "东方不败", "修改成功");
                //数据回滚
                driver.FindElement(By.Id("nickName")).Clear();
                driver.FindElement(By.Id("nickName")).SendKeys("独步天下");
                driver.FindElement(By.Id("name")).Click();
                driver.FindElement(By.Id("name")).Clear();
                driver.FindElement(By.Id("name")).SendKeys("令狐冲");
                driver.FindElement(By.Id("radioSexMan")).Click();
                driver.FindElement(By.Id("btnSave")).Click();
                Thread.Sleep(MinSleepTime);
                driver.FindElement(By.Id("infoUpdateConfirmPwd")).Click();
                driver.FindElement(By.Id("infoUpdateConfirmPwd")).SendKeys(UserHT["测试用户登陆密码"].ToString());
                driver.FindElement(By.Id("btnInfoUpdateConfirm")).Click();
                Thread.Sleep(MinSleepTime);
                driver.FindElement(By.Id("btnInfoUpdateSuccessConfirm")).Click();
                Thread.Sleep(MinSleepTime);
                //修改个人密码
                driver.FindElement(By.XPath("//ul/li/div[3]/div[2]/div/h3")).Click();
                driver.FindElement(By.Id("oldPwd")).SendKeys(UserHT["测试用户登陆密码"].ToString());
                driver.FindElement(By.Id("newPwd")).SendKeys("111111");
                driver.FindElement(By.Id("confirmNewPwd")).SendKeys("111111");
                driver.FindElement(By.Id("btnPwdSave")).Click();
                Thread.Sleep(MinSleepTime);
                CtripAssert.Contains(driver, "密码修改成功。", driver.FindElement(By.XPath("//container/div[2]/div[2]/div[1]")).Text, "密码修改功能验证");
                Thread.Sleep(MinSleepTime);
                driver.FindElement(By.Id("btnPwdUpdateSuccessConfirm")).Click();
                Thread.Sleep(MIDSleepTime);
                //数据回滚
                driver.FindElement(By.XPath("//ul/li/div[3]/div[2]/div/h3")).Click();
                driver.FindElement(By.Id("oldPwd")).SendKeys("111111");
                driver.FindElement(By.Id("newPwd")).SendKeys(UserHT["测试用户登陆密码"].ToString());
                driver.FindElement(By.Id("confirmNewPwd")).SendKeys(UserHT["测试用户登陆密码"].ToString());
                driver.FindElement(By.Id("btnPwdSave")).Click();
                Thread.Sleep(MIDSleepTime);
                driver.FindElement(By.XPath("//container/div[2]/div[2]/div[1]")).Click();
            }

            catch (Exception e)
            {
                new CtripException(driver, e.ToString(), this.GetType().ToString(), MethodBase.GetCurrentMethod().ToString());
            }
        }