public static void Login(TheEnvironment environment) { Report.Case("GMM Login", "Login to GMM"); string URL = String.Empty; string username = String.Empty; string password = String.Empty; var gmmLogin = new GMMLogin(driver); // Assign URL/user/pwd based on environment switch (environment) { case TheEnvironment.QAT: URL = System.Configuration.ConfigurationManager.AppSettings["qatGMMURL"]; username = System.Configuration.ConfigurationManager.AppSettings["qatGMMUser"]; password = System.Configuration.ConfigurationManager.AppSettings["qatGMMPwd"]; break; case TheEnvironment.UAT: URL = System.Configuration.ConfigurationManager.AppSettings["uatGMMURL"]; username = System.Configuration.ConfigurationManager.AppSettings["uatGMMUser"]; password = System.Configuration.ConfigurationManager.AppSettings["uatGMMPwd"]; break; } driver.Manage().Window.Maximize(); driver.Url = URL + "Login.aspx"; gmmLogin.UserName.EnterText("GMM Login User Textbox", username); gmmLogin.Password.EnterText("GMM Login Password Textbox", password); gmmLogin.Submit.ClickOnIt("GMM Login Button"); if (ElementVerify.Exist(driver, gmmLogin.SiteMenuAfterLogin) != null) { WriteConsole.Green("You successfully Login to GMM"); Report.Log(LogStatus.Pass, "Login GMM", "You successfully Login to GMM"); Report.PrintScreen(driver); } else { WriteConsole.Green("You successfully Login to GMM"); WriteConsole.Red(String.Format(ElementVerify.Exist(driver, gmmLogin.LoginErrorMessage).Text)); WriteConsole.Green("Suggested Solution: You can go to GMM Server, and restart DNS Client Sevice"); Report.Log(LogStatus.Fail, "Login GMM", String.Format(ElementVerify.Exist(driver, gmmLogin.LoginErrorMessage).Text)); Report.PrintScreen(driver); throw new Exception("GMM Login Failed"); } }
static void Main(string[] args) { //TheEnvironment envi; for (int i = 0; i < args.Length; i++) { try { //Enum.TryParse(args[i], out envi); //GMM.Login(envi); GMM.Login(TheEnvironment.UAT); string eventid = GMM.CreateEvent(); GMM.GoToMMPage(eventid); GMM.UpdateOdds(eventid); GMM.OpenMarket(eventid); //TouTou.MemberSite.Login(); //string BetNo = TouTou.MemberSite.PlaceBet(eventid).Trim(); //TTBO.TTBOLogin(); //TTBO.FindMember(); //TTBO.FindWager(BetNo); GMM.KeepEvent(eventid); GMM.ResultAndSettleEvent(eventid); //GMM.CheckReport(BetNo); //WL.Main(TheEnvironment.UAT); } catch (Exception e) { WriteConsole.Red(String.Format("Exception has happened : {0} ", e.Message.ToString())); switch (e.Message) { case "GMM Login Failed": Report.Log(LogStatus.Fail, "Login GMM", e.Message); break; case "GMM CreateEvent Failed": break; case "GMM GoToMMPage Failed": break; case "GMM UpdateOdds Failed": break; case "GMM OpenMarket Failed": break; case "GMM KeepEvent Failed": break; case "GMM ResultAndSettleEvent Failed": break; case "GMM CheckReport Failed": break; case "Toutou Login Failed": break; case "Toutou PlaceBet Failed": break; case "TTBO Login Failed": break; case "TTBO FindMember Failed": break; case "TTBO FindWager Failed": break; default: break; } } finally { WriteConsole.Yellow("Test Automation Completed"); Report.EndAutomation(); } } }