コード例 #1
0
        public void Add_Existing_Port_Triggering_Rules()
        {
            //Add_Existing_Port_Triggering_Rules
            WebDocument webDocument = "/dom[@domain='192.168.0.1']";

            TableTag myTable = webDocument.FindSingle("/dom[@domain='192.168.0.1']//table[#'portTriggeringTable']");

            //highlight the new port triggering rule
            IList <TrTag> rows    = myTable.Find <TrTag>("./tbody//tr");
            int           rowsCnt = rows.Count;

            Report.Info("Total Rules(After Add)", rowsCnt.ToString());

            if (TotalRows > 1 && TotalRows == rowsCnt)  // no rows are added
            {
                Report.Success("PortTriggerRule", "Unable to add this new rule because of the below reasons !!! ");
                myTable.EnsureVisible();
                Delay.Seconds(5);
                //Report.Screenshot("PortTriggerRule",myTable.Element,true);
                Report.Screenshot();
            }
            else
            {
                Report.Failure("PortTriggerRule", "Duplicate Rules Area added to the table");
                myTable.EnsureVisible();
                Delay.Seconds(5);
                //Report.Screenshot("PortTriggerRule",myTable.Element,true);
                Report.Screenshot();
            }
        }
コード例 #2
0
        public void Validate_DHCP_Reserved_Rule()
        {
            Delay.Seconds(30);
            WebDocument   webDocument = "/dom[@domain='192.168.0.1']";
            TableTag      myTable     = webDocument.FindSingle("/dom[@domain='192.168.0.1']//table[#'dhcpClientsTable']");
            IList <TrTag> rows        = myTable.Find <TrTag>("./tbody//tr");
            int           rowsCnt     = rows.Count;

            Report.Info("Total Rules(RowsCnt) (After)", rowsCnt.ToString());

            if (TotalRows == 1 && TotalRows == rowsCnt)
            {
                Report.Info("//-------------------- TotalRows == 1 && TotalRows == rowsCnt--------// ");

                int rowNum = 1;
                foreach (var row in rows)
                {
                    Report.Info("Row: " + rowNum);

                    IList <TdTag> cols    = row.Find <TdTag>("./td");
                    int           colsCnt = cols.Count;
                    Report.Info("Total Columns (colsCnt) in this Row", colsCnt.ToString());

                    /**
                     * foreach(TdTag MacCol in cols){
                     *      Report.Info(MacCol.InnerText.ToString());
                     * }
                     **/
                    if (rowNum == rowsCnt && colsCnt == 1)                      //No reserved rule!
                    {
                        Report.Failure("DHCPClients", "No reserved rule added !!! ");
                        Delay.Seconds(5);
                        myTable.EnsureVisible();
                        Report.Screenshot("DHCPClients", myTable.Element, false);
                        //break;
                    }
                    else                //to get the last  added rule (row)
                    {
                        Report.Info("//-------------------- rowNum == rowsCnt & colsCnt != 1 ------------------------// ");
                        Mouse.ScrollWheel(10);
                        row.EnsureVisible();
                        Report.Success("Valid... New DHCP Reserved Rule is added!");
                        Report.Screenshot("DHCPClientsTable", row.Element, true);
                        //break;
                    }
                    rowNum++;
                }                                           //end of for-loop
            }
            else if (TotalRows == rowsCnt && TotalRows > 1) // if no rows are added
            {
                Report.Info("//-------------------- TotalRows > 1 && TotalRows == rowsCnt ------------------------// ");
                Report.Failure("DHCPClients", "Unable to add this new rule !!! ");
                Delay.Seconds(5);
                myTable.EnsureVisible();
                Report.Screenshot("DHCPClients", myTable.Element, false);
                return;
            }
            else                // difference in row number
            {
                int rowNum = 1;
                foreach (var row in rows)
                {
                    //Report.Info("<---This port triggering rule is disabled from the list--->");
                    if (rowNum == rowsCnt)
                    {
                        Report.Info("//-------------------- rowNum == rowsCnt ------------------------// ");
                        Report.Info("//-------------------- Rules are added -----------------//");
                        Mouse.ScrollWheel(10);
                        row.EnsureVisible();
                        Report.Info("Valid... New DHCP Reservation Rule is added!");
                        Report.Screenshot("DHCPClientsTable", row.Element, true);
                        break;
                    }
                    rowNum++;
                }   // end of for-loop
            }//end of if-else
        }
