public void TheTest_seleniumCSTest(string idUser) { selenium.Open("/KARA_WEB/deconnexion.do"); selenium.Type("idUtilisateur", idUser); selenium.Type("motDePasse", "2697"); selenium.Click("B1"); selenium.WaitForPageToLoad("30000"); selenium.Click("bt_4_0"); selenium.WaitForPageToLoad("30000"); selenium.Type("dateNaissJ", "21"); selenium.Type("dateNaissM", "04"); selenium.Type("dateNaissA", "1987"); selenium.Type("nom", "SINCLAR"); selenium.Type("prenom", "BOB"); selenium.Click("//img[@onclick='ChangerOnglet(2)']"); selenium.Type("numVoie", "ICI"); selenium.Type("codePostal", "32456"); selenium.Type("burDistr", "ICI"); selenium.Click("//img[@onclick='ChangerOnglet(3)']"); selenium.Type("numICCID", "89331059970000209012"); selenium.Type("numIMEI", "111111111111119"); selenium.Click("B2"); selenium.WaitForPageToLoad("30000"); selenium.Click("//img[@onclick='valider()']"); selenium.WaitForPageToLoad("30000"); }
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 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']"); }
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"); }
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 GetCurrentlyLoggedInUserWhenLogged() { 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')]")); Assert.IsTrue(selenium.IsTextPresent("Logged in as lex")); }
public void Test_Roles() { selenium.SetTimeout("100000"); selenium.Open("Admin/tests/testreset.aspx"); selenium.WaitForPageToLoad("30000"); selenium.Open("Admin/QuickSetup.aspx"); selenium.WaitForPageToLoad("30000"); selenium.Open("MockCreate-User.aspx"); selenium.WaitForPageToLoad("30000"); selenium.Click("link=Roles"); selenium.WaitForPageToLoad("30000"); Assert.IsFalse(selenium.IsTextPresent("Exception"), "Text 'Exception' found when it shouldn't be."); Assert.IsTrue(selenium.IsTextPresent("Manage Roles"), "Text 'Manage Roles' not found when it should be."); Assert.IsTrue(selenium.IsTextPresent("Edit"), "Text 'Edit' not found when it should be."); Assert.IsTrue(selenium.IsTextPresent("Delete"), "Text 'Delete' not found when it should be."); selenium.Click("//input[@value='Create Role']"); selenium.WaitForPageToLoad("30000"); selenium.Type("ctl00_Body_ctl00_Name", "A Test Role"); selenium.AddSelection("ctl00_Body_ctl00_Users", "label=FirstName1 LastName1"); selenium.Click("//input[@value='Save']"); selenium.WaitForPageToLoad("30000"); Assert.IsTrue(selenium.IsTextPresent("saved successfully"), "Text 'saved successfully' not found when it should be."); Assert.IsTrue(selenium.IsTextPresent("Manage Roles"), "Text 'Manage Roles' not found when it should be."); Assert.IsTrue(selenium.IsTextPresent("Test Role"), "Text 'Test Role' not found when it should be."); selenium.Click("link=Edit"); selenium.WaitForPageToLoad("30000"); Assert.AreEqual("System Administrator", selenium.GetSelectedLabel("ctl00_Body_ctl00_Users")); selenium.AddSelection("ctl00_Body_ctl00_Users", "FirstName1 LastName1"); selenium.Click("//input[@value='Update']"); selenium.WaitForPageToLoad("30000"); Assert.IsTrue(selenium.IsTextPresent("updated successfully"), "Text 'updated successfully' not found when it should be."); selenium.Click("link=Edit"); selenium.WaitForPageToLoad("30000"); Assert.AreEqual("FirstName1 LastName1,System Administrator", String.Join(",", selenium.GetSelectedLabels("ctl00_Body_ctl00_Users"))); }
public void Test_CreateEditDeleteRole() { selenium.SetTimeout("100000"); selenium.Open("Admin/tests/testreset.aspx"); selenium.WaitForPageToLoad("30000"); selenium.Open("Admin/QuickSetup.aspx"); selenium.WaitForPageToLoad("30000"); selenium.Click("link=Roles"); selenium.WaitForPageToLoad("30000"); selenium.Click("//input[@value='Create Role']"); selenium.WaitForPageToLoad("30000"); selenium.Type("ctl00_Body_ctl00_Name", "Test Role #1"); selenium.Click("ctl00_Body_ctl00_SaveButton"); selenium.WaitForPageToLoad("30000"); Assert.IsTrue(selenium.IsTextPresent("successfully"), "Text 'successfully' not found when it should be."); Assert.IsTrue(selenium.IsTextPresent("Test Role #1"), "Text 'Test Role #1' not found when it should be."); selenium.Click("ctl00_Body_ctl00_IndexGrid_ctl04_EditButton"); selenium.WaitForPageToLoad("30000"); selenium.Type("ctl00_Body_ctl00_Name", "Test Role #1"); selenium.Click("//input[@value='Update']"); selenium.WaitForPageToLoad("30000"); selenium.ChooseOkOnNextConfirmation(); selenium.Click("ctl00_Body_ctl00_IndexGrid_ctl04_DeleteButton"); selenium.WaitForPageToLoad("30000"); Assert.IsTrue(selenium.GetConfirmation() != null && selenium.GetConfirmation().IndexOf("Are you sure you want to delete this role?") > -1, "Confirm box didn't appear when expected."); selenium.WaitForPageToLoad("30000"); Assert.IsTrue(selenium.IsTextPresent("deleted successfully"), "Text 'deleted successfully' not found when it should be."); Assert.IsFalse(selenium.IsTextPresent("Test Role"), "Text 'Test Role' found when it shouldn't be."); }
public void Test_Setup() { selenium.SetTimeout("100000"); selenium.Open("Admin/tests/testreset.aspx?Log=true&Config=true"); selenium.WaitForPageToLoad("30000"); Assert.IsFalse(selenium.IsTextPresent("Exception"), "Text 'Exception' found when it shouldn't be."); selenium.Open("Admin/QuickSetup.aspx"); selenium.WaitForPageToLoad("30000"); Assert.IsFalse(selenium.IsTextPresent("Exception"), "Text 'Exception' found when it shouldn't be."); Assert.IsTrue(selenium.IsTextPresent("You are signed in as"), "Text 'You are signed in as' not found when it should be."); Thread.Sleep(5000); }
public void Init() { firefox = new FirefoxDriver(); browser = new WebDriverBackedSelenium(firefox, "http://cms.uat-ecommerce.ladbrokes.com/hmc/hybris?wid=MC57x0"); browser.Start(); browser.Open("http://cms.uat-ecommerce.ladbrokes.com/hmc/hybris?wid=MC57x0"); browser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut.ToString()); browser.Type("id=Main_user", "mallikarjunmp"); browser.Type("id=Main_password", "12345"); browser.Click("id=Main_label"); browser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut.ToString()); }
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 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 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 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 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", "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 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 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 Test_Import() { selenium.SetTimeout("1000000"); selenium.Open("Admin/tests/testreset.aspx?Log=true&Config=true"); selenium.WaitForPageToLoad("30000"); selenium.Open("Admin/QuickSetup.aspx"); Assert.IsFalse(selenium.IsTextPresent("Exception"), "Text 'Exception' found when it shouldn't be."); selenium.Open("Admin/Tests/PrepareTestImport.aspx"); selenium.WaitForPageToLoad("30000"); Assert.IsFalse(selenium.IsTextPresent("Exception"), "Text 'Exception' found when it shouldn't be."); selenium.Open("Admin/Import.aspx"); selenium.WaitForPageToLoad("30000"); Assert.IsFalse(selenium.IsTextPresent("Exception"), "Text 'Exception' found when it shouldn't be."); Assert.IsTrue(selenium.IsTextPresent("Import Complete"), "Text 'Import Complete' not found when it should be."); }
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."); }
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 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 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 Test_Errors() { selenium.SetTimeout("1000000"); selenium.Open("Admin/tests/testreset.aspx?Log=true"); selenium.WaitForPageToLoad("30000"); selenium.Open("Admin/QuickSetup.aspx"); selenium.WaitForPageToLoad("30000"); selenium.Open("NonExistentPage.aspx"); selenium.WaitForPageToLoad("30000"); Assert.IsTrue(selenium.IsTextPresent("Oops"), "Text 'Oops' not found when it should be."); selenium.Open("Admin/Errors.aspx"); Assert.IsTrue(selenium.IsTextPresent("Errors"), "Text 'Errors' not found when it should be."); Assert.IsTrue(selenium.IsTextPresent("NonExistentPage.aspx"), "Text 'NonExistentPage.aspx' not found when it should be."); selenium.Open("User-SignOut.aspx"); selenium.Open("Admin/Errors.aspx"); Assert.IsTrue(selenium.IsTextPresent("Sign In Details"), "Text 'Sign In Details' not found when it should be."); }
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 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")); }
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 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 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")); }
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> /// 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 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> /// 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> /// 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 CardSearch(ISelenium adminBrowser, long cardNum, string status, string CustomerName) { try { IWebDriver adminDriver = ((WebDriverBackedSelenium)adminBrowser).UnderlyingWebDriver; //Click on Reward Adhoc token link in Admin LHN if (AdminLHNClick("Pay Methods", adminBrowser)) { Console.WriteLine("Successfully clicked on the Admin LHN link Customers"); adminBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut); } 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, "Card Search", "CardNo", "Text Box", Convert.ToString(cardNum), 1)) { Framework.BaseTest.CaptureScreenshot(adminBrowser, ""); Console.WriteLine("Unable to put value in Card Search Text box in Card Search page"); return false; } //adminBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut); //click on the Find Customer button if (!AdminTableObjects(adminBrowser, "Card Search", "", "Button", "Find Methods", 1)) { Framework.BaseTest.CaptureScreenshot(adminBrowser, ""); Console.WriteLine("Unable click on Find Customer button in Customer Search page"); return false; } adminBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut); ReadOnlyCollection<IWebElement> tableRows = adminDriver.FindElements(By.XPath("//table//tr[td[contains(.,'Active')]]")); //looping through a particular row for (int rowNum = 0; rowNum < tableRows.Count; rowNum++) { if (tableRows[rowNum].Text.IndexOf("Active") > 0 && tableRows[rowNum].Text.IndexOf(CustomerName) < 0) { IWebElement custName = tableRows[rowNum].FindElement(By.TagName("a")); custName.Click(); Thread.Sleep(3000); adminBrowser.WaitForPageToLoad("5000"); if (!UpdatePayMtd(adminBrowser, cardNum.ToString(), status, CustomerName)) { Console.WriteLine("Unable to remove card for the customer"); return false; } Console.WriteLine("Successfully searched the customer"); return true; } } Console.WriteLine("Successfully searched the customer"); return true; } catch (Exception ex) { Console.WriteLine(ex.Message); Framework.BaseTest.CaptureScreenshot(adminBrowser, ""); return false; } }
/// <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> /// 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> /// To click on Left hand navigation Link /// </summary> /// Author: Anand /// <param name="linkName">Link Name</param> /// Ex: /// <returns>True/False</returns> /// Created Date: 07-June-2012 public bool AdminLHNClick(string linkName, ISelenium myBrowser) { try { SelectTopBarFrame(myBrowser); myBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut); IWebDriver driver = ((WebDriverBackedSelenium)myBrowser).UnderlyingWebDriver; Assert.IsTrue(driver.FindElement(By.LinkText(linkName)).Displayed, "The link name: " + linkName + " is not present in Admin LHN"); driver.FindElement(By.LinkText(linkName)).Click(); myBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut); Thread.Sleep(2000); SelectMainFrame(myBrowser); return true; } catch (Exception ex) { Console.WriteLine(ex.Message); Console.WriteLine(ex.StackTrace); return false; } }
/// <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); }
public bool AdminSearchCustomer(ISelenium adminBrowser, string custName) { try { ///Click on Customers link in Admin LHN if (AdminLHNClick("Customers", adminBrowser)) { Console.WriteLine("Successfully clicked on the Admin LHN link Customers"); adminBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut); } 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, "Customer Search Criteria", "Username", "Text Box", custName, 1)) { Framework.BaseTest.CaptureScreenshot(adminBrowser, ""); Console.WriteLine("Unable to put value in Username Text box in Customer Search page"); return false; } adminBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut); //click on the Find Customer button if (!AdminTableObjects(adminBrowser, "Customer Search Criteria", "", "Button", "Find Customer", 1)) { Framework.BaseTest.CaptureScreenshot(adminBrowser, ""); Console.WriteLine("Unable click on Find Customer button in Customer Search page"); return false; } _frameworkCommon.WaitUntilAllElementsLoad(adminBrowser); _frameworkCommon.WaitUntilElementPresent(adminBrowser, "//table//th/font[contains(text(),'Account information')]", FrameGlobals.PageLoadTimeOut); adminBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut); //verifying the customer name in page if (!adminBrowser.IsTextPresent(custName)) { Framework.BaseTest.CaptureScreenshot(adminBrowser, ""); Console.WriteLine("Unable to verify the customer name in the page"); return false; } Console.WriteLine("Successfully searched the customer"); return true; } catch (Exception ex) { Console.WriteLine(ex.Message); Framework.BaseTest.CaptureScreenshot(adminBrowser, ""); 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 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> /// 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> 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> /// 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> /// 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 AdminDeleteFBlist(ISelenium adminBrowser, string custName) { try { IWebDriver driver = ((WebDriverBackedSelenium)adminBrowser).UnderlyingWebDriver; //Verifying freebet link in customer detail page adminBrowser.Highlight("//table//th/font[contains(text(),'Account information')]//ancestor::table//td[contains(text(),'Free bet tokens (open):')]/following-sibling::td/a"); if (adminBrowser.IsElementPresent("//table//th/font[contains(text(),'Account information')]//ancestor::table//td[contains(text(),'Free bet tokens (open):')]/following-sibling::td/a")) { adminBrowser.Click("//table//th/font[contains(text(),'Account information')]//ancestor::table//td[contains(text(),'Free bet tokens (open):')]/following-sibling::td/a"); adminBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut); ReadOnlyCollection<IWebElement> chkBoxs = driver.FindElements(By.XPath("//table//input[@type='checkbox']")); //check all the check box for (int chkBoxCount = 0; chkBoxCount < chkBoxs.Count; chkBoxCount++) { chkBoxs[chkBoxCount].Click(); } //click on the Delete Token button if (!AdminTableObjects(adminBrowser, "Free Token List", "", "Button", "Delete Token", 1)) { Framework.BaseTest.CaptureScreenshot(adminBrowser, ""); Console.WriteLine("Unable click on Find Customer button in Customer Search page"); return false; } Thread.Sleep(3000); if (adminBrowser.IsElementPresent("//table//th[contains(string(),'Account information')]//ancestor::table//td[contains(text(),'" + "Free bet tokens (open):" + "')]/following-sibling::td/a")) { return false; } } Console.WriteLine("Successfully deleted the FreeBets for 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); }