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 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_TestBreakableLogging() { selenium.SetTimeout("1000000"); selenium.Open("Admin/Tests/TestReset.aspx?Log=true"); selenium.WaitForPageToLoad("30000"); selenium.Open("Admin/QuickSetup.aspx"); selenium.WaitForPageToLoad("30000"); selenium.Open("Admin/Tests/TestBreakableLogging.aspx"); selenium.WaitForPageToLoad("30000"); Assert.IsFalse(selenium.IsTextPresent("Exception"), "Text 'Exception' found when it shouldn't be."); selenium.Open(""); Assert.IsFalse(selenium.IsTextPresent("Exception"), "Text 'Exception' found when it shouldn't be."); selenium.Open("Admin/Tests/LogContains.aspx?Query=Test group %231"); Assert.IsFalse(selenium.IsTextPresent("Exception"), "Text 'Exception' found when it shouldn't be."); Assert.IsTrue(selenium.IsTextPresent("LogContains=True"), "Text 'LogContains=True' not found when it should be."); selenium.Open("Admin/Tests/LogContains.aspx?Query=Test group %232"); Assert.IsFalse(selenium.IsTextPresent("Exception"), "Text 'Exception' found when it shouldn't be."); Assert.IsTrue(selenium.IsTextPresent("LogContains=True"), "Text 'LogContains=True' not found when it should be."); selenium.Open("Admin/Tests/LogContains.aspx?Query=Test group %233"); Assert.IsFalse(selenium.IsTextPresent("Exception"), "Text 'Exception' found when it shouldn't be."); Assert.IsTrue(selenium.IsTextPresent("LogContains=True"), "Text 'LogContains=True' not found when it should be."); selenium.Open("Admin/Tests/LogContains.aspx?Query=Test entry %231"); Assert.IsFalse(selenium.IsTextPresent("Exception"), "Text 'Exception' found when it shouldn't be."); Assert.IsTrue(selenium.IsTextPresent("LogContains=True"), "Text 'LogContains=True' not found when it should be."); selenium.Open("Admin/Tests/LogContains.aspx?Query=Test entry %232"); Assert.IsFalse(selenium.IsTextPresent("Exception"), "Text 'Exception' found when it shouldn't be."); Assert.IsTrue(selenium.IsTextPresent("LogContains=True"), "Text 'LogContains=True' not found when it should be."); }
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_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."); }
/** * SetupTest used to create a Selenium object and start it * */ private void SetupTest() { string filename = "java"; string parameters = @" -jar selenium-server.jar"; System.Diagnostics.Process[] allProcess = System.Diagnostics.Process.GetProcessesByName("java"); try { if (allProcess.Length == 0) { System.Diagnostics.Process.Start(filename, parameters); System.Threading.Thread.Sleep(3000); selenium = new DefaultSelenium("localhost", 4444, "*iexplore", "http://www.set.or.th"); selenium.Start(); selenium.SetTimeout("100000"); selenium.UseXpathLibrary("javascript-xpath"); } } catch (System.Exception e) { logger.LogErrorAndRaiseException("Selenium console not started." + e.ToString()); System.Windows.Forms.Application.Exit(); } }
public void Start(string siteUrl) { _siteUrl = siteUrl; _selenium = new DefaultSelenium(Configuration.SeleniumHost, Configuration.SeleniumPort, "*firefox", _siteUrl); _selenium.Start(); _selenium.SetTimeout(Timeout); }
public void Test_Initialize() { selenium.SetTimeout("2000000"); 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/InitializeCache.aspx"); selenium.WaitForPageToLoad("30000"); Assert.IsFalse(selenium.IsTextPresent("Exception"), "Text 'Exception' found when it shouldn't be."); }
public void Test_Update() { selenium.SetTimeout("1000000"); selenium.Open("Admin/Tests/TestReset.aspx"); selenium.WaitForPageToLoad("30000"); selenium.Open("Admin/QuickSetup.aspx"); selenium.WaitForPageToLoad("30000"); selenium.Click("link=Users"); selenium.WaitForPageToLoad("30000"); Assert.IsFalse(selenium.IsTextPresent("Exception"), "Text 'Exception' found when it shouldn't be."); Assert.IsFalse(selenium.IsTextPresent("aren't authorised"), "Text 'aren't authorised' found when it shouldn't be."); selenium.Click("//input[@value='Create User']"); selenium.WaitForPageToLoad("30000"); selenium.Type("ctl00_Body_ctl00_FirstName", "another"); selenium.Type("ctl00_Body_ctl00_LastName", "user"); selenium.Type("ctl00_Body_ctl00_Email", "*****@*****.**"); selenium.Type("ctl00_Body_ctl00_Username", "anotheruser"); selenium.Type("ctl00_Body_ctl00_Password", "pass"); selenium.Type("ctl00_Body_ctl00_PasswordConfirm", "pass"); selenium.AddSelection("ctl00_Body_ctl00_UserRoles", "label=Administrator"); selenium.Click("//input[@value='Save']"); selenium.WaitForPageToLoad("30000"); Assert.IsTrue(selenium.IsTextPresent("successfully"), "Text 'successfully' not found when it should be."); selenium.Click("link=Roles"); selenium.WaitForPageToLoad("30000"); selenium.Click("ctl00_Body_ctl00_CreateButton"); selenium.WaitForPageToLoad("30000"); selenium.Type("ctl00_Body_ctl00_Name", "another role"); selenium.AddSelection("ctl00_Body_ctl00_Users", "label=another user"); selenium.Click("//input[@value='Save']"); selenium.WaitForPageToLoad("30000"); Assert.IsTrue(selenium.IsTextPresent("successfully"), "Text 'successfully' not found when it should be."); selenium.Click("UpdateApplicationLink"); selenium.WaitForPageToLoad("30000"); selenium.WaitForPageToLoad("30000"); Assert.IsTrue(selenium.IsTextPresent("Application Update"), "Text 'Application Update' not found when it should be."); Assert.IsTrue(selenium.IsTextPresent("current application version"), "Text 'current application version' not found when it should be."); selenium.Click("//input[@value='Begin »']"); selenium.WaitForPageToLoad("30000"); selenium.WaitForPageToLoad("30000"); Assert.IsTrue(selenium.IsTextPresent("Ready for Upload"), "Text 'Ready for Upload' not found when it should be."); Assert.IsTrue(selenium.IsTextPresent("Your data has been backed up"), "Text 'Your data has been backed up' not found when it should be."); selenium.Click("//input[@value='Continue »']"); selenium.WaitForPageToLoad("30000"); selenium.WaitForPageToLoad("30000"); Assert.IsTrue(selenium.IsTextPresent("Update Complete"), "Text 'Update Complete' not found when it should be."); Assert.IsTrue(selenium.IsTextPresent("successfully"), "Text 'successfully' not found when it should be."); selenium.Click("link=Users"); selenium.WaitForPageToLoad("30000"); Assert.IsTrue(selenium.IsTextPresent("anotheruser"), "Text 'anotheruser' not found when it should be."); selenium.Click("link=Roles"); selenium.WaitForPageToLoad("30000"); Assert.IsTrue(selenium.IsTextPresent("another role"), "Text 'another role' not found when it should 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 Test_AutoBackup() { 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(""); Assert.IsFalse(selenium.IsTextPresent("Exception"), "Text 'Exception' found when it shouldn't be."); Thread.Sleep(10000); selenium.Open("Admin/tests/LogContains.aspx?Query=%3CData%3E${BackupComplete}%3C/Data%3E"); Assert.IsTrue(selenium.IsTextPresent("LogContains=True"), "Text 'LogContains=True' not found when it should be."); Assert.IsTrue(selenium.IsTextPresent("FoundTotal=1"), "Text 'FoundTotal=1' not found when it should be."); }
public void SetupTest() { selenium = new DefaultSelenium("localhost", 4444, "*firefox", url1); selenium.SetSpeed("1000"); selenium.Start(); selenium.SetTimeout("60000"); verificationErrors = new StringBuilder(); selenium.Open(url1); selenium.WindowMaximize(); //selenium.KeyDown(ID, "13");//enter key }
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 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 ActionResult ParseTourFromUrl(ParseUrlModel model) { selenium = new DefaultSelenium("localhost", 4444, "*firefox", "http://localhost"); selenium.Start(); selenium.SetTimeout("120000"); selenium.Open(model.Url); selenium.WaitForPageToLoad("60000"); var html = selenium.GetHtmlSource(); selenium.Stop(); // string html = HtmlDownloader.GetHtml(model.Url); string s = new ForecastParser(QueryFactory, log, UnitOfWorkFactory).ParseHtml(html, model.Url); return(View(new ParseUrlModel { Result = s })); }
public void Test_Users() { selenium.SetTimeout("100000"); selenium.Open("Admin/tests/testreset.aspx"); selenium.WaitForPageToLoad("30000"); selenium.Open("Admin/QuickSetup.aspx"); selenium.WaitForPageToLoad("30000"); selenium.Click("link=Users"); selenium.WaitForPageToLoad("30000"); Assert.IsFalse(selenium.IsTextPresent("Exception"), "Text 'Exception' found when it shouldn't be."); Assert.IsTrue(selenium.IsTextPresent("Manage Users"), "Text 'Manage Users' 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 User']"); selenium.WaitForPageToLoad("30000"); selenium.Type("ctl00_Body_ctl00_FirstName", "FirstName"); selenium.Type("ctl00_Body_ctl00_LastName", "LastName"); selenium.Type("ctl00_Body_ctl00_Email", "*****@*****.**"); selenium.Type("ctl00_Body_ctl00_Username", "TestUser"); selenium.Type("ctl00_Body_ctl00_Password", "pass"); selenium.Type("ctl00_Body_ctl00_PasswordConfirm", "pass"); selenium.Click("ctl00_Body_ctl00_IsApproved"); selenium.AddSelection("ctl00_Body_ctl00_UserRoles", "label=Administrator"); 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 Users"), "Text 'Manage Users' not found when it should be."); Assert.IsTrue(selenium.IsTextPresent("TestUser"), "Text 'TestUser' not found when it should be."); Assert.IsTrue(selenium.IsTextPresent("FirstName"), "Text 'FirstName' not found when it should be."); Assert.IsTrue(selenium.IsTextPresent("LastName"), "Text 'LastName' not found when it should be."); selenium.Click("link=Edit"); selenium.WaitForPageToLoad("30000"); Assert.AreEqual("Administrator", selenium.GetSelectedLabel("ctl00_Body_ctl00_UserRoles")); selenium.Type("ctl00_Body_ctl00_FirstName", "System2"); selenium.Type("ctl00_Body_ctl00_LastName", "Administrator2"); selenium.Type("ctl00_Body_ctl00_Email", "[email protected]"); selenium.Click("//input[@value='Update']"); selenium.WaitForPageToLoad("30000"); Assert.IsTrue(selenium.IsTextPresent("updated successfully"), "Text 'updated successfully' not found when it should be."); Assert.IsTrue(selenium.IsTextPresent("System2"), "Text 'System2' not found when it should be."); Assert.IsTrue(selenium.IsTextPresent("Administrator2"), "Text 'Administrator2' not found when it should be."); }
public void StartSelenium() { verificationErrors = new StringBuilder(); string platform = System.Configuration.ConfigurationManager.AppSettings["Platform"]; this.URL = System.Configuration.ConfigurationManager.AppSettings["TestURL"]; //get un/pw from db //this.UN = ""; //this.PW = ""; selenium = new DefaultSelenium("localhost", 4444, platform, this.URL); //selenium = new DefaultSelenium("localhost", 4444, "*firefox3 C:\\Program Files\\Mozilla Firefox\\firefox.exe", "http://dev.lofinc.net"); selenium.Start(); Thread.Sleep(5000); selenium.WindowMaximize(); selenium.SetTimeout("0"); selenium.Open("/admin/"); this.selenium.WaitForPageToLoad("5000"); }
public void Test_WebSiteSettings() { selenium.SetTimeout("1000000"); selenium.Open("Admin/tests/testreset.aspx?Config=true"); selenium.WaitForPageToLoad("30000"); selenium.Open("Admin/QuickSetup.aspx"); selenium.WaitForPageToLoad("30000"); selenium.Click("link=Settings"); selenium.WaitForPageToLoad("30000"); selenium.Click("link=WebSite Settings"); selenium.WaitForPageToLoad("30000"); selenium.Type("ctl00_Body_ctl00_ApplicationTitle", "Custom Title"); selenium.Click("//input[@value='Update']"); selenium.WaitForPageToLoad("30000"); Assert.IsTrue(selenium.IsTextPresent("updated successfully"), "Text 'updated successfully' not found when it should be."); Assert.IsTrue(selenium.IsTextPresent("Custom Title"), "Text 'Custom Title' not found when it should be."); Assert.IsFalse(selenium.IsTextPresent("Exception"), "Text 'Exception' found when it shouldn't be."); selenium.Click("link=Sign Out"); selenium.WaitForPageToLoad("30000"); selenium.Open("Edit-WebSiteSettings.aspx"); Assert.IsTrue(selenium.IsTextPresent("Sign In Details"), "Text 'Sign In Details' not found when it should be."); }
public void Test_RegisterApprovedUser() { selenium.SetTimeout("100000"); selenium.Open("Admin/tests/testreset.aspx"); selenium.WaitForPageToLoad("30000"); selenium.Open("Admin/QuickSetup.aspx"); selenium.WaitForPageToLoad("30000"); Assert.IsTrue(selenium.IsTextPresent("You are signed in as"), "Text 'You are signed in as' not found when it should be."); selenium.Click("link=Settings"); selenium.WaitForPageToLoad("30000"); Assert.IsFalse(selenium.IsTextPresent("Exception"), "Text 'Exception' found when it shouldn't be."); Assert.IsFalse(selenium.IsTextPresent("aren't authorised"), "Text 'aren't authorised' found when it shouldn't be."); selenium.Click("link=User Settings"); selenium.WaitForPageToLoad("30000"); if (!selenium.IsChecked("ctl00_Body_ctl00_AutoApproveNewUsers")) { selenium.Click("ctl00_Body_ctl00_AutoApproveNewUsers"); } selenium.Click("ctl00_Body_ctl00_UpdateButton"); selenium.WaitForPageToLoad("30000"); selenium.Click("SignOutLink"); selenium.WaitForPageToLoad("30000"); selenium.Click("RegisterLink"); selenium.WaitForPageToLoad("30000"); selenium.Type("ctl00_Body_ctl00_FirstName", "Approved"); selenium.Type("ctl00_Body_ctl00_LastName", "User"); selenium.Type("ctl00_Body_ctl00_Email", "*****@*****.**"); selenium.Type("ctl00_Body_ctl00_Username", "approveduser"); selenium.Type("ctl00_Body_ctl00_Password", "pass"); selenium.Type("ctl00_Body_ctl00_PasswordConfirm", "pass"); selenium.Click("ctl00_Body_ctl00_EnableNotifications"); selenium.Click("ctl00_Body_ctl00_RegisterButton"); selenium.WaitForPageToLoad("30000"); Assert.IsTrue(selenium.IsTextPresent("My Details"), "Text 'My Details' not found when it should be."); Assert.IsTrue(selenium.IsTextPresent("successfully"), "Text 'successfully' not found when it should be."); Assert.IsTrue(selenium.IsTextPresent("*****@*****.**"), "Text '*****@*****.**' not found when it should be."); selenium.Open("Admin/tests/testreset.aspx"); selenium.WaitForPageToLoad("30000"); }
public void Test_CreateEditDeleteUser() { selenium.SetTimeout("100000"); selenium.Open("Admin/tests/testreset.aspx"); selenium.WaitForPageToLoad("30000"); selenium.Open("Admin/QuickSetup.aspx"); selenium.WaitForPageToLoad("30000"); selenium.Click("link=Users"); selenium.WaitForPageToLoad("30000"); selenium.WaitForPageToLoad("30000"); selenium.Click("ctl00_Body_ctl00_CreateButton"); selenium.WaitForPageToLoad("30000"); selenium.Type("ctl00_Body_ctl00_FirstName", "Test1"); selenium.Type("ctl00_Body_ctl00_LastName", "Test1"); selenium.Type("ctl00_Body_ctl00_Email", "*****@*****.**"); selenium.Type("ctl00_Body_ctl00_Username", "test1"); selenium.Type("ctl00_Body_ctl00_Password", "pass"); selenium.Type("ctl00_Body_ctl00_PasswordConfirm", "pass"); selenium.AddSelection("ctl00_Body_ctl00_UserRoles", "label=Administrator"); 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("Test1"), "Text 'Test1' not found when it should be."); selenium.Click("ctl00_Body_ctl00_IndexGrid_ctl04_EditButton"); selenium.WaitForPageToLoad("30000"); selenium.Type("ctl00_Body_ctl00_FirstName", "Test2"); selenium.Type("ctl00_Body_ctl00_LastName", "Test2"); selenium.Type("ctl00_Body_ctl00_Email", "*****@*****.**"); selenium.Type("ctl00_Body_ctl00_Username", "test2"); selenium.RemoveSelection("ctl00_Body_ctl00_UserRoles", "label=Administrator"); selenium.Click("ctl00_Body_ctl00_UpdateButton"); selenium.WaitForPageToLoad("30000"); selenium.ChooseOkOnNextConfirmation(); selenium.Click("ctl00_Body_ctl00_IndexGrid_ctl04_DeleteButton"); Assert.IsTrue(selenium.GetConfirmation() != null && selenium.GetConfirmation().IndexOf("Are you sure you want to delete this user?") > -1, "Confirm box didn't appear when expected."); Assert.IsTrue(selenium.IsTextPresent("successfully"), "Text 'successfully' not found when it should be."); Assert.IsFalse(selenium.IsTextPresent("Test1"), "Text 'Test1' found when it shouldn't be."); }
public void Test_EnforceUniqueUsername() { selenium.SetTimeout("100000"); selenium.Open("Admin/tests/testreset.aspx"); selenium.WaitForPageToLoad("30000"); selenium.Open("Admin/QuickSetup.aspx"); selenium.WaitForPageToLoad("30000"); Assert.IsTrue(selenium.IsTextPresent("Settings"), "Text 'Settings' not found when it should be."); selenium.Click("link=Settings"); selenium.WaitForPageToLoad("30000"); selenium.Click("link=User Settings"); selenium.WaitForPageToLoad("30000"); if (!selenium.IsChecked("ctl00_Body_ctl00_AutoApproveNewUsers")) { selenium.Click("ctl00_Body_ctl00_AutoApproveNewUsers"); } selenium.Click("ctl00_Body_ctl00_UpdateButton"); selenium.WaitForPageToLoad("30000"); Assert.IsTrue(selenium.IsTextPresent("successfully"), "Text 'successfully' not found when it should be."); selenium.Click("SignOutLink"); selenium.WaitForPageToLoad("30000"); selenium.Click("RegisterLink"); selenium.WaitForPageToLoad("30000"); selenium.Type("ctl00_Body_ctl00_FirstName", "first"); selenium.Type("ctl00_Body_ctl00_LastName", "last"); selenium.Type("ctl00_Body_ctl00_Email", "*****@*****.**"); selenium.Type("ctl00_Body_ctl00_Username", "admin"); selenium.Type("ctl00_Body_ctl00_Password", "pass"); selenium.Type("ctl00_Body_ctl00_PasswordConfirm", "pass"); selenium.Click("ctl00_Body_ctl00_EnableNotifications"); selenium.Click("ctl00_Body_ctl00_RegisterButton"); selenium.WaitForPageToLoad("30000"); selenium.WaitForPageToLoad("30000"); Assert.IsTrue(selenium.IsTextPresent("username is already in use"), "Text 'username is already in use' not found when it should be."); Assert.IsTrue(selenium.IsTextPresent("New User Details"), "Text 'New User Details' not found when it should be."); Assert.IsTrue(selenium.IsTextPresent("Register"), "Text 'Register' not found when it should be."); }
public void Test_Backup() { selenium.SetTimeout("1000000"); selenium.Open("Admin/tests/testreset.aspx"); selenium.WaitForPageToLoad("30000"); selenium.Open("Admin/QuickSetup.aspx"); selenium.WaitForPageToLoad("30000"); Assert.IsTrue(selenium.IsTextPresent("You are signed in as"), "Text 'You are signed in as' not found when it should be."); Assert.IsTrue(selenium.IsTextPresent("Backup"), "Text 'Backup' not found when it should be."); Assert.IsFalse(selenium.IsTextPresent("Exception"), "Text 'Exception' found when it shouldn't be."); selenium.Click("link=Backup"); selenium.WaitForPageToLoad("30000"); Assert.IsFalse(selenium.IsTextPresent("Exception"), "Text 'Exception' found when it shouldn't be."); Assert.IsFalse(selenium.IsTextPresent("aren't authorised"), "Text 'aren't authorised' found when it shouldn't be."); selenium.Click("//input[@value='Start']"); selenium.WaitForPageToLoad("30000"); Assert.IsTrue(selenium.IsTextPresent("successfully"), "Text 'successfully' not found when it should be."); Assert.IsTrue(selenium.IsTextPresent("Total files backed up: 5"), "Text 'Total files backed up: 5' not found when it should be."); selenium.Click("link=Sign Out"); selenium.WaitForPageToLoad("30000"); selenium.Open("Admin/Backup.aspx"); selenium.WaitForPageToLoad("30000"); Assert.IsTrue(selenium.IsTextPresent("Sign In Details"), "Text 'Sign In Details' not found when it should be."); }
public void Test_UserSettings() { selenium.SetTimeout("1000000"); selenium.Open("Admin/tests/testreset.aspx?Config=true"); selenium.WaitForPageToLoad("30000"); selenium.Open("Admin/QuickSetup.aspx"); selenium.WaitForPageToLoad("30000"); selenium.Click("link=Settings"); selenium.WaitForPageToLoad("30000"); selenium.Click("link=User Settings"); selenium.WaitForPageToLoad("30000"); if (selenium.IsChecked("ctl00_Body_ctl00_EnableUserRegistration")) { selenium.Click("ctl00_Body_ctl00_EnableUserRegistration"); } 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=Sign Out"); selenium.WaitForPageToLoad("30000"); Assert.IsFalse(selenium.IsTextPresent("Register"), "Text 'Register' found when it shouldn't be."); selenium.Open("Edit-UserSettings.aspx"); Assert.IsTrue(selenium.IsTextPresent("Sign In Details"), "Text 'Sign In Details' not found when it should be."); }
public void Test_EditOwnAccount() { selenium.SetTimeout("100000"); selenium.Open("Admin/tests/testreset.aspx"); selenium.WaitForPageToLoad("30000"); selenium.Open("Admin/QuickSetup.aspx"); selenium.WaitForPageToLoad("30000"); Assert.IsTrue(selenium.IsTextPresent("Settings"), "Text 'Settings' not found when it should be."); selenium.Click("link=Settings"); selenium.WaitForPageToLoad("30000"); Assert.IsTrue(selenium.IsTextPresent("User Settings"), "Text 'User Settings' not found when it should be."); selenium.Click("link=User Settings"); selenium.WaitForPageToLoad("30000"); selenium.WaitForPageToLoad("30000"); if (!selenium.IsChecked("ctl00_Body_ctl00_AutoApproveNewUsers")) { selenium.Click("ctl00_Body_ctl00_AutoApproveNewUsers"); } selenium.Click("ctl00_Body_ctl00_UpdateButton"); selenium.WaitForPageToLoad("30000"); selenium.WaitForPageToLoad("30000"); Assert.IsTrue(selenium.IsTextPresent("successfully"), "Text 'successfully' not found when it should be."); selenium.Click("SignOutLink"); selenium.WaitForPageToLoad("30000"); selenium.Click("RegisterLink"); selenium.WaitForPageToLoad("30000"); selenium.Type("ctl00_Body_ctl00_FirstName", "Approved"); selenium.Type("ctl00_Body_ctl00_LastName", "User"); selenium.Type("ctl00_Body_ctl00_Email", "*****@*****.**"); selenium.Type("ctl00_Body_ctl00_Username", "testuser"); selenium.Type("ctl00_Body_ctl00_Password", "pass"); selenium.Type("ctl00_Body_ctl00_PasswordConfirm", "pass"); selenium.Click("ctl00_Body_ctl00_EnableNotifications"); selenium.Click("ctl00_Body_ctl00_RegisterButton"); selenium.WaitForPageToLoad("30000"); selenium.WaitForPageToLoad("30000"); Assert.IsTrue(selenium.IsTextPresent("My Details"), "Text 'My Details' not found when it should be."); Assert.IsTrue(selenium.IsTextPresent("successfully"), "Text 'successfully' not found when it should be."); Assert.IsTrue(selenium.IsTextPresent("*****@*****.**"), "Text '*****@*****.**' not found when it should be."); selenium.Click("//input[@id='ctl00_Body_ctl00_ViewEditButton']"); selenium.WaitForPageToLoad("30000"); selenium.WaitForPageToLoad("30000"); Assert.IsFalse(selenium.IsTextPresent("Exception"), "Text 'Exception' found when it shouldn't be."); Assert.IsTrue(selenium.IsTextPresent("First Name:"), "Text 'First Name:' not found when it should be."); selenium.Type("ctl00_Body_ctl00_FirstName", "NewFirst"); selenium.Type("ctl00_Body_ctl00_LastName", "NewLast"); selenium.Type("ctl00_Body_ctl00_Email", "*****@*****.**"); selenium.Click("ctl00_Body_ctl00_UpdateButton"); selenium.WaitForPageToLoad("30000"); selenium.WaitForPageToLoad("30000"); Assert.IsTrue(selenium.IsTextPresent("My Details"), "Text 'My Details' not found when it should be."); Assert.IsTrue(selenium.IsTextPresent("updated successfully"), "Text 'updated successfully' not found when it should be."); Assert.IsTrue(selenium.IsTextPresent("NewFirst"), "Text 'NewFirst' not found when it should be."); Assert.IsTrue(selenium.IsTextPresent("NewLast"), "Text 'NewLast' not found when it should be."); Assert.IsTrue(selenium.IsTextPresent("*****@*****.**"), "Text '*****@*****.**' not found when it should be."); selenium.Click("SignOutLink"); selenium.WaitForPageToLoad("30000"); selenium.Type("ctl00_Body_ctl00_Login_UserName", "testuser"); selenium.Type("ctl00_Body_ctl00_Login_Password", "pass"); selenium.Click("ctl00_Body_ctl00_Login_LoginButton"); selenium.WaitForPageToLoad("30000"); Assert.IsTrue(selenium.IsTextPresent("Sign Out"), "Text 'Sign Out' not found when it should be."); Assert.IsTrue(selenium.IsTextPresent("My Details"), "Text 'My Details' not found when it should be."); Assert.IsTrue(selenium.IsTextPresent("You are signed in as:"), "Text 'You are signed in as:' not found when it should be."); }
public void Test_Caches() { selenium.SetTimeout("1000000"); selenium.Open("Admin/tests/testreset.aspx"); selenium.WaitForPageToLoad("30000"); selenium.Open("Admin/QuickSetup.aspx"); selenium.WaitForPageToLoad("30000"); selenium.Open("Admin/Cache.aspx"); selenium.WaitForPageToLoad("30000"); Assert.IsFalse(selenium.IsTextPresent("Exception"), "Text 'Exception' found when it shouldn't be."); selenium.Click("EntitiesCacheLink"); selenium.WaitForPageToLoad("30000"); Assert.IsFalse(selenium.IsTextPresent("Exception"), "Text 'Exception' found when it shouldn't be."); Assert.IsTrue(selenium.IsTextPresent("BaseEntity"), "Text 'BaseEntity' not found when it should be."); Assert.IsTrue(selenium.IsTextPresent("User"), "Text 'User' not found when it should be."); Assert.IsTrue(selenium.IsTextPresent("SoftwareMonkeys.SiteStarter.Entities.dll"), "Text 'SoftwareMonkeys.SiteStarter.Entities.dll' not found when it should be."); selenium.Click("CacheIndexLink"); selenium.WaitForPageToLoad("30000"); selenium.Click("link=Strategies"); selenium.WaitForPageToLoad("30000"); Assert.IsFalse(selenium.IsTextPresent("Exception"), "Text 'Exception' found when it shouldn't be."); Assert.IsTrue(selenium.IsTextPresent("ActivateStrategy"), "Text 'ActivateStrategy' not found when it should be."); Assert.IsTrue(selenium.IsTextPresent("AuthenticateStrategy"), "Text 'AuthenticateStrategy' not found when it should be."); Assert.IsTrue(selenium.IsTextPresent("SoftwareMonkeys.SiteStarter.Business.dll"), "Text 'SoftwareMonkeys.SiteStarter.Business.dll' not found when it should be."); selenium.Click("CacheIndexLink"); selenium.WaitForPageToLoad("30000"); selenium.Click("link=Reactions"); selenium.WaitForPageToLoad("30000"); Assert.IsFalse(selenium.IsTextPresent("Exception"), "Text 'Exception' found when it shouldn't be."); selenium.Click("CacheIndexLink"); selenium.WaitForPageToLoad("30000"); selenium.Click("link=Parts"); selenium.WaitForPageToLoad("30000"); Assert.IsFalse(selenium.IsTextPresent("Exception"), "Text 'Exception' found when it shouldn't be."); selenium.Click("CacheIndexLink"); selenium.WaitForPageToLoad("30000"); selenium.Click("link=Controllers"); selenium.WaitForPageToLoad("30000"); Assert.IsFalse(selenium.IsTextPresent("Exception"), "Text 'Exception' found when it shouldn't be."); Assert.IsTrue(selenium.IsTextPresent("CreateController"), "Text 'CreateController' not found when it should be."); Assert.IsTrue(selenium.IsTextPresent("CreateUserController"), "Text 'CreateUserController' not found when it should be."); Assert.IsTrue(selenium.IsTextPresent("SoftwareMonkeys.SiteStarter.Web.Controllers"), "Text 'SoftwareMonkeys.SiteStarter.Web.Controllers' not found when it should be."); Assert.IsTrue(selenium.IsTextPresent("SoftwareMonkeys.SiteStarter.Web.dll"), "Text 'SoftwareMonkeys.SiteStarter.Web.dll' not found when it should be."); selenium.Click("CacheIndexLink"); selenium.WaitForPageToLoad("30000"); selenium.Click("link=Projections"); selenium.WaitForPageToLoad("30000"); Assert.IsFalse(selenium.IsTextPresent("Exception"), "Text 'Exception' found when it shouldn't be."); Assert.IsTrue(selenium.IsTextPresent("User-Create-Edit.ascx"), "Text 'User-Create-Edit.ascx' not found when it should be."); Assert.IsTrue(selenium.IsTextPresent("User-Index.ascx"), "Text 'User-Index.ascx' not found when it should be."); Assert.IsTrue(selenium.IsTextPresent("Settings-Index.ascx"), "Text 'Settings-Index.ascx' not found when it should be."); Assert.IsTrue(selenium.IsTextPresent("/Projections/"), "Text '/Projections/' not found when it should be."); selenium.Click("link=Sign Out"); selenium.WaitForPageToLoad("30000"); selenium.Open("Admin/Cache.aspx"); Assert.IsFalse(selenium.IsTextPresent("Exception"), "Text 'Exception' found when it shouldn't be."); Assert.IsTrue(selenium.IsTextPresent("Sign In Details"), "Text 'Sign In Details' not found when it should be."); selenium.Open("Admin/Entities.aspx"); Assert.IsFalse(selenium.IsTextPresent("Exception"), "Text 'Exception' found when it shouldn't be."); Assert.IsTrue(selenium.IsTextPresent("Sign In Details"), "Text 'Sign In Details' not found when it should be."); selenium.Open("Admin/Strategies.aspx"); Assert.IsFalse(selenium.IsTextPresent("Exception"), "Text 'Exception' found when it shouldn't be."); Assert.IsTrue(selenium.IsTextPresent("Sign In Details"), "Text 'Sign In Details' not found when it should be."); selenium.Open("Admin/Reactions.aspx"); Assert.IsFalse(selenium.IsTextPresent("Exception"), "Text 'Exception' found when it shouldn't be."); Assert.IsTrue(selenium.IsTextPresent("Sign In Details"), "Text 'Sign In Details' not found when it should be."); selenium.Open("Admin/Parts.aspx"); Assert.IsFalse(selenium.IsTextPresent("Exception"), "Text 'Exception' found when it shouldn't be."); Assert.IsTrue(selenium.IsTextPresent("Sign In Details"), "Text 'Sign In Details' not found when it should be."); selenium.Open("Admin/Controllers.aspx"); Assert.IsFalse(selenium.IsTextPresent("Exception"), "Text 'Exception' found when it shouldn't be."); Assert.IsTrue(selenium.IsTextPresent("Sign In Details"), "Text 'Sign In Details' not found when it should be."); selenium.Open("Admin/Projections.aspx"); Assert.IsFalse(selenium.IsTextPresent("Exception"), "Text 'Exception' found when it shouldn't be."); Assert.IsTrue(selenium.IsTextPresent("Sign In Details"), "Text 'Sign In Details' not found when it should be."); }
public void Test_Dispose() { selenium.SetTimeout("100000"); selenium.Open("Admin/Tests/Dispose.aspx"); selenium.Close(); }