defmodule StageProgressionRealtimeUpdateTest do
  use RemoteRetro.IntegrationCase, async: false

  import ShorterMaps

  test "realtime stage progression for connected users", ~M{retro, session: facilitator_session, non_facilitator} do
    participant_session = new_authenticated_browser_session(non_facilitator)
    retro_path = "/retros/" <> retro.id
    facilitator_session = visit(facilitator_session, retro_path)
    participant_session = visit(participant_session, retro_path)

    submit_idea(facilitator_session, %{category: "happy", body: "it works"})

    assert_has(facilitator_session, Query.css(".ui.header", text: "Stage Change: Voting!", count: 0))

    click_and_confirm(facilitator_session, "Proceed to Voting")

    assert_has(facilitator_session, Query.css(".ui.header", text: "Stage Change: Voting!", count: 1))
    assert_has(participant_session, Query.css(".ui.header", text: "Stage Change: Voting!", count: 1))
  end
end

defmodule StageProgressionRealtimeUpdateTest do
  use RemoteRetro.IntegrationCase, async: false

  import ShorterMaps

  @tag [
    retro_stage: "prime-directive",
  ]
  test "realtime stage progression for connected users", ~M{retro, session: facilitator_session, non_facilitator} do
    participant_session = new_authenticated_browser_session(non_facilitator)
    retro_path = "/retros/" <> retro.id
    facilitator_session = visit(facilitator_session, retro_path)
    participant_session = visit(participant_session, retro_path)

    click_and_confirm(facilitator_session, "Proceed to Idea Generation")

    assert_has(facilitator_session, Query.css(".ui.header", text: "Stage Change: Idea Generation!", count: 1))
    assert_has(participant_session, Query.css(".ui.header", text: "Stage Change: Idea Generation!", count: 1))
  end
end

Build performance: shift RealTimeStageProgressionTest to proceed from prime directive to idea generation
Build performance: shift RealTimeStageProgressionTest to proceed from prime directive to idea generation

  - this saves several user iteractions in the test that we don't actually need to go through, as previously the retro started in the idea generation stage, and the automated user had to have an idea submitted before they proceeded to voting. no such requirement is necessary when proceeding from prime directive to idea generation

stride-nyc/remote_retro,stride-nyc/remote_retro,stride-nyc/remote_retro