Stage isolated engine price catalog for inline zone choices
This commit is contained in:
@@ -144,11 +144,13 @@ def test_plain_answer_zone_changes_inside_its_bubble(browser, site):
|
||||
}
|
||||
return oldFetch(url,opts);
|
||||
};
|
||||
const answer = addMsg('ai','Норма ГЭСНм 10-08-002-02, объём работ = 100 шт.\\nВыберите ценовую зону:\\n1. Хабаровский край (1 зона)\\n2. Хабаровский край (2 зона)');
|
||||
const answer = addMsg('ai','Норма ГЭСНм 10-08-002-02, объём работ = 100 шт.\\nУровень цен: III квартал 2025.\\nВыберите ценовую зону:\\n1. Хабаровский край (1 зона)\\n2. Хабаровский край (2 зона)');
|
||||
answer._messageId = 30;
|
||||
bindFreeformBasis(answer);
|
||||
}""")
|
||||
page.locator(".inline-basis-trigger").first.click()
|
||||
assert page.locator('select[aria-label="Квартал цен"]').input_value() == ""
|
||||
assert "не загружен" in page.locator('.inline-basis-picker').inner_text()
|
||||
screenshot_dir = os.environ.get("INLINE_FREEFORM_SCREENSHOTS")
|
||||
if screenshot_dir:
|
||||
page.screenshot(path=str(Path(screenshot_dir) / "inline-freeform-picker.png"))
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
"""An isolated dev price snapshot must contain every catalogued form."""
|
||||
import json
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
def _catalog(root, name="264/118/428.json"):
|
||||
root.mkdir(parents=True, exist_ok=True)
|
||||
(root / "catalog.json").write_text(json.dumps({"zones": [{
|
||||
"subject_id": 264, "zone_id": 118, "period_id": 428,
|
||||
"zone_name": "Хабаровский край (1 зона)",
|
||||
"period_label": "4 квартал 2026", "file": name}]}), encoding="utf-8")
|
||||
|
||||
|
||||
def test_snapshot_validation_accepts_complete_catalog(tmp_path):
|
||||
from scripts.shadow.verify_engine_prices import validate
|
||||
_catalog(tmp_path)
|
||||
form = tmp_path / "264" / "118" / "428.json"
|
||||
form.parent.mkdir(parents=True)
|
||||
form.write_text("{}", encoding="utf-8")
|
||||
assert validate(tmp_path) == 1
|
||||
|
||||
|
||||
def test_snapshot_validation_rejects_missing_or_escaping_form(tmp_path):
|
||||
from scripts.shadow.verify_engine_prices import validate
|
||||
_catalog(tmp_path)
|
||||
with pytest.raises(ValueError, match="не найдена"):
|
||||
validate(tmp_path)
|
||||
_catalog(tmp_path, "../outside.json")
|
||||
with pytest.raises(ValueError, match="вне"):
|
||||
validate(tmp_path)
|
||||
|
||||
|
||||
def test_snapshot_validation_rejects_symlink_outside_snapshot(tmp_path):
|
||||
from scripts.shadow.verify_engine_prices import validate
|
||||
root = tmp_path / "snapshot"
|
||||
_catalog(root, "264/118/428.json")
|
||||
outside = tmp_path / "outside.json"
|
||||
outside.write_text("{}", encoding="utf-8")
|
||||
link = root / "264" / "118" / "428.json"
|
||||
link.parent.mkdir(parents=True)
|
||||
link.symlink_to(outside)
|
||||
with pytest.raises(ValueError, match="вне"):
|
||||
validate(root)
|
||||
Reference in New Issue
Block a user