public void Choose_All_MAC_Filter_Rules_To_Delete()
        {
            //This method is to select all the filter rules to delete
            Delay.Seconds(40);
            WebDocument webDocument = "/dom[@domain='192.168.0.1']";
            //Report.Info(webDocument.GetHtml());
            TableTag myTable = webDocument.FindSingle("/dom[@domain='192.168.0.1']//table[#'macFilterTable']");
            //Count the total no of IPv4 port Filter rules (rows)
            IList <TrTag> totalMACRules       = myTable.Find <TrTag>("./tbody//tr");
            int           rulesCount          = totalMACRules.Count;
            string        totalMACFilterRules = "Total Rules : " + rulesCount.ToString();

            Report.Info("Active MAC  Filter Rules ", totalMACFilterRules);

            if (rulesCount == 0)
            {
                //Mouse.ScrollWheel(150);
                Report.Failure("MAC Filter ", "There are no active rules to delete !!");
                TestSuite.Current.GetTestCase("Delete_All_MAC_Filtering_Rules").Checked      = false;
                TestSuite.Current.GetTestCase("Activate_MAC_Filtering_Rule_Always1").Checked = true;
                return;
            }
            else
            {
                //Report.Info(" There is/are " + rulesCount.ToString() + " row exists in MAC Filter table !!! ");
                Report.Info(" No. of rows exists in MAC Filter table : " + rulesCount.ToString());
                //walkthrough the column values

                IList <TdTag> cols      = myTable.Find <TdTag>("./tbody//td");
                int           colsCount = cols.Count;
                Report.Info("Total colsCount", colsCount.ToString());
                int j        = 1;
                int delCount = 0;
                int delCheck = 0;

                foreach (TdTag MacCol in cols)
                {
                    Report.Info(j.ToString());
                    Report.Info(MacCol.InnerText);
                    TdTag macAddress = null;
                    //if(j==1 && (MacCol.InnerText.ToString().StartsWith("No MAC filtering"))){
                    if (j == 1 && (MacCol.InnerText.ToString().StartsWith("No MAC filtering rule!")))                    //No MAC filtering rule!
                    //Report.Info("No MAC filtering rule exists !!!");
                    {
                        Report.Failure("MAC Filter ", "There are No MAC filtering  rules to delete !!");
                        TestSuite.Current.GetTestCase("Delete_All_MAC_Filtering_Rules").Checked      = false;
                        TestSuite.Current.GetTestCase("Activate_MAC_Filtering_Rule_Always1").Checked = false;
                        Delay.Seconds(1);
                        Report.Screenshot("MAC_Filtering", myTable.Element, true);
                        return;
                    }
                    else if (j == 2)
                    {
                        //Report.Info(MacCol.InnerText);
                        macAddress = MacCol;
                    }
                    else if (j == 4)
                    {
                        //Report.Info("---Checked  delete box ---");

                        /*
                         * WebElement webElement = MacCol.Element;
                         * Delay.Seconds(2);
                         * webElement.Click();
                         * Report.Screenshot("Delete MACFilter",webElement,true);
                         */
                        //Report.Info(MacCol.GetInnerHtml().ToString());
                        Report.Info("MacCol path: " + MacCol.GetPath().ToString());

                        String newPath = "";
                        //newPath = col.GetPath() + "/input[#'ipv4FilterTable-Delete-"+delCheck+"']";
//				        newPath = MacCol.GetPath() + "/input[#'fmChbx-macFilterTable-Delete-"+delCheck+"']";
                        newPath = MacCol.GetPath() + "/input[#'macFilterTable-Delete-" + delCheck + "']";

                        /*
                         * /dom[@caption='Hub 3.0' and @page='' and @path='/' and @browsername='IE' and @pageurl='http://192.168.0.1/?macfilter&mid=MACFiltering']//tbody[#'macFilterTable_body']/tr[1]/td[3]
                         *      /dom[@caption='Hub 3.0' and @page='' and @path='/' and @browsername='IE' and @pageurl='http://192.168.0.1/?macfilter&mid=MACFiltering']//input[#'macFilterTable-Delete-0']
                         * /dom[@caption='Hub 3.0' and @page='' and @path='/' and @browsername='IE' and @pageurl='http://192.168.0.1/?macfilter&mid=MACFiltering']//b[#'fmChbx-macFilterTable-Delete-0']
                         */

                        Report.Info("macFilterTable-Delete checkbox ");
                        Report.Info("newPath : " + newPath);

                        Ranorex.InputTag MACFilterTableDeleteTag = newPath;
//				        Report.Info("MACFilterTableDeleteTag(Default) : " + MACFilterTableDeleteTag.Checked.ToString());
                        if (MACFilterTableDeleteTag.Checked.ToString() == "False")
                        {
                            //Report.Info("----------------- MACFilterTableDeleteTag was False ---");
                            Delay.Seconds(1);
                            MACFilterTableDeleteTag.PerformClick();
                        }
                        else
                        {
                            Report.Info(" MACFilterTableDeleteTag is already Enabled ");
                        }
                        string rst = "The following MACFilter_Filtering rule is deleted permanently !!!";
                        Report.Success(rst);
                        Delay.Seconds(1);
                        //Report.Screenshot("MACFilter_Filtering",macAddress.Element,true);
                        Report.Screenshot("MACFilter_Filtering", myTable.Element, true);
                        Delay.Seconds(1);
                        j = 0;
                        delCount++;
                        delCheck++;
                    }
                    j++;
                }                       //end of for-loop

                if (delCount == rulesCount)
                {
                    // to check whether it selected all rows for deletion
                    string rst = "The following " + rulesCount.ToString() + " MAC Filtering rules are deleted permanently !!!";
                    Report.Success(rst);
                    Report.Screenshot("MAC_Filtering", myTable.Element, true);
                    Delay.Seconds(1);
                    TestSuite.Current.GetTestCase("Activate_MAC_Filtering_Rule_Always1").Checked = true;
                }
                else
                {
                    Report.Info(" All rows are not deleted !!! ");
                    TestSuite.Current.GetTestCase("Activate_MAC_Filtering_Rule_Always1").Checked = false;
                }
            }
        }
        public void View_Network_Logs()
        {
            Delay.Seconds(30);
            WebDocument webDocument = "/dom[@domain='192.168.0.1']";

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

            //display the content of the table - ConnectionTable//

            //identify the heading columns
            IList <ThTag> headCols      = myTable.Find <ThTag>("./thead//th");
            int           headColsCount = headCols.Count;
            //Report.Info("HeadColsCount",headColsCount.ToString());
            string deviceHeadInfo = " ";
            int    i = 1;

            foreach (ThTag col in headCols)
            {
                //Report.Info("i:",i.ToString());
                //Report.Info(col.InnerText);
                if (i < headColsCount && i > 1)
                {
                    deviceHeadInfo = deviceHeadInfo + col.InnerText + "||||";
                }
                else if (i == headColsCount)
                {
                    deviceHeadInfo = deviceHeadInfo + col.InnerText;
                }
                i++;
            }
            Report.Info(deviceHeadInfo);

            //Count the total number of rows
            IList <TrTag> totalConfig  = myTable.Find <TrTag>("./tbody//tr");
            int           rowsCount    = totalConfig.Count;
            string        totalRowsCnt = "Total Network Logs(Rows) : " + rowsCount.ToString();

            Report.Info("Network Logs ", totalRowsCnt);

            //walkthrough all the columns
            foreach (TrTag row in myTable.Find("./ tbody /tr"))
            {
                string rowInfo     = "";
                TdTag  rowNameCell = row.FindSingle("./ td [2] ");
                rowInfo += " Date And Time : " + rowNameCell.PreviousSibling.InnerText + ", ";
                rowInfo += " Error Number : " + rowNameCell.InnerText + ", ";
                rowInfo += " Event Description : " + rowNameCell.NextSibling.InnerText + " ";
                // Get all cells from the row
                /* rowInfo += " All Cells : ";  */
                foreach (TdTag cell in row.Find("./ td"))
                {
                    /* rowInfo += cell . InnerText + ", "; */
                    // Move the mouse to each cell element
                    cell.MoveTo();
                    // Set css style
                    cell.SetStyle(" background - color ", " #33 ff00 ");
                }
                Report.Info(rowInfo);
            }

            //Report.Screenshot("UpstreamBonded_Channels Status",myTable.Element);
            //Delay.Seconds(2);
        }
