code: def test_expander_collapses_and_expands(app: Page):
      """Test that an expander collapses and expands."""
      main_expanders = app.locator(".main [data-testid='stExpander']")
      expect(main_expanders).to_have_count(5)
  
      expanders = main_expanders.all()
      # Starts expanded
      expander_header = expanders[0].locator(EXPANDER_HEADER_IDENTIFIER)
      expect(expander_header).to_be_visible()
      toggle = expander_header.locator("svg").first
      expect(toggle).to_be_visible()
      expander_header.click()
      toggle = expander_header.locator("svg").first
      expect(toggle).to_be_visible()
  
      # Starts collapsed
      expander_header = expanders[1].locator(EXPANDER_HEADER_IDENTIFIER)
      expect(expander_header).to_be_visible()
      toggle = expander_header.locator("svg").first
      expect(toggle).to_be_visible()
      expander_header.click()
      toggle = expander_header.locator("svg").first
      expect(toggle).to_be_visible()
  
file_path: streamlit/e2e_playwright/st_expander_test.py
imports: from playwright.sync_api import Page, expect
  from e2e_playwright.conftest import ImageCompareFunction, wait_for_app_run
label_desc: Use image node_id 4 for calling a global function with example usage: test_expander_collapses_and_expands(app) without return types