Пример #1
0
        public static void ClickCntextMenuItem(string textValue)
        {
            try
            {
                //var sQLdmDesktopClient = repo.SQLdmDesktopClient;
                //bool isFound = false;
                repo.SQLdmDesktopClient.SelfInfo.WaitForItemExists(2000);
                //repo.SQLdmDesktopClient.MaintenanceModeInfo.WaitForItemExists(2000);
                Ranorex.ContextMenu contextMenuItems = @".//contextmenu[@processname='SQLdmDesktopClient']";
                if (contextMenuItems != null)
                {
                }

//				Report.Info(contextMenuItems.Children.Count.ToString());
//				Report.Info(contextMenuItems.Children[0].ToString());
//				Ranorex.MenuItem mi = null;
//				//Report.Info(contextMenuItems.Checked.Count.ToString());
//				//repo.SQLdmDesktopClient.SnoozeAlerts_ContextMenu.ClickThis();
//				foreach(Ranorex.Adapter item in contextMenuItems.Children)
//				{
//
//   Ranorex.Separator sep = item.As<Ranorex.Separator>();
//    if (sep != null)
//        Report.Info("Seperator!");
//
//					mi = item.As<Ranorex.MenuItem>();
//
//					if(mi.Text.Contains(textValue))
//					{
//						isFound = true; break;
//					}
//				}
//
//				if(isFound)
//				{
//					mi.ClickThis();
//					Reports.ReportLog("Context Menu '" +  textValue + "' Clicked ", Reports.SQLdmReportLevel.Success, null, Config.TestCaseName);
//				}
//				else
//					Reports.ReportLog("Context Menu '" +  textValue + "' does not exists ", Reports.SQLdmReportLevel.Info, null, Config.TestCaseName);
//
            }
            catch (Exception ex)
            {
                throw new Exception("Failed : SnoozeServer :" + ex.Message);
            }
        }
Пример #2
0
 public static Ranorex.MenuItem GetMenunItem(this Ranorex.ContextMenu treeitem, string dbkey)
 {
     Ranorex.MenuItem item = null;
     try
     {
         foreach (var itemtree in treeitem.Items)
         {
             if (itemtree.Text.Trim() == dbkey)
             {
                 item = itemtree;
                 System.Threading.Thread.Sleep(500);
                 break;
             }
         }
     }
     catch (Exception ex)
     {
         throw new Exception("ContextMenu Get Menun Item Failed : " + ex.Message);
     }
     return(item);
 }
Пример #3
0
        public static void Click_On_BiModaluserGuide(string _marketname, string buildname)
        {
            string FSW_PageURL = "";

            Ranorex.ContextMenu HelpMenuItems = "/contextmenu[@processname='SmartFit' and @win32ownerwindowlevel='1']";
            IList <MenuItem>    All_MenuItems = HelpMenuItems.FindChildren <MenuItem>();

            for (int k = 0; k <= All_MenuItems.Count - 1; k++)
            {
                int k1 = k + 1;
                Ranorex.MenuItem HelpMenuText = "/contextmenu[@processname='SmartFit' and @win32ownerwindowlevel='1']/menuitem[" + k1 + "]";
                string           txt          = HelpMenuText.Text;
                if (txt != null)
                {
                    if (txt == "Bimodal Fitting Guide")
                    {
                        Mouse.Click(HelpMenuText);
                        Delay.Seconds(6);
                        IList <Ranorex.WebDocument> AllDoms = Host.Local.FindChildren <Ranorex.WebDocument>();
                        foreach (WebDocument myDom in AllDoms)
                        {
                            if (myDom.Page.Contains("Bimodal"))
                            {
                                FSW_PageURL = myDom.PageUrl;
                                myDom.Close();
                                break;
                            }
                        }
                        break;
                    }
                }
            }



            Ranorex.MenuItem HelpButtonclick  = "/form[@title~'Smart Fit' or @title~'Solus Max' or @title~'Audigy']/contextmenu/menuitem[@automationid='MenuAutomationIds.HelpAction']";
            string           Excel_Preference = "";
            string           excelFinalPath   = "";

            buildname = buildname.Replace(" ", string.Empty);
            buildname = buildname.ToLower();
            if (buildname.Contains("smartfit"))
            {
                excelFinalPath = @"D:\TFS\FSW\TestSuites\Market_Preferences\Mkt Preferences_Smart Fit.xlsx";
            }
            else if (buildname.Contains("audigy"))
            {
                excelFinalPath = @"D:\TFS\FSW\TestSuites\Market_Preferences\Mkt Preferences_Audigy.xlsx";
            }
            //string excelFinalPath = @"D:\TFS\FSW\TestSuites\Market_Preferences\Mkt Preferences_Smart Fit.xlsx";
            Microsoft.Office.Interop.Excel.Application application = new Microsoft.Office.Interop.Excel.Application();
            XLS.Workbook    workBook  = application.Workbooks.Open(excelFinalPath);
            Excel.Worksheet worksheet = (Excel.Worksheet)workBook.Worksheets[3];
            for (int i = 2; i <= 70; i++)
            {
                object cellValue = ((Microsoft.Office.Interop.Excel.Range)worksheet.Cells[3, i]).Value;
                if (cellValue != null)
                {
                    string _Excel_Bimodal_Value = cellValue.ToString();
                    if (_Excel_Bimodal_Value == "Bimodal User Guide")
                    {
                        for (int j = 2; j <= 50; j++)
                        {
                            string Marketname = "";
                            object cellValue2 = ((Microsoft.Office.Interop.Excel.Range)worksheet.Cells[j, 1]).Value;
                            if (cellValue2 != null)
                            {
                                Marketname  = cellValue2.ToString();
                                _marketname = _marketname.Replace(" ", string.Empty);
                                Marketname  = Marketname.Replace(" ", string.Empty);
                                if (Marketname == "UK")
                                {
                                    Marketname = "United Kingdom";
                                }
                                if (Marketname == "USA")
                                {
                                    Marketname = "United States";
                                }
                            }
//							Marketname=Marketname.Replace(" ",string.Empty);
//							_marketname=_marketname.Replace(" ",string.Empty);
                            Marketname  = Marketname.Replace(" ", string.Empty).Replace("InternationalBusiness", "International");
                            _marketname = _marketname.Replace(" ", string.Empty).Replace("InternationalBusiness", "International");
                            if (_marketname != null)
                            {
                                object cellValue3 = ((Microsoft.Office.Interop.Excel.Range)worksheet.Cells[j, i]).Value;
                                if (cellValue3 != null)
                                {
                                    Excel_Preference = cellValue3.ToString();
                                }
                            }
                        }
                    }
                }
            }
            string Excel_Preference2 = Excel_Preference;

            Excel_Preference = Excel_Preference.Substring(0, Excel_Preference.LastIndexOf(":"));
            Excel_Preference = Excel_Preference.Replace("embedded", string.Empty).Replace("PDF", string.Empty).Replace(" ", string.Empty);

            if (FSW_PageURL.Contains(Excel_Preference))
            {
                Report.Success("Bimodal User Guide Validation is success");
            }
            else
            {
                Report.Failure("Bimodal User Guide of Excel file :" + Excel_Preference2 + " -is different from Bimodal User Guide edirection PDF :" + FSW_PageURL);
            }

            workBook.Close(0);
            application.Quit();
        }