"""E2E: Order detail modal structure and inline mapping.""" import pytest from playwright.sync_api import Page, expect def test_order_detail_modal_has_roa_ids(page: Page, app_url: str): """R9: Verify order detail modal contains all ROA ID labels.""" page.goto(f"{app_url}/logs") page.wait_for_load_state("networkidle") modal = page.locator("#orderDetailModal") expect(modal).to_be_attached() modal_html = modal.inner_html() assert "ID Comanda ROA" in modal_html, "Missing 'ID Comanda ROA' label in order detail modal" assert "ID Partener" in modal_html, "Missing 'ID Partener' label in order detail modal" assert "ID Adr. Facturare" in modal_html, "Missing 'ID Adr. Facturare' label in order detail modal" assert "ID Adr. Livrare" in modal_html, "Missing 'ID Adr. Livrare' label in order detail modal" def test_order_detail_items_table_columns(page: Page, app_url: str): """R9: Verify items table has all required columns.""" page.goto(f"{app_url}/logs") page.wait_for_load_state("networkidle") headers = page.locator("#orderDetailModal thead th") texts = headers.all_text_contents() required_columns = ["SKU", "Produs", "Cant.", "Pret", "TVA", "CODMAT", "Status", "Actiune"] for col in required_columns: assert col in texts, f"Column '{col}' missing from order detail items table. Found: {texts}" def test_quick_map_from_order_detail(page: Page, app_url: str): """R9+R11: Verify quick map modal is reachable from order detail context.""" page.goto(f"{app_url}/logs") page.wait_for_load_state("networkidle") modal = page.locator("#quickMapModal") expect(modal).to_be_attached() expect(page.locator("#qmCodmatLines")).to_be_attached() expect(page.locator("#qmPctWarning")).to_be_attached() def test_dashboard_navigates_to_logs(page: Page, app_url: str): """Verify the sidebar on the dashboard contains a link to the logs page.""" page.goto(f"{app_url}/") page.wait_for_load_state("networkidle") logs_link = page.locator("a[href='/logs']") expect(logs_link).to_be_visible()