public void OpenFirstDocketFromGrid() { IsropaLogin.Login(); SelectClerkMenuFromMainPage.SelectClerkMenu(); //Double click the docket to open it var element = GenericHelper.WaitForElementAndGetIt(ObjectRepository.Driver, By.XPath("//table[@id='ctl00_ContentPlaceHolder1_productGridView']/descendant::tr[2]")); MouseActionsHelper.DoubleClick(element); BrowserHelper.SwitchToWindow(1); //locate the service table and pull all the services var ServicesList = ObjectRepository.Driver.FindElements(By.Id("ctl00_ContentPlaceHolder1_productGridView")); foreach (var item in ServicesList) { Console.WriteLine(item.Text); } //locate the first service and perform a right click on it var Service = GenericHelper.WaitForElementAndGetIt(ObjectRepository.Driver, By.XPath("//table[@id='ctl00_ContentPlaceHolder1_productGridView']/descendant::tr[2]")); MouseActionsHelper.RightClick(Service); Thread.Sleep(3000); }
public void GetPaxNumber() { IsropaLogin.Login(); SelectClerkMenuFromMainPage.SelectClerkMenu(); // wait until find the " File " tab And Click it GenericHelper.WaitForElementAndGetIt(ObjectRepository.Driver, By.XPath("//div[@id='ctl00_ContentPlaceHolder1_TopRadMenu1']/descendant::span[text()='File']")).Click(); //wait for the " open exsiting file " option and click it var ExistingFile = GenericHelper.WaitForElementAndGetIt(ObjectRepository.Driver, By.XPath("//div[@id='ctl00_ContentPlaceHolder1_TopRadMenu1']/descendant::span[text()='Open Existing File']")); ExistingFile.Click(); GenericHelper.OpenExistingFile("170228"); /* now switch to the Child window*/ BrowserHelper.SwitchToWindow(1); //locate the "Show All Clients" checkbox and click it GenericHelper.WaitForElementAndGetIt(ObjectRepository.Driver, By.Id("ctl00_ContentPlaceHolder1_chkShowAllClients")).Click(); // wait 1 second Thread.Sleep(1000); //compare between the displayed number and the actual rows number if they are equals var DisplayesNumber = TableHelper.GetExpectedPaxNumber(By.XPath("//table[@id='ctl00_ContentPlaceHolder1_GVPaxs']/tbody/child::tr")); Assert.AreEqual(DisplayesNumber, TableHelper.GetActualPaxNumber()); Console.WriteLine("This Docket Has .{0} Pax", TableHelper.GetActualPaxNumber()); // return DisplayesNumber; }
public void ViewHotelList() { IsropaLogin.Login(); SelectClerkMenuFromMainPage.SelectClerkMenu(); //wait until the left panel is displayed and click hotel list option GenericHelper.WaitForElementAndGetIt(ObjectRepository.Driver, By.XPath("//div[@id='ctl00_cntClerkMenu1_UpdatePanel1']//span[text()='Hotels List ']")).Click(); Thread.Sleep(3000); }
public void GetDocketsNumber() { IsropaLogin.Login(); SelectClerkMenuFromMainPage.SelectClerkMenu(); //locate the table of the docket list and store all the dockets number in the DocketNumberList var DocketsNumberList = ObjectRepository.Driver.FindElements(By.XPath("//table[@id='ctl00_ContentPlaceHolder1_productGridView']/tbody/tr/td[1]")); foreach (var item in DocketsNumberList) { Console.WriteLine(item.Text); } }
public void getAllElements() { IsropaLogin.Login(); SelectClerkMenuFromMainPage.SelectClerkMenu(); var element = GenericHelper.WaitForElementAndGetIt(ObjectRepository.Driver, By.XPath("//table[@id='ctl00_ContentPlaceHolder1_productGridView']/descendant::tr[2]")); MouseActionsHelper.DoubleClick(element); Thread.Sleep(3000); //locate the table element IWebElement docketTable = ObjectRepository.Driver.FindElement(By.XPath("//table[@id='ctl00_ContentPlaceHolder1_productGridView']/child::tbody")); //locate the rows in the original table docketTable List <IWebElement> tableRows = new List <IWebElement>(docketTable.FindElements(By.TagName("tr"))); Console.WriteLine("current table has .{0}", tableRows.Count); foreach (var colElement in tableRows) { //Getting Number of cols in row table IList <IWebElement> cols = new List <IWebElement>(colElement.FindElements(By.TagName("td"))); if (cols.Count > 0) { //Iterating through each cell foreach (var cellData in cols) { //getting each cell data if (cellData.Text == "CALF") { ServiceAbbr.Add(cellData); } //Console.WriteLine("Cell No " + data); } } } Console.WriteLine("ServiceAbbr count Is.{0}", ServiceAbbr.Count); // List<IWebElement> CellsList = new List<IWebElement>(docketTable.FindElements(By.TagName("td"))); //List<IWebElement> templist = new List<IWebElement>(tableRows[0].FindElements(By.TagName("td"))); }
public void ServisResrvation() { IsropaLogin.Login(); SelectClerkMenuFromMainPage.SelectClerkMenu(); //wait until the left menu dispalyed GenericHelper.WaitForElementAndGetIt(ObjectRepository.Driver, By.XPath("//table[@id='ctl00_cntClerkMenu1_pnlLeftMenu']//span[text()='TCO Package ']")).Click(); //wait until the Components is displayed GenericHelper.WaitForElementAndGetIt(ObjectRepository.Driver, By.XPath("//ul[@id='nested']/li[2]/h3")).Click(); //wait until servises option is displayed GenericHelper.WaitForElementAndGetIt(ObjectRepository.Driver, By.XPath("//ul[@id='nested']/li[2]/descendant::div[4]")).Click(); Thread.Sleep(3000); }
public void DispalyTodayDockets() { //first LogIn IsropaLogin.Login(); // select Clerk menu SelectClerkMenuFromMainPage.SelectClerkMenu(); // wait until checkbox open today is visile GenericHelper.WaitForElementAndGetIt(ObjectRepository.Driver, By.Id("ctl00_ContentPlaceHolder1_chkOpenedToday")).Click(); //click the "Show" button GenericHelper.WaitForElementAndGetIt(ObjectRepository.Driver, By.Id("ctl00_ContentPlaceHolder1_btnShow")).Click(); //Wait and display the number of dockets Console.WriteLine("files #:{0} Files", GenericHelper.WaitForElementAndGetIt(ObjectRepository.Driver, By.Id("ctl00_ContentPlaceHolder1_lblShowNoOfFiles")).Text.ToString()); }
public void SelectFirstDocket() { IsropaLogin.Login(); SelectClerkMenuFromMainPage.SelectClerkMenu(); var element = GenericHelper.WaitForElementAndGetIt(ObjectRepository.Driver, By.XPath("//table[@id='ctl00_ContentPlaceHolder1_productGridView']/descendant::tr[2]")); MouseActionsHelper.DoubleClick(element); Thread.Sleep(3000); //select all the docket services var ServicesList = ObjectRepository.Driver.FindElements(By.XPath("//table[@id='ctl00_ContentPlaceHolder1_productGridView']")); foreach (var item in ServicesList) { Console.WriteLine(); } }
public void GetCalimity() { IsropaLogin.Login(); SelectClerkMenuFromMainPage.SelectClerkMenu(); // wait until find the " File " tab And Click it GenericHelper.WaitForElementAndGetIt(ObjectRepository.Driver, By.XPath("//div[@id='ctl00_ContentPlaceHolder1_TopRadMenu1']/descendant::span[text()='File']")).Click(); //wait for the " open exsiting file " option and click it var ExistingFile = GenericHelper.WaitForElementAndGetIt(ObjectRepository.Driver, By.XPath("//div[@id='ctl00_ContentPlaceHolder1_TopRadMenu1']/descendant::span[text()='Open Existing File']")); ExistingFile.Click(); GenericHelper.OpenExistingFile("170228"); /* now switch to the Child window*/ BrowserHelper.SwitchToWindow(1); //locate the table element IWebElement docketTable = ObjectRepository.Driver.FindElement(By.XPath("//table[@id='ctl00_ContentPlaceHolder1_productGridView']/child::tbody")); //locate the rows in the original table docketTable List <IWebElement> tableRows = new List <IWebElement>(docketTable.FindElements(By.TagName("tr"))); //loop over the tablerow the select the " CALF " Cell and its rate int rowIndx = 1; decimal TotalCalimity = 0; foreach (var item in tableRows) { var cellText = ObjectRepository.Driver.FindElement(By.XPath("//table[@id='ctl00_ContentPlaceHolder1_productGridView']/child::tbody/child::tr[" + rowIndx + "]/td[2]")).Text; if (cellText == "CALF") { var CalfRate = ObjectRepository.Driver.FindElement(By.XPath("//table[@id='ctl00_ContentPlaceHolder1_productGridView']/child::tbody/child::tr[1]/td[8]")).Text; TotalCalimity += GenericHelper.ConvertToDecimal(CalfRate); rowIndx++; } } Console.WriteLine("Total Calimity fund for this Docket Is. {0}\t", TotalCalimity); // return TotalCalimity; }
public void ReserveAccOnly() { IsropaLogin.Login(); SelectClerkMenuFromMainPage.SelectClerkMenu(); Console.WriteLine("Done...."); //wait until the left menu dispalyed GenericHelper.WaitForElementAndGetIt(ObjectRepository.Driver, By.XPath("//table[@id='ctl00_cntClerkMenu1_pnlLeftMenu']//span[text()='TCO Package ']")).Click(); //wait until the Components is displayed GenericHelper.WaitForElementAndGetIt(ObjectRepository.Driver, By.XPath("//ul[@id='nested']/li[2]/h3")).Click(); //wait until Accomodation only tab is displayed GenericHelper.WaitForElementAndGetIt(ObjectRepository.Driver, By.XPath("//ul[@id='nested']/li[2]/descendant::div[2]")).Click(); //click the country combobox GenericHelper.WaitForElementAndGetIt(ObjectRepository.Driver, By.Id("//div[@id='cboxClose']")).Click(); Thread.Sleep(2000); }
public void CharterFlightReservation() { IsropaLogin.Login(); SelectClerkMenuFromMainPage.SelectClerkMenu(); //wait until the left menu dispalyed and click TCO Packages GenericHelper.WaitForElementAndGetIt(ObjectRepository.Driver, By.XPath("//table[@id='ctl00_cntClerkMenu1_pnlLeftMenu']//span[text()='TCO Package ']")).Click(); //wait until the Components is displayed GenericHelper.WaitForElementAndGetIt(ObjectRepository.Driver, By.XPath("//ul[@id='nested']/li[2]/h3")).Click(); //wait until the flight option displayed then click it GenericHelper.WaitForElementAndGetIt(ObjectRepository.Driver, By.XPath("//ul[@id='nested']/li[2]/descendant::div[3]")).Click(); Thread.Sleep(3000); //Switch to iframe BrowserHelper.SwitchToFrame(1); Thread.Sleep(1000); //click the flight comboBox GenericHelper.WaitForElementAndGetIt(ObjectRepository.Driver, By.XPath("//table[@id='tblFPCalculation']//tr[1]//select[@id='ddlFlight']")).Click(); //select a value from the combo box DropDownListHelper.SelectElementByIndex(By.XPath("//table[@id='tblFPCalculation']//tr[1]//select[@id='ddlFlight']"), 1); //get the Paxes number from the textboxes "Adults" ,"Children" and "infant " var AdultsNoOriginalValue = ObjectRepository.Driver.FindElement(By.Id("txtADLTs")).GetAttribute("value"); //var AdutsNewValue = GenericHelper.ConvertStringIntoInt(AdultsNoOriginalValue); //AdutsNewValue++; ////convert the new value into string //string newValue = AdutsNewValue.ToString(); //ObjectRepository.Driver.FindElement(By.Id("txtADLTs")).Clear(); //ObjectRepository.Driver.FindElement(By.Id("txtADLTs")).SendKeys(newValue); //Console.WriteLine("Adults No is :{0}",AdultsNoOriginalValue); //click the "Calc" Button GenericHelper.WaitForElementAndGetIt(ObjectRepository.Driver, By.Id("btnCalcPrice")).Click(); //Wait until the " Reserve " button will be displayed then Click it GenericHelper.WaitForElementAndGetIt(ObjectRepository.Driver, By.Id("btnRsrv")).Click(); // the New Pax File Page -- is not a new Iframe it is the same frame //try to test any element in the new frame Console.WriteLine(ObjectRepository.Driver.FindElement(By.Id("ctl00_ContentPlaceHolder1_lblPageTitle")).Text); //enter the first name ObjectRepository.Driver.FindElement(By.Id("ctl00_ContentPlaceHolder1_Room1_AdultGuest1_txtFirstName")).SendKeys("Test1"); ObjectRepository.Driver.FindElement(By.Id("ctl00_ContentPlaceHolder1_Room1_AdultGuest1_txtLastName")).SendKeys("FamilyTest1"); ObjectRepository.Driver.FindElement(By.Id("ctl00_ContentPlaceHolder1_Room1_AdultGuest1_CLChildDOB_Image1")).Click(); Thread.Sleep(10000); }
public void IsCalimityAppropriate() { IsropaLogin.Login(); SelectClerkMenuFromMainPage.SelectClerkMenu(); // wait until find the " File " tab And Click it GenericHelper.WaitForElementAndGetIt(ObjectRepository.Driver, By.XPath("//div[@id='ctl00_ContentPlaceHolder1_TopRadMenu1']/descendant::span[text()='File']")).Click(); //wait for the " open exsiting file " option and click it var ExistingFile = GenericHelper.WaitForElementAndGetIt(ObjectRepository.Driver, By.XPath("//div[@id='ctl00_ContentPlaceHolder1_TopRadMenu1']/descendant::span[text()='Open Existing File']")); ExistingFile.Click(); GenericHelper.OpenExistingFile(TestContext.DataRow["DocketID"].ToString()); //----------------------------------------------------------------------------------------------------------- /* now switch to the Child window*/ BrowserHelper.SwitchToWindow(1); //locate the "Show All Clients" checkbox and click it GenericHelper.WaitForElementAndGetIt(ObjectRepository.Driver, By.Id("ctl00_ContentPlaceHolder1_chkShowAllClients")).Click(); // wait 1 second Thread.Sleep(1000); //compare between the displayed number and the actual rows number if they are equals var DisplayedNumber = TableHelper.GetExpectedPaxNumber(By.XPath("//table[@id='ctl00_ContentPlaceHolder1_GVPaxs']/tbody/child::tr")); Assert.AreEqual(DisplayedNumber, TableHelper.GetActualPaxNumber()); //locate the table element IWebElement docketTable = ObjectRepository.Driver.FindElement(By.XPath("//table[@id='ctl00_ContentPlaceHolder1_productGridView']/child::tbody")); //locate the rows in the original table docketTable List <IWebElement> tableRows = new List <IWebElement>(docketTable.FindElements(By.TagName("tr"))); //loop over the tablerow the select the " CALF " Cell and its rate int rowIndx = 1; decimal CALF = 0; decimal TotalServicesAmount = 0; foreach (var item in tableRows) { if (rowIndx <= tableRows.Count) { var cellText = ObjectRepository.Driver.FindElement(By.XPath("//table[@id='ctl00_ContentPlaceHolder1_productGridView']/child::tbody/child::tr[" + rowIndx + "]/td[2]")).Text; var AmountText = ObjectRepository.Driver.FindElement(By.XPath("//table[@id='ctl00_ContentPlaceHolder1_productGridView']/child::tbody/child::tr[" + rowIndx + "]/td[8]")); TotalServicesAmount += GenericHelper.ConvertToDecimal(AmountText.Text); if (cellText == "CALF") { var CalfRate = ObjectRepository.Driver.FindElement(By.XPath("//table[@id='ctl00_ContentPlaceHolder1_productGridView']/child::tbody/child::tr[" + rowIndx + "]/td[8]")).Text; CALF += GenericHelper.ConvertToDecimal(CalfRate); rowIndx++; } else { rowIndx++; } } } /* Verifying if the docket has services at all,by checking is CALF is bigger than Zero * COMPLETE HERE THE CODE * */ var CALF1 = Convert.ToDouble(CALF); var expectedCalimityRate = CalculateCalimityFund(DisplayedNumber); try { Assert.AreEqual(expectedCalimityRate, CALF1, "Fail at docket" + TestContext.DataRow["DocketID"].ToString()); Thread.Sleep(1000); Console.WriteLine("Total Pax :{0}", DisplayedNumber); Console.WriteLine("Expected Calimity fund Is. {0}", expectedCalimityRate); Console.WriteLine("The calimity Fund in Docket:{0} is Appropriate : {1} Euro", TestContext.DataRow["DocketID"].ToString(), expectedCalimityRate); Console.WriteLine("total services = :{0}", TotalServicesAmount); NavigationHelper.TcoLogOut(); } catch { Console.Beep(); Console.Beep(); Console.WriteLine("Total Pax :{0}", DisplayedNumber); Console.WriteLine("Expected Calimity fund Is. {0}", expectedCalimityRate); Console.WriteLine("The calimity Fund in Docket:{0} Is Not Appropriate : {1} Euro", TestContext.DataRow["DocketID"].ToString(), CALF1); NavigationHelper.TcoLogOut(); } Assert.AreEqual("TCO Log In", WindowHelper.GetTitle()); }