"""Smoke tests: dashboard loads and renders basic structure."""

from __future__ import annotations

from typing import TYPE_CHECKING

import pytest
from playwright.sync_api import expect

if TYPE_CHECKING:
    from playwright.sync_api import Page

pytestmark = pytest.mark.e2e


class TestDashboardLoads:
    """Dashboard renders its core layout on first load."""

    def test_page_title(self, dashboard: Page) -> None:
        """Page title is 'Blackbox'."""
        assert "Blackbox" == dashboard.title()

    def test_brand_visible(self, dashboard: Page) -> None:
        """Sidebar brand text is visible."""
        expect(dashboard.locator("#sidebar .sidebar-full span.text-accent-400")).to_have_text("blackbox")

    def test_empty_state_without_selection(self, page: Page, base_url: str) -> None:
        """Empty state shown when no session is selected."""
        page.goto(base_url)
        expect(page.get_by_text("Select a session to review")).to_be_visible()

    def test_session_list_loads_via_htmx(self, dashboard: Page) -> None:
        """Session list container is populated by the HTMX load trigger."""
        items = dashboard.locator("#session-list-container > div")
        assert items.count() >= 2
