All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.serenitybdd.screenplay.actions.CheckCheckboxOfTarget Maven / Gradle / Ivy

There is a newer version: 4.2.8
Show newest version
package net.serenitybdd.screenplay.actions;

import net.serenitybdd.screenplay.Actor;
import net.serenitybdd.screenplay.questions.SelectedStatus;
import net.serenitybdd.screenplay.targets.Target;

public class CheckCheckboxOfTarget extends ClickOnClickable {
    private final Target target;
    private final boolean expectedToBeChecked;

    public CheckCheckboxOfTarget(Target target, boolean expectedToBeChecked) {
        this.target = target;
        this.expectedToBeChecked = expectedToBeChecked;
    }

    @Override
    public  void performAs(T actor) {
        boolean isSelected = actor.asksFor(SelectedStatus.of(target));
        if (isSelected != expectedToBeChecked) actor.attemptsTo(Click.on(target));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy