Files
gomag-vending/api/tests/e2e/test_missing_skus.py
Claude Agent 419464a62c feat: add CI/CD testing infrastructure with test.sh orchestrator
Complete testing system: pyproject.toml (pytest markers), test.sh
orchestrator with auto app start/stop and colorful summary,
pre-push hook, Gitea Actions workflow.

New QA tests: API health (7 endpoints), responsive (3 viewports),
log monitoring (ERROR/ORA-/Traceback detection), real GoMag sync,
PL/SQL package validation, smoke prod (read-only).

Converted test_app_basic.py and test_integration.py to pytest.
Added pytestmark to all existing tests (unit/e2e/oracle).
E2E conftest upgraded: console error collector, screenshot on
failure, auto-detect live app on :5003.

Usage: ./test.sh ci (30s) | ./test.sh full (2-3min)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-24 10:40:25 +00:00

71 lines
2.6 KiB
Python

"""E2E: Missing SKUs page with resolved toggle and multi-CODMAT modal."""
import pytest
from playwright.sync_api import Page, expect
pytestmark = pytest.mark.e2e
@pytest.fixture(autouse=True)
def navigate_to_missing(page: Page, app_url: str):
page.goto(f"{app_url}/missing-skus")
page.wait_for_load_state("networkidle")
def test_missing_skus_page_loads(page: Page):
"""Verify the page renders with the correct heading."""
expect(page.locator("h4")).to_contain_text("SKU-uri Lipsa")
def test_resolved_toggle_buttons(page: Page):
"""R10: Verify resolved filter buttons exist and Nerezolvate is active by default."""
expect(page.locator("#btnUnresolved")).to_be_visible()
expect(page.locator("#btnResolved")).to_be_visible()
expect(page.locator("#btnAll")).to_be_visible()
classes = page.locator("#btnUnresolved").get_attribute("class")
assert "btn-primary" in classes, f"Expected #btnUnresolved to be active (btn-primary), got classes: {classes}"
def test_resolved_toggle_switches(page: Page):
"""R10: Clicking resolved/all toggles changes active state correctly."""
# Click "Rezolvate"
page.locator("#btnResolved").click()
page.wait_for_timeout(500)
classes_res = page.locator("#btnResolved").get_attribute("class")
assert "btn-success" in classes_res, f"Expected #btnResolved to be active (btn-success), got: {classes_res}"
classes_unr = page.locator("#btnUnresolved").get_attribute("class")
assert "btn-outline" in classes_unr, f"Expected #btnUnresolved to be outline after deactivation, got: {classes_unr}"
# Click "Toate"
page.locator("#btnAll").click()
page.wait_for_timeout(500)
classes_all = page.locator("#btnAll").get_attribute("class")
assert "btn-secondary" in classes_all, f"Expected #btnAll to be active (btn-secondary), got: {classes_all}"
def test_map_modal_multi_codmat(page: Page):
"""R11: Verify the mapping modal supports multiple CODMATs."""
modal = page.locator("#mapModal")
expect(modal).to_be_attached()
add_btn = page.locator("#mapModal button", has_text="Adauga CODMAT")
expect(add_btn).to_be_attached()
expect(page.locator("#mapProductName")).to_be_attached()
expect(page.locator("#mapPctWarning")).to_be_attached()
def test_export_csv_button(page: Page):
"""Verify Export CSV button is visible on the page."""
btn = page.locator("button", has_text="Export CSV")
expect(btn).to_be_visible()
def test_rescan_button(page: Page):
"""Verify Re-Scan button is visible on the page."""
btn = page.locator("button", has_text="Re-Scan")
expect(btn).to_be_visible()