예제 #1
0
        public void CanCreateLoanTest()
        {
            try
            {
                // Arrange
                if (!AuthenticationHelpers.IsLoggedIn(_driver))
                {
                    AuthenticationHelpers.LoginAsTestUser(_driver);
                }

                bool isCreateLoanConfirmationShown = false;

                // Act
                ElementHelpers.ClickElement(_driver, By.PartialLinkText("New Loan"));
                ElementHelpers.SendKeys(_driver, By.Id("LoanerCardBarcode"), "10000");
                ElementHelpers.SendKeys(_driver, By.Id("CopyBarcode"), "100001");
                ElementHelpers.SelectElementByText(_driver, By.Id("LibraryName"), "Georgia Tech Library");
                ElementHelpers.ClickElement(_driver, By.Id("Create"));

                isCreateLoanConfirmationShown = ElementHelpers.IsElementPresent(_driver, By.ClassName("alert-success"));

                // Assert
                Assert.True(isCreateLoanConfirmationShown);
            }
            finally
            {
                DriverHelpers.CleanUpTest(_driver);
            }
        }
예제 #2
0
 public static void LoginAsTestUser(IWebDriver driver)
 {
     ElementHelpers.ClickElement(driver, By.LinkText("Login"));
     ElementHelpers.ClearElement(driver, By.Id("Email"));
     ElementHelpers.SendKeys(driver, By.Id("Email"), "*****@*****.**");
     ElementHelpers.ClearElement(driver, By.Id("Password"));
     ElementHelpers.SendKeys(driver, By.Id("Password"), "12345678");
     ElementHelpers.ClickElement(driver, By.Id("login-button"));
 }
예제 #3
0
 public void CanOpenStartPageInBrowserTest(string browser)
 {
     try
     {
         _driver = DriverHelpers.GetDriver(browser);
         Assert.True(ElementHelpers.IsElementPresent(_driver, By.LinkText("GTL")));
     }
     finally
     {
         DriverHelpers.CleanUpTest(_driver);
     }
 }
예제 #4
0
 public static bool IsLoggedIn(IWebDriver driver)
 {
     return(ElementHelpers.IsElementPresent(driver, By.LinkText("Logout")));
 }
예제 #5
0
 public static void Logout(IWebDriver driver)
 {
     ElementHelpers.ClickElement(driver, By.LinkText("Logout"));
 }