generated from hmcts/spring-boot-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* updating serenity - report plugin version * updating serenity - report plugin version * tests for PO-703
- Loading branch information
1 parent
b3711ba
commit d5322ab
Showing
4 changed files
with
110 additions
and
1 deletion.
There are no files selected for viewing
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
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
46 changes: 46 additions & 0 deletions
46
src/functionalTest/java/uk/gov/hmcts/opal/steps/GetResultsStepDef.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package uk.gov.hmcts.opal.steps; | ||
|
||
import io.cucumber.datatable.DataTable; | ||
import io.cucumber.java.en.Then; | ||
import io.cucumber.java.en.When; | ||
import net.serenitybdd.rest.SerenityRest; | ||
|
||
import java.util.Map; | ||
|
||
import static net.serenitybdd.rest.SerenityRest.then; | ||
import static org.hamcrest.Matchers.equalTo; | ||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static uk.gov.hmcts.opal.config.Constants.RESULTS_URI; | ||
import static uk.gov.hmcts.opal.steps.BearerTokenStepDef.getToken; | ||
|
||
public class GetResultsStepDef extends BaseStepDef { | ||
@When("I make a request to get the results {string}") | ||
public void getResults(String resultIds) { | ||
SerenityRest | ||
.given() | ||
.header("Authorization", "Bearer " + getToken()) | ||
.accept("*/*") | ||
.contentType("application/json") | ||
.param("result_ids", resultIds) | ||
.when() | ||
.get(getTestUrl() + RESULTS_URI); | ||
} | ||
|
||
@Then("The results response contains {int} results") | ||
public void resultsResponseContainsCount(int count) { | ||
then().assertThat() | ||
.statusCode(200).body("count", equalTo(count)); | ||
} | ||
|
||
@Then("The results response contains the following result") | ||
public void resultsResponseContains(DataTable data) { | ||
Map<String, String> expected = data.asMap(String.class, String.class); | ||
String resultID = expected.get("result_id"); | ||
for (String key : expected.keySet()) { | ||
String actual = then().extract().body().jsonPath().getString("refData.find { it.result_id == '" | ||
+ resultID + "' }." + key); | ||
assertEquals(expected.get(key), actual, "Values are not equal"); | ||
} | ||
} | ||
} | ||
|
62 changes: 62 additions & 0 deletions
62
src/functionalTest/resources/features/opalMode/results/PO-703_results.feature
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
@Opal | ||
Feature: PO-703 results happy path | ||
|
||
@PO-703 | ||
Scenario: get results - happy path | ||
Given I am testing as the "[email protected]" user | ||
When I make a request to get the results "" | ||
Then The results response contains 59 results | ||
|
||
And The results response contains the following result | ||
| result_id | REM | | ||
| result_title | Final reminder of unpaid fine | | ||
| result_title_cy | Nodyn atgoffa terfynol am ddirwy heb ei thalu | | ||
| active | true | | ||
| result_type | Result | | ||
| imposition_creditor | | | ||
| imposition_allocation_order | | | ||
|
||
|
||
And The results response contains the following result | ||
| result_id | UPWO | | ||
| result_title | UNPAID WORK ORDER | | ||
| result_title_cy | | | ||
| active | true | | ||
| result_type | Result | | ||
| imposition_creditor | | | ||
| imposition_allocation_order | | | ||
|
||
And The results response contains the following result | ||
| result_id | FCOMP | | ||
| result_title | Compensation | | ||
| result_title_cy | Iawndal | | ||
| active | true | | ||
| result_type | Result | | ||
| imposition_creditor | Any | | ||
| imposition_allocation_order | 1 | | ||
|
||
@PO-703 | ||
Scenario: get results - happy path filtered by result id | ||
Given I am testing as the "[email protected]" user | ||
When I make a request to get the results "FO,ABDC" | ||
Then The results response contains 2 results | ||
|
||
And The results response contains the following result | ||
| result_id | FO | | ||
| result_title | Fine | | ||
| result_title_cy | Dirwy | | ||
| active | true | | ||
| result_type | Result | | ||
| imposition_creditor | CF | | ||
| imposition_allocation_order | | | ||
|
||
And The results response contains the following result | ||
| result_id | ABDC | | ||
| result_title | Application made for benefit deductions | | ||
| result_title_cy | Cais am dynnu arian o fudd-daliadau | | ||
| active | true | | ||
| result_type | Result | | ||
| imposition_creditor | | | ||
| imposition_allocation_order | | | ||
|
||
|