diff --git a/B05_Profile/B05_Profile_UI_RouteEdit_Cross_Card.ts b/B05_Profile/B05_Profile_UI_RouteEdit_Cross_Card.ts index f99e4050e..4e28bcb5d 100644 --- a/B05_Profile/B05_Profile_UI_RouteEdit_Cross_Card.ts +++ b/B05_Profile/B05_Profile_UI_RouteEdit_Cross_Card.ts @@ -156,8 +156,10 @@ export function routeCrossCard( box, ); // 그래프만(393-3) — 카드 머리 · 줌 단추 · 발(암 경계 · 요약) 걷음 · 벽 · 선 · 면적 고름 막음 - // 경고 칩(빈칸 · 기본값 · 사면 열림)만 그래프 오른쪽 위에 겹쳐 남김(505-3) - const chips = card.querySelectorAll(":scope > header .b06-cross-card__warning"); + // 경고 칩(빈칸 · 기본값 · 사면 열림) · 구조물 이름(표시만 종류 · 507-1)만 그래프 오른쪽 위에 겹쳐 남김(505-3) + const chips = card.querySelectorAll( + ":scope > header .b06-cross-card__warning, :scope > header .b06-cross-card__structure", + ); if (chips.length) { const box = document.createElement("div"); box.className = "b05-cross-chips"; diff --git a/common_util/common_util_structure_parts.json b/common_util/common_util_structure_parts.json index aba3e422f..1359dcc8e 100644 --- a/common_util/common_util_structure_parts.json +++ b/common_util/common_util_structure_parts.json @@ -150,6 +150,12 @@ "읽는 칸": ["pave_spec", "height_m", "widening_off"], "자리꼴": ["interval"], "정본": ["structures"] + }, + "mark": { + "이름": "표시만(형상 없음 · 측점 · 이름만)", + "읽는 칸": [], + "자리꼴": ["point", "interval", "site"], + "정본": ["pipe_points", "structures"] } }, "3D": { @@ -223,16 +229,16 @@ }, "cross_drain_exposed": { "목록": "both", - "횡단도": "none", + "횡단도": "anchor", "카드이름": "name", - "형상": "none", + "형상": "mark", "3D": "none" }, "open_ditch": { "목록": "both", - "횡단도": "none", + "횡단도": "anchor", "카드이름": "name", - "형상": "none", + "형상": "mark", "3D": "none" }, "cross_underdrain": { diff --git a/docs/raw/요구_1021/사용자요구_1021.md b/docs/raw/요구_1021/사용자요구_1021.md index 600f75e0b..6581e8648 100644 --- a/docs/raw/요구_1021/사용자요구_1021.md +++ b/docs/raw/요구_1021/사용자요구_1021.md @@ -21,3 +21,12 @@ 4. b05에서 mc는 사용자가 수정해야할 부분임. 이때 mc도 붙이고 글자크기 키우고 볼트체와 색상을 변경. b07~b09에도 남길것. 5. 검증 스크립트는 프로그램 개발에 도움을 주기 위한 스크립트는 너의 재량것 사용. 6. 서브3 백업사본은 삭제 + +## 요구 312 (10-21 · 사용자 · 계산 자리 창) + +1. 계산위치 제어 페이지사 제어안됨? 추가로로직은 45개 아님? +2. (물음 답) 45줄 전체 표시 + +## 요구 313 (10-21 · 사용자 · 311-2 고침) + +1. 노출형 횡단수로와 개거에 대해 잘 못 지시함. 다른 구조물 중 취수정이나 국가지점 번호 처럼 동작해야함. 되돌리면 될것같음. 확인 diff --git a/resources/tester/helper_322_2_check.cjs b/resources/tester/helper_322_2_check.cjs index 5d2b7c70f..d0a4c02eb 100644 --- a/resources/tester/helper_322_2_check.cjs +++ b/resources/tester/helper_322_2_check.cjs @@ -53,8 +53,8 @@ const enabled = (id) => def.types.find((t) => t.type_id === id).enabled; const own = (id) => clone(reflect.reflectOf(def)[id] ?? null); reflect.setReflect(def, "wildlife_path", "목록", "both"); reflect.setReflect(def, "retaining_wall", "목록", "b06"); -reflect.setReflect(def, "open_ditch", "횡단도", "none"); -reflect.setReflect(def, "cross_drain_exposed", "횡단도", "anchor"); +reflect.setReflect(def, "open_ditch", "횡단도", "anchor"); +reflect.setReflect(def, "cross_drain_exposed", "횡단도", "none"); const setBefore = reflect.isSet(def, "cross_drain_exposed", "횡단도"); reflect.setShapeOpt(def, "soil_guard", "weep", true); const weepOn = own("soil_guard"); @@ -95,8 +95,8 @@ const steps = []; reflect.setReflect(work, "masonry_wet", "목록", "both"); steps.push(reflect.differs(work, base)); reflect.setReflect(work, "masonry_wet", "목록", "hidden"); -reflect.setReflect(work, "open_ditch", "횡단도", "anchor"); reflect.setReflect(work, "open_ditch", "횡단도", "none"); +reflect.setReflect(work, "open_ditch", "횡단도", "anchor"); reflect.setShapeOpt(work, "soil_guard", "form", "콘크리트"); reflect.setShapeOpt(work, "soil_guard", "form", "통나무·목재틀"); reflect.setShown(work, "pipe", ["wing_wall_type"], false); diff --git a/resources/tester/test_272_1_station_list.py b/resources/tester/test_272_1_station_list.py index 845e8b0df..686445bb1 100644 --- a/resources/tester/test_272_1_station_list.py +++ b/resources/tester/test_272_1_station_list.py @@ -41,7 +41,7 @@ PIPES = [ }, ] STRUCTURES = [ - # 노출형 = 구조물 표 횡단도 none(322-1 ★1) — 측점 안 심음 + # 노출형 = 구조물 표 횡단도 anchor · 형상 표시만(507-1 · 요구 311-2) — 측점 심음 {"type_id": "cross_drain_exposed", "placement": "point", "chainage_m": 120.0}, { "type_id": "retaining_wall", @@ -67,7 +67,7 @@ STRUCTURES = [ }, {"type_id": "evac_road", "placement": "point", "chainage_m": 720.0}, ] -EXPECTED = [95, 160, 230, 300, 395, 400, 410, 500, 510, 530, 545, 560] +EXPECTED = [95, 120, 160, 230, 300, 395, 400, 410, 500, 510, 530, 545, 560] # 368-2 추가 측점 — 47 만 듦(95 관 · 300 세월교 자리는 그쪽이 이김) PLUS = [47.0, 95.0, 300.0] diff --git a/resources/tester/test_322_1_catalog_mirror.py b/resources/tester/test_322_1_catalog_mirror.py index 906428a7b..acccaf659 100644 --- a/resources/tester/test_322_1_catalog_mirror.py +++ b/resources/tester/test_322_1_catalog_mirror.py @@ -38,8 +38,8 @@ TABLE = { "box_culvert": ("both", "anchor", "name", "box", "box"), "ford_pavement": ("both", "anchor", "name", "ford_pavement", "chute"), "ford_bridge": ("both", "anchor", "name", "ford", "ford"), - "cross_drain_exposed": ("both", "none", "name", "none", "none"), - "open_ditch": ("both", "none", "name", "none", "none"), + "cross_drain_exposed": ("both", "anchor", "name", "mark", "none"), # 표시만(요구 311-2 · 507-1) + "open_ditch": ("both", "anchor", "name", "mark", "none"), # 표시만(요구 311-2 · 507-1) "cross_underdrain": ("both", "anchor", "name", "underdrain", "surface"), **{ t: ("hidden", "none", "name", "none", "none") diff --git a/resources/tester/test_322_2_check_mirror.py b/resources/tester/test_322_2_check_mirror.py index 518b48d31..45e1d7f02 100644 --- a/resources/tester/test_322_2_check_mirror.py +++ b/resources/tester/test_322_2_check_mirror.py @@ -63,7 +63,7 @@ def _cases() -> dict[str, tuple[dict, dict | None]]: bad["부품"] = {"형상.zz": False, "횡단도.span3": "no", "끔": False} cases["shape_bad"] = (bad, real) rule = copy.deepcopy(real) - rule["반영"] = {"open_ditch": {"횡단도": "anchor"}} + rule["반영"] = {"mirror": {"횡단도": "anchor"}} # 형상 없음(개거 = 표시만 · 507-1) cases["rule218"] = (rule, real) mismatch = copy.deepcopy(real) mismatch["반영"] = {"retaining_wall": {"형상": "pipe_set"}, "berm": {"횡단도": "anchor"}} @@ -126,7 +126,7 @@ def test_check_rules(ts: dict) -> None: "부품 「횡단도.span3」 — 참거짓", "부품 「끔」 — 없는 부품", ] - assert got["rule218"] == ["「개거(겉도랑)」 형상이 「없음」이면 횡단도도 「안 만듦」"] + assert got["rule218"] == ["「반사경」 형상이 「없음」이면 횡단도도 「안 만듦」"] assert got["mismatch"] == ["「옹벽」 형상 「배관 세트」 — 구간 · 구조물에 안 맞음"] assert got["hide_read"] == [ "「배관」 형상 「배관 세트」 이 쓰는 칸 「흙막이 기초」 — 숨길 수 없음" @@ -158,8 +158,8 @@ def test_reflect_edits(ts: dict) -> None: r = ts["reflect"] assert r["wildlife"] == [None, True] # b06 → both = enabled 참이 곧 처음 값 짝(반영 안 남음) assert r["wall"] == [None, False] # both → b06 = enabled 거짓 - assert r["openDitch"] is None # 처음 값(none)과 같음 — 반영 안 남음 - assert r["exposed"] == [{"횡단도": "anchor"}, True] + assert r["openDitch"] is None # 처음 값(anchor · 표시만 507-1)과 같음 — 반영 안 남음 + assert r["exposed"] == [{"횡단도": "none"}, True] assert r["weepOn"] == {"형상칸": {"weep": True}} and r["weepOff"] is None assert r["shown"] == {"pipe_kind": False, "inlet_type": False} # 정의 옵션만 assert r["readPipe"] == ["inlet_basin_height_m", "revet_foundation"] # 기본값 없는 읽는 칸 @@ -233,7 +233,7 @@ def test_server_save_reflect_parts_color_enabled(copy_def: Path) -> None: @pytest.mark.parametrize( "change", [ - lambda d: d.update(반영={"open_ditch": {"횡단도": "anchor"}}), # 218 + lambda d: d.update(반영={"mirror": {"횡단도": "anchor"}}), # 218 lambda d: d["표시"].setdefault("pipe", {}).update(revet_foundation=False), # 못 숨김 칸 lambda d: next(o for o in _type(d, "pipe")["options"] if o["key"] == "pipe_kind")[ "choices" diff --git a/resources/tester/test_322_3_plan_mirror.py b/resources/tester/test_322_3_plan_mirror.py index 6854ae3ea..09cd2abbb 100644 --- a/resources/tester/test_322_3_plan_mirror.py +++ b/resources/tester/test_322_3_plan_mirror.py @@ -147,6 +147,7 @@ def test_plan_rules(ts: dict) -> None: mixed = ts["mixed"] assert [round(s["chainage_m"], 3) for s in mixed] == [ 95.0, + 120.0, # 노출형 횡단수로 = 표시만 측점(507-1) 160.0, 230.0, 395.0, @@ -164,7 +165,8 @@ def test_plan_rules(ts: dict) -> None: assert first["blank"] == ["pipe_diameter_mm", "culvert_height_m"] joint = next(s for s in mixed if s["chainage_m"] == 530.0) # 옹벽 끝 = 소단 시작 assert joint["owners"] == ["s2", "s3"] and joint["title"] == "옹벽" and joint["role"] == "end" - assert all(s["title"] != "노출형 횡단수로" for s in mixed) # ★1 횡단도 none + exposed = next(s for s in mixed if s["chainage_m"] == 120.0) # 표시만 = 이름 · 빈칸 없음(507-1) + assert exposed["title"] == "노출형 횡단수로" and exposed["blank"] == [] kinds = ts["pipe_kinds"] assert [s["title"] for s in kinds] == ["흄관 D800", "파형강관 D1000", "세월교"] assert kinds[1]["blank"] == ["pipe_diameter_mm"] and kinds[0]["blank"] == [] diff --git a/resources/tester/test_505_3_cross_card_screen.py b/resources/tester/test_505_3_cross_card_screen.py index 61dd405b5..872ef6687 100644 --- a/resources/tester/test_505_3_cross_card_screen.py +++ b/resources/tester/test_505_3_cross_card_screen.py @@ -175,7 +175,7 @@ def test_0_곡선_판_도구줄_횡단판_비킴(page): def test_1_빈칸_칩_카드(page): modal = _open_modal(page) assert modal["station"] == "19+8" and modal["card"] - assert modal["chips"] == ["⚠ 배관 관경 빈칸"] + assert modal["chips"] == ["⚠ 배관 관경 빈칸", "배수관"] # 이름 칩(507-1) assert modal["pipes"] == 0 and modal["width"] == 380 assert all("ui-btn ui-btn--ghost ui-btn--sm" in name for name in modal["buttons"]) page.locator(".b05-crossmodal").get_by_text("닫기").click() @@ -198,7 +198,7 @@ def test_2_횡단_판_칩_관경_넣으면_형상_확대_밝음_어두움(page): ).first.select_option("800") # 세션 초안만 — [저장] 안 누름 page.wait_for_timeout(5000) modal = _open_modal(page) - assert modal["chips"] == [] and modal["pipes"] > 0 + assert modal["chips"] == ["배수관"] and modal["pipes"] > 0 shot = page.locator(".b05-crossmodal") shot.screenshot(path=str(SHOTS / "modal_light.png")) page.evaluate("document.documentElement.setAttribute('data-theme', 'dark')") diff --git a/resources/tester/test_505_3_cross_card_text.py b/resources/tester/test_505_3_cross_card_text.py index 05ecc02e1..25e350e53 100644 --- a/resources/tester/test_505_3_cross_card_text.py +++ b/resources/tester/test_505_3_cross_card_text.py @@ -47,7 +47,7 @@ def test_판_재료_한_벌() -> None: def test_빈칸_칩은_머리_걷기_전에_꺼냄() -> None: card = _read("B05_Profile", "B05_Profile_UI_RouteEdit_Cross_Card.ts") - chips = card.index('":scope > header .b06-cross-card__warning"') + chips = card.index('":scope > header .b06-cross-card__warning') # 이름 칩도 같이(507-1) remove = card.index(':scope > header, :scope > footer, .b06-cross-card__zoom"') assert chips < remove assert 'box.className = "b05-cross-chips";' in card diff --git a/resources/tester/test_507_1_exposed_mark.py b/resources/tester/test_507_1_exposed_mark.py new file mode 100644 index 000000000..797c0a7b1 --- /dev/null +++ b/resources/tester/test_507_1_exposed_mark.py @@ -0,0 +1,74 @@ +"""PLAN 507-1 노출형 횡단수로 · 개거 = 횡단면 표시만(요구 311-2). + +- 부품 상자 형상 `mark`(표시만) — 읽는 칸 · 필수 칸 없음 → 빈칸 경고 없음 · 그리는 함수 없음. +- 처음값 = 횡단도 anchor(측점 세움) · 카드이름 name · 형상 mark · 3D none. +- 측점 계획 = 그 자리에 측점 하나 · 이름 = 종류 이름. +- 실제 정의(사용자 마스터 · 반영 없음) = M02 검사 오류 없음(218 규칙 = 형상 none 만 막음). +- B05 「횡단」 판 · 임시 횡단 창 = 카드 머리를 걷기 전에 구조물 이름 칩을 꺼내 남김. +""" + +from __future__ import annotations + +from pathlib import Path + +from B05_Profile.B05_Profile_Structures_Schema import StructureInstance, load_definition +from common_util.common_util_structure_catalog import ( + catalog, + load_parts, + resolve_catalog, + shape_needs, +) +from common_util.common_util_structure_station import plan_stations +from M02_MasterTemplete.StructOptions.M02_SO_Check import catalog_errors + +ROOT = Path(__file__).resolve().parents[2] +KINDS = {"cross_drain_exposed": "노출형 횡단수로", "open_ditch": "개거(겉도랑)"} + + +def test_mark_part_has_no_fields() -> None: + mark = load_parts()["parts"]["형상"]["mark"] + assert mark["읽는 칸"] == [] and "필수 칸" not in mark + assert "point" in mark["자리꼴"] and "structures" in mark["정본"] + + +def test_start_values_are_mark_only() -> None: + rows = resolve_catalog(load_definition()) + for type_id in KINDS: + row = rows[type_id] + got = (row["station"], row["title"], row["shape"], row["model3d"]) + assert got == ("anchor", "name", "mark", "none"), type_id + assert shape_needs(type_id) == [] + + +def test_station_planted_with_name() -> None: + structures = [ + StructureInstance.model_validate( + { + "structure_id": f"s{i}", + "type_id": type_id, + "placement": "point", + "chainage_m": at, + "options": {}, + } + ) + for i, (type_id, at) in enumerate((("cross_drain_exposed", 120.0), ("open_ditch", 240.0))) + ] + plan = plan_stations([], structures) + assert [(round(s["chainage_m"], 3), s["title"], s["blank"]) for s in plan] == [ + (120.0, KINDS["cross_drain_exposed"], []), + (240.0, KINDS["open_ditch"], []), + ] + + +def test_real_definition_passes_m02_check() -> None: + assert load_definition().get("반영") == {} # 사용자 마스터 값은 안 고침 + assert catalog_errors(load_definition(), None) == [] + assert all(catalog()[t]["shape"] == "mark" for t in KINDS) + + +def test_b05_card_keeps_structure_name_chip() -> None: + card = (ROOT / "B05_Profile" / "B05_Profile_UI_RouteEdit_Cross_Card.ts").read_text( + encoding="utf-8" + ) + keep = card.index(":scope > header .b06-cross-card__structure") + assert keep < card.index(':scope > header, :scope > footer, .b06-cross-card__zoom"') diff --git a/resources/tester/test_507_1_exposed_mark_screen.py b/resources/tester/test_507_1_exposed_mark_screen.py new file mode 100644 index 000000000..5a22d3a3a --- /dev/null +++ b/resources/tester/test_507_1_exposed_mark_screen.py @@ -0,0 +1,189 @@ +"""PLAN 507-1 화면 — 자기 포트(5179) Playwright 머리 없는 브라우저 · 서버가 떠 있을 때만 · 검증_sub4. + +- B05 「구조물 배치」 노출형 횡단수로 7+7(147 m) 추가(세션만 · [저장] 안 함) → 측점 목록에 섬 +- 「횡단」 판 · 임시 횡단 창 = B06 카드 + 이름 칩 「노출형 횡단수로」 · 구조물 형상 0 +- B06 횡단 카드 머리 = 이름 · 형상 0 → 지움(세션) · 측점 목록에서 빠짐 +- 계정 화면 취향만 시험 앞 값으로 되돌림 · DB · storage 안 씀 + + ./venv/Scripts/python.exe -m pytest resources/tester/test_507_1_exposed_mark_screen.py -q +""" + +from __future__ import annotations + +import json +import urllib.request +from pathlib import Path + +import pytest + +ROOT = Path(__file__).resolve().parents[2] +BASE = "http://localhost:5179" +PROJECT = "c725d747-50ae-46b0-87ce-4d4e56a53cf3" # 검증_sub4(OWNERS.md) +SHOTS = ROOT / "tmp" / "shots_507_1" +AT_M = 147 # 7+7 — 격자 · 관(19+8) 측점과 안 겹침 +NAME = "노출형 횡단수로" +PREFS = "/api/dashboard/me/ui-prefs" +TOUCHED = ("profile-collapsed", "profile-height", "b05-routeedit-cross-v2") +#: 구조물 형상 그림(관 · 박스 · 세월교 · 벽 · 맹암거) — 표시만이면 0 +SHAPES = ( + ".b06-chart__culvert-pipe, [class*='b06-chart__box'], [class*='b06-chart__ford']," + " [class*='b06-chart__wall'], [class*='underdrain']" +) + + +def _up() -> bool: + try: + urllib.request.urlopen(BASE, timeout=3) + return True + except Exception: + return False + + +pytestmark = pytest.mark.skipif(not _up(), reason="5179 서버 없음") + +JS_ADD = r"""async ([no, dist]) => { + const w = (ms) => new Promise((r) => setTimeout(r, ms)); + const sec = document.querySelector('.b05-structure-section'); + const fire = (el, v) => { el.value = v; el.dispatchEvent(new Event('change', { bubbles: true })); }; + const [group, type] = sec.querySelectorAll('.b05-structure__grid select'); + fire(group, 'A'); await w(300); + fire(type, 'cross_drain_exposed'); await w(500); + const [a, b] = sec.querySelectorAll('.b05-structure__position-row > label')[2].querySelectorAll('input'); + fire(a, String(no)); fire(b, String(dist)); await w(200); + sec.querySelector('.is-primary').click(); await w(1500); +}""" +JS_ITEMS = ( + "() => [...document.querySelectorAll('.b05-route__irregular-list li')]" + ".map((l) => l.textContent.trim())" +) +JS_SCROLL = r"""(m) => { + const marker = [...document.querySelectorAll('.b06-chart__station')] + .find((e) => Math.abs(+e.getAttribute('data-chainage') - m) < 1e-6); + const body = marker.closest('.b05-route-profile__body'); + body.scrollLeft = Math.max(0, +marker.querySelector('line').getAttribute('x1') - body.clientWidth / 2); +}""" +JS_POINT = r"""(m) => { + const marker = [...document.querySelectorAll('.b06-chart__station')] + .find((e) => Math.abs(+e.getAttribute('data-chainage') - m) < 1e-6); + const r = marker.querySelector('.b06-chart__station-line').getBoundingClientRect(); + return { x: r.left + r.width / 2, y: r.top + r.height * 0.3 }; +}""" +JS_CARD = r"""(scope) => { + const root = document.querySelector(scope); + const card = root?.querySelector('.b06-cross-card'); + return { + card: !!card, + chips: [...(root?.querySelectorAll('.b05-cross-chips > *') ?? [])].map((e) => e.textContent), + shapes: card ? card.querySelectorAll(SHAPES).length : -1, + }; +}""".replace("SHAPES", json.dumps(SHAPES)) +JS_B06 = r"""(c) => ({ + head: c.querySelector(':scope > header .b06-cross-card__structure')?.textContent ?? null, + label: c.querySelector('.b06-cross-card__title strong')?.textContent ?? null, + shapes: c.querySelectorAll(SHAPES).length, +})""".replace("SHAPES", json.dumps(SHAPES)) + + +@pytest.fixture(scope="module") +def page(): + sync = pytest.importorskip("playwright.sync_api") + cred = json.loads((ROOT / "tmp" / "aislo_cred.json").read_text(encoding="utf-8")) + with sync.sync_playwright() as play: + chrome = play.chromium.launch(channel="msedge", headless=True) + ctx = chrome.new_context(viewport={"width": 1600, "height": 1000}) + login = {k: cred[k] for k in ("email", "password")} + assert ctx.request.post(f"{BASE}/api/auth/login/request", data=login, timeout=60000).ok + prefs = ctx.request.get(f"{BASE}{PREFS}").json().get("prefs", {}) + tab = ctx.new_page() + tab.add_init_script(f"localStorage.setItem('frd_current_project_id', '{PROJECT}')") + tab.goto(f"{BASE}/#/b05-profile", wait_until="domcontentloaded") + tab.wait_for_function("() => !!window.__aisloPipeline", timeout=90000) + tab.wait_for_timeout(8000) + SHOTS.mkdir(parents=True, exist_ok=True) + try: + yield tab + finally: + tab.wait_for_timeout(2000) + now = ctx.request.get(f"{BASE}{PREFS}").json().get("prefs", {}) + for key in (f"aislo:pref:{name}" for name in TOUCHED): + if key in prefs: + now[key] = prefs[key] + else: + now.pop(key, None) + assert ctx.request.put(f"{BASE}{PREFS}", data={"prefs": now}).ok + chrome.close() + + +def _profile(page, open_: bool) -> None: + height = page.evaluate( + "() => document.querySelector('.b05-route-profile')?.getBoundingClientRect().height ?? 0" + ) + if (height > 100) != open_: + page.get_by_text("종단", exact=True).last.click() + page.wait_for_timeout(3000) + + +def test_1_추가_측점_섬(page): + before = page.evaluate(JS_ITEMS) + assert not any(NAME in t for t in before) + page.evaluate(JS_ADD, [AT_M // 20, AT_M % 20]) + page.wait_for_timeout(4000) + items = page.evaluate(JS_ITEMS) + assert f"7+7{NAME}" in items, items + assert len(items) == len(before) + 1 + + +def test_2_횡단_판_이름_칩_형상_0(page): + _profile(page, False) + page.locator(".b05-route__irregular-item", has_text=NAME).first.click() + page.wait_for_timeout(4000) + got = page.evaluate(JS_CARD, ".b05-routeedit__cross") + page.locator(".b05-routeedit__cross").first.screenshot(path=str(SHOTS / "panel.png")) + assert got["card"] and NAME in got["chips"] and got["shapes"] == 0, got + + +def test_3_임시_횡단_이름_칩_형상_0(page): + _profile(page, True) + page.evaluate(JS_SCROLL, AT_M) + page.wait_for_timeout(800) + at = page.evaluate(JS_POINT, AT_M) + page.mouse.move(at["x"], at["y"]) + page.wait_for_timeout(300) + page.mouse.click(at["x"], at["y"]) + page.wait_for_function( + "() => document.querySelector('.b05-crossmodal .b06-cross-card')", timeout=30000 + ) + page.wait_for_timeout(1500) + station = page.evaluate("() => document.querySelector('.b05-crossmodal__station').textContent") + got = page.evaluate(JS_CARD, ".b05-crossmodal") + page.locator(".b05-crossmodal").screenshot(path=str(SHOTS / "modal.png")) + page.locator(".b05-crossmodal").get_by_text("닫기").click() + assert station == "7+7" and NAME in got["chips"] and got["shapes"] == 0, (station, got) + + +def test_4_B06_카드_머리_이름_형상_0_지움(page): + page.evaluate("() => { location.hash = '#/b06-section'; }") + page.wait_for_timeout(9000) + page.locator(".b05-route__irregular-item:visible", has_text=NAME).first.click() + page.wait_for_timeout(3000) + card = page.locator(".b06-cross-card:visible", has_text=NAME).first + card.scroll_into_view_if_needed() + page.wait_for_timeout(1500) + got = card.evaluate(JS_B06) + card.screenshot(path=str(SHOTS / "b06_card.png")) + assert got == {"head": NAME, "label": "7+7", "shapes": 0}, got + # 되돌림 — 고른 채로 세션에서 지움([저장] 안 함) + section = page.locator(".b05-structure-section:visible").first + if not section.locator("button.is-danger", has_text="삭제").first.is_visible(): + page.get_by_text("구조물 배치", exact=True).first.click() # B06 = 칸이 접혀 있음 + page.wait_for_timeout(1500) + # 「구조물 전체 삭제」 와 헷갈리지 않게 글이 꼭 「삭제」 인 것만 + remove = section.get_by_role("button", name="삭제", exact=True) + if remove.is_disabled(): # 칸을 펴면 고름이 풀림 — 다시 고름 + page.locator(".b05-route__irregular-item:visible", has_text=NAME).first.click() + page.wait_for_timeout(1500) + remove.click() + page.wait_for_timeout(3000) + left = page.evaluate(JS_ITEMS) + page.screenshot(path=str(SHOTS / "b06_after_delete.png")) + assert not any(NAME in t for t in left), left