// Path: src/samples/journey-pattern-sample/src/main/java/net/serenitybdd/demos/todos/questions/DisplayedItems.java
// @Subject("the displayed todo items")
// public class DisplayedItems implements Question<List<String>> {
// 
//     @Override
//     public List<String> answeredBy(Actor actor) {
//         return Text.of(ToDoList.TODO_ITEMS).viewedBy(actor).asList();
//     }
// }
// 
// Path: src/samples/journey-pattern-sample/src/main/java/net/serenitybdd/demos/todos/questions/PlaceholderText.java
// @Subject("the ToDo placeholder text")
// public class PlaceholderText implements Question<String> {
// 
//     @Override
//     public String answeredBy(Actor actor) {
//         return Attribute.of(NewTodoForm.NEW_TODO_FIELD).named("placeholder").viewedBy(actor).asString();
//     }
// }
// 
// Path: src/samples/journey-pattern-sample/src/main/java/net/serenitybdd/demos/todos/tasks/AddATodoItem.java
// public class AddATodoItem implements Task {
// 
//     private final String thingToDo;
// 
//     protected AddATodoItem(String thingToDo) { this.thingToDo = thingToDo; }
// 
//     // tag::performAs[]
//     @Step("{0} adds a todo item called #thingToDo")
//     public <T extends Actor> void performAs(T actor) {
//         actor.attemptsTo(
//                 Enter.theValue(thingToDo).into(NewTodoForm.NEW_TODO_FIELD),
//                 Hit.the(RETURN).keyIn(NewTodoForm.NEW_TODO_FIELD)
//         );
//     }
//     // end::performAs[]
// 
//     public static AddATodoItem called(String thingToDo) {
//         return Instrumented.instanceOf(AddATodoItem.class).withProperties(thingToDo);
//     }
// }
// 
// Path: src/samples/journey-pattern-sample/src/main/java/net/serenitybdd/demos/todos/tasks/OpenTheApplication.java
// public class OpenTheApplication implements Task {
// 
//     private ApplicationHomePage applicationHomePage;
// 
//     public static OpenTheApplication onTheHomePage() {
//         return instrumented(OpenTheApplication.class);
//     }
//     @Step("{0} opens the application on the home page")
//     public <T extends Actor> void performAs(T actor) {
//         actor.attemptsTo(Open.browserOn().the(applicationHomePage));
//     }
// }


import net.serenitybdd.demos.todos.questions.DisplayedItems;
import net.serenitybdd.demos.todos.questions.PlaceholderText;
import net.serenitybdd.demos.todos.tasks.AddATodoItem;
import net.serenitybdd.demos.todos.tasks.OpenTheApplication;
import net.serenitybdd.junit.runners.SerenityRunner;
import net.serenitybdd.screenplay.Actor;
import net.serenitybdd.screenplay.abilities.BrowseTheWeb;
import net.thucydides.core.annotations.Managed;
import net.thucydides.core.annotations.Steps;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.openqa.selenium.WebDriver;
import static net.serenitybdd.screenplay.GivenWhenThen.*;
import static org.hamcrest.Matchers.hasItem;
import static org.hamcrest.core.Is.is;
package net.serenitybdd.demos.todos.features.record_todos;



/**
 * This example illustrates using Serenity Steps with JUnit.
 */
 // tag::add_new_todos_start[]
@RunWith(SerenityRunner.class)
public class AddNewTodos {

    private Actor james = Actor.named("James");

    @Managed
    private WebDriver hisBrowser;

    @Steps
    private PlaceholderText thePlaceholderText;

// Path: src/samples/journey-pattern-sample/src/main/java/net/serenitybdd/demos/todos/questions/DisplayedItems.java
// @Subject("the displayed todo items")
// public class DisplayedItems implements Question<List<String>> {
// 
//     @Override
//     public List<String> answeredBy(Actor actor) {
//         return Text.of(ToDoList.TODO_ITEMS).viewedBy(actor).asList();
//     }
// }
// 
// Path: src/samples/journey-pattern-sample/src/main/java/net/serenitybdd/demos/todos/questions/PlaceholderText.java
// @Subject("the ToDo placeholder text")
// public class PlaceholderText implements Question<String> {
// 
//     @Override
//     public String answeredBy(Actor actor) {
//         return Attribute.of(NewTodoForm.NEW_TODO_FIELD).named("placeholder").viewedBy(actor).asString();
//     }
// }
// 
// Path: src/samples/journey-pattern-sample/src/main/java/net/serenitybdd/demos/todos/tasks/AddATodoItem.java
// public class AddATodoItem implements Task {
// 
//     private final String thingToDo;
// 
//     protected AddATodoItem(String thingToDo) { this.thingToDo = thingToDo; }
// 
//     // tag::performAs[]
//     @Step("{0} adds a todo item called #thingToDo")
//     public <T extends Actor> void performAs(T actor) {
//         actor.attemptsTo(
//                 Enter.theValue(thingToDo).into(NewTodoForm.NEW_TODO_FIELD),
//                 Hit.the(RETURN).keyIn(NewTodoForm.NEW_TODO_FIELD)
//         );
//     }
//     // end::performAs[]
// 
//     public static AddATodoItem called(String thingToDo) {
//         return Instrumented.instanceOf(AddATodoItem.class).withProperties(thingToDo);
//     }
// }
// 
// Path: src/samples/journey-pattern-sample/src/main/java/net/serenitybdd/demos/todos/tasks/OpenTheApplication.java
// public class OpenTheApplication implements Task {
// 
//     private ApplicationHomePage applicationHomePage;
// 
//     public static OpenTheApplication onTheHomePage() {
//         return instrumented(OpenTheApplication.class);
//     }
//     @Step("{0} opens the application on the home page")
//     public <T extends Actor> void performAs(T actor) {
//         actor.attemptsTo(Open.browserOn().the(applicationHomePage));
//     }
// }


// Path: src/samples/journey-pattern-sample/src/test/java/net/serenitybdd/demos/todos/features/record_todos/AddNewTodos.java
import net.serenitybdd.demos.todos.questions.DisplayedItems;
import net.serenitybdd.demos.todos.questions.PlaceholderText;
import net.serenitybdd.demos.todos.tasks.AddATodoItem;
import net.serenitybdd.demos.todos.tasks.OpenTheApplication;
import net.serenitybdd.junit.runners.SerenityRunner;
import net.serenitybdd.screenplay.Actor;
import net.serenitybdd.screenplay.abilities.BrowseTheWeb;
import net.thucydides.core.annotations.Managed;
import net.thucydides.core.annotations.Steps;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.openqa.selenium.WebDriver;
import static net.serenitybdd.screenplay.GivenWhenThen.*;
import static org.hamcrest.Matchers.hasItem;
import static org.hamcrest.core.Is.is;

package net.serenitybdd.demos.todos.features.record_todos;



/**
 * This example illustrates using Serenity Steps with JUnit.
 */
 // tag::add_new_todos_start[]
@RunWith(SerenityRunner.class)
public class AddNewTodos {

    private Actor james = Actor.named("James");

    @Managed
    private WebDriver hisBrowser;

    @Steps
    private PlaceholderText thePlaceholderText;

    private DisplayedItems theDisplayedItems = new DisplayedItems();