'Scenario: User should be able to search for a team
Given I am enrolled in a course with teams enabled
When I visit the Teams page for that topic
And I search for \'banana\'
Then I should see the search result page
And the search header should be shown
And 0 results should be shown
And my browser should fire a page viewed event for the search page
And a searched event should have been fired'

def test_search(self):

    search_text = 'banana'
    self.create_teams(self.topic, 5)
    self.browse_teams_page.visit()
    events = [{'event_type': 'edx.team.page_viewed', 'event': {'page_name': 'search-teams', 'topic_id': self.topic['id'], 'team_id': None}}, {'event_type': 'edx.team.searched', 'event': {'search_text': search_text, 'topic_id': self.topic['id'], 'number_of_results': 0}}]
    with self.assert_events_match_during(self.only_team_events, expected_events=events, in_order=False):
        search_results_page = self.browse_teams_page.search(search_text)
    self.verify_search_header(search_results_page, search_text)
    self.assertTrue(search_results_page.get_pagination_header_text().startswith('Showing    0    out    of    0    total'))
