net.serenitybdd.screenplay.targets.Target Java Examples

The following examples show how to use net.serenitybdd.screenplay.targets.Target. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ProjectWidgetDetails.java    From jenkins-build-monitor-plugin with MIT License 6 votes vote down vote up
@Override
public String answeredBy(Actor actor) {
    Target details    = BuildMonitorDashboard.Project_Widget_Details.of(projectName);

    return Text.of(details).viewedBy(actor).resolve();
}
 
Example #2
Source File: ProjectWidgetBuilds.java    From jenkins-build-monitor-plugin with MIT License 6 votes vote down vote up
@Override
public String answeredBy(Actor actor) {
    Target builds     = BuildMonitorDashboard.Project_Widget_Builds.of(projectName);

    return Text.of(builds).viewedBy(actor).resolve();
}
 
Example #3
Source File: ProjectWidgetPipelineStages.java    From jenkins-build-monitor-plugin with MIT License 6 votes vote down vote up
@Override
public String answeredBy(Actor actor) {
    Target details = BuildMonitorDashboard.Project_Widget_Pipeline_Stages.of(projectName);

    return Text.of(details).viewedBy(actor).resolve();
}
 
Example #4
Source File: GlobalHeaderNavigationBar.java    From serenity-cucumber-bdd-screenplay with Apache License 2.0 5 votes vote down vote up
public static Target getLoginScreen() {
    if (RunEnvironment.ofValue() == RunEnvironment.Mobile)
    {
        GET_LOGIN_SCREEN = Target.the("Mobile Sign In Button")
                .locatedBy("#_mobile_user_info > div > a");
    }
    return GET_LOGIN_SCREEN;
}
 
Example #5
Source File: SelectDropDownButton.java    From base_project_for_web_automation_projects with MIT License 5 votes vote down vote up
@Override
@Step("{0} clicks on #button is filtered by #valueFilter and click on the resulting item")
public <T extends Actor> void performAs(T actor) {
    button.resolveFor(actor).click();
    filter.resolveFor(actor).sendKeys(valueFilter);
    Target selectedItem = Target.the("selected item").locatedBy(cssSelectorForElementSelected);
    await().forever().pollInterval(1, SECONDS).until(isNotNull(selectedItem.resolveFor(actor)));
    selectedItem.resolveFor(actor).click();
}
 
Example #6
Source File: ProjectWidgetInformation.java    From jenkins-build-monitor-plugin with MIT License 5 votes vote down vote up
@Override
public ProjectInformation answeredBy(Actor actor) {
    Target widget     = BuildMonitorDashboard.Project_Widget.of(projectName);
    String cssClasses = Attribute.of(widget).named("class").viewedBy(actor).asString();

    return new ProjectInformation(projectName, ProjectStatus.fromMultiple(cssClasses));
}
 
Example #7
Source File: TheItemStatus.java    From serenity-documentation with Apache License 2.0 5 votes vote down vote up
@Override
public TodoStatus answeredBy(Actor actor) {
    Target completeItemButton = TodoListItem.COMPLETE_ITEM_BUTTON.of(itemName);

    Boolean itemChecked = SelectedStatus.of(completeItemButton).viewedBy(actor).as(Boolean.class);
    return statusFrom(itemChecked);
}
 
Example #8
Source File: Choose.java    From jenkins-build-monitor-plugin with MIT License 4 votes vote down vote up
public static Action the(Target radioButton) {
    return instrumented(Choose.class, radioButton);
}
 
Example #9
Source File: Setting.java    From jenkins-build-monitor-plugin with MIT License 4 votes vote down vote up
public static Target defining(String name) {
    return Target.the(format("the '%s' field", name))
            .locatedBy(lastElementMatching(either(xpathFor("input"), xpathFor("textarea"))))
            .of(name);
}
 
Example #10
Source File: Button.java    From jenkins-build-monitor-plugin with MIT License 4 votes vote down vote up
public static Target called(String text) {
    return Target.the(format("the '%s' button", text))
            .locatedBy("//button[contains(.,'{0}')]")
            .of(text);
}
 
Example #11
Source File: Checkbox.java    From jenkins-build-monitor-plugin with MIT License 4 votes vote down vote up
public static Target withLabel(String text) {
    return Target.the(format("the '%s' checkbox", text))
            .locatedBy("//*[label[contains(.,'{0}')]]/input[@type='checkbox']")
            .of(text);
}
 
Example #12
Source File: RadioButton.java    From jenkins-build-monitor-plugin with MIT License 4 votes vote down vote up
public static Target withLabel(String text) {
    return Target.the(format("the '%s' radio button", text))
            .locatedBy("//*[label[contains(.,'{0}')]]/input[@type='radio']")
            .of(text);
}
 