コード例 #3
0
        public void Validate_New_PortForwardingRule()
        {
            //Validate New_PortForwardingRule
            Delay.Seconds(20);

            //Ranorex.Report.Log(ReportLevel.Success,"New Port Triggering Added Successfully!!");

            //Code to display the result screen

            WebDocument webDocument = "/dom[@domain='192.168.0.1']";

            //IList<TableTag> Tb = webDocument.FindChildren<TableTag>();
            //Report.Info(Tb.Count.ToString());

            //Report.Info(webDocument.GetHtml());

            TableTag myTable = webDocument.FindSingle("/dom[@domain='192.168.0.1']//table[#'PortForwardingTable']");
            //Report.Screenshot("New Port Triggering Rule", myTable.Element,true);

            //highlight the new port triggering rule
            IList <TrTag> rows    = myTable.Find <TrTag>("./tbody//tr");
            int           rowsCnt = rows.Count;

            Report.Info("Total Rules(Rows)", rowsCnt.ToString());
            //Report.Info("------TotalRows(before Adding) : " ,TotalRows.ToString());

            if (TotalRows == rowsCnt)           // no rows are added
            {
                Report.Info("//-------------------- TotalRows == rowsCnt ------------------------// ");
                if (rowsCnt == 32)
                {
                    Report.Failure("PortForwardingTable", " There are already 32 rules, FW Table is full !!! ");
                    //return;
                }
                TableTag errorTable = webDocument.FindSingle("/dom[@domain='192.168.0.1']//div[#'AddRule']/table");
                //Report.Info("InValid... This PortForwardingTable cannot be added !");
                //Report.Log(ReportLevel.Failure,"PortForwardingTable","Unable to add this new rule");

                IList <TrTag> errorRows = errorTable.Find <TrTag>("./tbody//tr");
                Report.Info("errorRows", errorRows.ToString());

                Report.Failure("PortForwardingTable", "Unable to add this new rule !!! ");
                Delay.Seconds(5);
                errorTable.EnsureVisible();
                Report.Screenshot("PortForwardingTable", errorTable.Element, false);
                return;
            }
            else                // difference in rows
            {
                int rowNum = 1;
                foreach (var row in rows)
                {
                    //Report.Info("<---This port triggering rule is disabled from the list--->");
                    if (rowNum == rowsCnt)                      //to get the last  added rule (row)
                    {
                        Report.Info("//-------------------- rowNum == rowsCnt ------------------------// ");
                        //Report.Info(row.Element.Visible.ToString());
                        //Report.Info(row.Element.Size.ToString());

                        /*
                         *      row.Element.Focus();
                         *      if(row.Element.Visible){// if true
                         *              Report.Info("Valid... New PortForwardingTable is added!");
                         *              Report.Screenshot("PortForwardingTable",row.Element,true);
                         *      }else if(!row.Element.Visible){ //if false
                         *              Report.Info("InValid... This PortForwardingTable cannot be added !");
                         *              Report.Log(ReportLevel.Failure,"PortForwardingTable","Unable to add this new rule");
                         *              Report.Screenshot();
                         *      }
                         */
                        Mouse.ScrollWheel(10);
                        //row.Element.Focus();
                        row.EnsureVisible();
                        //Report.Info(row.Element.Visible.ToString());
                        Report.Info("Valid... New PortForwardingTable is added!");
                        Report.Screenshot("PortForwardingTable", row.Element, true);
                        //CompressedImage CI = row.CaptureCompressedImage();
                        //Delay.Seconds(2);
                        //Report.Screenshot();
                        break;
                    }
                    rowNum++;
                }                       //end of for-loop
            }
        }
