public void TheTectscompleteTest() { selenium.Open("/_int_/config_to.html"); selenium.Click("id=aggressive"); selenium.Type("id=serverlist", "10.105.74.54"); selenium.Click("link=Submit"); }
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 Test_Data() { selenium.SetTimeout("1000000"); selenium.Open("Admin/tests/testreset.aspx"); selenium.WaitForPageToLoad("30000"); selenium.Open("Admin/QuickSetup.aspx"); selenium.WaitForPageToLoad("30000"); selenium.Open("Admin/Data.aspx"); selenium.WaitForPageToLoad("30000"); Assert.IsFalse(selenium.IsTextPresent("Exception"), "Text 'Exception' found when it shouldn't be."); Assert.IsTrue(selenium.IsTextPresent("User-UserRole"), "Text 'User-UserRole' not found when it should be."); Assert.IsTrue(selenium.IsTextPresent("User"), "Text 'User' not found when it should be."); Assert.IsTrue(selenium.IsTextPresent("UserRole"), "Text 'UserRole' not found when it should be."); selenium.Click("link=User"); selenium.WaitForPageToLoad("30000"); Assert.IsFalse(selenium.IsTextPresent("Exception"), "Text 'Exception' found when it shouldn't be."); Assert.IsTrue(selenium.IsTextPresent("SoftwareMonkeys.SiteStarter.Entities.User"), "Text 'SoftwareMonkeys.SiteStarter.Entities.User' not found when it should be."); Assert.IsTrue(selenium.IsTextPresent("*****@*****.**"), "Text '*****@*****.**' not found when it should be."); Assert.IsTrue(selenium.IsTextPresent("Username: admin"), "Text 'Username: admin' not found when it should be."); selenium.Click("link=Sign Out"); selenium.WaitForPageToLoad("30000"); selenium.Open("Admin/Data.aspx"); selenium.WaitForPageToLoad("30000"); Assert.IsTrue(selenium.IsTextPresent("Sign In Details"), "Text 'Sign In Details' not found when it should be."); }
public void SetupClass() { base.StartServer(); selenium = new DefaultSelenium("localhost", 4444, "*chrome", ConfigurationManager.AppSettings["baseUrl"]); selenium.Start(); verificationErrors = new StringBuilder(); selenium.DeleteAllVisibleCookies(); selenium.Open("/dna/mbfood/"); // To Do // too general, could crash test if a topic happened to have the wrong name Assert.IsFalse(selenium.IsTextPresent("error")); Assert.IsFalse(selenium.IsTextPresent("There has been a problem")); selenium.Click("link=Sign in"); selenium.Click("bbcid_username"); selenium.Type("bbcid_username", "mpgsuper"); selenium.Type("bbcid_password", "ratbags"); selenium.Click("signin"); selenium.WaitForPageToLoad("30000"); // going this way so as to be certain to get the right site options without thinking about it selenium.Click("link=Site Options"); selenium.WaitForPageToLoad("30000"); // check a) where we are b) BBC site requirements for page titles https://confluence.dev.bbc.co.uk/display/DNA/Meta+Data - note that this title breaks those guidelines Assert.AreEqual("BBC - Food - DNA Administration - Site Options - Food", selenium.GetTitle()); Assert.IsTrue(selenium.IsElementPresent("//input[@name='sov_49_General_CustomBarlesquePath']"); stateOfOption = selenium.GetValue("//input[@name='so_49_General_CustomBarlesquePath' and @type='radio' and @checked='']/@value"); valueOfOption = selenium.GetValue("//input[@name='so_49_General_CustomBarlesquePath' and @type='text']"); }
///<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 Upload(string mFileToUpload) { path = Properties.Settings.Default.ContentPath; if (mFileToUpload == "") { return; } selenium.Open("/Default.aspx"); if (selenium.IsTextPresent("Sign In")) { selenium.Click("ctl00_LoginStatus1"); selenium.WaitForPageToLoad("30000"); selenium.Type("ctl00_ContentPlaceHolder1_Login1_Login1_UserName", Properties.Settings.Default._3DRUserName); selenium.Type("ctl00_ContentPlaceHolder1_Login1_Login1_Password", Properties.Settings.Default._3DRPassword); selenium.Click("ctl00_ContentPlaceHolder1_Login1_Login1_LoginButton"); } selenium.WaitForPageToLoad("30000"); selenium.Open("/Users/Upload.aspx"); selenium.WaitForPageToLoad("30000"); selenium.Type("ctl00_ContentPlaceHolder1_Upload1_TitleTextBox", "Automatic Test of " + mFileToUpload + " " + System.DateTime.Now.ToString()); SetUploadFile(path + mFileToUpload); selenium.Click("ctl00_ContentPlaceHolder1_Upload1_Step1NextButton"); selenium.WaitForPageToLoad("1200000"); selenium.WaitForCondition("window.GetLoadingComplete != undefined", "300000"); int count = 0; while ((selenium.GetEval("window.GetLoadingComplete() == true") != "true" && count < 300)) { count++; System.Threading.Thread.Sleep(1000); } if (selenium.GetEval("window.GetLoadingComplete() == true") == "true") { selenium.GetEval("window.TakeScreenShot();"); System.Threading.Thread.Sleep(3000); //count = 0; //string Thumbstring = selenium.GetEval("document.getElementById('ctl00_ContentPlaceHolder1_Upload1_ThumbnailImage')"); //while (Thumbstring.IndexOf("ScreenShot") == -1 && count < 10) //{ // count++; // System.Threading.Thread.Sleep(1000); // Thumbstring = selenium.GetEval("document.getElementById('ctl00_ContentPlaceHolder1_Upload1_ThumbnailImage')"); //} } // ctl00_ContentPlaceHolder1_Upload1_ThumbnailImage selenium.Click("ctl00_ContentPlaceHolder1_Upload1_ValidationViewSubmitButton"); selenium.WaitForPageToLoad("1200000"); }
/// <summary> /// Click on a button/ radio-button/ check-box present in the page /// </summary> /// <param name="locator">The locator.</param> /// <param name="type">Type of locator</param> public void Click(string locator, FindType type = FindType.ById) { _selenium.ChooseOkOnNextConfirmation(); _selenium.Click(locator); if (_selenium.IsConfirmationPresent()) { _selenium.GetConfirmation(); } }
public void StandartLoginValid() { selenium.Open("/"); selenium.Type("id=loginPassword", "lex"); selenium.Type("id=loginUsername", "lex"); selenium.Click("//div[@id='logindisplay']/form[2]/input[3]"); selenium.WaitForPageToLoad("30000"); Assert.IsTrue(selenium.IsElementPresent("//a[contains(@href, '/Account/Index')]")); }
public void LoginAsAdmin() { selenium.Open("/"); selenium.Type("id=loginPassword", "lex"); selenium.Type("id=loginUsername", "lex"); selenium.Click("//div[@id='logindisplay']/form[2]/input[3]"); selenium.WaitForPageToLoad(UpgradeSeleniumTester.browserWait); selenium.Click("//a[contains(@href, '/Account/Index')]"); selenium.WaitForPageToLoad(UpgradeSeleniumTester.browserWait); Assert.IsFalse(selenium.IsElementPresent("//a[contains(@href, '/Account/TeacherToAdminUpgrade')]")); }
/// <summary> /// To create a Self Excluded customer /// </summary> /// Author: Pradeep /// <param name="myBrowser">Selenium Browser</param> /// <returns>None</returns> /// Created Date: 21-Dec-2011 /// Modified By: /// Modified Date: /// Modification Comments: public string SelfExcludedCustomer(ISelenium myBrowser) { _isUpdateCustomersResourceFile = false; string slfExclCust = "Slf"; // string guidslf = Guid.NewGuid().ToString().Substring(0, 4); DateTime dateFormat = DateTime.Now; string dateTime = (dateFormat.ToString("yyyyMMddHHmmss")); string strUserCreated = _common.CreateCustomer(myBrowser, slfExclCust + dateTime, StrPasswrd); if (strUserCreated != "Fail") { string day = DateTime.Today.Day.ToString(CultureInfo.InvariantCulture); string month = DateTime.Today.Month.ToString(CultureInfo.InvariantCulture); string year = DateTime.Today.Year.ToString(CultureInfo.InvariantCulture); // Getting DDMMYYYY format if (day.Length == 1) { day = "0" + day; } if (month.Length == 1) { month = "0" + month; } // Getting YYYY-MM-DD format string strExclusionDate = year + "-" + month + "-" + day; _common.SearchCustomer(strUserCreated, myBrowser); // Clciking on SelfExcluded user // myBrowser.Click("//input[@name='exclusion_period' and @value='2Y']"); myBrowser.Click(AdminSuite.CustomerCreation.CustomersPage.CustomerExcluPeriodLstBx); myBrowser.Type(AdminSuite.CustomerCreation.CustomersPage.CustomerExcluDateTxtBx, strExclusionDate); // myBrowser.Type("name=exclusion_date", "2011-12-21"); myBrowser.Click(AdminSuite.CustomerCreation.CustomersPage.CustomerSelfExlusionBtn); _frameworkCommon.WaitUntilAllElementsLoad(myBrowser); System.Threading.Thread.Sleep(6000); Assert.IsTrue(myBrowser.IsTextPresent("New Self Exclusion Added"), "Self Exclustion is unsuccessfull for this customer"); _isUpdateCustomersResourceFile = _common.UpdateCustomerResouceFile("SelfExcludedCustomer", strUserCreated, StrPasswrd); if (_isUpdateCustomersResourceFile == false) { Framework.BaseTest.Fail("Customers Resource File updation failed."); } } else { Framework.BaseTest.Fail("User creation Failed"); } return(strUserCreated); }
public void Login() { selenium = new DefaultSelenium("localhost", 4444, "*chrome", "http://127.0.0.1:1556/"); selenium.Start(); selenium.Open("/"); selenium.Type("id=loginUsername", "lex"); selenium.Type("id=loginPassword", "lex"); selenium.Click("//div[@id='logindisplay']/form[2]/input[3]"); selenium.WaitForPageToLoad("30000"); selenium.Click("//a[contains(@href, 'UserActivity/Index')]"); selenium.WaitForPageToLoad("30000"); }
public void TheLogOutTest() { 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("id=logout"); selenium.WaitForPageToLoad("30000"); Assert.AreEqual("Log in", selenium.GetText("css=h2.login-header")); }
public void Login() { selenium = new DefaultSelenium("localhost", 4444, "*chrome", "http://127.0.0.1:1556/"); selenium.Start(); selenium.Open("/"); selenium.Type("id=loginUsername", "prof"); selenium.Type("id=loginPassword", "prof"); selenium.Click("//div[@id='logindisplay']/form[2]/input[3]"); selenium.WaitForPageToLoad("30000"); selenium.Click("link=Courses"); selenium.WaitForPageToLoad("30000"); }
public void DisplayUserAvatar() { selenium.Open("/"); selenium.Type("loginPassword", "lex"); selenium.Type("loginUsername", "lex"); selenium.Click("//div[@id='logindisplay']/form[2]/input[3]"); selenium.WaitForPageToLoad("30000"); selenium.Click("link=Users"); selenium.WaitForPageToLoad("30000"); selenium.Click("//div[@id='main']/table/tbody/tr[3]/td[7]/a[3]"); selenium.WaitForPageToLoad("30000"); Assert.IsTrue(selenium.IsElementPresent("avatar")); }
public void Login() { selenium = new DefaultSelenium("localhost", 4444, "*chrome", ConfigurationManager.AppSettings["SELENIUM_URL"]); selenium.Start(); selenium.Open("/"); selenium.Type("id=loginUsername", "lex"); selenium.Type("id=loginPassword", "lex"); selenium.Click("//div[@id='logindisplay']/form[2]/input[3]"); selenium.WaitForPageToLoad("30000"); selenium.Click("//a[contains(@href, 'UserActivity/Index')]"); selenium.WaitForPageToLoad("30000"); }
public void Login() { selenium = new DefaultSelenium("localhost", 4444, "*chrome", ConfigurationManager.AppSettings["SELENIUM_URL"]); selenium.Start(); selenium.Open("/"); selenium.Type("id=loginUsername", "prof"); selenium.Type("id=loginPassword", "prof"); selenium.Click("//div[@id='logindisplay']/form[2]/input[3]"); selenium.WaitForPageToLoad("40000"); selenium.Click("link=Courses"); selenium.WaitForPageToLoad("40000"); }
public void DisplayUserAvatar() { selenium.Open("/"); selenium.Type("id=loginPassword", "lex"); selenium.Type("id=loginUsername", "lex"); selenium.Click("//div[@id='logindisplay']/form[2]/input[3]"); selenium.WaitForPageToLoad(UpgradeSeleniumTester.browserWait); selenium.Click("//a[contains(@href, '/Account/Index')]"); selenium.WaitForPageToLoad(UpgradeSeleniumTester.browserWait); selenium.Click("//a[contains(@href, '/Account/Edit')]"); selenium.WaitForPageToLoad(UpgradeSeleniumTester.browserWait); Assert.IsTrue(selenium.IsElementPresent("avatar")); }
public void TheEditarCancelarTest() { 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"); selenium.Click("//a[contains(@href, '/Home/EditarCliente?ClienteId=130')]"); selenium.WaitForPageToLoad("30000"); selenium.Click("link=Cancelar"); selenium.WaitForPageToLoad("30000"); Assert.AreEqual("LstCliente", selenium.GetText("css=h2")); }
public void RegistrationAndLoginTest() { selenium.Open("/index.aspx"); selenium.WaitForPageToLoad("10000"); selenium.Click("link=Login"); selenium.WaitForPageToLoad("10000"); selenium.Click("link=Register"); selenium.WaitForPageToLoad("5000"); selenium.Type("ctl00_body_content_txtEmailAddress", "*****@*****.**"); selenium.Type("ctl00_body_content_txtPassword", "12345"); selenium.Type("ctl00_body_content_txtPasswordConfirm", "12345"); selenium.Type("ctl00_body_content_txtFirstName", "Javier"); selenium.Type("ctl00_body_content_txtLastName", "Mesa"); selenium.Type("ctl00_body_content_txtCompanyName", "XYZ Printing"); selenium.Type("ctl00_body_content_txtPhoneNumber", "7862986707"); selenium.Type("ctl00_body_content_txtBillAddressLine1", "2601 W 2nd Ave"); selenium.Type("ctl00_body_content_txtBillCity", "Hialeah"); selenium.Type("ctl00_body_content_txtBillState", "FL"); selenium.Type("ctl00_body_content_txtBillZipCode", "33010"); selenium.Click("ctl00_body_content_btnRegister"); selenium.WaitForPageToLoad("5000"); int count = userRepo.Users.Where(u => u.email.Trim() == "*****@*****.**").Count(); Assert.AreEqual(1, count); User newUser = userRepo.Users.Where(u => u.email.Trim() == "*****@*****.**").Single(); Assert.AreEqual("Javier", newUser.firstName.Trim()); Assert.AreEqual("Mesa", newUser.lastName.Trim()); Assert.AreEqual("82-7C-CB-0E-EA-8A-70-6C-4C-34-A1-68-91-F8-4E-7B", newUser.password.Trim()); Assert.AreEqual("XYZ Printing", newUser.company.Trim()); Assert.AreEqual("7862986707", newUser.homePhone.Trim()); Assert.AreEqual("2601 W 2nd Ave", newUser.b_address1.Trim()); Assert.AreEqual("Hialeah", newUser.b_city.Trim()); Assert.AreEqual("FL", newUser.b_state.Trim()); Assert.AreEqual("33010", newUser.b_zip.Trim()); selenium.Open("/index.aspx"); selenium.WaitForPageToLoad("5000"); selenium.Click("link=Login"); selenium.WaitForPageToLoad("5000"); selenium.Type("ctl00_body_content_loginEmail", "*****@*****.**"); selenium.Type("ctl00_body_content_pwd", "12345"); selenium.Click("ctl00_body_content_loginSubmit"); selenium.WaitForPageToLoad("5000"); Assert.IsTrue(selenium.IsTextPresent("Welcome back Javier")); }
public void TheEliminarCancelarTest() { 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.ChooseCancelOnNextConfirmation(); selenium.Click("xpath=(//a[@onclick=\"return confirm('Desea aliminar')\"])[13]"); Assert.AreEqual("Desea aliminar", selenium.GetConfirmation()); Assert.AreEqual("LstCliente", selenium.GetText("css=h2")); }
public void TheEliminarCorrectoTest() { 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("xpath=(//a[@onclick=\"return confirm('Desea aliminar')\"])[13]"); Assert.AreEqual("Desea aliminar", selenium.GetConfirmation()); selenium.WaitForPageToLoad("3000"); Assert.AreEqual("Se elimino satisfactoriamente el cliente", selenium.GetText("css=div.validation-summary-errors")); }
public void Test_Settings() { selenium.SetTimeout("1000000"); selenium.Open("Admin/tests/testreset.aspx"); selenium.WaitForPageToLoad("30000"); selenium.Open("Admin/QuickSetup.aspx"); selenium.WaitForPageToLoad("30000"); selenium.Click("link=Settings"); selenium.WaitForPageToLoad("30000"); Assert.IsFalse(selenium.IsTextPresent("Exception"), "Text 'Exception' found when it shouldn't be."); selenium.Click("link=Sign Out"); selenium.WaitForPageToLoad("30000"); selenium.Open("Index-Settings.aspx"); selenium.WaitForPageToLoad("30000"); Assert.IsTrue(selenium.IsTextPresent("Sign In Details"), "Text 'Sign In Details' not found when it should be."); }
///<summary> /// To exclude a customer from a company /// Author: Yogesh /// Ex:Customer_CompanyExclusion(myBrowser) /// <returns>None</returns> /// Created Date: 22-Dec-2011 /// Modified Date: 22-Dec-2011 /// Modification Comments: public void CustomerCompanyExclusion(ISelenium myBrowser) { _isUpdateCustomersResourceFile = false; string cmpnyExclu = "ATEcommATCmpnyExcl"; string guidBnCust = Guid.NewGuid().ToString().Substring(0, 3); cmpnyExclu = cmpnyExclu + guidBnCust; string strUser = _common.CreateCustomer(myBrowser, cmpnyExclu, StrPasswrd); if (strUser != "Fail") { myBrowser.Click(AdminSuite.CustomerCreation.CustomersPage.CompanyExcludedCustomerBtn); _frameworkCommon.WaitUntilAllElementsLoad(myBrowser); System.Threading.Thread.Sleep(10000); Assert.IsTrue(myBrowser.IsTextPresent("New Company Exclusion Added"), "Company Exclusion is unsuccessfull"); _isUpdateCustomersResourceFile = _common.UpdateCustomerResouceFile("CompanyExcludedCustomer", strUser, StrPasswrd); if (_isUpdateCustomersResourceFile == false) { Framework.BaseTest.Fail("Customers Resource File updation failed."); } } else { Framework.BaseTest.Fail("User creation Failed"); } }
// UpdateResourceFile("pradeep","@E:\AdminScripts\ECommerce_CodeBase\PreRequisite_Suite\Resources\Customers.resx"); /// <summary> To Launch the browser & to login to Open Bet application /// </summary> /// Author: Yogesh /// Ex: AdminBase.init() /// <returns>None</returns> /// Created Date: 22-Dec-2011 /// Modified Date: /// Modification Comments: public void Init() { if (FrameGlobals.useGrid.ToUpper() == "YES") { FirefoxProfile ffProfile = new FirefoxProfile(); DesiredCapabilities desriredCapibilities = null; desriredCapibilities = new DesiredCapabilities(); desriredCapibilities = DesiredCapabilities.Firefox(); desriredCapibilities.SetCapability(CapabilityType.BrowserName, "firefox"); // ffProfile.SetPreference("general.useragent.override", FrameGlobals.userAgentValue); FfDriver = new RemoteWebDriver(new Uri("http://localhost:4444/wd/hub"), desriredCapibilities, TimeSpan.FromSeconds(420.0)); MyBrowser = new WebDriverBackedSelenium(FfDriver, "http://www.google.com"); //_seleniumContainer.Add(Gallio.Framework.TestContext.CurrentContext.Test.Name, MyBrowser); } else { FfDriver = new FirefoxDriver(); MyBrowser = new WebDriverBackedSelenium(FfDriver, FrameGlobals.OBUrl); //MyBrowser = new WebDriverBackedSelenium(FfDriver, "https://stg-gib.ladbrokes.com/admin"); } MyBrowser.Start(); MyBrowser.Open(FrameGlobals.OBUrl); MyBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut); MyBrowser.Type(AdminSuite.CommonControls.AdminHomePage.UsrNmeTxtBx, FrameGlobals.AdminName); MyBrowser.Type(AdminSuite.CommonControls.AdminHomePage.PwdTxtBx, FrameGlobals.AdminPass); // MyBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut); MyBrowser.Click(AdminSuite.CommonControls.AdminHomePage.LoginBtn); MyBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut.ToString()); // MyBrowser.WindowMaximize(); FfDriver.Manage().Window.Maximize(); }
public void Test_RestrictAnonymousFromAccount() { selenium.SetTimeout("100000"); selenium.Open("Admin/tests/testreset.aspx"); selenium.WaitForPageToLoad("30000"); selenium.Open("Admin/QuickSetup.aspx"); selenium.WaitForPageToLoad("30000"); while (!selenium.IsTextPresent("Sign Out")) { Thread.Sleep(1000); } selenium.Click("SignOutLink"); selenium.WaitForPageToLoad("30000"); selenium.WaitForPageToLoad("30000"); while (!selenium.IsTextPresent("Sign In")) { Thread.Sleep(1000); } selenium.Open("User-Details.aspx"); selenium.WaitForPageToLoad("30000"); Assert.IsTrue(selenium.IsTextPresent("not signed in"), "Text 'not signed in' not found when it should be."); Assert.IsTrue(selenium.IsTextPresent("Sign In Details"), "Text 'Sign In Details' not found when it should be."); Assert.IsTrue(selenium.IsTextPresent("User Name:"), "Text 'User Name:' not found when it should be."); Assert.IsTrue(selenium.IsTextPresent("Password:"******"Text 'Password:' not found when it should be."); }
public void Init() { //Deleting cookies in ie browser through command line. /*var procStartInfo = new System.Diagnostics.ProcessStartInfo("cmd", "/c RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 2"); var proc = new System.Diagnostics.Process { StartInfo = procStartInfo }; proc.Start(); WebDriverObj = new InternetExplorerDriver(); */ string URL = "https://stg-gib.ladbrokes.com/admin"; WebDriverObj = new FirefoxDriver(); MyBrowser = new WebDriverBackedSelenium(WebDriverObj, URL); MyBrowser.Start(); WebDriverObj.Manage().Window.Maximize(); MyBrowser.WindowMaximize(); MyBrowser.Open(URL); MyBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut); MyBrowser.Refresh(); MyBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut); MyBrowser.Type(TestDataCreation.ControlsRepository.UsrNmeTxtBx, "Automation1"); MyBrowser.Type(TestDataCreation.ControlsRepository.PwdTxtBx, "aditi123"); MyBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut); MyBrowser.Click(TestDataCreation.ControlsRepository.LoginBtn); MyBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut); }
public void PolygonCount( [Values( "duffle_bag.zip" )] string mFileToUpload ) { path = Properties.Settings.Default.ContentPath; if (mFileToUpload == "") { return; } selenium.Open("/Default.aspx"); if (selenium.IsTextPresent("Sign In")) { selenium.Click("ctl00_LoginStatus1"); selenium.WaitForPageToLoad("30000"); selenium.Type("ctl00_ContentPlaceHolder1_Login1_Login1_UserName", Properties.Settings.Default._3DRUserName); selenium.Type("ctl00_ContentPlaceHolder1_Login1_Login1_Password", Properties.Settings.Default._3DRPassword); selenium.Click("ctl00_ContentPlaceHolder1_Login1_Login1_LoginButton"); } selenium.WaitForPageToLoad("30000"); selenium.Open("/Users/Upload.aspx"); selenium.WaitForPageToLoad("30000"); selenium.Type("ctl00_ContentPlaceHolder1_Upload1_TitleTextBox", "Screenshot Test" + System.DateTime.Now.ToString()); selenium.Type("ctl00_ContentPlaceHolder1_Upload1_ContentFileUpload", path + mFileToUpload); selenium.Click("ctl00_ContentPlaceHolder1_Upload1_Step1NextButton"); selenium.WaitForPageToLoad("300000"); selenium.WaitForCondition("window.GetLoadingComplete != undefined", "20000"); int count = 0; while ((selenium.GetEval("window.GetLoadingComplete() == true") != "true" && count < 30)) { count++; System.Threading.Thread.Sleep(1000); } NUnit.Framework.Assert.AreEqual(selenium.GetEval("window.GetLoadingComplete() == true"), "true"); selenium.Click("ctl00_ContentPlaceHolder1_Upload1_ValidationViewSubmitButton"); selenium.WaitForPageToLoad("30000"); NUnit.Framework.Assert.IsFalse(selenium.IsTextPresent("Number of Polygons: 0")); }
public void TheLoginFail_CamposVaciosTest() { selenium.Open("/"); Assert.AreEqual("Log in", selenium.GetText("css=h2.login-header")); selenium.Click("css=input[type=\"submit\"]"); selenium.WaitForPageToLoad("30000"); Assert.AreEqual("Ingrese datos de campos faltantes", selenium.GetText("css=div.validation-summary-errors")); }
public void TheNewTest() { selenium.Open("/"); selenium.Type("q", "selenium rc"); selenium.Click("btnG"); selenium.WaitForPageToLoad("30000"); Console.WriteLine("selenium rc - Google Search" + "/Vs/" + selenium.GetTitle()); }
public void TheEditarCorrectoTest() { 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("//a[contains(@href, '/Home/EditarCliente?ClienteId=130')]"); selenium.WaitForPageToLoad("30000"); selenium.Type("id=DNI", "12345677"); selenium.Click("css=button.btn.btn-default"); Assert.AreEqual("Desea Editar al cliente", selenium.GetConfirmation()); selenium.WaitForPageToLoad("3000"); Assert.AreEqual("Se Edito satisfactoriamente el cliente", selenium.GetText("css=div.validation-summary-errors")); }
public void TheConnexionTestTest(string idUser, string pass) { selenium.Open("/KARA_WEB/deconnexion.do"); selenium.Type("idUtilisateur", idUser); selenium.Type("motDePasse", pass); selenium.Click("B1"); selenium.WaitForPageToLoad("30000"); }
public void TheRegistrarCamposVaciosTest() { 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"); Assert.AreEqual("RegistrarCliente", selenium.GetText("css=h2")); selenium.Click("css=button.btn.btn-default"); Assert.AreEqual("Desea Registrar", selenium.GetConfirmation()); selenium.WaitForPageToLoad("3000"); Assert.AreEqual("Ingresar Campos Faltantes", selenium.GetText("css=div.validation-summary-errors")); }
///<summary> /// This method Clicks on the NRF links and validates the URl opened in the new browser /// <example>ValidatePopupsofNFR(MyBrowser, "xPath", "Ladbrokes LBR", "https://www.gibraltar.gov.gi/remotegambling"); public void ValidatePopupsofNFR(ISelenium browser, string xPath, string newWindowTitle, string expURL) { try { browser.Click(xPath); HGframeworkCommonObj.PageSync(browser); HGframeworkCommonObj.WaitUntilElementPresent(browser, LoginLogoutControls.alertContainer, "5000"); Thread.Sleep(1000); Assert.IsTrue(browser.IsElementPresent(LoginLogoutControls.alertContainer), "Alert container was not displayed on tapping the '" + xPath + "' link"); Assert.IsTrue(browser.IsTextPresent("You are about to navigate away from the site and any selections you have in the betslip may be lost"), "Warning message[1] is not displayed in the Alert container"); Assert.IsTrue(browser.IsTextPresent("Do you want to navigate away?"), "Warning message[2] is not displayed in the Alert container"); browser.Click(LoginLogoutControls.CloseButtonInAlertContainer); HGframeworkCommonObj.PageSync(browser); Assert.IsFalse(browser.IsVisible(LoginLogoutControls.alertContainer), "Alert container failed to close on tapping the Cancel button"); browser.Click(xPath); HGframeworkCommonObj.WaitUntilElementPresent(browser, LoginLogoutControls.alertContainer, "5000"); Thread.Sleep(1000); Assert.IsTrue(browser.IsElementPresent(LoginLogoutControls.alertContainer), "Alert container was not displayed on tapping the '" + xPath + "' link"); browser.Click(LoginLogoutControls.ContinueButtonInAlertContainer); HGframeworkCommonObj.PageSync(browser); Thread.Sleep(2000); HGFcommonObj.SwitchWindow(browser, newWindowTitle); string actUrl = browser.GetLocation(); // url = driver.Url; browser.Close(); browser.SelectWindow("null"); Thread.Sleep(1000); if (actUrl.ToLower().Trim() != expURL.ToLower().Trim()) { Console.WriteLine("Mismatch in URL's. Actual '" + actUrl + "', Expected '" + expURL + "'."); } } catch (Exception ex) { Console.WriteLine("Function 'ValidatePopupsofNFR' - Failed"); Console.WriteLine(ex.Message); Fail(ex.Message); } }
public void Google_For_SimpleTalk(SeleniumProvider seleniumProvider) { Browser = seleniumProvider.GetBrowser(); Browser.Open("/"); Browser.Type("q", "Simple Talk"); Browser.Click("btnG"); Browser.WaitForPageToLoad("3000"); Assert.True(Browser.IsTextPresent("www.simple-talk.com")); }
public void SetupTest() { selenium = new DefaultSelenium("localhost", 4444, "*chrome", "http://127.0.0.1:1556/"); selenium.Start(); verificationErrors = new StringBuilder(); selenium.Open("/"); selenium.Type("id=loginPassword", "lex"); selenium.Type("id=loginUsername", "lex"); selenium.Click("//div[@id='logindisplay']/form[2]/input[3]"); selenium.WaitForPageToLoad("30000"); }
public void Init() { FfDriver = new FirefoxDriver(); MyBrowser = new WebDriverBackedSelenium(FfDriver, "https://stg-gib.ladbrokes.com/admin"); MyBrowser.Start(); MyBrowser.Open("https://stg-gib.ladbrokes.com/admin"); MyBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut); MyBrowser.Type(AdminSuite.CommonControls.AdminHomePage.UsrNmeTxtBx, "sanjeeva_p"); MyBrowser.Type(AdminSuite.CommonControls.AdminHomePage.PwdTxtBx, "123456"); MyBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut); MyBrowser.Click(AdminSuite.CommonControls.AdminHomePage.LoginBtn); MyBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut); }
public void TestMethod3() { string URL = "http://www.abb.com"; selenium = new DefaultSelenium("localhost", 4444, "*firefox", URL); selenium.Start(); selenium.Open("/"); Assert.AreEqual("The ABB Group - Automation and Power Technologies", selenium.GetTitle()); selenium.Type("searchInput", "Robot"); selenium.Click("search"); selenium.WaitForPageToLoad("10000"); Assert.AreEqual("The ABB Group", selenium.GetTitle()); Assert.AreEqual("Robot", selenium.GetValue("searchInput")); }
///<summary> /// This method clicks on any desired object(button, link) /// <example>clickObject_MobileLobby(browser, xPath)</example> public void clickObject_MobileLobby(ISelenium browserObj, string strLocator) { try { Assert.IsTrue(browserObj.IsVisible(strLocator), strLocator + " element is not present"); browserObj.Focus(strLocator); browserObj.Click(strLocator); WaitForLoadingIcon_MobileLobby(browserObj, Convert.ToInt32(FrameGlobals.IconLoadTimeout)); } catch (Exception ex) { Console.WriteLine("Function 'clickObject' - Failed"); Console.WriteLine(ex.Message); Fail(ex.Message); } }
public void TestMethod1() { selenium = new DefaultSelenium("localhost", 4444, "*iexplore", "http://www.google.com/"); selenium.Start(); selenium.Open("/"); selenium.Type("q", "selenium rc"); selenium.Click("btnG"); selenium.WaitForPageToLoad("30000"); Assert.AreEqual("selenium rc - Google Search", selenium.GetTitle()); try { selenium.Stop(); } catch (Exception) { // Ignore errors if unable to close the browser } }
// Login with testing account public static void Login(ISelenium selenium) { for (int i = 0; i < 100; i++) { if (selenium.IsElementPresent("username") == true) { selenium.Type("username", "NvQA"); selenium.Type("password", "bJn#8xg4"); selenium.Type("captcha", "11111"); // The captcha wont be validated when user is NvQA selenium.Click("SubmitButton"); break; } else { Thread.Sleep(50); } } selenium.WaitForPageToLoad("15000"); }
public void TestMethod2() { selenium = new DefaultSelenium("localhost", 4444, "*iexplore", "http://localhost:1987"); selenium.Start(); selenium.Open("/WebSite1/"); selenium.Type("MainContent_TextBox1", "HUM"); selenium.Click("MainContent_Button1"); selenium.WaitForPageToLoad("3000770"); //Get the Table Value of Row 1 and Coulumn 2 object GG = selenium.GetTable("MainContent_GridView1.1.2"); Assert.AreEqual("1", "1"); try { selenium.Stop(); } catch (Exception) { // Ignore errors if unable to close the browser } }
/// <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> /// 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 AgeVerification(ISelenium adminBrowser, string cardNum, string issueNum, string CustomerName) { try { Framework.Common.Common FrameWKCommon = new Framework.Common.Common(); //Click on Customer Verification button if (!AdminTableObjects(adminBrowser, "Customer attributes", "", "Button", "Customer Verification", 1)) { Framework.BaseTest.CaptureScreenshot(adminBrowser, ""); Console.WriteLine("Unable to click on Customer Verification button in Customer attributes table"); return false; } Assert.IsTrue(adminBrowser.IsElementPresent(AdminSuite.CommonControls.AdminHomePage.custVerifyCountry), "Unable to find country select box in customer verify page"); Assert.IsTrue(adminBrowser.IsElementPresent("//input[@type='radio' and @value = 'A']"), "Unable to find country select box in customer verify page"); adminBrowser.Click("//input[@type='radio' and @value = 'A']"); //Entering value in OVS Score: Text box in Customer verification page if (!AdminTableObjects(adminBrowser, "Manually Verify Customer", "OVS Score", "Text Box", "100", 1)) { Framework.BaseTest.CaptureScreenshot(adminBrowser, ""); Console.WriteLine("Unable to put value in OVS Score Text box in Manually Verify Customer page"); return false; } //Entering value in Reference: Text box in Customer verification page if (!AdminTableObjects(adminBrowser, "Manually Verify Customer", "Reference", "Text Box", "100", 1)) { Framework.BaseTest.CaptureScreenshot(adminBrowser, ""); Console.WriteLine("Unable to put value in Reference Text box in Manually Verify Customer page"); return false; } //Entering value in Notes Text box in Customer verification page if (!AdminTableObjects(adminBrowser, "Manually Verify Customer", "Notes", "Text Box", "Notes", 1)) { Framework.BaseTest.CaptureScreenshot(adminBrowser, ""); Console.WriteLine("Unable to put value in Notes Text box in Manually Verify Customer page"); return false; } Assert.IsTrue(adminBrowser.IsElementPresent("//input[@type='radio' and @value = 'A']"), "Unable to find country select box in customer verify page"); adminBrowser.Click("//input[@type='radio' and @value = 'A']"); //Entering value in Driving Licence No Text box in Customer verification page if (!AdminTableObjects(adminBrowser, "Manually Verify Customer", "Driving Licence No", "Text Box", "Notes", 1)) { Framework.BaseTest.CaptureScreenshot(adminBrowser, ""); Console.WriteLine("Unable to put value in Driving Licence No Text box in Manually Verify Customer page"); return false; } //Click on Add Payment Method button if (!AdminTableObjects(adminBrowser, "Add payment method", "", "Button", "Add Payment Method", 1)) { Framework.BaseTest.CaptureScreenshot(adminBrowser, ""); Console.WriteLine("Unable click on Add Payment Method button in New Payment Method page"); return false; } adminBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut); Thread.Sleep(5000); Console.WriteLine("Successfully added payment method for customer"); return true; } catch (Exception ex) { Console.WriteLine(ex.Message); Framework.BaseTest.CaptureScreenshot(adminBrowser, ""); 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> /// 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> /// Add desired Customer to SelfExcluded User Group /// </summary> /// Author: Anand /// <param name="browser">Browser Instance</param> /// <param name="customerName">Customer Name</param> public bool CompanyExcludedCustomer(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.Click(AdminSuite.CustomerCreation.CustomersPage.CompanyExcludedCustomerBtn); _frameworkCommon.WaitUntilAllElementsLoad(browser); System.Threading.Thread.Sleep(10000); if (browser.IsTextPresent("New Company Exclusion Added")) { return true; } else { return false; } } catch (Exception ex) { Console.WriteLine(ex.Message); return false; } }
///<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); } }
/// <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> /// 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); } }
/// <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> /// Clicking on the link or button in the table /// </summary> /// Author: Anand /// <param name="adminBrowser">browser object</param> /// <param name="tableHeading">Table Heading</param> /// <param name="searchText">row string to be searched</param> /// <param name="objName">Object Type you wanted to operate on</param> /// <param name="objValue">Any value you would want to enter or select</param> /// <param name="index">column number</param> /// <returns> true/false</returns> /// Created Date: 07-June-2012 public bool AdminTableButtonLink(ISelenium adminBrowser, string tableHeading, string searchText, string objName, string objValue, int index) { try { if (objName.Contains("Link")) { //Click on the link without a search string if (string.IsNullOrEmpty(searchText)) { adminBrowser.Click("//table//th[contains(string(),'" + tableHeading + "')]//ancestor::table/tbody//a[contains(text(),'" + objValue + "']"); } //Click on the link with a search string else { adminBrowser.Click("//table//th[contains(string(),'" + tableHeading + "')]//ancestor::table//td[contains(text(),'" + searchText + "')]/following-sibling::td/a"); } _frameworkCommon.WaitUntilAllElementsLoad(adminBrowser); adminBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut); } //Click on the button else { adminBrowser.Click("//table//th[contains(string(),'" + tableHeading + "')]//ancestor::table/tbody//input[@value='" + objValue + "']"); _frameworkCommon.WaitUntilAllElementsLoad(adminBrowser); adminBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut); } return true; } catch (Exception ex) { Console.WriteLine(ex.Message); Console.WriteLine(ex.StackTrace); return false; } }
/// <summary> /// To logout from Admin /// </summary> /// Author: Anand /// <param name="myBrowser"> </param> /// Created Date: 12-April-2012 public void AdminLogout(ISelenium myBrowser) { try { // Navigating to LHN SelectTopBarFrame(myBrowser); IWebDriver driver = ((WebDriverBackedSelenium)myBrowser).UnderlyingWebDriver; //Assert.IsTrue(myBrowser.IsElementPresent("//a[contains(text(),'Logout')]"),"logout link" if (myBrowser.IsElementPresent("//a[contains(text(),'Logout')]")) { myBrowser.Click("//a[contains(text(),'Logout')]"); myBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut); } else { ConsoleColor clr = new ConsoleColor(); clr = Console.ForegroundColor; Console.ForegroundColor = ConsoleColor.DarkRed; Console.WriteLine("!!!Warning: Logout link not present in LHN of Admin"); Console.ForegroundColor = clr; } } catch (Exception ex) { BaseTest.CaptureScreenshot(myBrowser, ""); Console.WriteLine(ex.StackTrace); BaseTest.Fail(ex.Message); } }
/// <summary> /// Restricting the customer for placing bets /// </summary> /// Author : Hemalatha /// Date Created : 11-07-2012 /// Pre-conditions : User should logged into the admin /// <param name="adminBrowser">browser instance</param> /// <param name="custName">Customer Name</param> /// <param name="reasonDesc">Reason for restricting the customer</param> /// <returns></returns> public bool AddCustFlag(ISelenium adminBrowser, string custName, string reasonDesc, string flagName) { try { if (AdminSearchCustomer(adminBrowser, custName) == true) { //Click on the Amend Status Flag Button if (!AdminTableObjects(adminBrowser, "Customer attributes", "", "Button", "Amend Status Flags", 1)) { Framework.BaseTest.CaptureScreenshot(adminBrowser, ""); Console.WriteLine("Unable to click on the Amend Status Flags button in Customer detail page"); return false; } //select Customer Status Flag if (!AdminTableObjects(adminBrowser, "Add Customer Status Flag", "Customer Status Flag", "Select Box", flagName, 1)) { Framework.BaseTest.CaptureScreenshot(adminBrowser, ""); Console.WriteLine("Unable to click on the Customer Status Flags button in Customer detail page"); return false; } //Entering reason for adding the flag string reason = "//table[contains(string(),'Add Customer Status Flag')]//tr[contains(string(),'Reason Description')]/td/textarea[@name='reason']"; adminBrowser.Highlight(reason); adminBrowser.Type(reason, reasonDesc); //Clicking the Add Status Flag button string statusFlagButton = "//input[@value='Add Status Flag']"; adminBrowser.Click(statusFlagButton); } Console.WriteLine("Successfully restricted the customer for bets"); return true; } catch (Exception e) { Console.WriteLine(e.Message); Framework.BaseTest.CaptureScreenshot(adminBrowser, ""); return false; } }
/// <summary> /// Change the customer Password /// </summary> /// Author: Kiran /// <param name="browser">browser Instance</param> /// <param name="userName">User Name</param> /// <param name="userName">passwordUser</param> public void ChangeCustomerPassword(ISelenium adminBrowser, string userName, string password) { try { // Enter Customer Name and Search SearchCustomer(userName, adminBrowser); SelectMainFrame(adminBrowser); adminBrowser.Type(AdminSuite.CustomerCreation.CustomersPage.UpdCustPwdField1, password); adminBrowser.Type(AdminSuite.CustomerCreation.CustomersPage.UpdCustPwdField2, password); adminBrowser.Click(AdminSuite.CustomerCreation.CustomersPage.UpdatePassword); adminBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut); Assert.IsTrue(adminBrowser.IsTextPresent("Successfully changed password"), "Failed to update password"); } catch (Exception ex) { CaptureScreenshot(adminBrowser, ""); Fail(ex.Message); } }
/// <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> /// 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); }