-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
problems modeling complex controls #31
Comments
I would propose something like this:
|
You could also wrap the CSS locators in enums and have an enum value for each tab. |
I eventually came up with: public class NavigateToSection implements Task {
private String label;
public NavigateToSection(String label) {
this.label = label;
}
@Step("{0} navigates to section '#label'")
@Override
public <T extends Actor> void performAs(T actor) {
actor.should(seeThat(the(Section.labeled(label)), isCurrentlyVisible()).orComplainWith(NavigationSectionNotFound.class, label));
actor.attemptsTo(Click.on(Section.labeled(label)));
}
public static NavigateToSection labeled(String pageLabel) {
return Instrumented.instanceOf(NavigateToSection.class).withProperties(pageLabel);
}
} public class Section {
public static Target labeled(String label) {
return Target.the("application section " + label).locatedBy("//a[contains(., '" + label + "')]");
}
} This seems to work for my use-case, for now. I seem to be struggling more with how to express what I want in English and where are all the bits and pieces. I refactor almost everything every day, as I build up more stuff. That whole Open-Closed Principle is completely not working for me. :( |
I am having problems modelling slightly complex controls, and the documentation has only trivial buttons and links.
I have a situation like this:
NavigateTo.page(String)
, as inactor.attemptsTo(NavigateTo.page("Interesting"))
.As a hint I was able to find this, but it is not clear where the
find(...)
static import comes from.I constantly find myself struggling to model something in Screenplay, that I used to whip up without a second thought using PageObjects:
Can you help?
The text was updated successfully, but these errors were encountered: