Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class LoginFormValidation extends Specification {
- @Deployment
- def static JavaArchive "create deployment"() {
- return ShrinkWrap.create(WebArchive.class)......;
- }
- By LOGGED_IN = By.xpath("//li[contains(text(),'Welcome')]");
- By LOGGED_OUT = By.xpath("//li[contains(text(),'Goodbye')]");
- By USERNAME_FIELD = By.id("loginForm:username");
- By PASSWORD_FIELD = By.id("loginForm:password");
- By LOGIN_BUTTON = By.id("loginForm:login");
- By LOGOUT_BUTTON = By.id("loginForm:logout");
- @Selenium
- WebDriver driver;
- def "should be possible to login"() {
- when:
- driver.get("http://localhost:8080/weld-login/home.jsf");
- driver.findElement(USERNAME_FIELD).sendKeys(username);
- driver.findElement(PASSWORD_FIELD).sendKeys(password);
- driver.findElement(LOGIN_BUTTON).submit();
- then:
- checkElementPresence(LOGGED_IN, "User should be logged in!");
- where:
- username << ["aslak", "dan"]
- password << ["xxx", "xxx"]
- }
- }
Add Comment
Please, Sign In to add comment