'Scenario: The staff should be able to edit team successfully.
Given I am staff user for a course with a team
When I visit the Team profile page
Then I should see the Edit Team button
And When I click edit team button
Then I should see the edit team page
And an analytics event should be fired
When I edit all the fields with appropriate data
And I click Update button
Then I should see the page for my team with updated data'

def test_staff_can_edit_team_successfully(self):

    self.verify_team_info(name=self.team['name'], description=self.team['description'], location='Afghanistan', language='Afar')
    self.verify_and_navigate_to_edit_team_page()
    self.fill_create_or_edit_form()
    expected_events = [{'event_type': 'edx.team.changed', 'event': {'team_id': self.team['id'], 'field': 'country', 'old': 'AF', 'new': 'PK', 'truncated': []}}, {'event_type': 'edx.team.changed', 'event': {'team_id': self.team['id'], 'field': 'name', 'old': self.team['name'], 'new': self.TEAMS_NAME, 'truncated': []}}, {'event_type': 'edx.team.changed', 'event': {'team_id': self.team['id'], 'field': 'language', 'old': 'aa', 'new': 'en', 'truncated': []}}, {'event_type': 'edx.team.changed', 'event': {'team_id': self.team['id'], 'field': 'description', 'old': self.team['description'], 'new': self.TEAM_DESCRIPTION, 'truncated': []}}]
    with self.assert_events_match_during(event_filter=self.only_team_events, expected_events=expected_events):
        self.team_management_page.submit_form()
    self.team_page.wait_for_page()
    self.verify_team_info(name=self.TEAMS_NAME, description=self.TEAM_DESCRIPTION, location='Pakistan', language='English')
