'Scenario: Collapsing all sections when 1 or more sections are already collapsed
Given I navigate to the outline page of a course with sections
And all sections are expanded
When I collapse the first section
And I click the "Collapse All Sections" link
Then I see the "Expand All Sections" link
And all sections are collapsed'

def test_collapse_all_when_some_expanded(self):

    self.course_outline_page.visit()
    self.verify_all_sections(collapsed=False)
    self.course_outline_page.section_at(0).expand_subsection()
    self.course_outline_page.toggle_expand_collapse()
    self.assertEquals(self.course_outline_page.expand_collapse_link_state, ExpandCollapseLinkState.EXPAND)
    self.verify_all_sections(collapsed=True)
