Exemplo n.º 1
0
 public void DianPingChaXunCase001()
 {
     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(MIDSleepTime);
         //订单页面跳转
         Log.Info("订单页面跳转");
         driver.FindElement(By.Id("ctl00_MainContentPlaceHolder_PageLeft1_HotelOrder")).Click();
         Thread.Sleep(MinSleepTime);
         Log.Info("选择国内酒店");
         SeleniumFun.SelectByText(driver.FindElement(By.Id("ddl_orderRange")), "国内酒店");
         Log.Info("返回订单查询结果");
         driver.FindElement(By.Id("btn_search")).Click();
         Thread.Sleep(MinSleepTime);
         Log.Info("点击具体订单");
         driver.FindElement(By.XPath("//ul/li/div[3]/div[5]/div[2]/table/tbody/tr[1]/td[2]")).Click();
         Bcom.SwitchPage(driver);
         SeleniumFun.CheckSecurity(driver);
         Thread.Sleep(MIDSleepTime);
         //验证跳转页面正确
         CtripAssert.Contains(driver, driver.FindElement(By.ClassName("mem_location")).Text, "酒店订单", "验证跳转页面");
     }
     catch (Exception e)
     {
         new CtripException(driver, e.ToString(), this.GetType().ToString(), MethodBase.GetCurrentMethod().ToString());
     }
 }
Exemplo n.º 2
0
        public void DingDanGuanLiCase002()
        {
            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("验证订单管理全部订单链接");
                driver.FindElement(By.XPath("//ul/li/div[2]/dl[1]/dd[1]/a")).Click();
                Thread.Sleep(MinSleepTime);
                //验证跳转链接正确
                CtripAssert.Contains(driver, driver.FindElement(By.XPath("//ul/li/div[3]/div[3]/div[1]/h3")).Text, "待完成的订单", "验证跳转链接是否正确");
                //设置时间区间显示订单数
                TestLog.WriteLine("验证不同时间区间订单显示");
                TestLog.WriteLine("检查已完成订单");
                TestLog.WriteLine("检查最近一个月已完成订单数");
                String notendtext = driver.FindElement(By.Id("h3_contianerF")).Text;
                int    flagA      = int.Parse(notendtext.Substring(notendtext.IndexOf('(') + 1, notendtext.IndexOf(')') - notendtext.IndexOf('(') - 1));
                CtripAssert.IsTrue(driver, flagA >= 0);
                TestLog.WriteLine("检查最近三个月已完成订单数");
                SeleniumFun.SelectByText(driver.FindElement(By.Id("sel_orderrange")), "最近3个月订单");
                Thread.Sleep(MIDSleepTime);
                int flagB = int.Parse(notendtext.Substring(notendtext.IndexOf('(') + 1, notendtext.IndexOf(')') - notendtext.IndexOf('(') - 1));
                CtripAssert.IsTrue(driver, flagB >= flagA);
                TestLog.WriteLine("检查最近一年已完成订单数");
                SeleniumFun.SelectByText(driver.FindElement(By.Id("sel_orderrange")), "最近1年订单");
                Thread.Sleep(MIDSleepTime);
                int flagC = int.Parse(notendtext.Substring(notendtext.IndexOf('(') + 1, notendtext.IndexOf(')') - notendtext.IndexOf('(') - 1));
                CtripAssert.IsTrue(driver, flagC >= flagA);
            }
            catch (Exception e)
            {
                new CtripException(driver, e.ToString(), this.GetType().ToString(), MethodBase.GetCurrentMethod().ToString());
            }
        }
Exemplo n.º 3
0
 public void YongHuXinXi010()
 {
     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_Passenger")).Click();
         //证书判断
         SeleniumFun.CheckSecurity(driver);
         Thread.Sleep(MinSleepTime);
         //验证列表显示正常
         driver.FindElement(By.Id("txt_keyword")).SendKeys("test");
         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[1]/td[2]")).Text, "test/test", "列表显示正常");
         //修改常用旅客信息
         driver.FindElement(By.XPath("//ul/li/div[3]/div[2]/table/tbody/tr[1]/td[9]/a[1]")).Click();
         Thread.Sleep(MIDSleepTime);
         driver.FindElement(By.Id("txt_namecn")).Clear();
         driver.FindElement(By.Id("txt_namecn")).SendKeys("令狐冲");
         driver.FindElement(By.Id("txt_mobile")).Clear();
         driver.FindElement(By.Id("txt_mobile")).SendKeys("13888888888");
         SeleniumFun.SelectByText(driver.FindElement(By.ClassName("vam")), "身份证");
         driver.FindElement(By.XPath("//ul/li/div[3]/div[5]/div[2]/div[3]/ul/li[1]/input[1]")).Clear();
         driver.FindElement(By.XPath("//ul/li/div[3]/div[5]/div[2]/div[3]/ul/li[1]/input[1]")).SendKeys("21080219900409251x");
         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[1]/td[9]/a[1]")).Click();
         CtripAssert.AreEqual(driver, driver.FindElement(By.Id("txt_namecn")).GetAttribute("value"), "令狐冲");
         CtripAssert.AreEqual(driver, driver.FindElement(By.Id("txt_mobile")).GetAttribute("value"), "13888888888");
         CtripAssert.AreEqual(driver, driver.FindElement(By.ClassName("vam")).GetAttribute("value"), "1");
         CtripAssert.AreEqual(driver, driver.FindElement(By.XPath("//ul/li/div[3]/div[5]/div[2]/div[3]/ul/li[1]/input[1]")).GetAttribute("value"), "21080219900409251x", "修改成功");
         //数据回滚
         driver.FindElement(By.XPath("//ul/li/div[3]/div[2]/table/tbody/tr[1]/td[9]/a[1]")).Click();
         Thread.Sleep(MIDSleepTime);
         driver.FindElement(By.Id("txt_namecn")).Clear();
         driver.FindElement(By.Id("txt_mobile")).Clear();
         driver.FindElement(By.Id("txt_mobile")).SendKeys("13111111111");
         SeleniumFun.SelectByText(driver.FindElement(By.ClassName("vam")), "护照");
         driver.FindElement(By.XPath("//ul/li/div[3]/div[5]/div[2]/div[3]/ul/li[1]/input[1]")).Clear();
         driver.FindElement(By.XPath("//ul/li/div[3]/div[5]/div[2]/div[3]/ul/li[1]/input[1]")).SendKeys("chinesehz001");
         driver.FindElement(By.XPath("//ul/li/div[3]/div[5]/div[2]/div[3]/ul/li[1]/input[2]")).SendKeys("2015-01-01");
         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());
     }
 }