public void TheFIASimpleTest(string dateNaissJ, string dateNaissM, string dateNaissA, string nom, string prenom, string numVoie, string codePostal, string burDistr, string numICCID, string numIMEI) { selenium.Click("bt_4_0"); selenium.WaitForPageToLoad("30000"); selenium.Type("dateNaissJ", dateNaissJ); selenium.Type("dateNaissM", dateNaissM); selenium.Type("dateNaissA", dateNaissA); selenium.Click("document.fiaForm.codeDptNaiss[1]"); selenium.Select("document.fiaForm.codeDptNaiss[1]", "label=ALLIER"); selenium.Click("//option[@value='03']"); selenium.Select("civilite", "label=Madame"); selenium.Type("nom", nom); selenium.Type("prenom", prenom); selenium.Click("//img[@onclick='ChangerOnglet(2)']"); selenium.Type("numVoie", numVoie); selenium.Type("codePostal", codePostal); selenium.Type("burDistr", burDistr); selenium.Click("//img[@onclick='ChangerOnglet(3)']"); selenium.Type("numICCID", numICCID); selenium.Type("numIMEI", numIMEI); selenium.Click("B2"); selenium.WaitForPageToLoad("30000"); selenium.Click("//img[@onclick='valider()']"); selenium.WaitForPageToLoad("30000"); }
public string SuspCustomer(ISelenium myBrowser, string strUser) { //string strUser; _isUpdateCustomersResourceFile = false; //string suspCust = "SuspCust"; //string guidSuspCust = Guid.NewGuid().ToString().Substring(0, 2); //DateTime dateFormat = DateTime.Now; //string dateTime = (dateFormat.ToString("yyyyMMddHHmmss")); //suspCust = suspCust + dateTime; //strUser = _common.CreateCustomer(myBrowser, suspCust, StrPasswrd); if (strUser != "Fail") { _common.SearchCustomer(strUser, myBrowser); _common.SelectMainFrame(myBrowser); if (myBrowser.GetValue(AdminSuite.CustomerCreation.CustomersPage.CustomerStatusLstBx) == "A") { myBrowser.Select(AdminSuite.CustomerCreation.CustomersPage.CustomerStatusLstBx, "Suspended"); myBrowser.Select(AdminSuite.CustomerCreation.CustomersPage.ReasonForSuspendingUserLstBx, "Other"); myBrowser.Select(AdminSuite.CustomerCreation.CustomersPage.StatusReasonLstBx, "CTS"); myBrowser.Type(AdminSuite.CustomerCreation.CustomersPage.ReasonForSuspendingUserTxtBx, "used for eCommerce Automation"); myBrowser.Click(AdminSuite.CustomerCreation.CustomersPage.UpdateCustomerButton); _frameworkCommon.WaitUntilAllElementsLoad(myBrowser); System.Threading.Thread.Sleep(6000); if (myBrowser.GetValue(AdminSuite.CustomerCreation.CustomersPage.CustomerStatusLstBx) != "S") { Framework.BaseTest.Fail("Suspension of Customer: Unsuccessfull"); } else { _isUpdateCustomersResourceFile = _common.UpdateCustomerResouceFile("SuspendedCustomer", strUser, StrPasswrd); } if (_isUpdateCustomersResourceFile == false) { Framework.BaseTest.Fail("Customers Resource File updation failed."); } } } else { Framework.BaseTest.Fail("User creation Failed"); } return(strUser); }
///<summary> /// To add a customer belonging to a banned country /// Author: Yogesh /// Ex:Customer_CompanyExclusion(myBrowser) /// <returns>None</returns> /// Created Date: 22-Dec-2011 /// Modified Date: public void CustomerFrmBannedCntry(ISelenium myBrowser) { _isUpdateCustomersResourceFile = false; string banCustomer = "ATEcommATBnCust"; string guidBnCust = Guid.NewGuid().ToString().Substring(0, 4); banCustomer = banCustomer + guidBnCust; string strUser = _common.CreateCustomer(myBrowser, banCustomer, StrPasswrd); if (strUser != "Fail") { //strUser = common.SelectMainFrame(myBrowser); _common.SelectMainFrame(myBrowser); Assert.IsTrue(myBrowser.IsElementPresent(AdminSuite.CustomerCreation.CustomersPage.UpdateRegistrationButton), "Update Registration button is not found"); myBrowser.Click(AdminSuite.CustomerCreation.CustomersPage.UpdateRegistrationButton); const string strBannedCountryName = "Italy"; myBrowser.Select(AdminSuite.CustomerCreation.CustomersPage.CntryTxtBx, strBannedCountryName); myBrowser.Click(AdminSuite.CustomerCreation.CustomersPage.UpdateCustomerButton); _frameworkCommon.WaitUntilAllElementsLoad(myBrowser); Assert.IsTrue(myBrowser.IsTextPresent(strBannedCountryName), "Change of country to a Banned Country is not successfull"); _isUpdateCustomersResourceFile = _common.UpdateCustomerResouceFile("BannedCountryCustomer", strUser, StrPasswrd); if (_isUpdateCustomersResourceFile == false) { Framework.BaseTest.Fail("Customers Resource File updation failed."); } } else { Framework.BaseTest.Fail("User creation Failed"); } }
public void CreateOrder() { RegisterAndLogin(); selenium.Open("/customerView_Home.aspx"); selenium.WaitForPageToLoad("5000"); selenium.Click("ctl00_navigation_menu_NavigationControl_NavTreeViewt0"); selenium.WaitForPageToLoad("5000"); selenium.Type("ctl00_body_content_txtJobName", "Salsa Impulse"); selenium.Type("ctl00_body_content_txtFinalSizeX", "5"); selenium.Type("ctl00_body_content_txtFinalSizeY", "5"); selenium.Type("ctl00_body_content_txtQty", "1000"); selenium.Select("ctl00_body_content_lstWeight", "label=Light"); selenium.Check("ctl00_body_content_chkTwoSide"); selenium.Type("ctl00_body_content_FileUpload", "C:\\Documents and Settings\\Javier\\Desktop\\Salsa Impulse\\SalsaImpulseBusinessCard.jpg"); selenium.Click("ctl00_body_content_btnFileUpload"); selenium.WaitForPageToLoad("5000"); Assert.IsTrue(selenium.IsTextPresent("Uploaded File:")); Assert.IsTrue(selenium.IsTextPresent("SalsaImpulseBusinessCard.jpg")); selenium.Click("ctl00_body_content_createPay"); selenium.WaitForPageToLoad("5000"); int count = orderRepo.Orders.Where(o => o.job_name == "Salsa Impulse").Count(); Assert.AreEqual(1, count); Order order = orderRepo.Orders.Where(o => o.job_name == "Salsa Impulse").Single(); Assert.AreEqual("Salsa Impulse", order.job_name.Trim()); Assert.AreEqual(5.0, order.width); Assert.AreEqual(5.0, order.height); Assert.AreEqual(1000, order.quantity); Assert.IsTrue(order.two_sided); }
public void TheRegistrar_CancelarTest() { selenium.Open("/Home/Login"); Assert.AreEqual("Log in", selenium.GetText("css=h2.login-header")); selenium.Type("id=Codigo", "root"); selenium.Type("id=Contrase_a", "root"); selenium.Click("css=input[type=\"submit\"]"); selenium.WaitForPageToLoad("30000"); Assert.AreEqual("Mantenimiento Cliente", selenium.GetText("link=Mantenimiento Cliente")); selenium.Click("link=Agregar"); selenium.WaitForPageToLoad("30000"); selenium.Type("id=Nombre", "Maria"); selenium.Type("id=Apellidos", "Magdalena"); selenium.Type("id=DNI", "12345677"); selenium.Type("id=Edad", "20"); selenium.Select("id=Sexo", "label=Femenino"); selenium.Select("id=Nivel", "label=Universitario"); selenium.Type("id=Telefono", "123456789"); selenium.ChooseCancelOnNextConfirmation(); selenium.Click("css=button.btn.btn-default"); Assert.AreEqual("Desea Registrar", selenium.GetConfirmation()); Assert.AreEqual("RegistrarCliente", selenium.GetText("css=h2")); }
public void TheRegistrarCorrectoTest() { selenium.Open("/"); Assert.AreEqual("Log in", selenium.GetText("css=h2.login-header")); selenium.Type("id=Codigo", "root"); selenium.Type("id=Contrase_a", "root"); selenium.Click("css=input[type=\"submit\"]"); selenium.WaitForPageToLoad("30000"); Assert.AreEqual("Mantenimiento Cliente", selenium.GetText("link=Mantenimiento Cliente")); selenium.Click("link=Agregar"); selenium.WaitForPageToLoad("30000"); selenium.Type("id=Nombre", "Maria"); selenium.Type("id=Apellidos", "Magdalena"); selenium.Type("id=DNI", "12345678"); selenium.Type("id=Edad", "20"); selenium.Select("id=Sexo", "label=Femenino"); selenium.Select("id=Nivel", "label=Superior"); selenium.Type("id=Telefono", "123456789"); selenium.Click("css=button.btn.btn-default"); Assert.AreEqual("Desea Registrar", selenium.GetConfirmation()); selenium.WaitForPageToLoad("3000"); Assert.AreEqual("Se Registro satisfactoriamente el cliente", selenium.GetText("css=div.validation-summary-errors")); }
public void TheUntitled() { var categoryName = Guid.NewGuid().ToString(); var childCategoryName = Guid.NewGuid().ToString(); selenium.Open("/"); selenium.Type("email", "*****@*****.**"); selenium.Type("password", "1"); selenium.Click("//input[@value='Войти']"); selenium.WaitForPageToLoad("30000"); selenium.Click("link=добавить"); selenium.WaitForPageToLoad("30000"); selenium.Type("Name", categoryName); selenium.Click("//input[@value='Создать']"); selenium.WaitForPageToLoad("30000"); selenium.Click("link=список"); selenium.WaitForPageToLoad("30000"); try { Assert.IsTrue(selenium.IsTextPresent(categoryName)); } catch (AssertionException e) { verificationErrors.Append(e.Message); } selenium.Click("link=добавить"); selenium.WaitForPageToLoad("30000"); selenium.Select("ParentId", "label=" + categoryName); selenium.Type("Name", childCategoryName); selenium.Click("//input[@value='Создать']"); selenium.WaitForPageToLoad("30000"); selenium.Click("//div[@id='content']/div/li/ul/li/a"); selenium.WaitForPageToLoad("30000"); selenium.Click("link=список"); selenium.WaitForPageToLoad("30000"); selenium.Click("//div[@id='content']/div/li/ul/li/a"); selenium.WaitForPageToLoad("30000"); try { Assert.AreEqual(categoryName, selenium.GetSelectedLabel("ParentId")); } catch (AssertionException e) { verificationErrors.Append(e.Message); } }
public void TheTest01Test(string login) { selenium.Open("/KARA_WEB/deconnexion.do"); selenium.Type("idUtilisateur", "0088195"); selenium.Type("motDePasse", "2697"); selenium.Click("B1"); selenium.WaitForPageToLoad("30000"); selenium.Click("bt_3_0"); selenium.WaitForPageToLoad("30000"); selenium.Select("codeGestion", "label=Migration Forfaits Bloqués vers Abo - Ajout"); selenium.Type("numAppelAjt", "0640684010"); selenium.Type("numICCIDAjt", "89331072970067505032"); selenium.Click("B2"); selenium.WaitForPageToLoad("30000"); selenium.Click("//img[@onclick='valider()']"); selenium.WaitForPageToLoad("30000"); selenium.Type("numTitAjt", "100001"); selenium.Type("numCtrAjt", "000001"); selenium.Type("numPtFactAjt", "03"); selenium.Click("B2"); selenium.WaitForPageToLoad("30000"); selenium.Select("choixUtilisateur", "label=Utilisateur = pt facturation"); selenium.WaitForPageToLoad("30000"); selenium.Click("B2"); selenium.WaitForPageToLoad("30000"); selenium.Select("choixOffre", "label=Nouvelle offre"); selenium.WaitForPageToLoad("30000"); selenium.Select("choixCible", "label=Gamme SFR Evolution Pro"); selenium.Click("B2"); selenium.WaitForPageToLoad("30000"); selenium.Select("champ_1", "label=SFR Evolution Pro 3H"); selenium.WaitForPageToLoad("30000"); selenium.Click("btnsuiv"); selenium.WaitForPageToLoad("30000"); Assert.AreEqual("V&S KARA - Les Offres", selenium.GetTitle()); selenium.Click("btnsuiv"); selenium.WaitForPageToLoad("30000"); selenium.Click("btnsuiv"); selenium.WaitForPageToLoad("30000"); selenium.Select("champ_1", "label=Liste Rouge"); selenium.Select("champ_12", "label=Controle Parental Inactif"); selenium.Click("btnsuiv"); selenium.WaitForPageToLoad("30000"); selenium.Type("champ_2", ""); selenium.Click("B2"); selenium.Type("champ_2", "8"); }
public void TheRegistrarDatosInvalidosTest() { selenium.Open("/Home/Login"); Assert.AreEqual("Log in", selenium.GetText("css=h2.login-header")); selenium.Type("id=Codigo", "root"); selenium.Type("id=Contrase_a", "root"); selenium.Click("css=input[type=\"submit\"]"); selenium.WaitForPageToLoad("30000"); Assert.AreEqual("LstCliente", selenium.GetText("css=h2")); selenium.Click("link=Agregar"); selenium.WaitForPageToLoad("30000"); selenium.Type("id=Nombre", "1234561"); selenium.Type("id=Apellidos", "123456"); selenium.Type("id=DNI", "kkk"); selenium.Type("id=Edad", "j"); selenium.Select("id=Nivel", "label=Universitario"); selenium.Type("id=Telefono", "kkl"); selenium.Click("css=button.btn.btn-default"); Assert.AreEqual("Desea Registrar", selenium.GetConfirmation()); selenium.WaitForPageToLoad("3000"); Assert.AreEqual("Datos Incorrectos", selenium.GetText("css=div.validation-summary-errors")); }
public void Select(string selectLocator, string optionLocator) { bool actRes = false; string errStr = ""; try { selenium.Select(selectLocator, optionLocator); actRes = true; } catch (System.Exception ex) { errStr = ex.ToString(); } res = new ResultClass() { Decp = "Select, " + selectLocator, Res = actRes ? "pass" : "fail", Tdev = " ms", Err = errStr, }; BaseListOfResItems.Add(res); }
/// <summary> /// Method to select item from ComboBox/DropDown /// </summary> /// Authour: Vamsi krishna Boyapati /// <param name="objMySelenium">RC instance</param> /// <param name="strLocator">Locator of the Control/Element(Xpath)</param> /// <param name="itemToSelect">String to select</param> /// <returns>Boolean value(True/False)</returns> public bool SelectItemFromDropDwon(ISelenium objMySelenium, string strLocator, string itemToSelect) { bool bStatus = false; try { string[] arrItems = objMySelenium.GetSelectOptions(strLocator); foreach (string strTemp in arrItems) { if (strTemp.ToUpper().Trim().Contains(itemToSelect.Trim().ToUpper())) { objMySelenium.Select(strLocator, strTemp); bStatus = true; break; } } } catch (AutomationException EX) { Console.WriteLine(EX.Message); } return(bStatus); }
public void UpdateEventsByEventID(ISelenium browser, string eventID, string eventStatus, string eventDisplayed) { try { //Clicking on Event Link in LHN LHNavigation(AdminSuite.CommonControls.AdminHomePage.EventNameLink, browser); //Selecting TopFrame SelectMainFrame(browser); browser.WaitForFrameToLoad(AdminSuite.CommonControls.AdminHomePage.EventNameLink, FrameGlobals.PageLoadTimeOut); browser.Type(AdminSuite.CommonControls.AdminHomePage.OpenBetIdTextBox, eventID); browser.Select(AdminSuite.CommonControls.AdminHomePage.OpenBetHierarchyLevelDrpLst, AdminSuite.CommonControls.AdminHomePage.OpenBetHeierarchyLevelEvent); browser.Click(AdminSuite.CommonControls.AdminHomePage.EventFindBtn); browser.WaitForPageToLoad(Framework.FrameGlobals.PageLoadTimeOut); if (string.Empty != eventStatus) { if (eventStatus == "Suspend") { browser.Select(AdminSuite.CommonControls.EventDetailsPage.eventStatusListBox, "label=Suspended"); } else if (eventStatus == "Active") { browser.Select(AdminSuite.CommonControls.EventDetailsPage.eventStatusListBox, "label=Active"); } else { throw new AutomationException("Event status is invalid."); } browser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut); } if (string.Empty != eventDisplayed) { if (eventDisplayed == "Yes") { browser.Select(AdminSuite.CommonControls.EventDetailsPage.eventDisplayStatusLstBx, "label=Yes"); } else if (eventDisplayed == "No") { browser.Select(AdminSuite.CommonControls.EventDetailsPage.eventDisplayStatusLstBx, "label=No"); } else { throw new AutomationException("Event displayed is invalid."); } } //Updating the Event if (browser.IsElementPresent(AdminSuite.CommonControls.EventDetailsPage.updateEventBtn)) { browser.Click(AdminSuite.CommonControls.EventDetailsPage.updateEventBtn); browser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut); Assert.IsTrue(_frameworkCommon.WaitUntilElementPresent(browser, AdminSuite.CommonControls.EventDetailsPage.eventDescriptionTextBox, "120"), "Event Updation is not Successfull"); } } catch (Exception ex) { Console.WriteLine(ex.StackTrace); Console.WriteLine(ex.Message); //return null; } }
///<summary> /// This method enters all details of a customer /// <example>EnterRegisterDetails(browser) </example> public string EnterRegisterDetails(ISelenium browser, string promocode, string country, string accountCurrency, string DOByear, string firstname, string lastname, string username) { try { IWebDriver driver = ((WebDriverBackedSelenium)browser).UnderlyingWebDriver; Random rnd = new Random(); int rndNumber = rnd.Next(10000); string[] pCode = new string[] { "HA2 9SR", "HA2 9SG", "HA2 9SE", "HA2 9SN", "HA2 9SW", "HA2 9SX", "HA2 8SS", "HA2 8SE", "HA2 8SX", "HA2 8SN", "HA2 8SA" }; string title = "Mr"; string gender = "male"; string DOBmonth = "January"; string DOBday = rnd.Next(20, 30).ToString(); string houseno = rndNumber.ToString(); string postcode = pCode[rnd.Next(0, 10)];; string address1 = "Ladbrokes Ltd, Imperial Drive"; string address2 = "Harrow"; string city = "Middx"; string email = firstname + lastname + "@gmail.com"; string teleCode = "+44"; string telnumber = "1234567890"; string mobnumber = "1234512345"; string password = "******"; string confirmPassword = "******"; string securityQuestion = "Favourite Colour"; string securityAnswer = "Blue"; WaitForLoadingIcon_MobileLobby(browser, FrameGlobals.IconLoadTimeout); Assert.IsTrue(browser.IsVisible(MobileLobbyControls.registrationTitle), "Registration Page is not displayed"); //Enter data in all the fields browser.Type(MobileLobbyControls.promocode, promocode); browser.Select(MobileLobbyControls.title, title); browser.Type(MobileLobbyControls.firstname, firstname); browser.Type(MobileLobbyControls.lastname, lastname); //gender if (gender.ToLower().Trim() == "male") { browser.Click(MobileLobbyControls.genderMale); } else { browser.Click(MobileLobbyControls.genderFemale); } browser.Select(MobileLobbyControls.DOBday, DOBday); browser.Select(MobileLobbyControls.DOBmonth, DOBmonth); browser.Select(MobileLobbyControls.DOByear, DOByear); if ((DateTime.Now.Year - int.Parse(DOByear)) < 18) { Assert.IsTrue(browser.IsVisible(MobileLobbyControls.registrationTitle), "Registration Page is not displayed"); string xPath = "//div[@class='monthformError parentFormundefined formError']/div[@class='formErrorContent' and contains(text(), 'You are under 18')]"; Assert.IsTrue(browser.IsElementPresent(xPath), "'You are under 18' error message was not displayed"); } browser.Select(MobileLobbyControls.country, country); browser.Type(MobileLobbyControls.housename, houseno); browser.Type(MobileLobbyControls.postcode, postcode); if (country.ToLower() == "united kingdom") { clickObject_MobileLobby(browser, MobileLobbyControls.findaddress); } browser.Type(MobileLobbyControls.address1, address1); browser.Type(MobileLobbyControls.address2, address2); browser.Type(MobileLobbyControls.city, city); browser.Type(MobileLobbyControls.email, email); browser.Type(MobileLobbyControls.telintcode, teleCode); browser.Type(MobileLobbyControls.telnumber, telnumber); browser.Type(MobileLobbyControls.mobintcode, teleCode); browser.Type(MobileLobbyControls.mobnumber, mobnumber); browser.Select(MobileLobbyControls.accountCurrency, accountCurrency); browser.Type(MobileLobbyControls.username, username); browser.Type(MobileLobbyControls.password, password); browser.Type(MobileLobbyControls.confirmPassword, confirmPassword); browser.Select(MobileLobbyControls.securityQuestion, securityQuestion); browser.Type(MobileLobbyControls.securityAnswer, securityAnswer); MLcommonObj.SelectCheckbox(browser, MobileLobbyControls.contactMe, "on"); MLcommonObj.SelectCheckbox(browser, MobileLobbyControls.aggreement, "on"); Thread.Sleep(1000); return username; } catch (Exception ex) { CaptureScreenshot(browser, "EnterRegisterDetails"); Console.WriteLine("Function 'EnterRegisterDetails' - Failed"); Console.WriteLine(ex.Message); Fail(ex.Message); return null; } }
/// <summary> /// Selects the from a dropdown. /// </summary> /// <param name="selectLocator">The select locator.</param> /// <param name="optionLocator">The option locator.</param> /// <param name="type">Type of locator</param> public void Select(string selectLocator, string optionLocator, FindType type = FindType.ById) { _selenium.Select(selectLocator, optionLocator); }
/// <summary> /// Verifying market data in openbet /// </summary> /// <param name="browser">Browser instance</param> /// <param name="testData">Test data</param> public void VerifyMarketData(ISelenium browser, TestData testData) { string marketStatus = string.Empty; string marketDisplay = string.Empty; bool updateMarketFlg = false; if (_frameworkCommon.WaitUntilElementPresent(browser, "name=MktName", "60") == true) { marketStatus = browser.GetValue(AdminSuite.CommonControls.EventDetailsPage.marketStatusListBox); marketDisplay = browser.GetValue(AdminSuite.CommonControls.EventDetailsPage.mktDisplayListBox); if ("a" != marketStatus.ToLower()) { browser.Select(AdminSuite.CommonControls.EventDetailsPage.marketStatusListBox, "label=Active"); Console.WriteLine("Updated Market status to Active"); updateMarketFlg = true; } if ("y" != marketDisplay.ToLower()) { browser.Select(AdminSuite.CommonControls.EventDetailsPage.mktDisplayListBox, "label=Yes"); Console.WriteLine("Updated market display to Yes"); updateMarketFlg = true; } if (updateMarketFlg) { if (browser.IsElementPresent(AdminSuite.CommonControls.EventDetailsPage.ModifyMarketButton)) { browser.Click(AdminSuite.CommonControls.EventDetailsPage.ModifyMarketButton); browser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut); Assert.IsTrue(_frameworkCommon.WaitUntilElementPresent(browser, AdminSuite.CommonControls.EventDetailsPage.eventDescriptionTextBox, "120"), "Event Updation is not Successfull"); } else { Console.WriteLine("Unable to update the event in Openbet"); } } browser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut); } }
public bool AdminRewardAdhoctoken(ISelenium adminBrowser, string custName, string tokenVal, string redemptionVal) { try { int dt = Convert.ToInt32(DateTime.Now.Day.ToString()) + 1; string relativeDate = dt.ToString() + " 12:12"; //Click on Reward Adhoc token link in Admin LHN if (AdminLHNClick("Reward Adhoc token", adminBrowser)) { Console.WriteLine("Successfully clicked on the Admin LHN link Reward Adhoc token"); } else { Framework.BaseTest.CaptureScreenshot(adminBrowser, ""); Console.WriteLine("Unable to click on the Admin LHN link"); return false; } //Entering value in Username Text box in Reward Adhoc token page if (!AdminTableObjects(adminBrowser, "Reward Adhoc token", "Username", "Text Box", custName, 1)) { Framework.BaseTest.CaptureScreenshot(adminBrowser, ""); Console.WriteLine("Unable to put value in Username Text box in Reward Adhoc token page"); return false; } //click on the Search button in Reward Adhoc token page if (!AdminTableObjects(adminBrowser, "Reward Adhoc token", "", "Button", "Search", 1)) { Framework.BaseTest.CaptureScreenshot(adminBrowser, ""); Console.WriteLine("Unable to click on the Search button in Reward Adhoc token page"); return false; } //Entering value in GBP text box in Reward Adhoc token page if (!AdminTableObjects(adminBrowser, "Reward Adhoc token", "GBP", "Text Box", tokenVal, 1)) { Framework.BaseTest.CaptureScreenshot(adminBrowser, ""); Console.WriteLine("Unable to to locate GBP text box in Reward Adhoc token page"); return false; } // Selecting Redemtion Value in Reward Adhoc token page adminBrowser.Select("//select[@name='RValID']", "label=" + redemptionVal); //Entering value in Relative Expiry text box in Reward Adhoc token page if (!AdminTableObjects(adminBrowser, "Reward Adhoc token", "Relative Expiry", "Text Box", relativeDate, 1)) { Framework.BaseTest.CaptureScreenshot(adminBrowser, ""); Console.WriteLine("Unable to to locate Relative Expiry text box in Reward Adhoc token page"); return false; } //click on the Reward token button in Reward Adhoc token page if (!AdminTableObjects(adminBrowser, "Reward Adhoc token", "", "Button", "Reward token", 1)) { Framework.BaseTest.CaptureScreenshot(adminBrowser, ""); Console.WriteLine("Unable to click on the Reward token button in Reward Adhoc token page"); return false; } if (!adminBrowser.IsTextPresent("Token Rewarded")) { Framework.BaseTest.CaptureScreenshot(adminBrowser, ""); Console.WriteLine("Success message is not displayed on creating the Token"); return false; } Console.WriteLine("Successfully created Adhoc Token to customer"); return true; } catch (Exception ex) { Console.WriteLine(ex.Message); Framework.BaseTest.CaptureScreenshot(adminBrowser, ""); return false; } }
/// <summary> /// To update the Selection /// </summary> /// <param name="browser">Selenium browser Instance</param> /// <param name="selectionId">ID of the selection</param> /// <param name="price">Price tobe updated</param> /// <param name="status"> Status tobe updated</param> /// Ex: Pass Argument as "Active" public void UpdateSelection(ISelenium browser, string selectionId, string price, string status, string multipleKeyVal, string displayed) { //Clicking on Event Link in LHN LHNavigation(AdminSuite.CommonControls.AdminHomePage.EventNameLink, browser); //Selecting TopFrame SelectMainFrame(browser); browser.Type(AdminSuite.CommonControls.AdminHomePage.OpenBetIdTextBox, selectionId); browser.Select(AdminSuite.CommonControls.AdminHomePage.OpenBetHierarchyLevelDrpLst, AdminSuite.CommonControls.AdminHomePage.OpenBetHeierarchyName); browser.Click(AdminSuite.CommonControls.AdminHomePage.EventFindBtn); browser.WaitForPageToLoad(Framework.FrameGlobals.PageLoadTimeOut); if (String.IsNullOrWhiteSpace(status) == false) { browser.Select(AdminSuite.CommonControls.EventDetailsPage.SelectionStatusLstBx, "label=" + status + ""); } if (String.IsNullOrWhiteSpace(price) == false) { browser.Type(AdminSuite.CommonControls.EventDetailsPage.PriceTxtBx, price); } // Adding multiplekeyvalue for the selection if (multipleKeyVal != "") { browser.Type(AdminSuite.CommonControls.EventDetailsPage.multipleKeyTxtBx, multipleKeyVal); } if (displayed != string.Empty) { browser.Select(AdminSuite.CommonControls.EventDetailsPage.SelectionDispStatusListBx, "label=" + displayed + ""); } // Updating the event details page browser.Click(AdminSuite.CommonControls.EventDetailsPage.SelectionUpdateBtn); browser.WaitForPageToLoad(Framework.FrameGlobals.PageLoadTimeOut); }
/// <summary> /// Suspend a customer /// </summary> /// Author: Kiran /// <param name="browser">Browser Instance</param> /// <param name="customerName">Customer Name</param> public bool UpdateSuspCust(ISelenium browser, string customerName) { try { //Clicking on Event Link in LHN LHNavigation(AdminSuite.CommonControls.AdminHomePage.CustomersLink, browser); //Selecting TopFrame SelectMainFrame(browser); // Enter Customer Name and Search SearchCustomer(customerName, browser); browser.Select("name=Status", "label=Suspended"); browser.Select("name=StatusReasonType", "label=Test Accounts"); browser.Select("name=StatusReason", "label=Test Account: No Longer Required"); browser.Click(AdminSuite.CustomerCreation.CustomersPage.UpdateCustomerButton); _frameworkCommon.WaitUntilAllElementsLoad(browser); System.Threading.Thread.Sleep(10000); if (browser.IsTextPresent("Current Customer Status: Suspended")) { return true; } else { return false; } } catch (Exception ex) { Console.WriteLine(ex.Message); return false; } }
/// <summary> Updates the PayoutFraction /// Author: Yogesh /// Date Created: FEb 29 2012 /// </summary> /// <param name="browser">Selenium browser Instance</param> /// <param name="selectionId">Selection Id of the selection</param> /// <param name="updatePayoutFractionNumerator">Payout fraction numerator</param> /// <param name="updatePayoutFractionDenominator">Payout fraction denominator</param> /// Ex: UpdatePayourFraction(browser, "12345678", "1", "2", "3"); /// Returns: Nothing public void UpdatePayoutFraction(ISelenium browser, string selectionId, string updatePayoutFractionNumerator, string updatePayoutFractionDenominator) { try { //Clicking on Event Link in LHN LHNavigation(AdminSuite.CommonControls.AdminHomePage.EventNameLink, browser); //Selecting TopFrame SelectMainFrame(browser); browser.Type(AdminSuite.CommonControls.AdminHomePage.OpenBetIdTextBox, selectionId); browser.Select(AdminSuite.CommonControls.AdminHomePage.OpenBetHierarchyLevelDrpLst, AdminSuite.CommonControls.AdminHomePage.OpenBetHeierarchyName); browser.Click(AdminSuite.CommonControls.AdminHomePage.EventFindBtn); _frameworkCommon.WaitUntilAllElementsLoad(browser); browser.WaitForPageToLoad(Framework.FrameGlobals.PageLoadTimeOut); browser.Click(AdminSuite.CommonControls.EventDetailsPage.BackButton); //click on back button string payoutFractionNumerator = browser.GetText("//tr[td[contains(text(), 'Each-Way')]]/td/input[@name='MktEWFacNum']"); string payoutFractionDenominator = browser.GetText("//tr[td[contains(text(), 'Each-Way')]]/td/input[@name='MktEWFacDen']"); if (String.IsNullOrWhiteSpace(payoutFractionNumerator) && String.IsNullOrWhiteSpace(payoutFractionDenominator)) { browser.Type("//tr[td[contains(text(), 'Each-Way')]]/td/input[@name='MktEWFacNum']", updatePayoutFractionNumerator); browser.Type("//tr[td[contains(text(), 'Each-Way')]]/td/input[@name='MktEWFacDen']", updatePayoutFractionDenominator); } // Updating the market details page browser.Click(AdminSuite.CommonControls.EventDetailsPage.ModifyMarketButton); browser.WaitForPageToLoad(Framework.FrameGlobals.PageLoadTimeOut); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); Console.WriteLine(ex.Message); } }
/// <Summary> /// Update Horse Racing event start date to tomorrow's date /// Author: Aswathy /// Created Date: Apr-19-2013 /// </Summary> /* public void UpdateEventStartDate(ISelenium adminBrowser, string eventID, DateTime date) { string x = date.ToString("yyyy-MM-dd hh:mm:ss"); //Eg:2013-04-29 15:00:00 //Clicking on Event Link in LHN LHNavigation(AdminSuite.CommonControls.AdminHomePage.EventNameLink, adminBrowser); //Selecting TopFrame SelectMainFrame(adminBrowser); adminBrowser.Type(AdminSuite.CommonControls.AdminHomePage.OpenBetIdTextBox, eventID); adminBrowser.Select(AdminSuite.CommonControls.AdminHomePage.OpenBetHierarchyLevelDrpLst, AdminSuite.CommonControls.AdminHomePage.OpenBetHeierarchyLevelEvent); adminBrowser.Click(AdminSuite.CommonControls.AdminHomePage.EventFindBtn); adminBrowser.WaitForPageToLoad(Framework.FrameGlobals.PageLoadTimeOut); adminBrowser.Type("//input[@id='start_time']", date.ToString()); adminBrowser.Click(AdminSuite.CommonControls.EventDetailsPage.updateEventBtn); adminBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut); } */ /// <Summary> /// Update Horse Racing event start date to tomorrow's date /// Author: Aswathy /// Created Date: Apr-26-2013 /// </Summary> /// public void UpdateOdds(ISelenium adminBrowser, string eventID, string newOddVal) { // Click on Event Link in LHN LHNavigation(AdminSuite.CommonControls.AdminHomePage.EventNameLink, adminBrowser); SelectMainFrame(adminBrowser); adminBrowser.Type(AdminSuite.CommonControls.AdminHomePage.OpenBetIdTextBox, eventID); adminBrowser.Select(AdminSuite.CommonControls.AdminHomePage.OpenBetHierarchyLevelDrpLst, AdminSuite.CommonControls.AdminHomePage.OpenBetHeierarchyName); adminBrowser.Click(AdminSuite.CommonControls.AdminHomePage.EventFindBtn); adminBrowser.WaitForPageToLoad(Framework.FrameGlobals.PageLoadTimeOut); // Updating the price adminBrowser.Type(AdminSuite.CommonControls.EventDetailsPage.PriceTxtBx, newOddVal); adminBrowser.Click(AdminSuite.CommonControls.EventDetailsPage.ModifySelectionButton); adminBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut); }
/// <summary> Update the Market Index Value of a selection dynamically, also we can suspend the market /// Author : Yogesh M /// Date Created: Feb 05 2011 /// Date Modfied: March 06 2011 /// Modification Comments: Added the status of market in the method /// Note: Market Index value is <= number of selections the market has /// eg: updatedMarketIndexValue = UpdateMarketIndex(browser, selectionId, 2, Suspended); /// UpdateMarketIndex(browser, selectionId, 0, Active); //label=Suspended or label=Active /// <param name="browser">Selenium Browser instance</param> /// </summary> /// <param name="browser"> </param> /// <param name="selectionId">Selection Id of the selection</param> /// <param name="updatedMarketIndexValue">User entered value of updated market index</param> /// <param name="status"> </param> /// <returns>Updated Market Index value</returns> public string UpdateMarketIndex(ISelenium browser, string selectionId, int updatedMarketIndexValue, string status) { try { string updatedMarektIndex = ""; //Clicking on Event Link in LHN LHNavigation(AdminSuite.CommonControls.AdminHomePage.EventNameLink, browser); //Selecting TopFrame SelectMainFrame(browser); browser.WaitForFrameToLoad(AdminSuite.CommonControls.AdminHomePage.EventNameLink, FrameGlobals.PageLoadTimeOut); browser.Type(AdminSuite.CommonControls.AdminHomePage.OpenBetIdTextBox, selectionId); browser.Select(AdminSuite.CommonControls.AdminHomePage.OpenBetHierarchyLevelDrpLst, AdminSuite.CommonControls.AdminHomePage.OpenBetHeierarchyName); browser.Click(AdminSuite.CommonControls.AdminHomePage.EventFindBtn); _frameworkCommon.WaitUntilAllElementsLoad(browser); browser.WaitForPageToLoad(Framework.FrameGlobals.PageLoadTimeOut); browser.Click(AdminSuite.CommonControls.EventDetailsPage.BackButton);//click on back button present in the selection page browser.WaitForPageToLoad(Framework.FrameGlobals.PageLoadTimeOut); if (updatedMarketIndexValue != 0) { //update the marketIndex value in the market page updatedMarektIndex = Convert.ToString(updatedMarketIndexValue, CultureInfo.InvariantCulture); browser.Type(AdminSuite.CommonControls.EventDetailsPage.BirIndexTextBox, updatedMarektIndex); Console.WriteLine("Market index is updated to : " + updatedMarektIndex + ""); //return updatedMarektIndex; } if (String.IsNullOrWhiteSpace(status) == false) { browser.Select("name=MktStatus", "label=" + status + ""); } // Updating the event details page browser.Click(AdminSuite.CommonControls.EventDetailsPage.ModifyMarketButton); browser.WaitForPageToLoad(Framework.FrameGlobals.PageLoadTimeOut); return updatedMarektIndex; } catch (Exception ex) { Console.WriteLine(ex.StackTrace); Console.WriteLine(ex.Message); return null; } }
public void UpdateHorseRaceSelectionResultSettlement(ISelenium browser, string selectionID, string resultValue) { //Clicking on Event Link in LHN LHNavigation(AdminSuite.CommonControls.AdminHomePage.EventNameLink, browser); //Selecting TopFrame SelectMainFrame(browser); browser.Type(AdminSuite.CommonControls.AdminHomePage.OpenBetIdTextBox, selectionID); browser.Select(AdminSuite.CommonControls.AdminHomePage.OpenBetHierarchyLevelDrpLst, AdminSuite.CommonControls.AdminHomePage.OpenBetHeierarchyName); browser.Click(AdminSuite.CommonControls.AdminHomePage.EventFindBtn); browser.WaitForPageToLoad(Framework.FrameGlobals.PageLoadTimeOut); //browser.SelectFrame("MainArea"); if (String.IsNullOrWhiteSpace(resultValue) == false) { browser.Select("name=OcResult", "label=" + resultValue + ""); } // Updating the event details page browser.Click("//th/input[@value='Set Selection Results']"); browser.WaitForPageToLoad(Framework.FrameGlobals.PageLoadTimeOut); //th/input[@value='Set Selection Results'] }
public void UpdateEventStartDateTimeBySelectionID(ISelenium browser, string selectionID, string startDateTime) { try { //Clicking on Event Link in LHN LHNavigation(AdminSuite.CommonControls.AdminHomePage.EventNameLink, browser); //Selecting TopFrame SelectMainFrame(browser); browser.WaitForFrameToLoad(AdminSuite.CommonControls.AdminHomePage.EventNameLink, FrameGlobals.PageLoadTimeOut); browser.Type(AdminSuite.CommonControls.AdminHomePage.OpenBetIdTextBox, selectionID); browser.Select(AdminSuite.CommonControls.AdminHomePage.OpenBetHierarchyLevelDrpLst, "label=Even outcome");// AdminSuite.CommonControls.AdminHomePage.OpenBetHeierarchyName); browser.Click(AdminSuite.CommonControls.AdminHomePage.EventFindBtn); _frameworkCommon.WaitUntilAllElementsLoad(browser); browser.WaitForPageToLoad(Framework.FrameGlobals.PageLoadTimeOut); browser.Click(AdminSuite.CommonControls.EventDetailsPage.BackButton);//click on back button present in the selection page browser.WaitForPageToLoad(Framework.FrameGlobals.PageLoadTimeOut); browser.Click(AdminSuite.CommonControls.EventDetailsPage.BackButton);//click on back button present in the selection page browser.WaitForPageToLoad(Framework.FrameGlobals.PageLoadTimeOut); string startTimeXpath = "//input[@name='EvStartTime']"; browser.Type(startTimeXpath, startDateTime); //if (browser.IsElementPresent(startTimeXpath)) //{ // //startTime = browser.GetText(startTimeXpath); // startTime = browser.GetValue(startTimeXpath); //} //Updating the Event if (browser.IsElementPresent(AdminSuite.CommonControls.EventDetailsPage.updateEventBtn)) { browser.Click(AdminSuite.CommonControls.EventDetailsPage.updateEventBtn); browser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut); Assert.IsTrue(_frameworkCommon.WaitUntilElementPresent(browser, AdminSuite.CommonControls.EventDetailsPage.eventDescriptionTextBox, "120"), "Event Updation is not Successfull"); } } catch (Exception ex) { Console.WriteLine(ex.StackTrace); Console.WriteLine(ex.Message); //return null; } }
/// <summary> Update the Handicap Value of a selection /// Author : Yogesh M /// </summary> /// Date Created: Feb 03 2012 /// eg: updatehandicapValue = UpdateHandicapValue(browser, "1234555", "2"); /// Note: You need to specify the list number present in the Handicap list box & not the value in the list box /// <param name="browser">Selenium Browser Instance</param> /// <param name="selectionId">Selection Id of the selection</param> /// <param name="handicapListNumber">The list number in the handicap list box(1 to 81)</param> /// <returns> Updated handicap value</returns> public string UpdateHandicapValue(ISelenium browser, string selectionId, int handicapListNumber) { try { //Clicking on Event Link in LHN LHNavigation(AdminSuite.CommonControls.AdminHomePage.EventNameLink, browser); //Selecting TopFrame Thread.Sleep(2000); browser.WaitForPageToLoad("60000"); browser.SelectFrame("relative=top"); browser.SelectFrame("MainArea"); browser.WaitForPageToLoad("10000"); //SelectMainFrame(browser); browser.Type("//input[@name='openbet_id']", selectionId); // browser.Select(AdminSuite.CommonControls.AdminHomePage.OpenBetHierarchyLevelDrpLst, AdminSuite.CommonControls.AdminHomePage.OpenBetHeierarchyName); browser.Select("//select[@name='hierarchy_level']", AdminSuite.CommonControls.AdminHomePage.OpenBetHeierarchyName); browser.Focus(AdminSuite.CommonControls.AdminHomePage.EventFindBtn); browser.Click(AdminSuite.CommonControls.AdminHomePage.EventFindBtn); _frameworkCommon.WaitUntilAllElementsLoad(browser); browser.WaitForPageToLoad(Framework.FrameGlobals.PageLoadTimeOut); browser.Focus(AdminSuite.CommonControls.EventDetailsPage.BackButton); //click on back button present in the selection page browser.Click(AdminSuite.CommonControls.EventDetailsPage.BackButton); //click on back button present in the selection page browser.WaitForPageToLoad(Framework.FrameGlobals.PageLoadTimeOut); //update the handicap value in the market page IWebDriver driver = ((WebDriverBackedSelenium)browser).UnderlyingWebDriver; _frameworkCommon.WaitUntilAllElementsLoad(browser); Thread.Sleep(5000); _frameworkCommon.WaitUntilElementPresent(browser, AdminSuite.CommonControls.EventDetailsPage.HandicapValueListBox, "20000"); int labels = driver.FindElements(By.XPath(AdminSuite.CommonControls.EventDetailsPage.HandicaValueLabels)).Count; // verify if the user has entered the handicap list number present in the handicap list box in market page Assert.IsTrue(handicapListNumber <= labels, "Please select a handicap list number <= " + labels + ""); string updatedHandicapValue = driver.FindElement(By.XPath("//select[@name='MktHcapValue']/option[" + handicapListNumber + "]")).Text; browser.Select(AdminSuite.CommonControls.EventDetailsPage.HandicapValueListBox, updatedHandicapValue); // Handicap list drop down in the market page // Updating the event details page browser.Click(AdminSuite.CommonControls.EventDetailsPage.ModifyMarketButton); browser.WaitForPageToLoad(Framework.FrameGlobals.PageLoadTimeOut); Console.WriteLine("Handicapped value is updated to : " + updatedHandicapValue + ""); return updatedHandicapValue; } catch (Exception ex) { Console.WriteLine(ex.StackTrace); Console.WriteLine(ex.Message); return null; } }
/// <summary> /// Search for an Event /// </summary> /// <param name="browser">Selenium browser instance</param> /// <param name="catName">Category Name</param> /// <param name="eventClsName">Event ClassName</param> /// <param name="eventTypeName">Event TypeName</param> /// <param name="eventSubType">Event SubType</param> /// <param name="eventName">Event Name</param> /// <param name="eventStatus">Event Status</param> public bool SearchEvent(ISelenium browser, string catName, string eventClsName, string eventTypeName, string eventSubType, string eventName) { try { bool eventFound = false; TimeSpan ts = new TimeSpan(0, 1, 0); IWebDriver driver = ((WebDriverBackedSelenium)browser).UnderlyingWebDriver; //Clicking on Event Link in LHN LHNavigation(AdminSuite.CommonControls.AdminHomePage.EventNameLink, browser); //Selecting TopFrame System.Threading.Thread.Sleep(10000); SelectMainFrame(browser); _frameworkCommon.WaitUntilElementPresent(browser, AdminSuite.CommonControls.EventDetailsPage.categoryNameLstBx, "60"); catName = catName.Replace("|", "").Trim(); if (catName != "") { if (browser.IsElementPresent(AdminSuite.CommonControls.EventDetailsPage.categoryNameLstBx)) { Assert.IsTrue(_frameworkCommon.CheckItemPresentInDropDownList(browser, AdminSuite.CommonControls.EventDetailsPage.categoryNameLstBx, catName), "Category Name does not present in DropdownList"); browser.Select(AdminSuite.CommonControls.EventDetailsPage.categoryNameLstBx, "label=" + catName); } } eventClsName = eventClsName.Replace("|", "").Trim(); if (eventClsName != "") { if (browser.IsElementPresent(AdminSuite.CommonControls.EventDetailsPage.classNameLstBx)) { Assert.IsTrue(_frameworkCommon.CheckItemPresentInDropDownList(browser, AdminSuite.CommonControls.EventDetailsPage.classNameLstBx, eventClsName), "EventClass Name does not present"); browser.Select(AdminSuite.CommonControls.EventDetailsPage.classNameLstBx, "label=" + eventClsName); } } if (eventTypeName != "") { if (browser.IsElementPresent(AdminSuite.CommonControls.EventDetailsPage.eventTypeLstBx)) { Assert.IsTrue(_frameworkCommon.CheckItemPresentInDropDownList(browser, AdminSuite.CommonControls.EventDetailsPage.eventTypeLstBx, eventTypeName), "EventClass Name does not present"); browser.Select(AdminSuite.CommonControls.EventDetailsPage.eventTypeLstBx, "label=" + eventTypeName); } } if (eventSubType != "") { if (browser.IsElementPresent(AdminSuite.CommonControls.EventDetailsPage.subEventTypeLstBx)) { Assert.IsTrue(_frameworkCommon.CheckItemPresentInDropDownList(browser, AdminSuite.CommonControls.EventDetailsPage.subEventTypeLstBx, eventSubType), "EventSubType Name does not present"); browser.Select(AdminSuite.CommonControls.EventDetailsPage.subEventTypeLstBx, "label=" + eventSubType); } } Assert.IsTrue(_frameworkCommon.CheckItemPresentInDropDownList(browser, AdminSuite.CommonControls.EventDetailsPage.dateRangeLstBx, "--"), "Date range dropdown missing"); // Selecting Daterange if (browser.IsElementPresent(AdminSuite.CommonControls.EventDetailsPage.dateRangeLstBx)) { browser.Select(AdminSuite.CommonControls.EventDetailsPage.dateRangeLstBx, "label=--"); } //Clicking on Seach button browser.Click(AdminSuite.CommonControls.EventDetailsPage.eventSearchBtn); _frameworkCommon.WaitUntilAllElementsLoad(browser); browser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut); //Thread.Sleep(2000); // Wait for Element to present if (_frameworkCommon.WaitUntilElementPresent(browser, "link=" + eventName + "", "60") == true) { browser.Click("link=" + eventName); browser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut); eventFound = true; } return eventFound; } catch (Exception ex) { CaptureScreenshot(browser, ""); Fail(ex.Message); return false; } }
/// <summary> /// Update market by Market id in Open bet /// </summary> /// <param name="browser">Browser instance</param> /// <param name="marketId">Market id</param> /// <param name="marketStatus">Market status</param> /// <param name="marketDisplayed">Display</param> public void UpdateMarketByMarketID(ISelenium browser, string marketId, string marketStatus, string marketDisplayed) { try { //Clicking on Event Link in LHN LHNavigation(AdminSuite.CommonControls.AdminHomePage.EventNameLink, browser); //Selecting TopFrame SelectMainFrame(browser); browser.WaitForFrameToLoad(AdminSuite.CommonControls.AdminHomePage.EventNameLink, FrameGlobals.PageLoadTimeOut); browser.Type(AdminSuite.CommonControls.AdminHomePage.OpenBetIdTextBox, marketId); browser.Select(AdminSuite.CommonControls.AdminHomePage.OpenBetHierarchyLevelDrpLst, "label=Event market");// AdminSuite.CommonControls.AdminHomePage.OpenBetHeierarchyName); browser.Click(AdminSuite.CommonControls.AdminHomePage.EventFindBtn); _frameworkCommon.WaitUntilAllElementsLoad(browser); browser.WaitForPageToLoad(Framework.FrameGlobals.PageLoadTimeOut); //browser.Click(AdminSuite.CommonControls.EventDetailsPage.BackButton);//click on back button present in the selection page //browser.WaitForPageToLoad(Framework.FrameGlobals.PageLoadTimeOut); if (string.Empty != marketStatus) { if (marketStatus == "Suspend") { browser.Select(AdminSuite.CommonControls.EventDetailsPage.marketStatusListBox, "label=Suspended"); } else if (marketStatus == "Active") { browser.Select(AdminSuite.CommonControls.EventDetailsPage.marketStatusListBox, "label=Active"); } else { throw new AutomationException("Market status is invalid."); } browser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut); } if (string.Empty != marketDisplayed) { if (marketDisplayed == "Yes") { browser.Select(AdminSuite.CommonControls.EventDetailsPage.mktDisplayListBox, "label=Yes"); } else if (marketDisplayed == "No") { browser.Select(AdminSuite.CommonControls.EventDetailsPage.mktDisplayListBox, "label=No"); } else { throw new AutomationException("Market displayed is invalid."); } } //update Market if (browser.IsElementPresent(AdminSuite.CommonControls.EventDetailsPage.ModifyMarketButton)) { browser.Click(AdminSuite.CommonControls.EventDetailsPage.ModifyMarketButton); browser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut); Assert.IsTrue(_frameworkCommon.WaitUntilElementPresent(browser, AdminSuite.CommonControls.EventDetailsPage.eventDescriptionTextBox, "120"), "Market Updation is not Successfull"); } } catch (Exception ex) { Console.WriteLine(ex.StackTrace); Console.WriteLine(ex.Message); //return null; } }
/* /// <Summary> /// Update Horse Racing event start date /// Author: Revathy /// Created Date: Apr-30-2013 /// </Summary> public string UpdateEventStartDateTime(ISelenium adminBrowserObj, string eventid, string date) { string EventStartTime = GetEventStartTimeByEventID(adminBrowserObj, eventid); SelectMainFrame(adminBrowserObj); adminBrowserObj.Type("//input[@name='EvStartTime']", date); adminBrowserObj.Click(AdminSuite.CommonControls.EventDetailsPage.updateEventBtn); return EventStartTime; } */ /// <Summary> /// Update Horse Racing event Early price status /// Author: Revathy /// Created Date: Apr-30-2013 /// </Summary> public void SetEventLPStatus(ISelenium adminBrowserObj, string eventid, string status) { string EventStartTime = GetEventStartTimeByEventID(adminBrowserObj, eventid); adminBrowserObj.Click("//a[contains(string(),'Race Winner')]"); Thread.Sleep(5000); SelectMainFrame(adminBrowserObj); adminBrowserObj.Select("//select[@name='MktLPAvail']", status); adminBrowserObj.Click("//input[@value='Modify Market']"); }
/// <summary> /// To Update Markt Status /// </summary> /// <param name="browser">Selenium browser instance</param> /// <param name="catName">Category Name</param> /// <param name="eventClsName">Event ClassName</param> /// <param name="eventTypeName">Event TypeName</param> /// <param name="eventSubType">Event SubType</param> /// <param name="eventName">Event Name</param> /// <param name="eventStatus">Event Display Status</param> public void UpdateMarketStatus(ISelenium browser, string catName, string eventClsName, string eventTypeName, string eventSubType, string eventName, string mktName, string marketStatus) { string errorMessage = ""; bool eventUpdationStatus = false; bool finalEventStatus = true; Framework.Common.Common frameworkcommon = new Framework.Common.Common(); AdminSuite.Common com = new AdminSuite.Common(); Framework.Common.Common Fcommon = new Framework.Common.Common(); TimeSpan ts = new TimeSpan(0, 1, 0); IWebDriver driver = ((WebDriverBackedSelenium)browser).UnderlyingWebDriver; //Clicking on Event Link in LHN LHNavigation(AdminSuite.CommonControls.AdminHomePage.EventNameLink, browser); //Selecting TopFrame SelectMainFrame(browser); System.Threading.Thread.Sleep(10000); frameworkcommon.WaitUntilElementPresent(browser, AdminSuite.CommonControls.EventDetailsPage.categoryNameLstBx, "60"); catName = catName.Replace("|", "").Trim(); if (catName != "") { Assert.IsTrue(frameworkcommon.CheckItemPresentInDropDownList(browser, AdminSuite.CommonControls.EventDetailsPage.categoryNameLstBx, catName), "Category Name does not present in DropdownList"); browser.Select(AdminSuite.CommonControls.EventDetailsPage.categoryNameLstBx, "label=" + catName); } eventClsName = eventClsName.Replace("|", "").Trim(); if (eventClsName != "") { Assert.IsTrue(frameworkcommon.CheckItemPresentInDropDownList(browser, AdminSuite.CommonControls.EventDetailsPage.classNameLstBx, eventClsName), "EventClass Name does not present"); browser.Select(AdminSuite.CommonControls.EventDetailsPage.classNameLstBx, "label=" + eventClsName); } if (eventTypeName != "") { Assert.IsTrue(frameworkcommon.CheckItemPresentInDropDownList(browser, AdminSuite.CommonControls.EventDetailsPage.eventTypeLstBx, eventTypeName), "EventClass Name does not present"); browser.Select(AdminSuite.CommonControls.EventDetailsPage.eventTypeLstBx, "label=" + eventTypeName); } Assert.IsTrue(frameworkcommon.CheckItemPresentInDropDownList(browser, AdminSuite.CommonControls.EventDetailsPage.dateRangeLstBx, "--"), "Date range dropdown missing"); // Selecting Daterange browser.Select(AdminSuite.CommonControls.EventDetailsPage.dateRangeLstBx, "label=--"); //Clicking on Seach button browser.Click(AdminSuite.CommonControls.EventDetailsPage.eventSearchBtn); _frameworkCommon.WaitUntilAllElementsLoad(browser); browser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut); // Wait for Element to present if (frameworkcommon.WaitUntilElementPresent(browser, "link=" + eventName + "", "60") == true) { browser.Click("link=" + eventName); browser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut); Thread.Sleep(10000); //Wait Untill the EventDetails Page loads if (frameworkcommon.WaitUntilElementPresent(browser, AdminSuite.CommonControls.EventDetailsPage.eventDescriptionTextBox, "60") == true) { if (frameworkcommon.WaitUntilElementPresent(browser, "link=" + "|" + mktName + "|" + "", "60") == true) { //browser.Click("link=" + mktName); browser.Click("link=" + "|" + mktName + "|"); browser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut); if (marketStatus == "Suspend") { browser.Select(AdminSuite.CommonControls.EventDetailsPage.marketStatusListBox, "label=Suspended"); eventUpdationStatus = false; browser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut); } else { browser.Select(AdminSuite.CommonControls.EventDetailsPage.marketStatusListBox, "label=Active"); } //Updating the Event if (browser.IsElementPresent(AdminSuite.CommonControls.EventDetailsPage.ModifyMarketButton)) { if (eventUpdationStatus == false) { browser.Click(AdminSuite.CommonControls.EventDetailsPage.ModifyMarketButton); browser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut); Assert.IsTrue(frameworkcommon.WaitUntilElementPresent(browser, AdminSuite.CommonControls.EventDetailsPage.eventDescriptionTextBox, "120"), "markrt display status Updation is not Successfull"); browser.Click(AdminSuite.CommonControls.EventDetailsPage.updateEventBtn); browser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut); } } } } } else { finalEventStatus = false; errorMessage = errorMessage + eventName; errorMessage = errorMessage + Environment.NewLine; } //Finally checking whether all the Events are Suspended or not if (finalEventStatus == false) { Framework.BaseTest.Fail("market display status updation Process is Failed"); } }
/// <summary> /// Update a Selection result /// Author: Aswathy /// Created Date: Jun-10-2013 /// </summary> public void SetSelectionResult(ISelenium adminBrowser, string selectionID, string resultStatus) { try { //Clicking on Event Link in LHN LHNavigation(AdminSuite.CommonControls.AdminHomePage.EventNameLink, adminBrowser); //Selecting TopFrame SelectMainFrame(adminBrowser); adminBrowser.Type(AdminSuite.CommonControls.AdminHomePage.OpenBetIdTextBox, selectionID); adminBrowser.Select(AdminSuite.CommonControls.AdminHomePage.OpenBetHierarchyLevelDrpLst, AdminSuite.CommonControls.AdminHomePage.OpenBetHeierarchyName); adminBrowser.Click(AdminSuite.CommonControls.AdminHomePage.EventFindBtn); adminBrowser.WaitForPageToLoad(Framework.FrameGlobals.PageLoadTimeOut); adminBrowser.Select(AdminSuite.CommonControls.AdminHomePage.ResultStatus, "label=" + resultStatus + ""); adminBrowser.Click("//input[@type='button' and @value='Set Selection Results']"); adminBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut); } catch (Exception ex) { CaptureScreenshot(adminBrowser, ""); Console.WriteLine(ex); } }
/// <summary> /// Adding a Reward Adhoc token to customer in Admin. /// </summary> /// Date Created: /// Author: Anand C /// User should be login to Admin application /// <param name="adminBrowser">Browser Instance</param> /// <param name="custName">Customer name for whom the token be added</param> /// <param name="tokenVal">token value to be added</param> public bool UpdatePayMtd(ISelenium adminBrowser, string cardNum, string status, string CustomerName) { try { //Click on Debit/Credit link /*if (!AdminTableObjects(adminBrowser, "Customer Payment Methods", cardNum.Substring(cardNum.Length - 4, 4), "Link", "", 1)) { Framework.BaseTest.CaptureScreenshot(adminBrowser); Console.WriteLine("Unable to put value in Card Search Text box in Card Search page"); return false; }*/ Assert.IsTrue(adminBrowser.IsElementPresent("//table//th[contains(text(),'Customer Payment Methods')]//ancestor::table/tbody/tr[td[contains(.,'" + cardNum.Substring(cardNum.Length - 4, 4) + "')]]//a"), cardNum + " card is not available for this customer: " + CustomerName); adminBrowser.Click("//table//th[contains(text(),'Customer Payment Methods')]//ancestor::table/tbody/tr[td[contains(.,'" + cardNum.Substring(cardNum.Length - 4, 4) + "')]]//a"); adminBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut); // Assert.IsTrue(adminBrowser.IsElementPresent("//select[@name='status']"), "Authorisation status list box is not visible"); Assert.IsTrue(adminBrowser.IsElementPresent("//select[@name='auth_dep']"), "Authorisation deposit list box is not visible"); Assert.IsTrue(adminBrowser.IsElementPresent("//select[@name='auth_wtd']"), "Authorisation withdrawal list box is not visible"); adminBrowser.Select("//select[@name='status']", status); adminBrowser.Select("//select[@name='auth_dep']", "Yes"); adminBrowser.Select("//select[@name='status_dep']", "Active"); adminBrowser.Select("//select[@name='auth_wtd']", "Yes"); adminBrowser.Select("//select[@name='status_wtd']", "Active"); //click on the Update Payment Method button if (!AdminTableObjects(adminBrowser, "Authorisation", "", "Button", "Update Payment Method", 1)) { Framework.BaseTest.CaptureScreenshot(adminBrowser, ""); Console.WriteLine("Unable click on Payment Method button in Customer Payment page"); return false; } adminBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut); Thread.Sleep(5000); Console.WriteLine("Successfully searched the customer"); return true; } catch (Exception ex) { Console.WriteLine(ex.Message); Framework.BaseTest.CaptureScreenshot(adminBrowser, ""); return false; } }
/// <Summary> /// Show all Horse Racing Events that starts "Tomorrow" /// Author: Aswathy /// Created Date: Apr-19-2013 /// </Summary> public void ShowTomoHorseRacingEvents(ISelenium adminBrowser) { Framework.Common.Common frameworkcommon = new Framework.Common.Common(); //Clicking on Event Link in LHN LHNavigation(AdminSuite.CommonControls.AdminHomePage.EventNameLink, adminBrowser); //Selecting TopFrame SelectMainFrame(adminBrowser); System.Threading.Thread.Sleep(10000); adminBrowser.Select(AdminSuite.CommonControls.EventDetailsPage.categoryNameLstBx, "label=RACING"); adminBrowser.Select(AdminSuite.CommonControls.EventDetailsPage.classNameLstBx, "label=Horse Racing"); // adminBrowser.Select(AdminSuite.CommonControls.EventDetailsPage.eventTypeLstBx, "label=" + eventTypeName); // adminBrowser.Select(AdminSuite.CommonControls.EventDetailsPage.subEventTypeLstBx, "label=" + eventSubType); adminBrowser.Select(AdminSuite.CommonControls.EventDetailsPage.dateRangeLstBx, "label=Tomorrow"); adminBrowser.Select("name=status", "label=Active"); adminBrowser.Click(AdminSuite.CommonControls.EventDetailsPage.showEventBtn); adminBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut); }
/// <summary> /// Updates a perticular segment value /// </summary> /// Author: Kiran /// <param name="browser">browser Instance</param> /// <param name="userName">User Name</param> /// <param name="segmentType">HVC</param> /// <param name="segmentVal">Yes</param> public bool UpdateSegments(ISelenium adminBrowser, string userName, string segmentType, string segmentVal) { try { // Enter Customer Name and Search SearchCustomer(userName, adminBrowser); SelectMainFrame(adminBrowser); adminBrowser.Click(AdminSuite.CustomerCreation.CustomersPage.updateSegment); adminBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut); string xPath = "//tr/td[contains(text(), '" + segmentType + "')]/following-sibling::td/select"; Assert.IsTrue(adminBrowser.IsElementPresent(xPath), "Element not found " + xPath); adminBrowser.Select(xPath, segmentVal); Thread.Sleep(1000); adminBrowser.Click(AdminSuite.CustomerCreation.CustomersPage.updateSegmentandURL); adminBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut); xPath = "//tr/td[@class='caption' and contains(text(), '" + segmentType + "')]/following-sibling::td[contains(text(), '" + segmentVal + "')]"; if (segmentVal.ToLower().Contains("unset") || segmentVal.ToLower().Contains("no")) { if (adminBrowser.IsAlertPresent()) { adminBrowser.ChooseOkOnNextConfirmation(); } xPath = "//tr/td[@class='caption' and contains(text(), '" + segmentType + "')]/following-sibling::td/i[contains(text(), '" + segmentVal + "')]"; } adminBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut); adminBrowser.Click(AdminSuite.CustomerCreation.CustomersPage.backBtn); adminBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut); Assert.IsTrue(adminBrowser.IsElementPresent(xPath), "Element not found " + xPath); return true; } catch (Exception ex) { CaptureScreenshot(adminBrowser, ""); Fail(ex.Message); return false; } }
/// <summary> /// Add desired Customer to Banned User Group /// </summary> /// Author: Anand /// <param name="browser">Browser Instance</param> /// <param name="userName">User Name</param> public bool UpdateBannedCountryCustomer(ISelenium browser, string userName, string countryName) { //Clicking on Event Link in LHN LHNavigation(AdminSuite.CommonControls.AdminHomePage.CustomersLink, browser); //Selecting TopFrame SelectMainFrame(browser); // Enter Customer Name and Search SearchCustomer(userName, browser); // if (browser.IsElementPresent(AdminSuite.CustomerCreation.CustomersPage.UpdateRegistrationButton)) { browser.Click(AdminSuite.CustomerCreation.CustomersPage.UpdateRegistrationButton); browser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut); //const string strBannedCountryName = ; browser.Select(AdminSuite.CustomerCreation.CustomersPage.CntryTxtBx, countryName); browser.Click(AdminSuite.CustomerCreation.CustomersPage.UpdateCustomerButton); _frameworkCommon.WaitUntilAllElementsLoad(browser); if (browser.IsTextPresent(countryName)) { //UpdateCustomerStatus(browser, userName, "Active", "-- unset --", "-- unset --"); Console.WriteLine("Change of country to " + countryName + " is successfull"); return true; } else { Console.WriteLine("Change of country to " + countryName + " was unsuccessfull"); return false; } } else { Console.WriteLine("AdminSuite:Common:Fail- Update Registration Button is not Found"); return false; } }
/// <summary> /// To update the Selection /// </summary> /// <param name="browser">Selenium browser Instance</param> /// <param name="selectionId">ID of the selection</param> /// <param name="status"> Display Status to be updated</param> public void UpdateSelectionDisplayStatus(ISelenium browser, string selectionId, string displayStatus) { //Clicking on Event Link in LHN LHNavigation(AdminSuite.CommonControls.AdminHomePage.EventNameLink, browser); //Selecting TopFrame SelectMainFrame(browser); browser.Type(AdminSuite.CommonControls.AdminHomePage.OpenBetIdTextBox, selectionId); browser.Select(AdminSuite.CommonControls.AdminHomePage.OpenBetHierarchyLevelDrpLst, AdminSuite.CommonControls.AdminHomePage.OpenBetHeierarchyName); browser.Click(AdminSuite.CommonControls.AdminHomePage.EventFindBtn); browser.WaitForPageToLoad(Framework.FrameGlobals.PageLoadTimeOut); if (String.IsNullOrWhiteSpace(displayStatus) == false) { browser.Select(AdminSuite.CommonControls.EventDetailsPage.SelectionDispStatusListBx, "label=" + displayStatus + ""); } else { Fail("unable to update the Displayed status in admin as Displayed list box is not present in admin"); } // Updating the event details page browser.Click(AdminSuite.CommonControls.EventDetailsPage.SelectionUpdateBtn); browser.WaitForPageToLoad(Framework.FrameGlobals.PageLoadTimeOut); }
/// <summary> /// To Update Customer Flag Information /// </summary> /// Author: Anand /// <param name="flagName"> </param> /// <param name="flagVal"> </param> /// <param name="myBrowser"> </param> /// Ex: Adit_Test_SelfExcluded /// <returns>None</returns> /// Created Date: 12-April-2012 public bool UpdateCustomerFlag(string flagName, string flagVal, ISelenium myBrowser) { try { // Navigating to MainFrame SelectMainFrame(myBrowser); IWebDriver driver = ((WebDriverBackedSelenium)myBrowser).UnderlyingWebDriver; Assert.IsTrue(myBrowser.IsElementPresent(AdminSuite.CustomerCreation.CustomersPage.ViewCustFlag), "Customer Flag Information table isnot found"); myBrowser.Click(AdminSuite.CustomerCreation.CustomersPage.ViewCustFlag); myBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut); //Updating the customer flags Assert.IsTrue(driver.FindElement(By.XPath("//tr//td/b[text()='" + flagName + "']//ancestor::tr/td/Select")).Displayed, "Unable to navigate to Customer Flags page"); myBrowser.Select("//tr//td/b[text()='" + flagName + "']//ancestor::tr/td/Select", flagVal); Assert.IsTrue(driver.FindElement(By.XPath("//th[@class='buttons']/input[@value='Update Customer Flags']")).Displayed, "Update Customer Flags button is not displayed in Customer Flags page"); myBrowser.Click("//th[@class='buttons']/input[@value='Update Customer Flags']"); myBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut); return true; } catch (Exception ex) { BaseTest.CaptureScreenshot(myBrowser, ""); Console.WriteLine(ex.StackTrace); BaseTest.Fail(ex.Message); return false; } }
/// <summary> /// Verifying event details data in openbet /// </summary> /// <param name="browser">Browser instance</param> /// <param name="testData">Test data</param> public void VerifyEventData(ISelenium browser, TestData testData) { //IWebDriver driver = ((WebDriverBackedSelenium)browser).UnderlyingWebDriver; string eventStatus = string.Empty; string eventDisplay = string.Empty; bool updateEventFlg = false; //Wait Untill the EventDetails Page loads if (_frameworkCommon.WaitUntilElementPresent(browser, AdminSuite.CommonControls.EventDetailsPage.eventDescriptionTextBox, "60") == true) { eventStatus = browser.GetValue(AdminSuite.CommonControls.EventDetailsPage.eventStatusListBox); eventDisplay = browser.GetValue(AdminSuite.CommonControls.EventDetailsPage.eventDisplayStatusLstBx); if ("a" != eventStatus.ToLower()) { browser.Select(AdminSuite.CommonControls.EventDetailsPage.eventStatusListBox, "label=Active"); Console.WriteLine("Updated Event status to Active"); updateEventFlg = true; } if ("y" != eventDisplay.ToLower()) { browser.Select(AdminSuite.CommonControls.EventDetailsPage.eventDisplayStatusLstBx, "label=Yes"); Console.WriteLine("Updated Event display to Yes"); updateEventFlg = true; } if (updateEventFlg) { if (browser.IsElementPresent(AdminSuite.CommonControls.EventDetailsPage.updateEventBtn)) { browser.Click(AdminSuite.CommonControls.EventDetailsPage.updateEventBtn); browser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut); Assert.IsTrue(_frameworkCommon.WaitUntilElementPresent(browser, AdminSuite.CommonControls.EventDetailsPage.eventDescriptionTextBox, "120"), "Event Updation is not Successfull"); } else { Console.WriteLine("Unable to update the event in Openbet"); } } browser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut); } }
/// <summary> /// Active the status of a customer /// </summary> /// Author: Kiran /// <param name="browser">Browser Instance</param> /// <param name="userName">User Name</param> public void UpdateCustomerStatus(ISelenium browser, string userName, string status, string statusGroup, string statusReason) { //Clicking on Event Link in LHN LHNavigation(AdminSuite.CommonControls.AdminHomePage.CustomersLink, browser); //Selecting TopFrame SelectMainFrame(browser); // Enter Customer Name and Search SearchCustomer(userName, browser); // if (browser.IsElementPresent(AdminSuite.CustomerCreation.CustomersPage.UpdateCustomerButton)) { browser.Select(AdminSuite.CustomerCreation.CustomersPage.CustomerStatusLstBx, status); browser.Select(AdminSuite.CustomerCreation.CustomersPage.ReasonForSuspendingUserLstBx, statusGroup); Thread.Sleep(2000); browser.Select(AdminSuite.CustomerCreation.CustomersPage.StatusReasonLstBx, statusReason); browser.Click(AdminSuite.CustomerCreation.CustomersPage.UpdateCustomerButton); _frameworkCommon.WaitUntilAllElementsLoad(browser); } }
/// <summary> /// Verifying selection data /// </summary> /// <param name="browser">Browser instance</param> /// <param name="testData">TestData</param> public void VerifySelectionData(ISelenium browser, TestData testData) { string selectionStatus = string.Empty; string selectionDisplay = string.Empty; string selectionPrice = string.Empty; bool updateSelectionFlg = false; if (_frameworkCommon.WaitUntilElementPresent(browser, "name=OcDesc", "60") == true) { selectionStatus = browser.GetValue(AdminSuite.CommonControls.EventDetailsPage.SelectionStatusLstBx); selectionDisplay = browser.GetValue(AdminSuite.CommonControls.EventDetailsPage.SelectionDispStatusListBx); selectionPrice = browser.GetValue(AdminSuite.CommonControls.EventDetailsPage.PriceTxtBx); if ("a" != selectionStatus.ToLower()) { browser.Select(AdminSuite.CommonControls.EventDetailsPage.SelectionStatusLstBx, "label=Active"); Console.WriteLine("Updated selection status to Active"); updateSelectionFlg = true; } if ("y" != selectionDisplay.ToLower()) { browser.Select(AdminSuite.CommonControls.EventDetailsPage.SelectionDispStatusListBx, "label=Yes"); Console.WriteLine("Updated selection display to Yes"); updateSelectionFlg = true; } if (testData.Odds != selectionPrice) { browser.Type(AdminSuite.CommonControls.EventDetailsPage.PriceTxtBx, testData.Odds); Console.WriteLine("Updated selection price from test data"); updateSelectionFlg = true; } if (updateSelectionFlg) { if (browser.IsElementPresent(AdminSuite.CommonControls.EventDetailsPage.SelectionUpdateBtn)) { browser.Click(AdminSuite.CommonControls.EventDetailsPage.SelectionUpdateBtn); browser.WaitForPageToLoad(Framework.FrameGlobals.PageLoadTimeOut); } else { Console.WriteLine("Unable to update the event in Openbet"); } Thread.Sleep(3000); } browser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut); } }
/// <summary> /// Update each way in Open bet. /// </summary> /// <param name="browser">Browser instance</param> /// <param name="selectionId">Selection id</param> /// <param name="eachWayPlaces">Each way place</param> /// <param name="eachWayTopValue">Top value</param> /// <param name="eachWayBottomValue">bottom value</param> /// <returns></returns> public string UpdateEachWay(ISelenium browser, string selectionId, string eachWayPlaces, string eachWayTopValue, string eachWayBottomValue) { try { string updatedMarektIndex = ""; //Clicking on Event Link in LHN LHNavigation(AdminSuite.CommonControls.AdminHomePage.EventNameLink, browser); //Selecting TopFrame SelectMainFrame(browser); browser.WaitForFrameToLoad(AdminSuite.CommonControls.AdminHomePage.EventNameLink, FrameGlobals.PageLoadTimeOut); browser.Type(AdminSuite.CommonControls.AdminHomePage.OpenBetIdTextBox, selectionId); browser.Select(AdminSuite.CommonControls.AdminHomePage.OpenBetHierarchyLevelDrpLst, AdminSuite.CommonControls.AdminHomePage.OpenBetHeierarchyName); browser.Click(AdminSuite.CommonControls.AdminHomePage.EventFindBtn); _frameworkCommon.WaitUntilAllElementsLoad(browser); browser.WaitForPageToLoad(Framework.FrameGlobals.PageLoadTimeOut); browser.Click(AdminSuite.CommonControls.EventDetailsPage.BackButton);//click on back button present in the selection page browser.WaitForPageToLoad(Framework.FrameGlobals.PageLoadTimeOut); if (string.Empty != eachWayPlaces && "0" != eachWayPlaces.Trim()) { browser.Type(AdminSuite.CommonControls.EventDetailsPage.EachWayPlacesTxtBx, eachWayPlaces); Console.WriteLine("Each way Places is updated to : " + eachWayPlaces + ""); } if (string.Empty != eachWayTopValue && "0" != eachWayTopValue.Trim()) { browser.Type(AdminSuite.CommonControls.EventDetailsPage.EachWayTopTxtBx, eachWayTopValue); Console.WriteLine("Each way top is updated to : " + eachWayTopValue + ""); } if (string.Empty != eachWayBottomValue && "0" != eachWayBottomValue.Trim()) { browser.Type(AdminSuite.CommonControls.EventDetailsPage.EachWayBottomTxtBx, eachWayBottomValue); Console.WriteLine("Each way Bottom is updated to : " + eachWayBottomValue + ""); } // Updating the event details page browser.Click(AdminSuite.CommonControls.EventDetailsPage.ModifyMarketButton); browser.WaitForPageToLoad(Framework.FrameGlobals.PageLoadTimeOut); return updatedMarektIndex; } catch (Exception ex) { Console.WriteLine(ex.StackTrace); Console.WriteLine(ex.Message); return null; } }
///<summary> /// This method creates a customer with the same details of a self exclusion customer /// <example>RegisterCustomer_selfExclusion(portalbrowser, adminbrowser) </example> public void RegisterCustomer_selfExclusion(ISelenium browser, ISelenium adminBrowser) { try { string regMsg, gender, xPath; var admincommonObj = new AdminSuite.Common(); Random rnd = new Random(); int rndNumber = rnd.Next(10000); //get details of customer in OB adminBrowser.WindowFocus(); string username = "******" + rndNumber; admincommonObj.SelectMainFrame(adminBrowser); string firstname = adminBrowser.GetText("//tr/td[@class='caption' and contains(text(), 'First Name:')]/following-sibling::td"); string lastname = adminBrowser.GetText("//tr/td[@class='caption' and contains(text(), 'Last Name:')]/following-sibling::td"); string title = adminBrowser.GetText("//tr/td[@class='caption' and contains(text(), 'Title:')]/following-sibling::td"); if (title.ToLower() == "mr") { gender = "male"; } else { gender = "female"; } string dob = adminBrowser.GetText("//tr/td[@class='caption' and contains(text(), 'Date of Birth:')]/following-sibling::td"); string[] arr = dob.Split('-'); string DOByear = arr[0]; System.Globalization.DateTimeFormatInfo mfi = new System.Globalization.DateTimeFormatInfo(); string DOBmonth = mfi.GetMonthName(int.Parse(arr[1])).ToString(); string DOBday = arr[2]; string houseno = adminBrowser.GetText("//tr/td[@class='caption' and contains(text(), 'Address (1)')]/following-sibling::td"); string postcode = adminBrowser.GetText("//tr/td[@class='caption' and contains(text(), 'Postcode:')]/following-sibling::td"); string address1 = adminBrowser.GetText("//tr/td[@class='caption' and contains(text(), '(2)')]/following-sibling::td") + adminBrowser.GetText("//tr/td[@class='caption' and contains(text(), '(3)')]/following-sibling::td"); string address2 = adminBrowser.GetText("//tr/td[@class='caption' and contains(text(), '(3)')]/following-sibling::td"); string city = adminBrowser.GetText("//tr/td[@class='caption' and contains(text(), 'City:')]/following-sibling::td"); string email = adminBrowser.GetText("//tr/td[@class='caption' and contains(text(), 'Email:')]/following-sibling::td"); string teleCode = "+44"; string telnumber = "1234567890"; string mobnumber = "1234512345"; string password = "******"; string confirmPassword = "******"; string securityQuestion = "Favourite Colour"; string securityAnswer = "Blue"; string accountCurrency = "UK Pound Sterling"; string country = "United Kingdom"; browser.WindowFocus(); WaitForLoadingIcon_MobileLobby(browser, FrameGlobals.IconLoadTimeout); Assert.IsTrue(browser.IsVisible(MobileLobbyControls.registrationTitle), "Registration Page is not displayed"); //Enter data in all the fields browser.Type(MobileLobbyControls.promocode, ""); browser.Select(MobileLobbyControls.title, title); browser.Type(MobileLobbyControls.firstname, firstname); browser.Type(MobileLobbyControls.lastname, lastname); //gender if (gender.ToLower().Trim() == "male") { browser.Click(MobileLobbyControls.genderMale); } else { browser.Click(MobileLobbyControls.genderFemale); } browser.Select(MobileLobbyControls.DOBday, DOBday); browser.Select(MobileLobbyControls.DOBmonth, DOBmonth); browser.Select(MobileLobbyControls.DOByear, DOByear); browser.Select(MobileLobbyControls.country, country); browser.Type(MobileLobbyControls.housename, houseno); browser.Type(MobileLobbyControls.postcode, postcode); browser.Type(MobileLobbyControls.address1, address1); browser.Type(MobileLobbyControls.address2, address2); browser.Type(MobileLobbyControls.city, city); browser.Type(MobileLobbyControls.email, email); browser.Type(MobileLobbyControls.telintcode, teleCode); browser.Type(MobileLobbyControls.telnumber, telnumber); browser.Type(MobileLobbyControls.mobintcode, teleCode); browser.Type(MobileLobbyControls.mobnumber, mobnumber); browser.Select(MobileLobbyControls.accountCurrency, accountCurrency); browser.Type(MobileLobbyControls.username, username); browser.Type(MobileLobbyControls.password, password); browser.Type(MobileLobbyControls.confirmPassword, confirmPassword); browser.Select(MobileLobbyControls.securityQuestion, securityQuestion); browser.Type(MobileLobbyControls.securityAnswer, securityAnswer); MLcommonObj.SelectCheckbox(browser, MobileLobbyControls.contactMe, "on"); MLcommonObj.SelectCheckbox(browser, MobileLobbyControls.aggreement, "on"); Thread.Sleep(1000); //Validate registration clickObject_MobileLobby(browser, MobileLobbyControls.registerNow); Assert.IsTrue(browser.IsVisible(MobileLobbyControls.registrationTitle), "Registration page title was not found in the header after registration"); Assert.IsTrue(browser.IsVisible(MobileLobbyControls.failureRgMsg), "Registration failure message was not displayed"); regMsg = "We are sorry but your country of residence is currently prohibited from using the Ladbrokes service."; xPath = "//ul[@class='error_align']/li[contains(text()[2], '" + regMsg + "')]"; Assert.IsTrue(browser.IsElementPresent(xPath), "Registration failure message was not displayed to the user"); Assert.IsTrue(browser.IsVisible(MobileLobbyControls.contactMessage), "Customer contact message was not displayed on failing to create a customer from banned country"); Console.WriteLine("Customer was not registered as his details provided matched a self excluded customer"); } catch (Exception ex) { CaptureScreenshot(browser, "EnterRegisterDetails"); Console.WriteLine("Function 'EnterRegisterDetails' - Failed"); Console.WriteLine(ex.Message); Fail(ex.Message); } }
public void UpdateEachWayByEventID(ISelenium browser, string eventId, string status) { try { //Clicking on Event Link in LHN LHNavigation(AdminSuite.CommonControls.AdminHomePage.EventNameLink, browser); //Selecting TopFrame SelectMainFrame(browser); browser.WaitForFrameToLoad(AdminSuite.CommonControls.AdminHomePage.EventNameLink, FrameGlobals.PageLoadTimeOut); browser.Type(AdminSuite.CommonControls.AdminHomePage.OpenBetIdTextBox, eventId); browser.Select(AdminSuite.CommonControls.AdminHomePage.OpenBetHierarchyLevelDrpLst, AdminSuite.CommonControls.AdminHomePage.OpenBetHeierarchyLevelEvent); browser.Click(AdminSuite.CommonControls.AdminHomePage.EventFindBtn); _frameworkCommon.WaitUntilAllElementsLoad(browser); browser.WaitForPageToLoad(Framework.FrameGlobals.PageLoadTimeOut); //browser.Click("label=|Race Winner|"); if (browser.IsElementPresent(string.Format("link=|{0}|", "Race Winner"))) { browser.Click(string.Format("link=|{0}|", "Race Winner")); _frameworkCommon.WaitUntilAllElementsLoad(browser); browser.WaitForPageToLoad(Framework.FrameGlobals.PageLoadTimeOut); browser.Select("name=MktEWAvail", "label=" + status); if (status == "Yes") { browser.Type(AdminSuite.CommonControls.EventDetailsPage.EachWayPlacesTxtBx, "1"); browser.Type(AdminSuite.CommonControls.EventDetailsPage.EachWayTopTxtBx, "1"); browser.Type(AdminSuite.CommonControls.EventDetailsPage.EachWayBottomTxtBx, "1"); } browser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut); //update Market if (browser.IsElementPresent(AdminSuite.CommonControls.EventDetailsPage.ModifyMarketButton)) { browser.Click(AdminSuite.CommonControls.EventDetailsPage.ModifyMarketButton); browser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut); Assert.IsTrue(_frameworkCommon.WaitUntilElementPresent(browser, AdminSuite.CommonControls.EventDetailsPage.eventDescriptionTextBox, "120"), "Market Updation is not Successfull"); } } else { Console.WriteLine("Market is not available"); } Thread.Sleep(3000); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); Console.WriteLine(ex.Message); } }
/// <summary> /// To suspend/ Activate the Events /// </summary> /// <param name="browser">Selenium browser instance</param> /// <param name="catName">Category Name</param> /// <param name="eventClsName">Event ClassName</param> /// <param name="eventTypeName">Event TypeName</param> /// <param name="eventSubType">Event SubType</param> /// <param name="eventName">Event Name</param> /// <param name="eventStatus">Event Status</param> public void UpdateEvents(ISelenium browser, string catName, string eventClsName, string eventTypeName, string eventSubType, string eventName, string eventStatus) { string errorMessage = ""; bool eventUpdationStatus = false; bool finalEventStatus = true; Framework.Common.Common frameworkcommon = new Framework.Common.Common(); AdminSuite.Common com = new AdminSuite.Common(); Framework.Common.Common Fcommon = new Framework.Common.Common(); TimeSpan ts = new TimeSpan(0, 1, 0); IWebDriver driver = ((WebDriverBackedSelenium)browser).UnderlyingWebDriver; //Clicking on Event Link in LHN LHNavigation(AdminSuite.CommonControls.AdminHomePage.EventNameLink, browser); //Selecting TopFrame System.Threading.Thread.Sleep(10000); SelectMainFrame(browser); frameworkcommon.WaitUntilElementPresent(browser, AdminSuite.CommonControls.EventDetailsPage.categoryNameLstBx, "60"); catName = catName.Replace("|", "").Trim(); if (catName != "") { if (browser.IsElementPresent(AdminSuite.CommonControls.EventDetailsPage.categoryNameLstBx)) { Assert.IsTrue(frameworkcommon.CheckItemPresentInDropDownList(browser, AdminSuite.CommonControls.EventDetailsPage.categoryNameLstBx, catName), "Category Name does not present in DropdownList"); browser.Select(AdminSuite.CommonControls.EventDetailsPage.categoryNameLstBx, "label=" + catName); } } eventClsName = eventClsName.Replace("|", "").Trim(); if (eventClsName != "") { if (browser.IsElementPresent(AdminSuite.CommonControls.EventDetailsPage.classNameLstBx)) { Assert.IsTrue(frameworkcommon.CheckItemPresentInDropDownList(browser, AdminSuite.CommonControls.EventDetailsPage.classNameLstBx, eventClsName), "EventClass Name does not present"); browser.Select(AdminSuite.CommonControls.EventDetailsPage.classNameLstBx, "label=" + eventClsName); } } if (eventTypeName != "") { if (browser.IsElementPresent(AdminSuite.CommonControls.EventDetailsPage.eventTypeLstBx)) { Assert.IsTrue(frameworkcommon.CheckItemPresentInDropDownList(browser, AdminSuite.CommonControls.EventDetailsPage.eventTypeLstBx, eventTypeName), "EventClass Name does not present"); browser.Select(AdminSuite.CommonControls.EventDetailsPage.eventTypeLstBx, "label=" + eventTypeName); } } if (eventSubType != "") { if (browser.IsElementPresent(AdminSuite.CommonControls.EventDetailsPage.subEventTypeLstBx)) { Assert.IsTrue(frameworkcommon.CheckItemPresentInDropDownList(browser, AdminSuite.CommonControls.EventDetailsPage.subEventTypeLstBx, eventSubType), "EventSubType Name does not present"); browser.Select(AdminSuite.CommonControls.EventDetailsPage.subEventTypeLstBx, "label=" + eventSubType); } } Assert.IsTrue(frameworkcommon.CheckItemPresentInDropDownList(browser, AdminSuite.CommonControls.EventDetailsPage.dateRangeLstBx, "--"), "Date range dropdown missing"); // Selecting Daterange if (browser.IsElementPresent(AdminSuite.CommonControls.EventDetailsPage.dateRangeLstBx)) { browser.Select(AdminSuite.CommonControls.EventDetailsPage.dateRangeLstBx, "label=--"); } //Clicking on Seach button browser.Click(AdminSuite.CommonControls.EventDetailsPage.eventSearchBtn); _frameworkCommon.WaitUntilAllElementsLoad(browser); browser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut); //Thread.Sleep(2000); // Wait for Element to present if (frameworkcommon.WaitUntilElementPresent(browser, "link=" + eventName + "", "60") == true) { browser.Click("link=" + eventName); browser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut); if (eventStatus == "Taginfo" || eventStatus == "Taginfoundo") { browser.Click("//a[contains(string(),'Race Winner')]"); Thread.Sleep(10000); browser.Click("//tr[@class='active']//a[contains(string(),'Horse1')]"); Thread.Sleep(10000); if (eventStatus == "Taginfoundo") browser.Select("name=OcFlag", "label=Named runner"); else browser.Select("name=OcFlag", "label=Unnamed favourite"); browser.Click("//input[@value='Modify Selection']"); } else { //Wait Untill the EventDetails Page loads if (frameworkcommon.WaitUntilElementPresent(browser, AdminSuite.CommonControls.EventDetailsPage.eventDescriptionTextBox, "60") == true) { if (eventStatus == "Suspend") { browser.Select(AdminSuite.CommonControls.EventDetailsPage.eventStatusListBox, "label=Suspended"); eventUpdationStatus = false; browser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut); } else { browser.Select(AdminSuite.CommonControls.EventDetailsPage.eventStatusListBox, "label=Active"); } //Updating the Event if (browser.IsElementPresent(AdminSuite.CommonControls.EventDetailsPage.updateEventBtn)) { if (eventUpdationStatus == false) { browser.Click(AdminSuite.CommonControls.EventDetailsPage.updateEventBtn); browser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut); Assert.IsTrue(frameworkcommon.WaitUntilElementPresent(browser, AdminSuite.CommonControls.EventDetailsPage.eventDescriptionTextBox, "120"), "Event Updation is not Successfull"); } } } } } else { finalEventStatus = false; errorMessage = errorMessage + eventName; errorMessage = errorMessage + Environment.NewLine; } //Finally checking whether all the Events are Suspended or not if (finalEventStatus == false) { Console.WriteLine("Following Events are not Suspended, Please verify Manually" + Environment.NewLine + errorMessage); Framework.BaseTest.Fail("Event suspending Process is Failed"); } }
bool selenium_command(SeleniumAction action, string param, string param2, bool compare) { try { switch (action) { case SeleniumAction.Open: Console.WriteLine("action={0} host={1} param={2},{3}", action.ToString(), selenium1_url, param, param2); selenium1.Open(param); Console.WriteLine("action={0} host={1} param={2},{3}", action.ToString(), selenium2_url, param, param2); selenium2.Open(param); break; case SeleniumAction.Click: Console.WriteLine("action={0} host={1} param={2},{3}", action.ToString(), selenium1_url, param, param2); selenium1.Click(param); Console.WriteLine("action={0} host={1} param={2},{3}", action.ToString(), selenium2_url, param, param2); selenium2.Click(param); break; case SeleniumAction.WaitForPageToLoad: Console.WriteLine("action={0} host={1} param={2},{3}", action.ToString(), selenium1_url, param, param2); selenium1.WaitForPageToLoad(param); Console.WriteLine("action={0} host={1} param={2},{3}", action.ToString(), selenium2_url, param, param2); selenium2.WaitForPageToLoad(param); break; case SeleniumAction.Type: Console.WriteLine("action={0} host={1} param={2},{3}", action.ToString(), selenium1_url, param, param2); selenium1.Type(param, param2); Console.WriteLine("action={0} host={1} param={2},{3}", action.ToString(), selenium2_url, param, param2); selenium2.Type(param, param2); break; case SeleniumAction.GoBack: Console.WriteLine("action={0} host={1} param={2},{3}", action.ToString(), selenium1_url, param, param2); selenium1.GoBack(); Console.WriteLine("action={0} host={1} param={2},{3}", action.ToString(), selenium2_url, param, param2); selenium2.GoBack(); break; case SeleniumAction.Select: Console.WriteLine("action={0} host={1} param={2},{3}", action.ToString(), selenium1_url, param, param2); selenium1.Select(param, param2); Console.WriteLine("action={0} host={1} param={2},{3}", action.ToString(), selenium2_url, param, param2); selenium2.Select(param, param2); break; case SeleniumAction.AddSelection: Console.WriteLine("action={0} host={1} param={2},{3}", action.ToString(), selenium1_url, param, param2); selenium1.AddSelection(param, param2); Console.WriteLine("action={0} host={1} param={2},{3}", action.ToString(), selenium2_url, param, param2); selenium2.AddSelection(param, param2); break; } if (compare) { return(compare_result(String.Format("action={0} param={1},{2}", action.ToString(), param, param2))); } else { return(true); } } catch (Exception ee) { Console.WriteLine("Exception: action={0} param={1},{2} message={3}", action.ToString(), param, param2, ee.Message); Console.WriteLine("Press any key to conitnue......"); Console.ReadKey(); //ConsoleKeyInfo key = Console.ReadKey(); //if (key.Key == CosoleKey.Escape) //{ //} return(false); } }