Exemplo n.º 3
0
        public void Validate_Network_Logs_Date_Time()
        {
            Delay.Seconds(30);
            WebDocument webDocument = "/dom[@domain='192.168.0.1']";

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

            //display the content of the table - ConnectionTable//
            Report.Screenshot();
            //identify the heading columns
            IList <ThTag> headCols      = myTable.Find <ThTag>("./thead//th");
            int           headColsCount = headCols.Count;
            //Report.Info("HeadColsCount",headColsCount.ToString());
            string deviceHeadInfo = " ";
            int    i = 1;

            foreach (ThTag col in headCols)
            {
                //Report.Info("i:",i.ToString());
                //Report.Info(col.InnerText);
                if (i < headColsCount && i > 1)
                {
                    deviceHeadInfo = deviceHeadInfo + col.InnerText + "||||";
                }
                else if (i == headColsCount)
                {
                    deviceHeadInfo = deviceHeadInfo + col.InnerText;
                }
                i++;
            }
            Report.Info(deviceHeadInfo);

            //Count the total number of rows
            IList <TrTag> totalConfig  = myTable.Find <TrTag>("./tbody//tr");
            int           rowsCount    = totalConfig.Count;
            string        totalRowsCnt = "Total Network Logs(Rows) : " + rowsCount.ToString();

            Report.Info("Network Logs ", totalRowsCnt);
            bool isUKDate = true;

            //walkthrough all the columns
            foreach (TrTag row in myTable.Find("./ tbody /tr"))
            {
                string rowInfo     = "";
                string dateTime    = "";
                TdTag  rowNameCell = row.FindSingle("./ td [2] ");
                dateTime = rowNameCell.PreviousSibling.InnerText;
                rowInfo += " Date And Time : " + rowNameCell.PreviousSibling.InnerText + ", ";
                rowInfo += " Error Number : " + rowNameCell.InnerText + ", ";
                rowInfo += " Event Description : " + rowNameCell.NextSibling.InnerText + " ";
                // Get all cells from the row
                /* rowInfo += " All Cells : ";  */
                foreach (TdTag cell in row.Find("./ td"))
                {
                    /* rowInfo += cell . InnerText + ", "; */
                    // Move the mouse to each cell element
                    cell.MoveTo();
                    // Set css style
                    cell.SetStyle(" background - color ", " #33 ff00 ");
                }

                Report.Info(rowInfo);
                //Report . Info ("dateTime:", dateTime);
                int start = 0, at = 0;
                at = dateTime.IndexOf('-', start);
                if (at > 2)                //Year first
                                           //Report . Info ("at:",at.ToString());
                {
                    isUKDate = false;
                    //Report . Info (" Date is in US format");
                    break;
                }
                else if (at == 2)               //Date First
                //Report . Info ("at:",at.ToString());
                {
                    Report.Info(" Date is in UK format");
                }
            }           //end of for-loop
            if (!isUKDate)
            {
                Report.Failure(" Network logs Date is in US format");
            }
            else
            {
                Report.Success(" Date is in UK format");
            }
            Report.Screenshot();
        }