Darcy is a framework for writing page objects in order to automate interaction with graphical user interfaces. Page objects are classes that model what a user can see and do with a specific page.
Key features:
- Flexible and extendable by virtue of a declarative, element-based DSL. Write your page objects in terms of the UI buttons, labels, and widgets that you see. Abstract complicated interactions in reusable, custom element types with high-level APIs.
- Allows easy configuration of events and conditions to keep your automation code synchronized with the UI or data it is controlling, simplifying automating AJAX-heavy web applications and waiting for backend data flows.
- Integrates well with Java 8.
- Automation library agnostic -- any library that can find UI elements and interact with them can be wrapped with darcy. Selenium WebDriver support is provided by darcy-webdriver.
Darcy is divided into modules. This module, darcy-ui, defines a general purpose API for all types of user interfaces. darcy-web extends the API for web browser automation.
import static com.redhat.darcy.ui.elements.Elements.textInput;
import static com.redhat.darcy.ui.elements.Elements.button;
import static com.redhat.synq.Synq.after;
@RequireAll
public class MyHomePage extends AbstractView {
private TextInput login = textInput(By.id("login"));
private TextInput password = textInput(By.id("password"));
private Button submit = button(By.id("submit"));
@NotRequired
private Label errorMsg = label(By.className("error"));
public AccountDetails login(Credentials credentials) {
login.clearAndType(credentials.login());
password.clearAndType(credentials.password());
return after(submit::click)
.expect(transition().to(new AccountDetails())
.failIf(errorMsg::isDisplayed)
.throwing(new InvalidLoginException(credentials, errorMsg::readText))
.waitUpTo(1, MINUTES);
}
}
Check out the Automating Applications with Darcy GitBook to learn more about darcy.
Try it out and open an issue if you don't like something! Pull requests welcome and encouraged! Please read the documentation to get started, and check out the issue list if you're looking for something to do.
darcy is licensed under version 3 of the GPL.