feat(performance): 메타 광고 상세보기 [합계 | 계정별] 탭
- 가져올 때 그날 메타 행 metrics 에 계정별 값(_accounts: 이름·광고비·ROAS·항목, insights account_name)을 함께 저장 — 새 마이그레이션 없음. "_" 키는 일자별 표 열·합계·화면 값에서 제외. - ad_spend.detail_tabs: 합계 탭 + 계정 탭(그 계정이 광고 낸 날만, 광고비 큰 계정부터), 계정별 값 없는 날 수 안내. - 상세보기 창: 탭(주황 강조, 계정 ID 말풍선), 계정 탭은 1원 반올림 차이 안내. 네이버·구글은 그대로 표 하나. - 테스트: 계정별 변환·탭 순서/이름/가중 ROAS·옛 자료 안내·API 응답, jsdom 탭 전환. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -28,6 +28,17 @@ async function env(file) {
|
||||
return { columns: ["총비용", "노출수", "클릭률(%)", "구매완료 광고수익률(%)"], total: { "총비용": 300000, "노출수": 30043, "클릭률(%)": 1.53, "구매완료 광고수익률(%)": 250.5 },
|
||||
rows: [{ date: "2026-10-03", amount: 300000, roas: 250.5, values: { "총비용": 300000, "노출수": 30043, "클릭률(%)": 1.53, "구매완료 광고수익률(%)": 250.5 } }] }; } };
|
||||
}
|
||||
if (/^\/performance\/api\/ad-spend\/meta\/details/.test(url)) { // 메타 — [합계 | 계정…] 탭(2026-10-16)
|
||||
const tbl = function (amount, roas) {
|
||||
return { columns: ["광고비(부가세 포함)", "ROAS(%)"], total: { "광고비(부가세 포함)": amount, "ROAS(%)": roas },
|
||||
rows: [{ date: "2026-10-03", amount: amount, roas: roas, values: { "광고비(부가세 포함)": amount, "ROAS(%)": roas } }] };
|
||||
};
|
||||
return { ok: true, status: 200, json: async function () {
|
||||
return Object.assign(tbl(165001, 400), { accounts_missing: e.metaMissing || 0, tabs: [
|
||||
Object.assign({ key: "total", label: "합계" }, tbl(165001, 400)),
|
||||
Object.assign({ key: "111", label: "본계정", account_id: "111" }, tbl(110000, 450)),
|
||||
Object.assign({ key: "222", label: "서브<계정>", account_id: "222" }, tbl(55001, 300))] }); } };
|
||||
}
|
||||
if (/^\/performance\/api\/ad-spend\/upload/.test(url)) {
|
||||
return { ok: true, status: 200, json: async function () {
|
||||
return { ok: true, saved: 12, name: "쿠팡(로켓)", total: 2636494, from: "2026-10-01", to: "2026-10-12", empty_days: e.uploadEmpty || [] }; } };
|
||||
@@ -235,6 +246,24 @@ function gross(td) { return td.querySelector(".v-gross").textContent.trim(); }
|
||||
check("[네이버] 상세 표 = 날짜 + 보고서 항목(파일 순서), 날짜 mm/dd(요일)", ths.join(",") === "날짜,총비용,노출수,클릭률(%),구매완료 광고수익률(%)" &&
|
||||
row.join(",") === "10/03(토),300,000,30,043,1.53,250.50", [ths, row]);
|
||||
check("[네이버] 맨 아래 합계 줄", /합계/.test(modal.querySelector("tfoot").textContent) && /30,043/.test(modal.querySelector("tfoot").textContent));
|
||||
check("[네이버] 계정 탭 없음(탭 자료 없는 채널)", !modal.querySelector(".perf-detail-tabs"));
|
||||
}
|
||||
// ── 메타 — 상세보기 [합계 | 계정…] 탭(2026-10-16) ──
|
||||
{
|
||||
const e = await env("perf_ads.html");
|
||||
e.metaMissing = 2;
|
||||
e.d.querySelector('.perf-main thead [data-detail-channel="meta"]').click(); await settle();
|
||||
const modal = e.d.querySelector(".perf-modal");
|
||||
const tabs = Array.from(modal.querySelectorAll(".perf-detail-tabs [data-tab]"));
|
||||
const foot = function () { return modal.querySelector(".perf-detail-tab-body tfoot").textContent; };
|
||||
check("[메타] 탭 = 합계 + 계정(이름은 글자 그대로, 계정 ID 는 말풍선)", tabs.map(function (b) { return b.textContent; }).join("|") === "합계|본계정|서브<계정>" &&
|
||||
tabs[1].getAttribute("title") === "act_111" && !tabs[0].hasAttribute("title"), tabs.map(function (b) { return b.outerHTML; }));
|
||||
check("[메타] 처음엔 합계 탭", tabs[0].classList.contains("is-active") && tabs[0].getAttribute("aria-selected") === "true" && /165,001/.test(foot()) &&
|
||||
modal.querySelectorAll(".perf-detail-tab-body table").length === 1);
|
||||
tabs[2].click();
|
||||
check("[메타] 계정 탭 누르면 그 계정 표", tabs[2].classList.contains("is-active") && !tabs[0].classList.contains("is-active") &&
|
||||
/55,001/.test(foot()) && /1원 다를 수/.test(modal.textContent));
|
||||
check("[메타] 계정별 자료 없는 날 안내", /2일은 계정별 자료가 없어/.test(modal.textContent) && modal.textContent.indexOf("[메타 광고 불러오기]") >= 0);
|
||||
}
|
||||
// ── 설정: 수동 입력 토글 ──
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user