Skip to content

Commit

Permalink
Feature View Pets Catalogue - implemented two scenarios
Browse files Browse the repository at this point in the history
  • Loading branch information
globox97 committed Apr 6, 2024
1 parent 3cebf6c commit 82c4103
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,21 @@ public class ViewCatalogueStepDefs {

@When("I request the Catalogue")
public void viewCatalogue() throws Exception {
stepDefs.result = stepDefs.mockMvc.perform(get("/pets/search?isAdopted=false")
stepDefs.result = stepDefs.mockMvc.perform(get("/pets/search/findByIsAdopted?isAdopted=false")
.accept(MediaType.APPLICATION_JSON))
.andDo(print());
}

@When("I request the catalogue for the specific shelter {string}")
public void viewShelterCatalogue(String shelter) throws Exception {
stepDefs.result = stepDefs.mockMvc.perform(get("/pets/search/findByShelter?Shelter={shelter}", shelter)
.accept(MediaType.APPLICATION_JSON))
.andDo(print());
}

@When("I request the Catalogue with breed {string}")
public void viewCataloguewithBreed(String breed) throws Exception{
stepDefs.result = stepDefs.mockMvc.perform(get("/pets/search?breed={breed}", breed)
stepDefs.result = stepDefs.mockMvc.perform(get("/pets/search/findByBreed?breed={breed}", breed)
.accept(MediaType.APPLICATION_JSON))
.andDo(print());
}
Expand Down
13 changes: 4 additions & 9 deletions src/test/resources/features/ViewCatalogue.feature
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
# Created by globox97 at 11/03/2024
Feature: View Pets Catalogue
In order to view the Pets Catalogue
In order to choose a pet to adopt from those available
As a User
I want to view the pet catalogue

Background:
Given there is a registered client with username "client" and password "password" and email "[email protected]"
Given there is a registered volunteer with username "volunteer" and password "password" and email "[email protected]"
And There is a Pet with breed "cat"
And There is a Pet with breed "dog"


Scenario: View Pets Catalogue without being logged in
Given I'm not logged in
Expand All @@ -27,7 +21,8 @@ Feature: View Pets Catalogue
Then The response code is 200

Scenario: View Pets Catalogue as a Shelter Volunteer
Given I'm logged in as a Volunteer
When I request the Catalogue
Given There is a registered shelter volunteer with username "volunteer" and password "password" and email "[email protected]"
Given I login with username "volunteer" and password "password"
When I request the Catalogue for the specific shelter
Then I'm shown the Catalogue from the shelter I work in
And The response code is 200

0 comments on commit 82c4103

Please sign in to comment.