Example #13
Source File: Link.java    From jenkins-build-monitor-plugin with MIT License 4 votes vote down vote up
public static Target called(String text) {
    return to(text);
}
 
Example #14
Source File: Link.java    From jenkins-build-monitor-plugin with MIT License 4 votes vote down vote up
public static Target to(String text) {
    return Target.the(format("the '%s' link", text))
            .locatedBy("//a[contains(., '{0}')]")
            .of(text);
}
 
Example #15
Source File: ProjectBadgesState.java    From jenkins-build-monitor-plugin with MIT License 4 votes vote down vote up
@Override
public WebElementState answeredBy(Actor actor) {
    Target widget     = BuildMonitorDashboard.Project_Widget_Badges.of(projectName);

    return stateOf(widget).answeredBy(actor);
}
 
Example #16
Source File: Choose.java    From jenkins-build-monitor-plugin with MIT License 4 votes vote down vote up
public Choose(Target radioButton) {
    this.radioButton = radioButton;
}
 
Example #17
Source File: EnterCode.java    From jenkins-build-monitor-plugin with MIT License 4 votes vote down vote up
public Action intoTheCodeMirror(Target editorField) {
    return instrumented(EnterCodeIntoCodeMirrorEditor.class, editorField, Joiner.on(System.lineSeparator()).join(lines));
}
 
Example #18
Source File: EnterCode.java    From jenkins-build-monitor-plugin with MIT License 4 votes vote down vote up
public Action intoThePipelineEditor(Target editorField) {
    return instrumented(EnterCodeIntoPipelineEditor.class, editorField, Joiner.on(System.lineSeparator()).join(lines));
}
 
Example #19
Source File: EnterCode.java    From jenkins-build-monitor-plugin with MIT License 4 votes vote down vote up
public EnterCodeIntoCodeMirrorEditor(Target target, String code) {
    this.target = target;
    this.code  = code;
}
 
Example #20
Source File: EnterCode.java    From jenkins-build-monitor-plugin with MIT License 4 votes vote down vote up
public EnterCodeIntoPipelineEditor(Target target, String code) {
    this.target = target;
    this.code  = code;
}
 
Example #21
Source File: Breadcrumbs.java    From jenkins-build-monitor-plugin with MIT License 4 votes vote down vote up
public static Target linkTo(String name) {
    return Target.the(format("the '%s' breadcrumb link", name))
            .locatedBy("//ul[@id='breadcrumbs']//a[contains(., '{0}')]")
            .of(name);
}
 
Example #22
Source File: ScrollToTarget.java    From jenkins-build-monitor-plugin with MIT License 4 votes vote down vote up
public ScrollToTarget(Target target) {
    this.target = target;
}
 
Example #23
Source File: Scroll.java    From jenkins-build-monitor-plugin with MIT License 4 votes vote down vote up
public static ScrollToTarget to(Target target) {
    return new ScrollToTarget(target);
}
 
Example #24
Source File: CreateAProject.java    From jenkins-build-monitor-plugin with MIT License 4 votes vote down vote up
public CreateAProject ofType(Target projectType) {
    this.projectType = projectType;

    return this;
}
 
Example #25
Source File: ProjectWidgetState.java    From jenkins-build-monitor-plugin with MIT License 4 votes vote down vote up
@Override
public WebElementState answeredBy(Actor actor) {
    Target widget     = BuildMonitorDashboard.Project_Widget.of(projectName);

    return stateOf(widget).answeredBy(actor);
}
 
Example #26
Source File: JSClick.java    From serenity-documentation with Apache License 2.0 4 votes vote down vote up
private String pathTo(Target target) {
    return target.getCssOrXPathSelector();
}
 
Example #27
Source File: JSClick.java    From serenity-documentation with Apache License 2.0 4 votes vote down vote up
public static Action on(Target target) {
    return instrumented(JSClick.class, target);
}
 
Example #28
Source File: JSClick.java    From serenity-documentation with Apache License 2.0 4 votes vote down vote up
public JSClick(Target target) {
    this.target = target;
}
 
Example #29
Source File: ItemTextLabel.java    From serenity-documentation with Apache License 2.0 4 votes vote down vote up
public static Target forItemCalled(String itemName) {
    return Target.the("Item text label").locatedBy(String.format(ITEM_TEXT_LABEL, itemName));
}
 
Example #30
Source File: CompleteItemButton.java    From serenity-documentation with Apache License 2.0 4 votes vote down vote up
public static Target forItemCalled(String itemName) {
    return Target.the("Complete button").locatedBy(String.format(COMPLETE_BUTTON, itemName));
}