This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module TranslateEnglishToRuby | |
module RubyConstantName | |
def RubyConstantName.from sentence | |
joined_together capitalised( words_from sentence ) | |
end | |
#... other methods defined here `joined_together()` etc | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
. | |
├── model | |
│ ├── ApplicationInformation.java | |
│ ├── TodoStatus.java | |
│ └── TodoStatusFilter.java | |
├── questions | |
│ ├── ApplicationDetails.java | |
│ ├── ClearCompletedItemsOptionAvailability.java | |
│ ├── CurrentFilter.java | |
│ ├── DisplayedItems.java |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package net.serenitybdd.demos.todos.user_interface; | |
import net.serenitybdd.screenplay.targets.Target; | |
public class TodoListItem { | |
public static Target COMPLETE_ITEM = the(“Complete item tick box”).locatedBy( “//*[@class=’view’ and contains(.,’{0}’)]//input[@type=’checkbox’]”); | |
public static Target DELETE_ITEM = the(“Delete item button”).locatedBy( “//*[@class=’view’ and contains(.,’{0}’)]//button[@class=’destroy’]”); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package net.serenitybdd.demos.todos.user_interface; | |
import net.serenitybdd.screenplay.targets.Target; | |
public class ToDoList { | |
public static Target WHAT_NEEDS_TO_BE_DONE = the(“’What needs to be done?’ field”).locatedBy(“#new-todo”); | |
public static Target ITEMS = the(“List of todo items”).locatedBy(“.view label”); | |
public static Target ITEMS_LEFT = the(“Count of items left”).locatedBy(“#todo-count strong”); | |
public static Target TOGGLE_ALL = the(“Complete all items link”).locatedBy(“#toggle-all”); | |
public static Target CLEAR_COMPLETED = the(“Clear completed link”).locatedBy(“#clear-completed”); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class TheItems implements Question<List<String>> { | |
@Override | |
public List<String> answeredBy(Actor actor) { | |
return Text.of(ToDoList.ITEMS) | |
.viewedBy(actor) | |
.asList(); | |
} | |
public static Question<List<String>> displayed() { return new TheItems(); } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
then(james).should(seeThat(TheItems.displayed(), hasItem(“Buy some milk”))); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
seeThat(TheItems.displayed(), hasItem(“Buy some milk”)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class AddATodoItem implements Task { | |
private final String thingToDo; | |
public <T extends Actor> void performAs(T theActor) { | |
theActor.attemptsTo( | |
Enter.theValue(thingToDo) | |
.into(WHAT_NEEDS_TO_BE_DONE) | |
.thenHit(RETURN) | |
); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Before | |
public void ourUsersCanBrowseTheWeb() { | |
james.can(BrowseTheWeb.with(hisBrowser)); | |
jane.can(BrowseTheWeb.with(herBrowser)); | |
} | |
@Test | |
public void should_not_affect_todos_belonging_to_another_user() { | |
givenThat(james).wasAbleTo(Start.withATodoListContaining(“Walk the dog”, “Put out the garbage”)); | |
andThat(jane).wasAbleTo(Start.withATodoListContaining(“Walk the dog”, “Feed the cat”)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Actor james = Actor.named(“James”); | |
james.can(BrowseTheWeb.with(hisBrowser)); |
NewerOlder