Skip to content

Commit

Permalink
Added search by tag cucumber tests
Browse files Browse the repository at this point in the history
  • Loading branch information
HoolaBoola committed Dec 11, 2020
1 parent f088655 commit e6aaa43
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 23 deletions.
17 changes: 17 additions & 0 deletions src/test/java/recommendation_library/Stepdefs.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ public void commandBookSelected() {
inputLines.add("1");
}

@When("command search tags is selected")
public void commandSearchTagsSelected() {
inputLines.add("10");
}

@When("command list all is selected")
public void commandAllListingSelected() {
inputLines.add("1");
Expand Down Expand Up @@ -208,9 +213,21 @@ public void systemWillRespondWith(String expectedOutput) {

@Then("app lists a recommendation with author {string}, title {string}, description {string}, isbn {string}, and page count {string}")
public void listingAddedBookRecommendation(String author, String title, String description, String isbn, String pageCount) {
System.err.println(author);
System.err.println(title);
System.err.println(description);
System.err.println(isbn);
System.err.println(pageCount);
System.err.println(String.join("\n", inputLines));
io = new StubIO(inputLines);
System.err.println(io);

dao = new InMemoryRecommendationDao();
System.err.println(dao);

ui = new UserInterface(io, dao);
System.err.println(ui);

ui.run();

String addDate = java.time.LocalDate.now().toString();
Expand Down
54 changes: 31 additions & 23 deletions src/test/resources/RecommendationLibrary/searchByTags.feature
Original file line number Diff line number Diff line change
@@ -1,49 +1,57 @@
Feature: As a user I can list my recommendations
Feature: As a user I can search a recommendation by tag

Scenario: user can list added book recommendations
Scenario: user can list added book tags
Given command add is selected
When command book is selected
And book recommendation with author "AuthorTest", title "TitleTest", description "DescriptionTest", isbn "isbnTest" and page count "10" is added
And command list is selected
And command edit is selected
And command book is selected
And title "TitleTest" is entered
And field to edit "6" is entered
And tag "eka" is entered
And command search tags is selected
And field to edit "eka" is entered
And command list books is selected
Then app lists a recommendation with author "AuthorTest", title "TitleTest", description "DescriptionTest", isbn "isbnTest", and page count "10"

Scenario: user can list added video recommendations
Given command add is selected
When command video is selected
And video recommendation with title "TitleTest", description "DescriptionTest" and url "urlTest" is added
And command list is selected
And command edit is selected
And command video is selected
And title "TitleTest" is entered
And field to edit "5" is entered
And tag "eka" is entered
And command search tags is selected
And field to edit "eka" is entered
And command list videos is selected
Then app lists a recommendation with title "TitleTest", description "DescriptionTest" and url "urlTest"

Scenario: user can list all recommendations when video is added
Given command add is selected
When command video is selected
And video recommendation with title "TitleTest", description "DescriptionTest" and url "urlTest" is added
And command list is selected
And command list all is selected
Then app lists a recommendation with title "TitleTest", description "DescriptionTest" and url "urlTest"

Scenario: user can list all recommendations
Given command add is selected
When command book is selected
And book recommendation with author "AuthorTest", title "TitleTest", description "DescriptionTest", isbn "isbnTest" and page count "10" is added
And command list is selected
And command list all is selected
Then app lists a recommendation with author "AuthorTest", title "TitleTest", description "DescriptionTest", isbn "isbnTest", and page count "10"


Scenario: user can list added blog recommendations
Given command add is selected
When command blog is selected
And blog recommendation with title "TitleTest", author "AuthorTest", description "DescriptionTest" and url "www.blog.fi" is added
And command list is selected
And command edit is selected
And command blog is selected
And title "TitleTest" is entered
And field to edit "5" is entered
And tag "eka" is entered
And command search tags is selected
And field to edit "eka" is entered
And command list blogs is selected
Then app lists a recommendation with title "TitleTest", author "AuthorTest", description "DescriptionTest" and url "www.blog.fi"

Scenario: user can list added podcast recommendations
Given command add is selected
When command podcast is selected
And podcast recommendation with title "TitleTest", name "TestName", author "AuthorTest" and description "DescriptionTest" is added
And command list is selected
And command edit is selected
And command podcast is selected
And title "TitleTest" is entered
And field to edit "5" is entered
And tag "eka" is entered
And command search tags is selected
And field to edit "eka" is entered
And command list podcasts is selected
Then app lists a podcast recommendation with title "TitleTest", name "TestName", author "AuthorTest" and description "DescriptionTest"

0 comments on commit e6aaa43

Please sign in to comment.