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); } }
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")); }