feat(안내문 발송): DM 수동 보내기를 별도 탭(/outreach/dm)으로
- 탭 [발송 리스트] [DM 수동 보내기] + 맨 오른쪽 설정 톱니(_tabs.html)
- /outreach/dm: 왼쪽 이름 넣기·이름 목록, 오른쪽 본문 — 이름 누르면 {이름} 바뀌고 복사 + 짧은 안내
- 리스트 화면의 DM 수동 버튼·창은 뺌
- outreach.js/css 캐시 버전 20261030b, 화면·브라우저 테스트
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -53,7 +53,8 @@ function check(name, cond, extra) {
|
||||
}
|
||||
return json({});
|
||||
}
|
||||
r.fulfill({ status: 200, contentType: "text/html; charset=utf-8", body: fs.readFileSync(path.join(__dirname, ".out", "outreach.html"), "utf8") });
|
||||
const page = url === "/outreach/dm" ? "outreach_dm.html" : "outreach.html"; // DM 수동 보내기 탭(2026-10-30)
|
||||
r.fulfill({ status: 200, contentType: "text/html; charset=utf-8", body: fs.readFileSync(path.join(__dirname, ".out", page), "utf8") });
|
||||
});
|
||||
const p = await ctx.newPage();
|
||||
p.on("dialog", function (d) { d.accept(); });
|
||||
@@ -120,16 +121,25 @@ function check(name, cond, extra) {
|
||||
await p.waitForTimeout(200);
|
||||
const sendCall = calls.find(function (c) { return c.url === "/outreach/api/send"; });
|
||||
check("고른 메일 보내기 → 메일·대기 줄만 보냄", !!sendCall && JSON.stringify(sendCall.body.ids) === "[1,3]", sendCall);
|
||||
// 설정 = 맨 오른쪽 톱니 아이콘(2026-10-30)
|
||||
// 탭 [발송 리스트][DM 수동 보내기] + 설정 = 맨 오른쪽 톱니 아이콘(2026-10-30)
|
||||
const gear = await p.evaluate(function () {
|
||||
const g = document.querySelector(".otr-gear"), top = document.querySelector(".otr-top").getBoundingClientRect(), r = g.getBoundingClientRect();
|
||||
const g = document.querySelector(".otr-gear"), top = document.querySelector(".otr-tabs").getBoundingClientRect(), r = g.getBoundingClientRect();
|
||||
return { href: g.getAttribute("href"), icon: g.textContent.trim(), right: Math.round(top.right - r.right),
|
||||
font: getComputedStyle(g.querySelector(".material-symbols-outlined")).fontFamily };
|
||||
});
|
||||
check("설정 = 맨 오른쪽 톱니(글자 대신 아이콘)", gear.href === "/outreach/settings" && gear.icon === "settings" && gear.right <= 2 &&
|
||||
/Material Symbols/.test(gear.font), gear);
|
||||
// DM 수동 보내기 — 이름 넣기 → 왼쪽 목록, 이름 누르면 오른쪽 문구 {이름} 바뀌고 복사 + 짧은 안내
|
||||
await p.click("#otr-dm-open");
|
||||
const tabs = await p.$$eval(".otr-tab", function (els) { return els.map(function (e) { return [e.textContent.trim(), e.getAttribute("href"), e.classList.contains("is-active")]; }); });
|
||||
check("탭 = 발송 리스트(선택됨) · DM 수동 보내기", JSON.stringify(tabs) === JSON.stringify([["forward_to_inbox발송 리스트", "/outreach/", true], ["chatDM 수동 보내기", "/outreach/dm", false]]), tabs);
|
||||
// DM 수동 보내기 탭 — 왼쪽 이름(넣기 + 목록) | 오른쪽 본문. 이름 누르면 문구 {이름} 바뀌고 복사 + 짧은 안내
|
||||
await p.click('.otr-tab[href="/outreach/dm"]');
|
||||
await p.waitForSelector("#otr-dm-names");
|
||||
const lay = await p.evaluate(function () {
|
||||
const l = document.getElementById("otr-dm-names").getBoundingClientRect(), r = document.getElementById("otr-dm-body").getBoundingClientRect();
|
||||
return { leftOfBody: l.right < r.left, active: document.querySelector(".otr-tab.is-active").getAttribute("href"),
|
||||
body: document.getElementById("otr-dm-body").textContent };
|
||||
});
|
||||
check("DM 탭 — 왼쪽 이름 목록, 오른쪽 본문({이름} 그대로)", lay.leftOfBody && lay.active === "/outreach/dm" && lay.body.includes("{이름}"), lay);
|
||||
await p.fill("#otr-dm-text", "이름\n김민지\t메모\n\n박서준, x\n김민지");
|
||||
await p.click("#otr-dm-load");
|
||||
const names = await p.$$eval("#otr-dm-names .otr-dm-name", function (els) { return els.map(function (e) { return e.textContent; }); });
|
||||
@@ -145,7 +155,8 @@ function check(name, cond, extra) {
|
||||
dm.clip === dm.body && /박서준 님 문구를 클립보드에 복사/.test(dm.toast), dm);
|
||||
await p.waitForTimeout(1800);
|
||||
check("안내는 잠깐 뒤 사라짐", await p.evaluate(function () { return document.getElementById("otr-toast").hidden; }));
|
||||
await p.click("#otr-dm-close");
|
||||
await p.goBack();
|
||||
await p.waitForSelector("#otr-add-open");
|
||||
// 리스트 추가 — 미리보기(판별) → 추가
|
||||
await p.click("#otr-add-open");
|
||||
await p.fill("#otr-add-text", "new@x.com 새사람\n@hong 홍\n홍길동");
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"""안내문 발송 화면(index.html)을 진짜 ERP 셸로 렌더 — 브라우저 테스트용(2026-10-27).
|
||||
|
||||
python tests/js/render_outreach.py # → tests/js/.out/outreach.html, outreach_settings.html
|
||||
python tests/js/render_outreach.py # → tests/js/.out/outreach.html, outreach_dm.html, outreach_settings.html
|
||||
|
||||
화면 데이터는 실제 router._view 로 만든다(저장소 없이 줄만 가짜).
|
||||
"""
|
||||
@@ -36,10 +36,13 @@ def main() -> None:
|
||||
ctx = {"user": {"email": "me@miras.co.kr", "name": "나", "picture": ""}, "is_admin": False, "nav_items": [],
|
||||
"page_title": "안내문 발송", "page_subtitle": "", "template": t, "body_text": store.html_to_text(t["body"]),
|
||||
"needs_name": store.needs_name(t), "images": [], "rows": [_view(r, t) for r in raw],
|
||||
"dm_template": store.dm_text(t, store.NAME_TAG),
|
||||
"active_tab": "list",
|
||||
"logs": [], "gmail": {"available": True, "connected": True, "email": "me@miras.co.kr"}, "msg": ""}
|
||||
with open(os.path.join(OUT_DIR, "outreach.html"), "w", encoding="utf-8") as f:
|
||||
f.write(env.get_template("outreach/index.html").render(**ctx))
|
||||
# DM 수동 보내기 탭(2026-10-30)
|
||||
with open(os.path.join(OUT_DIR, "outreach_dm.html"), "w", encoding="utf-8") as f:
|
||||
f.write(env.get_template("outreach/dm.html").render(**{**ctx, "active_tab": "dm", "dm_template": store.dm_text(t, store.NAME_TAG)}))
|
||||
# 설정 화면 — 저장해 둔 서식 본문(HTML)·DM 문구로
|
||||
saved = store.normalize_template({
|
||||
"subject": "{이름}님께 제안", "fmt": "html", "dm_body": "안녕하세요 {이름}님, DM 입니다",
|
||||
|
||||
@@ -357,6 +357,10 @@ def body(c):
|
||||
assert c.get(f"/outreach/api/recipients/{mira['id']}/preview").json()["text"] == "미라님, DM 문구입니다"
|
||||
assert "수신 거부: 회신" in c.get(f"/outreach/api/recipients/{kim['id']}/preview").json()["text"]
|
||||
assert cur(c.get("/outreach/settings").text)["dm_body"] == "{이름}님, **DM** 문구입니다"
|
||||
# DM 수동 보내기 탭(2026-10-30) — {이름} 을 그대로 둔 DM 문구(별표 뺌)를 화면 데이터로
|
||||
d = c.get("/outreach/dm").text
|
||||
dm_data = __import__("json").loads(d.split('id="otr-data">')[1].split("</script>")[0])
|
||||
assert 'id="otr-dm-names"' in d and "DM 수동 보내기" in d and dm_data == {"dm_template": "{이름}님, DM 문구입니다"}, dm_data
|
||||
# 서식 편집기 본문(fmt=html) — 서버가 정리해 저장, 메일 미리보기에 서식·이름
|
||||
r = c.post("/outreach/settings", data={"subject": "{이름}님 제안", "fmt": "html", "dm_body": "",
|
||||
"body": '<p>안녕 <span style="color: rgb(230, 0, 0)" onclick="x">{이름}</span>님</p><script>x</script>'})
|
||||
|
||||
Reference in New Issue
Block a user