Exemple #1
0
        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 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);
        }
Exemple #3
0
        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 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 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());
        }