public static void ClickThis(this Ranorex.ComboBox item) { try { item.Click(); Sleep(); } catch (Exception ex) { throw new Exception("ComboBox Click Failed : " + ex.Message); } }
// public static void ConnectDMRepo() // { // try // { // repo.Application.File.Click(); // Reports.ReportLog("Clicked File Menu Successfully ! ", Reports.SQLdmReportLevel.Success, null, Configuration.Config.TestCaseName); // repo.SQLdmDesktopClient.ConnectToSQLDMRepository.Click(); // Reports.ReportLog("Clicked Menuitem ConnectToSQLDMRepository Successfully ! ", Reports.SQLdmReportLevel.Success, null, Configuration.Config.TestCaseName); // Ranorex.ComboBox combobox = repo.RepositoryConnectionDialog.AuthenticationDropDownList; // combobox.Click(); // ListItem lst_userItem = combobox.FindSingle<ListItem>("/list/listitem[@text='SQL Server Authentication']"); // lst_userItem.Focus(); // lst_userItem.Click(); // Reports.ReportLog("SQL Server Authentication Selected ", Reports.SQLdmReportLevel.Success, null, Configuration.Config.TestCaseName); // repo.RepositoryConnectionDialog.Username.PressKeys(Constants.SqlSystemUser); // Reports.ReportLog("Username : "******"Entered Successfully " , Reports.SQLdmReportLevel.Success, null, Configuration.Config.TestCaseName); // // repo.RepositoryConnectionDialog.Password.PressKeys(Constants.SqlSystemUserPassword); // Reports.ReportLog("Passsword Entered Successfully " , Reports.SQLdmReportLevel.Success, null, Configuration.Config.TestCaseName); // repo.RepositoryConnectionDialog.ConnectButton.ClickThis(); // Reports.ReportLog("Clicked Connect Button Successfully ! " , Reports.SQLdmReportLevel.Success, null, Configuration.Config.TestCaseName); // // if(repo.Application.CaptionText.TextValue.Contains(Constants.SQLdmRepository)) // Reports.ReportLog("Connected to SQLdmRepository Successfully ! " , Reports.SQLdmReportLevel.Success, null, Configuration.Config.TestCaseName); // else // { // Reports.ReportLog("Failed to connect to SQLdmRepository " , Reports.SQLdmReportLevel.Fail, null, Configuration.Config.TestCaseName); // throw new Exception("Failed to connect to SQLdmRepository "); // } // } // catch(Exception ex) // { // throw new Exception("Failed : ConnectDMRepo : " + ex.Message); // } // } public static void ConnectDMRepo(string userType) { try { repo.Application.File.Click(); Reports.ReportLog("Clicked File Menu Successfully ! ", Reports.SQLdmReportLevel.Success, null, Configuration.Config.TestCaseName); repo.SQLdmDesktopClient.ConnectToSQLDMRepository.Click(); Reports.ReportLog("Clicked Menuitem ConnectToSQLDMRepository Successfully ! ", Reports.SQLdmReportLevel.Success, null, Configuration.Config.TestCaseName); if (userType.Equals(Constants.SqlUser)) { Ranorex.ComboBox combobox = repo.RepositoryConnectionDialog.AuthenticationDropDownList; combobox.Click(); ListItem lst_userItem = combobox.FindSingle <ListItem>("/list/listitem[@text='SQL Server Authentication']"); lst_userItem.Focus(); lst_userItem.Click(); Reports.ReportLog("SQL Server Authentication Selected ", Reports.SQLdmReportLevel.Success, null, Configuration.Config.TestCaseName); repo.RepositoryConnectionDialog.Username.PressKeys(Constants.NewSqlUser); Reports.ReportLog("Username : "******"Entered Successfully ", Reports.SQLdmReportLevel.Success, null, Configuration.Config.TestCaseName); repo.RepositoryConnectionDialog.Password.PressKeys(Constants.NewSqlUserPassword); Reports.ReportLog("Passsword Entered Successfully ", Reports.SQLdmReportLevel.Success, null, Configuration.Config.TestCaseName); } else { Ranorex.ComboBox combobox = repo.RepositoryConnectionDialog.AuthenticationDropDownList; combobox.Click(); ListItem lst_userItem = combobox.FindSingle <ListItem>("/list/listitem[@text='Windows Authentication']"); lst_userItem.Focus(); lst_userItem.Click(); Reports.ReportLog("Windows Authentication Selected ", Reports.SQLdmReportLevel.Success, null, Configuration.Config.TestCaseName); } repo.RepositoryConnectionDialog.ConnectButton.ClickThis(); Reports.ReportLog("Clicked Connect Button Successfully ! ", Reports.SQLdmReportLevel.Success, null, Configuration.Config.TestCaseName); if (repo.Application.CaptionText.TextValue.Contains(Constants.SQLdmRepository)) { Reports.ReportLog("Connected to SQLdmRepository Successfully ! ", Reports.SQLdmReportLevel.Success, null, Configuration.Config.TestCaseName); } else { Reports.ReportLog("Failed to connect to SQLdmRepository ", Reports.SQLdmReportLevel.Fail, null, Configuration.Config.TestCaseName); throw new Exception("Failed to connect to SQLdmRepository "); } Thread.Sleep(30000); } catch (Exception ex) { throw new Exception("Failed : ConnectDMRepo : " + ex.Message); } }
public static void SelectSqlAuthentication() { try { Ranorex.ComboBox combobox = repo.AddPermissionWizard.ComboBoxUserPageCmbBxAuthentication; combobox.Click(); ListItem lst_userItem = combobox.FindSingle <ListItem>("/list/listitem[@text='SQL Server Authentication']"); lst_userItem.Focus(); lst_userItem.Click(); Reports.ReportLog("SQL Server Authentication Selected ", Reports.SQLdmReportLevel.Success, null, Configuration.Config.TestCaseName); } catch (Exception ex) { throw new Exception("Failed : SelectAuthenticationType : " + ex.Message); } }