Jacobvu84 / serenity-screenplay-appium

The demo shows the integration of Serenity BDD, Screenplay and Cucumber JVM.
3 stars 3 forks source link

Get Attribute in Screenplay #3

Open Jacobvu84 opened 5 years ago

Jacobvu84 commented 5 years ago
package net.serenitybdd.demos.todos.screenplay.questions;

import net.serenitybdd.demos.todos.screenplay.user_interface.TodoList;
import net.serenitybdd.screenplay.Actor;
import net.serenitybdd.screenplay.Question;
import net.serenitybdd.screenplay.annotations.Subject;
import net.serenitybdd.screenplay.questions.Attribute;

@Subject("the ToDo placeholder text")
public class Placeholder implements Question<String> {

    @Override
    public String answeredBy(Actor actor) {
        return Attribute.of(TodoList.WHAT_NEEDS_TO_BE_DONE).named("placeholder")
                .viewedBy(actor)
                .asString();
    }

    public static Placeholder text() {
        return new Placeholder();
    }
}