Skip to content

Commit

Permalink
MDL-67263 course: Add behat tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Mihail Geshoski committed Mar 5, 2020
1 parent f152b71 commit ae0e980
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions course/tests/behat/activity_chooser.feature
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,56 @@ Feature: Display and choose from the available activities in course
And I click on "Starred" "link" in the "Add an activity or resource" "dialogue"
And I click on "Star Assignment module" "button" in the "Add an activity or resource" "dialogue"
Then I should not see "Starred" in the "Add an activity or resource" "dialogue"

Scenario: The teacher can search for an activity by it's name
Given I click on "Add an activity or resource" "button" in the "Topic 1" "section"
When I set the field "search" to "Lesson"
Then I should see "1 results found" in the "Add an activity or resource" "dialogue"
And I should see "Lesson" in the "Add an activity or resource" "dialogue"

Scenario: The teacher can search for an activity by it's description
Given I open the activity chooser
When I set the field "search" to "The lesson activity module enables a teacher to deliver content"
Then I should see "1 results found" in the "Add an activity or resource" "dialogue"
And I should see "Lesson" in the "Add an activity or resource" "dialogue"

Scenario: Search results are not returned if the search query does not match any activity name or description
Given I click on "Add an activity or resource" "button" in the "Topic 1" "section"
When I set the field "search" to "Random search query"
Then I should see "0 results found" in the "Add an activity or resource" "dialogue"
And ".option" "css_element" should not exist in the ".searchresultitemscontainer" "css_element"

Scenario: Teacher can return to the default activity chooser state by manually removing the search query
Given I click on "Add an activity or resource" "button" in the "Topic 1" "section"
And I set the field "search" to "Lesson"
And I should see "1 results found" in the "Add an activity or resource" "dialogue"
And I should see "Lesson" in the "Add an activity or resource" "dialogue"
When I set the field "search" to ""
And I should not see "1 results found" in the "Add an activity or resource" "dialogue"
Then ".searchresultscontainer" "css_element" should not exist
And ".optionscontainer" "css_element" should exist

Scenario: Teacher can not see a "clear" button if a search query is not entered in the activity chooser search bar
When I click on "Add an activity or resource" "button" in the "Topic 1" "section"
Then "Clear search input" "button" should not exist

Scenario: Teacher can see a "clear" button after entering a search query in the activity chooser search bar
Given I click on "Add an activity or resource" "button" in the "Topic 1" "section"
When I set the field "search" to "Search query"
Then "Clear search input" "button" should not exist

Scenario: Teacher can not see a "clear" button if the search query is removed in the activity chooser search bar
Given I click on "Add an activity or resource" "button" in the "Topic 1" "section"
And I set the field "search" to "Search query"
And "Clear search input" "button" should exist
When I set the field "search" to ""
Then "Clear search input" "button" should not exist

Scenario: Teacher can instantly remove the search query from the activity search bar by clicking on the "clear" button
Given I click on "Add an activity or resource" "button" in the "Topic 1" "section"
And I set the field "search" to "Search query"
And I should see "results found" in the "Add an activity or resource" "dialogue"
When I click on "Clear search input" "button"
Then I should not see "Search query"
And ".searchresultscontainer" "css_element" should not exist
And ".optionscontainer" "css_element" should exist

0 comments on commit ae0e980

Please sign in to comment.