コード例 #4
0
        public void Add_New_PortTriggerRule()
        {
            //Ranorex.Report.Log(ReportLevel.Success,"New Port Triggering Added Successfully!!");

            //Code to display the result screen
            if (TotalRows < 10)
            {
                Delay.Seconds(20);
            }
            else if (TotalRows > 10 && TotalRows < 20)
            {
                Delay.Seconds(30);
            }
            else if (TotalRows > 20 && TotalRows < 30)
            {
                Delay.Seconds(40);
            }
            else if (TotalRows > 30)
            {
                Delay.Seconds(50);
            }
            WebDocument webDocument = "/dom[@domain='192.168.0.1']";

            TableTag myTable = webDocument.FindSingle("/dom[@domain='192.168.0.1']//table[#'portTriggeringTable']");
            //Report.Screenshot("New Port Triggering Rule", myTable.Element,true);


            //highlight the new port triggering rule
            IList <TrTag> rows    = myTable.Find <TrTag>("./tbody//tr");
            int           rowsCnt = rows.Count;

            Report.Info("Total Rules(After Add)", rowsCnt.ToString());

            //int rowNum = 1;

            if (TotalRows == 1 && TotalRows == rowsCnt)                         // no rows are added
            //Report.Info("//-------------------- TotalRows == rowsCnt ------------------------// ");
            {
                Report.Info("//-------------------- TotalRows == 1 && TotalRows == rowsCnt--------// ");

                //TableTag errorTable = webDocument.FindSingle("/dom[@domain='192.168.0.1']//div[#'AddRule']/table");
                //Report.Info("InValid... This PortTriggerRule cannot be added !");

                //Report.Log(ReportLevel.Failure,"PortForwardingTable","Unable to add this new rule");

                /*
                 *              Report.Failure("PortTriggerRule","Unable to add this new rule !!! ");
                 *              Delay.Seconds(5);
                 *              //errorTable.EnsureVisible();
                 *              myTable.EnsureVisible();
                 *
                 *              //Report.Screenshot("PortTriggerRule",errorTable.Element,false);
                 *              Report.Screenshot("PortTriggerRule",myTable.Element,false);
                 *              return;
                 */

                int rowNum = 1;
                foreach (var row in rows)
                {
                    /**
                     * Report.Info("Row: " + rowNum);
                     * IList<TdTag> cols = row.Find<TdTag>("./td");
                     * foreach(TdTag MacCol in cols){
                     * Report.Info(MacCol.InnerText.ToString());
                     * }
                     **/

                    if (rowNum == rowsCnt)                      //to get the last  added rule (row)
                    {
                        Report.Info("//-------------------- rowNum == rowsCnt ------------------------// ");
                        Mouse.ScrollWheel(10);
                        row.EnsureVisible();
                        IList <TdTag> cols = row.Find <TdTag>("./td");
                        if (cols.Count == 1)
                        {
                            Report.Failure("No new PortTriggerRule is added !!!");
                            Delay.Seconds(1);
                            //Report.Screenshot("PortTriggerRule",row.Element,true);
                            Report.Screenshot("PortTriggerRule", myTable.Element, true);
                        }
                        else
                        {
                            Report.Success("Valid... New PortTriggerRule is added!");
                            Delay.Seconds(1);
                            //Report.Screenshot("PortTriggerRule",row.Element,true);
                            Report.Screenshot("PortTriggerRule", myTable.Element, true);
                        }
                        break;
                    }
                    rowNum++;
                }
            }
            else if (TotalRows > 1 && TotalRows == rowsCnt)                     // no rows are added
            // unable to add this rule

            {
                if (rowsCnt == 32)
                {
                    //Report.Success("PortTriggerRule"," There are already 32 rules, FWPortTrigTable is full !!! ");
                    Report.Info(" Already 32 rules in the table !!! ");
                    //return;
                }
                //bool rst=true;
                bool tblRst = false;
                //Report.Info("tblRst(before)",tblRst.ToString());
                tblRst = Validate.Attribute(repo.MessageFromWebpage.Text65535Info, "WindowText", "Table FWPortTrigTable is full", "{2}", false);
                //Report.Info("tblRst(after)",tblRst.ToString());

                //if(rst == tblRst){
                if (tblRst)
                {
                    if (rowsCnt == 31)
                    {
                        Report.Log(ReportLevel.Success, "Table FWPortTrigTable is full,  Adding 32nd Rule !!!");
                        Report.Screenshot("PortTriggerRule", repo.MessageFromWebpage.MessageFromWebpage, true);
                        Delay.Seconds(2);
                        repo.MessageFromWebpage.ButtonOK.Click();               //Click OK Button
                        return;
                    }
                    else
                    {
                        Delay.Seconds(2);
                        repo.MessageFromWebpage.ButtonOK.Click();               //Click OK Button
                        string tabFull = "Unable to add this new rule after:  " + rowsCnt + " rules";
                        throw new Ranorex.ValidationException(tabFull);
                        //Report.Failure("PortTriggerRule",tabFull);
                        //Ranorex.Validate.Fail(tabFull);// Method to mark a test case as failed and immediately exit the current module and test case iteration
                        //return;
                    }
                }

                /** else{
                 *      Report.Failure("PortTriggerRule","Unable to add this new rule because of the below reason!!! ");
                 * } **/

                Report.Failure("PortTriggerRule", "Unable to add this new rule because of the below reasons !!! ");
                Delay.Seconds(5);
                //errorTable.EnsureVisible();
                myTable.EnsureVisible();

                //Report.Screenshot("PortTriggerRule",errorTable.Element,false);
                Report.Screenshot("PortTriggerRule", myTable.Element, false);
                return;
            }
            else
            {
                int rowNum = 1;
                foreach (var row in rows)
                {
                    //Report.Info("<---This port triggering rule is disabled from the list--->");
                    if (rowNum == rowsCnt)
                    {
                        Report.Info("//-------------------- rowNum == rowsCnt ------------------------// ");
                        //Report.Info(row.Element.Visible.ToString());
                        //Report.Info(row.Element.Size.ToString());

                        /*
                         *      if(row.Element.Visible){// if true
                         *              Report.Info("Valid... New PortTriggerRule is added!");
                         *              Report.Screenshot("PortTriggerRule",row.Element,true);
                         *      }else if(!row.Element.Visible){ //if false
                         *              Report.Info("In Valid... This PortTriggerRule cannot be added !");
                         *              Report.Log(ReportLevel.Failure,"PortTriggerRule","Unable to add this new rule");
                         *              Report.Screenshot();
                         *      }
                         */
                        Mouse.ScrollWheel(10);
                        row.EnsureVisible();
                        Report.Info("Valid... New Port Triggering Rule is added!");
                        Report.Screenshot("PortTriggering Rule", row.Element, true);
                        break;
                    }
                    rowNum++;
                }               //end of for-loop
            }                   //end of if-else
        }