From a3238a4a0c819c70bbe69029c1e6067969016552 Mon Sep 17 00:00:00 2001 From: John Ferguson Smart Date: Thu, 23 May 2024 09:42:19 +0100 Subject: [PATCH] Updated to Serenity 4.1.14 including Gradle updates --- build.gradle | 16 +++++----- .../cucumber/steps/TodoUserActionSteps.java | 17 ---------- .../todos/cucumber/steps/TodoUserSteps.java | 10 ++++-- .../completing_todos.feature | 31 ++++--------------- .../deleting_todos.feature | 1 - .../filtering_other_todos.feature | 20 ------------ 6 files changed, 21 insertions(+), 74 deletions(-) delete mode 100644 src/test/resources/features/cucumber/maintain_my_todo_list/filtering_other_todos.feature diff --git a/build.gradle b/build.gradle index 5f7c9f45..855eedf0 100644 --- a/build.gradle +++ b/build.gradle @@ -12,7 +12,7 @@ buildscript { } } dependencies { - classpath "net.serenity-bdd:serenity-gradle-plugin:4.0.30" + classpath "net.serenity-bdd:serenity-gradle-plugin:4.1.14" } } @@ -26,13 +26,13 @@ sourceCompatibility = 17 targetCompatibility = 17 ext { - SERENITY_VERSION = '4.0.30' - JUNIT_PLATFORM_VERSION = '1.10.1' + SERENITY_VERSION = '4.1.14' + JUNIT_PLATFORM_VERSION = '1.10.2' CUCUMBER_JUNIT_PLATFORM_VERSION = '7.14.0' - JUNIT_JUPITER_VERSION = '5.10.1' - JUNIT_VINTAGE_VERSION = '5.10.1' + JUNIT_JUPITER_VERSION = '5.10.2' + JUNIT_VINTAGE_VERSION = '5.10.2' LOGBACK_CLASSIC_VERSION = '1.2.10' - ASSERTJ_CORE_VERSION = '3.22.0' + ASSERTJ_CORE_VERSION = '3.25.3' } dependencies { @@ -43,14 +43,14 @@ dependencies { implementation "net.serenity-bdd:serenity-screenplay-webdriver:${SERENITY_VERSION}" implementation "net.serenity-bdd:serenity-ensure:${SERENITY_VERSION}" implementation "net.serenity-bdd:serenity-cucumber:${SERENITY_VERSION}" + implementation "ch.qos.logback:logback-classic:${LOGBACK_CLASSIC_VERSION}" + implementation "org.assertj:assertj-core:${ASSERTJ_CORE_VERSION}" testImplementation "org.junit.platform:junit-platform-launcher:${JUNIT_PLATFORM_VERSION}" testImplementation "io.cucumber:cucumber-junit-platform-engine:${CUCUMBER_JUNIT_PLATFORM_VERSION}" testImplementation "org.junit.platform:junit-platform-suite:${JUNIT_PLATFORM_VERSION}" testImplementation "org.junit.jupiter:junit-jupiter-engine:${JUNIT_JUPITER_VERSION}" testImplementation "org.junit.vintage:junit-vintage-engine:${JUNIT_VINTAGE_VERSION}" testImplementation "net.serenity-bdd:serenity-saucelabs:${SERENITY_VERSION}" - implementation "ch.qos.logback:logback-classic:${LOGBACK_CLASSIC_VERSION}" - testImplementation "org.assertj:assertj-core:${ASSERTJ_CORE_VERSION}" } test { diff --git a/src/test/java/net/serenitybdd/demos/todos/cucumber/steps/TodoUserActionSteps.java b/src/test/java/net/serenitybdd/demos/todos/cucumber/steps/TodoUserActionSteps.java index a795953c..bf818d6d 100644 --- a/src/test/java/net/serenitybdd/demos/todos/cucumber/steps/TodoUserActionSteps.java +++ b/src/test/java/net/serenitybdd/demos/todos/cucumber/steps/TodoUserActionSteps.java @@ -35,21 +35,4 @@ public void sheFiltersTheListToShowOnlyFilterTasks(String status) { public void herListShouldContain(List items) { james.should_see_that_displayed_items_contain(items.toArray(new String[]{})); } - - @Given("Pete wants to change his password") - public void peteWantsToChangeHisPassword() { - } - - @When("he enters {string} as his new password") - public void heEntersAsHisNewPassword(String arg0) { - } - - @Then("his password should be updated") - public void hisPasswordShouldBeUpdated() { - } - - @Then("his password should be updated:{}") - public void hisPasswordShouldBeUpdatedUpdated(boolean yes) { - - } } diff --git a/src/test/java/net/serenitybdd/demos/todos/cucumber/steps/TodoUserSteps.java b/src/test/java/net/serenitybdd/demos/todos/cucumber/steps/TodoUserSteps.java index 36c8941e..7534000c 100644 --- a/src/test/java/net/serenitybdd/demos/todos/cucumber/steps/TodoUserSteps.java +++ b/src/test/java/net/serenitybdd/demos/todos/cucumber/steps/TodoUserSteps.java @@ -26,6 +26,7 @@ import net.serenitybdd.screenplay.waits.Wait; import java.util.List; +import java.util.stream.Collectors; import static java.util.Collections.EMPTY_LIST; import static net.serenitybdd.demos.todos.screenplay.model.TodoStatus.Completed; @@ -82,7 +83,9 @@ public void that_James_has_an_empty_todo_list(Actor actor) { @Given("{actor} has a todo list containing {items}") public void that_James_has_an_empty_todo_list(Actor actor, List items) { - Serenity.setSessionVariable("todoItems").to(items); + + actor.remember("todoItems", items); + actor.wasAbleTo(Start.withATodoListContaining(items)); } @@ -129,8 +132,9 @@ public void item_should_be_recorded_in_the_list(String expectedItem) { @Then("his/her todo list should contain {items}") public void todo_list_should_contain(List expectedItems) { - List originalItems = Serenity.sessionVariableCalled("todoItems"); - assertThat(originalItems).isNotEmpty(); + + List todoItems = theActorInTheSpotlight().recall("todoItems"); + assertThat(todoItems).isNotEmpty(); theActorInTheSpotlight().should(seeThat(TheItems.displayed(), equalTo(expectedItems)) .orComplainWith(MissingTodoItemsException.class, "Missing todos " + expectedItems)); diff --git a/src/test/resources/features/cucumber/maintain_my_todo_list/completing_todos.feature b/src/test/resources/features/cucumber/maintain_my_todo_list/completing_todos.feature index e75fb950..dff78fc9 100644 --- a/src/test/resources/features/cucumber/maintain_my_todo_list/completing_todos.feature +++ b/src/test/resources/features/cucumber/maintain_my_todo_list/completing_todos.feature @@ -13,48 +13,29 @@ Feature: Completing todos Then her todo list should contain Buy some milk, Walk the dog But the "Walk the dog" task should be shown as Completed - Given Pete wants to change his password - When he enters "Password1!" as his new password - Then his password should be updated - - @manual - Scenario Outline: Updating a password - Given Pete wants to change his password - When he enters "" as his new password - Then his password should be updated: - Examples: - | password | updated? | - | Password1! | true | - | Password1 | false | - | Password! | false | - | Passwor | false | - - - @ios Scenario: Completed tasks should appear in the Completed list - Given Jane has a todo list containing Buy some milk, Walk the dog - When she completes the task called "Walk the dog" - And she filters her list to show only Completed tasks + Given James has a todo list containing Buy some milk, Walk the dog + When he completes the task called "Walk the dog" + And he filters her list to show only Completed tasks Then her todo list should contain Walk the dog Scenario Outline: Completed tasks should be shown as Completed - Given Jane has a todo list containing + Given Sarah has a todo list containing When she completes the task called "Walk the dog" Then the "" task should be shown as Examples: | Initial Tasks | Task | Final Status | -# | | Walk the dog | Completed | | Buy some milk, Walk the dog | Walk the dog | Completed | | Walk the dog | Walk the dog | Completed | | Buy some milk, Walk the dog | Buy some milk | Active | Scenario: The list of completed items should be empty if nothing has been completed - Given Jane has a todo list containing Buy some milk, Walk the dog + Given Jill has a todo list containing Buy some milk, Walk the dog When she filters her list to show only Completed tasks Then her todo list should be empty Scenario: The todo count should keep track of how many todos remain - Given Jane has a todo list containing Buy some milk, Walk the dog + Given Sophie has a todo list containing Buy some milk, Walk the dog Then her remaining todo count should be 2 When she completes the task called "Walk the dog" Then her remaining todo count should be 1 diff --git a/src/test/resources/features/cucumber/maintain_my_todo_list/deleting_todos.feature b/src/test/resources/features/cucumber/maintain_my_todo_list/deleting_todos.feature index f5934398..94951002 100644 --- a/src/test/resources/features/cucumber/maintain_my_todo_list/deleting_todos.feature +++ b/src/test/resources/features/cucumber/maintain_my_todo_list/deleting_todos.feature @@ -12,7 +12,6 @@ Feature: Deleting todos When she deletes the task called 'Walk the dog' Then her todo list should contain Buy some milk - @manual Scenario: Delete all the items Given Jane has a todo list containing Buy some milk, Walk the dog When she deletes the task called 'Walk the dog' diff --git a/src/test/resources/features/cucumber/maintain_my_todo_list/filtering_other_todos.feature b/src/test/resources/features/cucumber/maintain_my_todo_list/filtering_other_todos.feature deleted file mode 100644 index aa3d4050..00000000 --- a/src/test/resources/features/cucumber/maintain_my_todo_list/filtering_other_todos.feature +++ /dev/null @@ -1,20 +0,0 @@ -@cucumber -@filtering -Feature: Filtering other todos - - In order to make me feel a sense of accomplishment - As a forgetful person - I want to be to view all of things I have completed - - @ios @android - Scenario Outline: Filtering items by status - Given Jane has prepared a todo list containing - And she has completed the task called "" - When she filters the list to show only tasks - Then her list should contain - Examples: - | tasks | completed | filter | expected | - | Buy some milk, Walk the dog | Walk the dog | Active | Buy some milk | -# | Buy some milk, Walk the dog | Broken | Active | Buy some milk | - | Buy some milk, Walk the dog | Walk the dog | Completed | Walk the dog | - | Buy some milk, Walk the dog | Walk the dog | All | Buy some milk, Walk the dog |