// Path: src/samples/journey-pattern-sample/src/main/java/net/serenitybdd/demos/todos/questions/ClearCompletedItemsOptionAvailability.java
// @Subject("the 'Clear Completed' option")
// public class ClearCompletedItemsOptionAvailability implements Question<ElementAvailability> {
// 
//     private final Map<Boolean, ElementAvailability> ELEMENT_AVAILABILITY =
//             ImmutableMap.of(
//                     Boolean.TRUE, ElementAvailability.Available,
//                     Boolean.FALSE, ElementAvailability.Unavailable
//                     );
// 
//     @Override
//     public ElementAvailability answeredBy(Actor actor) {
//         Boolean clearCompleteButtonIsVisible = Visibility.of(ClearCompleted.BUTTON).viewedBy(actor).value();
//         return ELEMENT_AVAILABILITY.get(clearCompleteButtonIsVisible);
//     }
// }
// 
// 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/tasks/AddTodoItems.java
// public class AddTodoItems implements Task {
// 
//     private final List<String> todos;
// 
//     protected AddTodoItems(List<String> items) { this.todos = ImmutableList.copyOf(items); }
// 
//     @Step("{0} adds the todo items called #todos")
//     public <T extends Actor> void performAs(T actor) {
//         todos.forEach(
//                 todo -> actor.attemptsTo(AddATodoItem.called(todo))
//         );
//     }
// 
//     public static AddTodoItems called(String... items) {
//         return Instrumented.instanceOf(AddTodoItems.class).withProperties(asList(items));
//     }
// }
// 
// Path: src/samples/journey-pattern-sample/src/main/java/net/serenitybdd/demos/todos/tasks/ClearCompletedItems.java
// public class ClearCompletedItems implements Performable {
// 
//     @Step("{0} clears all the completed items")
//     public <T extends Actor> void performAs(T actor) {
//         actor.attemptsTo(Click.on(ClearCompleted.BUTTON));
//     }
// }
// 
// Path: src/samples/journey-pattern-sample/src/main/java/net/serenitybdd/demos/todos/tasks/Complete.java
// public class Complete {
// 
//     public static CompleteItem itemCalled(String itemName) {
//         return instrumented(CompleteItem.class, itemName);
//     }
//     public static CompleteAllItems allItems() {
//         return instrumented(CompleteAllItems.class);
//     }
// 
// }
// 
// 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.ClearCompletedItemsOptionAvailability;
import net.serenitybdd.demos.todos.questions.DisplayedItems;
import net.serenitybdd.demos.todos.tasks.AddTodoItems;
import net.serenitybdd.demos.todos.tasks.ClearCompletedItems;
import net.serenitybdd.demos.todos.tasks.Complete;
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.demos.todos.questions.ElementAvailability.Unavailable;
import static net.serenitybdd.screenplay.GivenWhenThen.*;
import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.equalTo;
package net.serenitybdd.demos.todos.features.maintain_my_todo_list;



@RunWith(SerenityRunner.class)
public class ClearCompletedTodos {

    @Managed
    private
    WebDriver hisBrowser;

    @Managed
    private
    WebDriver herBrowser;

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

    @Steps
    private
    ClearCompletedItems clearTheCompletedItems;

// Path: src/samples/journey-pattern-sample/src/main/java/net/serenitybdd/demos/todos/questions/ClearCompletedItemsOptionAvailability.java
// @Subject("the 'Clear Completed' option")
// public class ClearCompletedItemsOptionAvailability implements Question<ElementAvailability> {
// 
//     private final Map<Boolean, ElementAvailability> ELEMENT_AVAILABILITY =
//             ImmutableMap.of(
//                     Boolean.TRUE, ElementAvailability.Available,
//                     Boolean.FALSE, ElementAvailability.Unavailable
//                     );
// 
//     @Override
//     public ElementAvailability answeredBy(Actor actor) {
//         Boolean clearCompleteButtonIsVisible = Visibility.of(ClearCompleted.BUTTON).viewedBy(actor).value();
//         return ELEMENT_AVAILABILITY.get(clearCompleteButtonIsVisible);
//     }
// }
// 
// 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/tasks/AddTodoItems.java
// public class AddTodoItems implements Task {
// 
//     private final List<String> todos;
// 
//     protected AddTodoItems(List<String> items) { this.todos = ImmutableList.copyOf(items); }
// 
//     @Step("{0} adds the todo items called #todos")
//     public <T extends Actor> void performAs(T actor) {
//         todos.forEach(
//                 todo -> actor.attemptsTo(AddATodoItem.called(todo))
//         );
//     }
// 
//     public static AddTodoItems called(String... items) {
//         return Instrumented.instanceOf(AddTodoItems.class).withProperties(asList(items));
//     }
// }
// 
// Path: src/samples/journey-pattern-sample/src/main/java/net/serenitybdd/demos/todos/tasks/ClearCompletedItems.java
// public class ClearCompletedItems implements Performable {
// 
//     @Step("{0} clears all the completed items")
//     public <T extends Actor> void performAs(T actor) {
//         actor.attemptsTo(Click.on(ClearCompleted.BUTTON));
//     }
// }
// 
// Path: src/samples/journey-pattern-sample/src/main/java/net/serenitybdd/demos/todos/tasks/Complete.java
// public class Complete {
// 
//     public static CompleteItem itemCalled(String itemName) {
//         return instrumented(CompleteItem.class, itemName);
//     }
//     public static CompleteAllItems allItems() {
//         return instrumented(CompleteAllItems.class);
//     }
// 
// }
// 
// 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/maintain_my_todo_list/ClearCompletedTodos.java
import net.serenitybdd.demos.todos.questions.ClearCompletedItemsOptionAvailability;
import net.serenitybdd.demos.todos.questions.DisplayedItems;
import net.serenitybdd.demos.todos.tasks.AddTodoItems;
import net.serenitybdd.demos.todos.tasks.ClearCompletedItems;
import net.serenitybdd.demos.todos.tasks.Complete;
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.demos.todos.questions.ElementAvailability.Unavailable;
import static net.serenitybdd.screenplay.GivenWhenThen.*;
import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.equalTo;

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



@RunWith(SerenityRunner.class)
public class ClearCompletedTodos {

    @Managed
    private
    WebDriver hisBrowser;

    @Managed
    private
    WebDriver herBrowser;

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

    @Steps
    private
    ClearCompletedItems clearTheCompletedItems;

    private DisplayedItems theDisplayedItems = new DisplayedItems();