From de5a8a3d0a4f0c5345dd896d48b0b12a53b7d3bb Mon Sep 17 00:00:00 2001 From: king Date: Mon, 26 Oct 2026 14:17:25 +0900 Subject: [PATCH] =?UTF-8?q?fix(performance):=20=EC=9D=BC=EC=9E=90=EB=B3=84?= =?UTF-8?q?=20=ED=91=9C=20=EC=A0=9C=EB=AA=A9=C2=B7=EA=B8=B0=EA=B0=84=20?= =?UTF-8?q?=ED=95=A9=EA=B3=84=20=ED=96=89=20=E2=80=94=20=ED=8E=98=EC=9D=B4?= =?UTF-8?q?=EC=A7=80=20=EC=8A=A4=ED=81=AC=EB=A1=A4=EC=97=90=20=EA=B3=A0?= =?UTF-8?q?=EC=A0=95(=EB=A7=A4=EC=B6=9C=C2=B7=EA=B4=91=EA=B3=A0=EB=B9=84),?= =?UTF-8?q?=20=EC=8A=A4=ED=81=AC=EB=A1=A4=20=EB=A7=89=EB=8C=80=20=EB=B0=B0?= =?UTF-8?q?=EA=B2=BD=20=ED=88=AC=EB=AA=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 10-26 판은 표 상자 안 세로 스크롤이라 진짜 ERP 셸에서 상자 아래가 화면 밖에 잘리고 휠이 페이지로 안 넘어갔다 - 표 상자 세로 스크롤 없앰 → stickyHead 가 .erp-page 스크롤마다 제목 행·기간 합계 행 칸을 translateY 로 내림(표 끝에서 멈춤), 내려온 동안 제목 칸이 아래 1px 선을 직접 그림(border-collapse 선 틈으로 뒤 줄이 비침 방지) - 스크롤 막대 트랙 투명(scrollbar-color, 표 상자·실적 화면) - perf_sticky.browser.test.js 를 진짜 erp_base.html 셸 렌더(perf_*_shell.html)로 — 휠 스크롤·가로 고정·표 끝 멈춤 Co-Authored-By: Claude Opus 5.5 --- app/modules/performance/CLAUDE.md | 10 +- .../templates/performance/ads.html | 4 +- .../templates/performance/index.html | 4 +- .../templates/performance/settings.html | 4 +- app/static/performance.css | 17 +-- app/static/performance.js | 42 ++++++-- tests/js/perf_sticky.browser.test.js | 101 ++++++++++-------- tests/js/render_performance.py | 15 ++- 8 files changed, 129 insertions(+), 68 deletions(-) diff --git a/app/modules/performance/CLAUDE.md b/app/modules/performance/CLAUDE.md index 8713c5e..2f9f4c7 100644 --- a/app/modules/performance/CLAUDE.md +++ b/app/modules/performance/CLAUDE.md @@ -46,9 +46,13 @@ - 일자별 표 **기간 합계 행은 맨 위**(제목 행 바로 아래, 2026-10-21 `calc.main_table`) — 매출·광고비 공통, 연간 보기 "연간 합계"는 그대로 맨 아래. - **기간 빠른 선택 = 이번달·올해·직접선택**(2026-10-26 — 오늘·이번주 버튼 삭제, `dashboard.build_dashboard`·`ad_spend.build_ad_dashboard` 의 `nav.quick`), 매출 실적 기본 기간도 **이번달**(`router.dashboard_page` `period="month"`, 광고비는 원래 이번달). day·week 주소(`?period=week`)는 그대로 열린다. -- **일자별 표 스크롤 고정**(2026-10-26, `.perf-main-wrap`) — 표 상자를 화면 높이(`100vh − 상단 바 − 24px`)로 묶어 상자 안에서 세로 스크롤, - 제목 행 + 맨 위 기간 합계 행(`tbody tr.perf-row-total:first-child`)이 sticky. 합계 행 top = 제목 행 높이(`--perf-head-h`, `performance.js stickyHead` - 가 ResizeObserver 로 잼). 상자가 가로 스크롤이라 페이지 스크롤 기준 sticky 는 안 먹어서 상자 안 스크롤로 했다. 테스트 `tests/js/perf_sticky.browser.test.js`. +- **일자별 표 스크롤 고정**(2026-10-26, **10-27 다시** `.perf-main-wrap`) — 페이지(`.erp-page`)를 스크롤해도 제목 행 + 맨 위 기간 합계 행 + (`tbody tr.perf-row-total:first-child`)이 화면 위에 붙어 있다. 표 상자는 가로 스크롤 상자라 CSS sticky 가 페이지 스크롤에 안 먹어서 + `performance.js stickyHead` 가 스크롤(capture)·창 크기·표 크기마다 두 줄 칸을 `translateY` 로 내린다(표 끝에서 멈춤, 내려온 동안 `is-stuck` → + 제목 칸 `::after` 가 아래 1px 선 — 표 칸 선(border-collapse)은 안 움직여 틈이 비쳤다). **표 상자 세로 스크롤 금지** — 10-26 판은 상자를 화면 높이로 + 묶어 상자 안에서 스크롤했는데, 진짜 셸에서는 상자 아래가 화면 밖에 잘리고(`overscroll-behavior: contain`) 휠이 페이지로 안 넘어갔다. + 스크롤 막대 배경(트랙) 투명 = `scrollbar-color: #c3c6cb transparent`(표 상자·실적 화면 `.erp-page`). 테스트 `tests/js/perf_sticky.browser.test.js` + (진짜 `erp_base.html` 셸 렌더 `perf_*_shell.html` 로 휠 스크롤 — 스텁 셸로는 이 문제가 안 보였다). - 열 순서 카페24·네이버·쿠팡(윙)·쿠팡(로켓)·오늘의집·G마켓·카카오·GS샵·11번가·롯데ON·토스·애터미아자몰(마이그레이션 003). - 쿠팡(로켓)·애터미아자몰은 **수동 입력 전용**(`adapters/manual.py`, `manual_only` — 매출 업데이트에서 빠지고 인증 설정·연결 테스트 없음, 수동 입력 늘 켜짐). - **직접 추가 쇼핑몰·그룹·순서 드래그**(2026-10-22, 마이그레이션 009 `is_custom`·`is_group`·`parent_code`) — 설정 [+ 쇼핑몰 추가(수동 입력)] diff --git a/app/modules/performance/templates/performance/ads.html b/app/modules/performance/templates/performance/ads.html index 0d5a683..8c41c9d 100644 --- a/app/modules/performance/templates/performance/ads.html +++ b/app/modules/performance/templates/performance/ads.html @@ -1,6 +1,6 @@ {% extends "erp_base.html" %} -{% block head_extra %}{% endblock %} +{% block head_extra %}{% endblock %} {#- ROAS 덧붙임 — "광고비(ROAS%)". 광고비가 없으면 아무것도 안 붙는다. -#} {%- macro roas(p) -%}{%- if p is not none -%}({{ "{:,}".format(p) }}%){%- endif -%}{%- endmacro -%} @@ -241,4 +241,4 @@ } | tojson }} {% endblock %} -{% block scripts %}{% endblock %} +{% block scripts %}{% endblock %} diff --git a/app/modules/performance/templates/performance/index.html b/app/modules/performance/templates/performance/index.html index ff75f70..74803c9 100644 --- a/app/modules/performance/templates/performance/index.html +++ b/app/modules/performance/templates/performance/index.html @@ -1,6 +1,6 @@ {% extends "erp_base.html" %} -{% block head_extra %}{% endblock %} +{% block head_extra %}{% endblock %} {%- macro won(v) -%} {%- if v is none -%} @@ -292,4 +292,4 @@ } | tojson }} {% endblock %} -{% block scripts %}{% endblock %} +{% block scripts %}{% endblock %} diff --git a/app/modules/performance/templates/performance/settings.html b/app/modules/performance/templates/performance/settings.html index a426db6..5c903b1 100644 --- a/app/modules/performance/templates/performance/settings.html +++ b/app/modules/performance/templates/performance/settings.html @@ -1,6 +1,6 @@ {% extends "erp_base.html" %} -{% block head_extra %}{% endblock %} +{% block head_extra %}{% endblock %} {%- macro when(v) -%}{{ (v or '')[:16] | replace('T', ' ') or '—' }}{%- endmacro -%} @@ -259,4 +259,4 @@ {% endblock %} -{% block scripts %}{% endblock %} +{% block scripts %}{% endblock %} diff --git a/app/static/performance.css b/app/static/performance.css index 82afe40..c3b591a 100644 --- a/app/static/performance.css +++ b/app/static/performance.css @@ -458,11 +458,16 @@ body.perf-dragging, body.perf-dragging * { cursor: grabbing !important; user-sel font: inherit; font-size: 13.5px; line-height: 1.5; resize: vertical; } .perf-memo-input:focus { outline: none; border-color: #1a56db; box-shadow: 0 0 0 3px rgba(26, 86, 219, .12); } -/* ── 일자별 표 스크롤 고정(2026-10-26): 표 상자 안에서 세로 스크롤 → 제목 행 + 맨 위 기간 합계 행 고정 ── - (상자가 가로 스크롤(overflow-x)이라 페이지 스크롤 기준 sticky 는 안 먹는다 — 상자 높이를 화면 높이로 묶고 상자 안에서 스크롤) - --perf-head-h = 제목 행 높이(performance.js stickyHead 가 잼, 기본 31px). 연간 보기 "연간 합계"는 맨 아래 그대로. */ -.perf-main-wrap { overflow: auto; max-height: calc(100vh - var(--erp-topbar-h, 56px) - 24px); overscroll-behavior: contain; } +/* ── 일자별 표 스크롤 고정(2026-10-26, 10-27 다시): 페이지(.erp-page)를 스크롤해도 제목 행 + 맨 위 기간 합계 행이 화면 위에 ── + 표 상자는 가로 스크롤 상자(overflow-x)라 CSS sticky 가 페이지 스크롤에 안 먹는다 → performance.js stickyHead 가 스크롤 때마다 + 두 줄 칸을 translateY 로 내린다(상자 세로 스크롤 없음 — 예전엔 상자 안에서만 스크롤돼 상자 아래가 화면 밖에 잘리고 휠이 페이지로 안 넘어갔다). + 날짜 칸 가로 고정(sticky left)은 그대로. 연간 보기 "연간 합계"는 맨 아래 그대로(제목 행만 고정). */ +.perf-main-wrap { overflow-x: auto; overflow-y: hidden; } .perf-main-wrap .perf-main thead th { z-index: 3; } .perf-main-wrap .perf-main thead th.perf-th-label { z-index: 5; } -.perf-main-wrap .perf-main tbody tr.perf-row-total:first-child > * { position: sticky; top: var(--perf-head-h, 31px); z-index: 1; } -.perf-main-wrap .perf-main tbody tr.perf-row-total:first-child > .perf-td-label { left: 0; z-index: 4; } +.perf-main-wrap .perf-main tbody tr.perf-row-total:first-child > * { position: relative; z-index: 2; } +.perf-main-wrap .perf-main tbody tr.perf-row-total:first-child > .perf-td-label { position: sticky; left: 0; z-index: 4; } +/* 내려온 제목 행 아래 1px — 표 칸 사이 선(border-collapse)은 칸과 함께 안 움직여 그 틈으로 뒤 줄 글자가 비쳤다 → 칸이 직접 선을 그림 */ +.perf-main-wrap.is-stuck .perf-main thead th::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; background: var(--perf-line); } +/* 스크롤 막대 배경(트랙) 투명(2026-10-27) — 표 상자 가로 막대·실적 화면 세로 막대. 손잡이만 옅은 회색 */ +.perf-table-wrap, .erp-page:has(> .perf) { scrollbar-color: #c3c6cb transparent; } diff --git a/app/static/performance.js b/app/static/performance.js index affc537..1692804 100644 --- a/app/static/performance.js +++ b/app/static/performance.js @@ -1434,16 +1434,44 @@ }); } - // 일자별 표 스크롤 고정(2026-10-26) — 기간 합계 행이 제목 행 바로 밑에 붙도록 제목 행 높이를 CSS 변수로. - // 그룹 접기·화면 크기·글꼴에 따라 높이가 바뀌므로 ResizeObserver 로 다시 잰다. + // 일자별 표 스크롤 고정(2026-10-26, 10-27 다시) — 페이지를 스크롤해 표 위쪽이 화면 위로 넘어가면 제목 행 + 맨 위 기간 합계 행 칸을 + // 그만큼 translateY 로 내려 화면 위(스크롤 상자 .erp-page 위 끝, 없으면 상단 바 아래)에 붙여 둔다. 표 끝을 넘어가지는 않는다. + // 표 상자가 가로 스크롤 상자라 CSS sticky 로는 안 된다. 스크롤(capture — .erp-page 스크롤도)·창 크기·표 크기(그룹 접기)마다 다시 계산. + function scrollParent(node) { + for (let n = node.parentElement; n && n !== document.body; n = n.parentElement) { + const o = getComputedStyle(n).overflowY; + if ((o === "auto" || o === "scroll") && n.scrollHeight > n.clientHeight + 1) return n; + } + return null; + } function stickyHead(root) { root.querySelectorAll(".perf-main-wrap").forEach(function (wrap) { - const head = wrap.querySelector("thead"); + const table = wrap.querySelector("table"), head = table && table.tHead; if (!head) return; - const measure = function () { wrap.style.setProperty("--perf-head-h", head.getBoundingClientRect().height + "px"); }; - measure(); - if (window.ResizeObserver) new ResizeObserver(measure).observe(head); - else window.addEventListener("resize", measure); + const total = table.querySelector("tbody tr.perf-row-total:first-child"); + const cells = Array.from(head.querySelectorAll("th")).concat(total ? Array.from(total.children) : []); + let last = 0; + function edge() { + const sc = scrollParent(wrap); + if (sc) return sc.getBoundingClientRect().top + sc.clientTop; + const bar = document.querySelector(".erp-topbar"); // 좁은 화면 = 문서 스크롤, 상단 바가 위에 붙어 있으면 그 아래 + const pos = bar ? getComputedStyle(bar).position : ""; + return bar && (pos === "sticky" || pos === "fixed") ? Math.max(0, bar.getBoundingClientRect().bottom) : 0; + } + function update() { + const r = table.getBoundingClientRect(); + const h = head.getBoundingClientRect().height + (total ? total.getBoundingClientRect().height : 0); + const off = Math.max(0, Math.min(edge() - r.top, r.height - h)); + if (Math.abs(off - last) < 0.25) return; + last = off; + const v = off ? "translateY(" + off + "px)" : ""; + cells.forEach(function (c) { c.style.transform = v; }); + wrap.classList.toggle("is-stuck", off > 0); + } + window.addEventListener("scroll", update, true); + window.addEventListener("resize", update); + if (window.ResizeObserver) new ResizeObserver(update).observe(table); + update(); }); } diff --git a/tests/js/perf_sticky.browser.test.js b/tests/js/perf_sticky.browser.test.js index 9a27696..83a120e 100644 --- a/tests/js/perf_sticky.browser.test.js +++ b/tests/js/perf_sticky.browser.test.js @@ -1,8 +1,9 @@ -// 실적 — 기간 빠른 선택(이번달·올해만, 기본 이번달) · 일자별 표 스크롤 고정(2026-10-26) — 실제 브라우저(Chromium). +// 실적 — 기간 빠른 선택(이번달·올해만, 기본 이번달) · 일자별 표 제목·기간 합계 행 스크롤 고정(2026-10-26, 10-27 다시) — 실제 브라우저(Chromium). // python tests/js/render_performance.py // NODE_PATH= PJ_TEST_BROWSER= node tests/js/perf_sticky.browser.test.js -// 매출 실적(이번달)·광고비(이번달): 표 상자 안에서 세로 스크롤하면 제목 행은 상자 맨 위, 기간 합계 행은 제목 행 바로 아래에 붙어 있고 -// 날짜 칸은 가로 스크롤해도 왼쪽 고정(예전 그대로). 오늘·이번주 버튼은 없다. +// 진짜 ERP 셸(erp_base.html — 페이지 스크롤 상자 = .erp-page)로 렌더한 매출 실적·광고비(이번달): 표 위에서 마우스 휠 → 페이지가 스크롤되고 +// (표 상자는 세로 스크롤 없음 — 예전엔 상자 안에서만 돌아 상자 아래가 화면 밖에 잘렸다) 제목 행은 화면 위, 기간 합계 행은 그 바로 아래, +// 표 끝을 넘으면 같이 올라감. 날짜 칸 가로 고정 그대로, 스크롤 막대 배경 투명. 오늘·이번주 버튼 없음. const fs = require("fs"), path = require("path"); const { chromium } = require("playwright"); const ROOT = path.join(__dirname, "..", ".."); @@ -11,64 +12,78 @@ function check(name, cond, extra) { if (cond) console.log("PASS " + name); else { console.log("FAIL " + name + (extra !== undefined ? " → " + JSON.stringify(extra) : "")); fails.push(name); } } -function page(file) { - const css = fs.readFileSync(path.join(ROOT, "app", "static", "performance.css"), "utf8"); - const js = fs.readFileSync(path.join(ROOT, "app", "static", "performance.js"), "utf8"); - return fs.readFileSync(path.join(__dirname, ".out", file), "utf8") - .replace(//, function () { return ""; }) - .replace(/"; }); -} async function stickyFlow(browser, file, label) { - const ctx = await browser.newContext({ viewport: { width: 900, height: 600 } }); + const ctx = await browser.newContext({ viewport: { width: 1300, height: 760 } }); const p = await ctx.newPage(); await p.route("**/*", function (r) { const url = new URL(r.request().url()).pathname; - if (url.startsWith("/performance/api/")) { r.fulfill({ status: 200, contentType: "application/json", body: "{}" }); return; } - r.fulfill({ status: 200, contentType: "text/html; charset=utf-8", body: page(file) }); + if (url.startsWith("/static/")) { + const f = path.join(ROOT, "app", url); + if (!fs.existsSync(f)) return r.fulfill({ status: 404, body: "" }); + return r.fulfill({ status: 200, contentType: f.endsWith(".css") ? "text/css" : "application/javascript", body: fs.readFileSync(f) }); + } + if (url.includes("/api/")) return r.fulfill({ status: 200, contentType: "application/json", body: "{}" }); + r.fulfill({ status: 200, contentType: "text/html; charset=utf-8", body: fs.readFileSync(path.join(__dirname, ".out", file), "utf8") }); }); await p.goto("http://perf.test/performance/"); + await p.waitForTimeout(150); const quick = await p.evaluate(function () { return Array.from(document.querySelectorAll(".perf-quick .perf-seg")).map(function (n) { return n.textContent.trim(); }); }); check(label + " 빠른 선택 = 이번달·올해·직접선택(오늘·이번주 없음)", JSON.stringify(quick) === '["이번달","올해","직접선택"]', quick); - const geo = async function () { + const geo = function () { return p.evaluate(function () { - const wrap = document.querySelector(".perf-main-wrap"); + const page = document.querySelector(".erp-page"), wrap = document.querySelector(".perf-main-wrap"); const head = wrap.querySelector("thead th:nth-child(2)"); const total = wrap.querySelector("tbody tr.perf-row-total:first-child"); - const totalCell = total.querySelector("td"); - const label = total.querySelector(".perf-td-label"); - const w = wrap.getBoundingClientRect(); - return { wrapTop: w.top, wrapLeft: w.left, scrollH: wrap.scrollHeight, clientH: wrap.clientHeight, + const cell = total.querySelector("td"), lab = total.querySelector(".perf-td-label"); + const hit = function (el) { + const r = el.getBoundingClientRect(); + const x = document.elementFromPoint(r.left + r.width / 2, r.top + r.height / 2); + return !!x && !!x.closest("tr.perf-row-total"); + }; + const table = wrap.querySelector("table").getBoundingClientRect(); + return { pageTop: page.getBoundingClientRect().top, pageScroll: page.scrollTop, + wrapScrollH: wrap.scrollHeight, wrapClientH: wrap.clientHeight, wrapLeft: wrap.getBoundingClientRect().left, + tableTop: table.top, tableBottom: table.bottom, headTop: head.getBoundingClientRect().top, headBottom: head.getBoundingClientRect().bottom, - totalTop: totalCell.getBoundingClientRect().top, labelLeft: label.getBoundingClientRect().left, - totalText: label.textContent.trim(), - // 기간 합계 행 위에 다른 줄이 겹쳐 보이지 않는가 — 합계 칸 가운데를 찍으면 합계 행 칸이 나와야 한다 - hit: (function () { - const r = totalCell.getBoundingClientRect(); - const el = document.elementFromPoint(r.left + r.width / 2, r.top + r.height / 2); - return !!el && !!el.closest("tr.perf-row-total"); - })(), - labelHit: (function () { - const r = label.getBoundingClientRect(); - const el = document.elementFromPoint(r.left + r.width / 2, r.top + r.height / 2); - return !!el && !!el.closest("tr.perf-row-total"); - })() }; + totalTop: cell.getBoundingClientRect().top, totalBottom: cell.getBoundingClientRect().bottom, + labelLeft: lab.getBoundingClientRect().left, labelText: lab.textContent.trim(), hitCell: hit(cell), hitLabel: hit(lab), + track: getComputedStyle(wrap).scrollbarColor, pageTrack: getComputedStyle(page).scrollbarColor }; }); }; const g0 = await geo(); - check(label + " 표 상자가 세로로 스크롤된다(화면 높이로 묶음)", g0.scrollH > g0.clientH + 100, g0); - check(label + " 맨 위 행 = 기간 합계", g0.totalText === "기간 합계", g0.totalText); - await p.evaluate(function () { document.querySelector(".perf-main-wrap").scrollTop = 400; }); - await p.waitForTimeout(50); + check(label + " 맨 위 행 = 기간 합계, 표 상자 세로 스크롤 없음", g0.labelText === "기간 합계" && g0.wrapScrollH <= g0.wrapClientH + 1, g0); + check(label + " 처음엔 제자리(옮기지 않음)", Math.abs(g0.totalTop - g0.headBottom) <= 1 && g0.headTop > g0.pageTop + 50, g0); + check(label + " 스크롤 막대 배경 투명(표 상자·페이지)", / (transparent|rgba\(0, 0, 0, 0\))$/.test(g0.track) && / (transparent|rgba\(0, 0, 0, 0\))$/.test(g0.pageTrack), [g0.track, g0.pageTrack]); + // 표 위에서 휠 → 페이지가 스크롤된다 + const box = await p.locator(".perf-main-wrap").boundingBox(); + await p.mouse.move(box.x + 300, box.y + 60); + await p.mouse.wheel(0, 500); + await p.waitForTimeout(200); const g1 = await geo(); - check(label + " 세로 스크롤 뒤 제목 행 = 상자 맨 위", Math.abs(g1.headTop - g1.wrapTop) <= 1.5, g1); - check(label + " 세로 스크롤 뒤 기간 합계 행 = 제목 행 바로 아래", Math.abs(g1.totalTop - g1.headBottom) <= 1.5 && g1.hit, g1); - await p.evaluate(function () { document.querySelector(".perf-main-wrap").scrollLeft = 300; }); - await p.waitForTimeout(50); + check(label + " 표 위 휠 → 페이지 스크롤", g1.pageScroll > 300, g1.pageScroll); + check(label + " 스크롤 뒤 제목 행 = 화면(스크롤 상자) 맨 위", g1.tableTop < g1.pageTop && Math.abs(g1.headTop - g1.pageTop) <= 1, g1); + check(label + " 스크롤 뒤 기간 합계 행 = 제목 행 바로 아래, 다른 줄에 안 가려짐", + Math.abs(g1.totalTop - g1.headBottom) <= 1 && g1.hitCell && g1.hitLabel, g1); + // 가로 스크롤 — 날짜 칸은 왼쪽 고정(내려온 합계 행도) + await p.evaluate(function () { document.querySelector(".perf-main-wrap").scrollLeft = 400; }); + await p.waitForTimeout(80); const g2 = await geo(); - check(label + " 가로 스크롤해도 기간 합계 날짜 칸은 왼쪽 고정", Math.abs(g2.labelLeft - g2.wrapLeft) <= 1.5 && g2.labelHit, g2); + check(label + " 가로 스크롤해도 기간 합계 날짜 칸은 왼쪽 고정", Math.abs(g2.labelLeft - g2.wrapLeft) <= 1.5 && g2.hitLabel && + Math.abs(g2.headTop - g2.pageTop) <= 1, g2); + // 표 끝을 넘어가면 같이 올라간다(표 밖으로 나가지 않음) + await p.evaluate(function () { const pg = document.querySelector(".erp-page"); pg.scrollTop = pg.scrollHeight; }); + await p.waitForTimeout(120); + const g3 = await geo(); + check(label + " 표 끝을 지나면 제목·합계 행도 표 안(표 끝에서 멈춤)", + g3.totalBottom <= g3.tableBottom + 1 && g3.headTop >= g3.tableTop - 1 && g3.headTop < g3.pageTop, g3); + // 다시 맨 위 — 제자리 + await p.evaluate(function () { document.querySelector(".erp-page").scrollTop = 0; }); + await p.waitForTimeout(120); + const g4 = await geo(); + check(label + " 맨 위로 돌아오면 제자리", Math.abs(g4.headTop - g0.headTop) <= 1 && Math.abs(g4.totalTop - g4.headBottom) <= 1, g4); await ctx.close(); } @@ -76,8 +91,8 @@ async function stickyFlow(browser, file, label) { const exe = process.env.PJ_TEST_BROWSER; const browser = await chromium.launch(exe ? { executablePath: exe } : {}); try { - await stickyFlow(browser, "perf_dash_month.html", "[매출 실적]"); - await stickyFlow(browser, "perf_ads.html", "[광고비]"); + await stickyFlow(browser, "perf_dash_shell.html", "[매출 실적]"); + await stickyFlow(browser, "perf_ads_shell.html", "[광고비]"); } finally { await browser.close(); } diff --git a/tests/js/render_performance.py b/tests/js/render_performance.py index 2393e6b..32a67ee 100644 --- a/tests/js/render_performance.py +++ b/tests/js/render_performance.py @@ -94,11 +94,20 @@ def main() -> None: html = e.get_template("performance/index.html").render(**base, active_tab="dashboard", metric="net", **ctx) with open(os.path.join(OUT_DIR, "perf_dash.html"), "w", encoding="utf-8") as f: f.write(html) - # 이번달 보기(기본, 2026-10-26) — 맨 위 기간 합계 행이 있는 표(제목·합계 행 스크롤 고정 확인용) + # 이번달 보기(기본) + 진짜 ERP 셸(erp_base.html — .erp-page 가 스크롤 상자) — 제목·기간 합계 행 스크롤 고정 확인용(2026-10-27) + shell = jinja2.Environment(loader=jinja2.FileSystemLoader([ + os.path.join(ROOT, "app", "templates"), os.path.join(ROOT, "app", "modules", "performance", "templates")]), autoescape=True) + sbase = {**base, "user": {"email": "me@test.local", "name": "Me", "picture": ""}} mctx = build_dashboard(FakeStore(), kind="month", anchor=date(2026, 10, 7), today=date(2026, 10, 7)) mctx["auto_sync"] = ctx["auto_sync"] - html = e.get_template("performance/index.html").render(**base, active_tab="dashboard", metric="net", **mctx) - with open(os.path.join(OUT_DIR, "perf_dash_month.html"), "w", encoding="utf-8") as f: + html = shell.get_template("performance/index.html").render(**sbase, active_tab="dashboard", metric="net", **mctx) + with open(os.path.join(OUT_DIR, "perf_dash_shell.html"), "w", encoding="utf-8") as f: + f.write(html) + sactx = build_ad_dashboard(FakeStore(), kind="month", anchor=date(2026, 10, 7), today=date(2026, 10, 7), + sales_codes=["cafe24", "coupang"]) + sactx["auto_sync"] = ctx["auto_sync"] + html = shell.get_template("performance/ads.html").render(**sbase, active_tab="ads", **sactx) + with open(os.path.join(OUT_DIR, "perf_ads_shell.html"), "w", encoding="utf-8") as f: f.write(html) actx =build_ad_dashboard(FakeStore(), kind="month", anchor=date(2026, 10, 7), today=date(2026, 10, 7), sales_codes=["cafe24", "coupang"])