Beispiel #1
0
 public void Advanced_Search_By_Role_Filters_Results()
 {
     using (var driver = BrowserFactory.Create())
     {
         SignInAsAdmin(driver);
         driver.FindElement(By.PartialLinkText("Users")).Click();
         driver.WaitFor(d => d.FindElements(By.CssSelector(".table tbody tr")).Count > 1);
         driver.FindElement(By.CssSelector(".advanced")).Click();
         driver.WaitFor(d => d.FindElements(By.CssSelector(".modal-body")).Count > 0);
         (driver as IJavaScriptExecutor).ExecuteScript(@"$('select[name=""Role""]').val('Administrator')");
         ModalHelper.ClickPrimary(driver);
         driver.WaitFor(d => d.FindElements(By.CssSelector(".modal-body")).Count == 0);
         var rows     = driver.FindElementsByCssSelector(".table tbody tr");
         var filtered = true;
         foreach (var el in rows)
         {
             var td = el.FindElement(By.CssSelector("td:nth-child(3)"));
             if (td.Text != "Administrator")
             {
                 filtered = false;
             }
         }
         Assert.IsTrue(filtered);
     }
 }
Beispiel #2
0
 public void Admin_Can_Delete_User()
 {
     using (var driver = BrowserFactory.Create())
     {
         SignInAsAdmin(driver);
         driver.FindElement(By.PartialLinkText("Users")).Click();
         driver.WaitFor(d => d.FindElements(By.CssSelector(".table tbody tr")).Count > 1);
         driver.FindElement(By.CssSelector(".user-row-10 a[title='Delete user']")).Click();
         driver.WaitFor(u => u.FindElements(By.CssSelector(".modal-footer")).Count > 0);
         ModalHelper.ClickPrimary(driver);
         driver.WaitFor(u => u.FindElements(By.CssSelector(".alert-info")).Count > 0);
         Assert.IsTrue(driver.ElementExists(By.CssSelector(".alert-info")));
     }
 }
Beispiel #3
0
 public void Search_Users_By_Advanced_Email_Filters_Results()
 {
     using (var driver = BrowserFactory.Create())
     {
         SignInAsAdmin(driver);
         driver.FindElement(By.PartialLinkText("Users")).Click();
         driver.WaitFor(d => d.FindElements(By.CssSelector(".table tbody tr")).Count > 1);
         driver.FindElement(By.CssSelector(".advanced")).Click();
         driver.WaitFor(d => d.FindElements(By.CssSelector(".modal-body")).Count > 0);
         (driver as IJavaScriptExecutor).ExecuteScript(@"$('input[name=""Email""]').val('*****@*****.**')");
         ModalHelper.ClickPrimary(driver);
         driver.WaitFor(d => d.FindElements(By.CssSelector(".table tbody tr")).Count < DefaultNumPerPage);
         Assert.AreEqual(1, driver.FindElementsByCssSelector(".table tbody tr").Count);
     }
 }
Beispiel #4
0
 public void Advanced_Search_By_Value_Filters_Results()
 {
     using (var driver = BrowserFactory.Create())
     {
         SignInAsAdmin(driver);
         driver.FindElement(By.PartialLinkText("Resources")).Click();
         driver.FindElement(By.PartialLinkText("Content")).Click();
         driver.WaitFor(d => d.FindElements(By.CssSelector(".table tbody tr")).Count > 1);
         driver.FindElement(By.CssSelector(".advanced")).Click();
         driver.WaitFor(d => d.FindElements(By.CssSelector(".modal-body")).Count > 0);
         (driver as IJavaScriptExecutor).ExecuteScript(@"$('input[name=""Value""]').val('27')");
         ModalHelper.ClickPrimary(driver);
         driver.WaitFor(d => d.FindElements(By.CssSelector(".modal-body")).Count == 0);
         Assert.AreEqual(1, driver.FindElementsByCssSelector(".table tbody tr").Count);
     }
 }
Beispiel #5
0
 public void Advanced_Search_By_Date_Filters_Results()
 {
     using (var driver = BrowserFactory.Create())
     {
         SignInAsAdmin(driver);
         driver.FindElement(By.PartialLinkText("Logs")).Click();
         driver.WaitFor(d => d.FindElements(By.CssSelector(".table tbody tr")).Count > 1);
         driver.FindElement(By.CssSelector(".advanced")).Click();
         driver.WaitFor(d => d.FindElements(By.CssSelector(".modal-body")).Count > 0);
         (driver as IJavaScriptExecutor).ExecuteScript("$('.date-range').trigger('click')");
         (driver as IJavaScriptExecutor).ExecuteScript("$('.ranges ul li:nth-child(2)').trigger('click')");
         ModalHelper.ClickPrimary(driver);
         driver.WaitFor(d => d.FindElements(By.CssSelector(".table tbody tr")).Count < DefaultNumPerPage);
         Assert.AreEqual(1, driver.FindElementsByCssSelector(".table tbody tr").Count);
     }
 }
Beispiel #6
0
 public void Advanced_Search_By_User_Filters_Results()
 {
     using (var driver = BrowserFactory.Create())
     {
         SignInAsAdmin(driver);
         driver.FindElement(By.PartialLinkText("Logs")).Click();
         driver.WaitFor(d => d.FindElements(By.CssSelector(".table tbody tr")).Count > 1);
         driver.FindElement(By.CssSelector(".advanced")).Click();
         driver.WaitFor(d => d.FindElements(By.CssSelector(".modal-body")).Count > 0);
         (driver as IJavaScriptExecutor).ExecuteScript(@"$('input[name=""UserId""]').val('1')");
         ModalHelper.ClickPrimary(driver);
         driver.WaitFor(d => d.FindElements(By.CssSelector(".modal-body")).Count == 0);
         var td = driver.FindElementByCssSelector(".table tbody tr td:first-child");
         Assert.AreEqual("99", td.Text);
     }
 }