Compare commits
5
Commits
v1.0.5-rename
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eeccece373 | ||
|
|
d60b30e7d6 | ||
|
|
6917b6faf3 | ||
|
|
c00db123f7 | ||
|
|
087e74a025 |
No files matched your search
+1
-1
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "aacut",
|
||||
"private": true,
|
||||
"version": "1.0.1",
|
||||
"version": "1.0.6",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "yarn clean && node scripts/patch-sdk-offline.mjs && yarn build:worker && vite build",
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
#!/usr/bin/env python3
|
||||
"""验证顶栏新增「更多素材」菜单:出现 + 点击新窗口打开目标 URL"""
|
||||
import sys, asyncio
|
||||
|
||||
BASE = "https://127.0.0.1:3005"
|
||||
TARGET = "https://doc.88531.cn/docs/mrfx/mrfx-1g99qum57n5qk"
|
||||
|
||||
async def main():
|
||||
from playwright.async_api import async_playwright
|
||||
async with async_playwright() as p:
|
||||
browser = await p.chromium.launch(args=["--ignore-certificate-errors"])
|
||||
ctx = await browser.new_context(ignore_https_errors=True,
|
||||
viewport={"width": 1600, "height": 900})
|
||||
page = await ctx.new_page()
|
||||
errs = []
|
||||
page.on("pageerror", lambda e: errs.append(str(e)))
|
||||
|
||||
await page.goto(BASE + "/", wait_until="domcontentloaded", timeout=120000)
|
||||
await page.wait_for_timeout(6000)
|
||||
|
||||
link = page.locator("a", has_text="更多素材")
|
||||
n = await link.count()
|
||||
print("菜单项存在:", n, "PASS" if n == 1 else "FAIL")
|
||||
if n:
|
||||
info = await link.first.evaluate("el => ({href: el.href, target: el.target, text: el.innerText.trim()})")
|
||||
print("链接:", info)
|
||||
print("URL正确:", "PASS" if info["href"] == TARGET else "FAIL " + info["href"])
|
||||
print("新窗口:", "PASS" if info["target"] == "_blank" else "FAIL")
|
||||
|
||||
# 点击并捕获新标签页
|
||||
async with ctx.expect_page() as newp:
|
||||
await link.first.click()
|
||||
np = await newp.value
|
||||
await np.wait_for_load_state("domcontentloaded", timeout=60000)
|
||||
print("新标签URL:", np.url, "PASS" if np.url.rstrip("/") == TARGET.rstrip("/") else "FAIL")
|
||||
title = await np.title()
|
||||
print("目标页title:", title)
|
||||
await np.close()
|
||||
|
||||
print("JS errors:", errs[:5])
|
||||
await page.screenshot(path="/vol1/1000/HD1/APP/hermes/awork/unicut_nav_check.png")
|
||||
await browser.close()
|
||||
|
||||
asyncio.run(main())
|
||||
@@ -0,0 +1,128 @@
|
||||
#!/usr/bin/env python3
|
||||
"""复现:项目列表卡片改名是否真正落库/刷新后是否保留。
|
||||
用法: python3 scripts/dbg_rename.py
|
||||
"""
|
||||
import sys, asyncio, json
|
||||
|
||||
BASE = "https://127.0.0.1:3005"
|
||||
|
||||
|
||||
async def main():
|
||||
from playwright.async_api import async_playwright
|
||||
async with async_playwright() as p:
|
||||
browser = await p.chromium.launch(args=["--ignore-certificate-errors"])
|
||||
ctx = await browser.new_context(ignore_https_errors=True,
|
||||
viewport={"width": 1600, "height": 900})
|
||||
page = await ctx.new_page()
|
||||
errs = []
|
||||
page.on("pageerror", lambda e: errs.append(str(e)))
|
||||
|
||||
await page.goto(f"{BASE}/workspace/draft", wait_until="domcontentloaded", timeout=120000)
|
||||
await page.wait_for_timeout(5000)
|
||||
|
||||
# 预置本地存储文件夹句柄(与 e2e_quickvideo_cover.py 的 GUARD 一致)
|
||||
GUARD = """async () => {
|
||||
try {
|
||||
const root = await navigator.storage.getDirectory();
|
||||
const db = await new Promise((res, rej) => {
|
||||
const rq = indexedDB.open('H5VideoLocalDB');
|
||||
rq.onupgradeneeded = () => rq.result.createObjectStore('folderHandles');
|
||||
rq.onsuccess = () => res(rq.result);
|
||||
rq.onerror = () => rej(rq.error);
|
||||
});
|
||||
const done = await new Promise((res, rej) => {
|
||||
const tx = db.transaction('folderHandles', 'readwrite');
|
||||
const st = tx.objectStore('folderHandles');
|
||||
const rec = { id: 'root', handle: root };
|
||||
if (st.keyPath) st.put(rec); else st.put(rec, 'root');
|
||||
tx.oncomplete = () => res(true);
|
||||
tx.onerror = () => rej(tx.error);
|
||||
});
|
||||
db.close();
|
||||
return done;
|
||||
} catch (e) { return String(e); }
|
||||
}"""
|
||||
print("GUARD:", await page.evaluate(GUARD))
|
||||
await page.reload(wait_until="domcontentloaded")
|
||||
await page.wait_for_timeout(6000)
|
||||
|
||||
print("URL:", page.url)
|
||||
print("TITLE:", await page.title())
|
||||
|
||||
# 若无项目,先创建一个
|
||||
if await page.locator("input[class*='__name__']").count() == 0:
|
||||
btn = page.get_by_text("创建项目", exact=True).first
|
||||
if await btn.count():
|
||||
await btn.click()
|
||||
await page.wait_for_timeout(6000)
|
||||
# 创建后可能跳进编辑器,返回列表
|
||||
if "workspace/draft" not in page.url:
|
||||
await page.goto(f"{BASE}/workspace/draft", wait_until="domcontentloaded", timeout=120000)
|
||||
await page.wait_for_timeout(5000)
|
||||
print("创建后 name input count:", await page.locator("input[class*='__name__']").count())
|
||||
|
||||
# 列表卡片名输入框
|
||||
inputs = page.locator("input[class*='__name__']")
|
||||
n = await inputs.count()
|
||||
print("input.title count:", n)
|
||||
if n == 0:
|
||||
# 打印可见输入框与页面骨架
|
||||
allin = page.locator("input")
|
||||
print("all input count:", await allin.count())
|
||||
for i in range(min(await allin.count(), 8)):
|
||||
el = allin.nth(i)
|
||||
print(" input", i, await el.get_attribute("class"),
|
||||
repr(await el.get_attribute("value")),
|
||||
"visible=", await el.is_visible())
|
||||
print("BODY:", (await page.inner_text("body"))[:600])
|
||||
await browser.close()
|
||||
return 1
|
||||
|
||||
old = await inputs.first.get_attribute("value")
|
||||
print("原名:", repr(old))
|
||||
|
||||
# 聚焦 + 全选 + 输入 + 失焦
|
||||
await inputs.first.click()
|
||||
await page.keyboard.press("Control+a")
|
||||
await page.keyboard.type("RENAME_TEST_001")
|
||||
await page.keyboard.press("Tab")
|
||||
await page.wait_for_timeout(2000)
|
||||
|
||||
val_after = await inputs.first.input_value()
|
||||
print("失焦后输入框:", repr(val_after))
|
||||
|
||||
# 读 IndexedDB projects 表
|
||||
async def read_meta():
|
||||
return await page.evaluate("""async () => {
|
||||
try {
|
||||
const rq = indexedDB.open('H5VideoLocalDB');
|
||||
const db = await new Promise((res, rej) => { rq.onsuccess=()=>res(rq.result); rq.onerror=()=>rej(rq.error); });
|
||||
const tx = db.transaction('projects','readonly');
|
||||
const all = await new Promise((res, rej) => {
|
||||
const r = tx.objectStore('projects').getAll();
|
||||
r.onsuccess=()=>res(r.result); r.onerror=()=>rej(r.error);
|
||||
});
|
||||
return all.map(x => ({id:x.id, name:x.name, updatedAt:x.updatedAt}));
|
||||
} catch(e){ return 'ERR:'+e; }
|
||||
}""")
|
||||
|
||||
meta1 = await read_meta()
|
||||
print("失焦后 IndexedDB:", json.dumps(meta1, ensure_ascii=False))
|
||||
|
||||
# 刷新
|
||||
await page.reload(wait_until="domcontentloaded")
|
||||
await page.wait_for_timeout(5000)
|
||||
inputs2 = page.locator("input[class*='__name__']")
|
||||
n2 = await inputs2.count()
|
||||
print("刷新后 input.title count:", n2)
|
||||
if n2:
|
||||
print("刷新后输入框值:", repr(await inputs2.first.input_value()))
|
||||
meta2 = await read_meta()
|
||||
print("刷新后 IndexedDB:", json.dumps(meta2, ensure_ascii=False))
|
||||
|
||||
print("JS errors:", errs[:5])
|
||||
await browser.close()
|
||||
return 0
|
||||
|
||||
|
||||
sys.exit(asyncio.run(main()))
|
||||
@@ -0,0 +1,112 @@
|
||||
#!/usr/bin/env python3
|
||||
"""复现用户路径: ①改名按回车 ②改名后立即点开项目再返回列表 ③改名后失焦点空白处"""
|
||||
import sys, asyncio, json
|
||||
|
||||
BASE = "https://127.0.0.1:3005"
|
||||
|
||||
GUARD = """async () => {
|
||||
try {
|
||||
const root = await navigator.storage.getDirectory();
|
||||
const db = await new Promise((res, rej) => {
|
||||
const rq = indexedDB.open('H5VideoLocalDB');
|
||||
rq.onupgradeneeded = () => rq.result.createObjectStore('folderHandles');
|
||||
rq.onsuccess = () => res(rq.result);
|
||||
rq.onerror = () => rej(rq.error);
|
||||
});
|
||||
await new Promise((res, rej) => {
|
||||
const tx = db.transaction('folderHandles', 'readwrite');
|
||||
const st = tx.objectStore('folderHandles');
|
||||
const rec = { id: 'root', handle: root };
|
||||
if (st.keyPath) st.put(rec); else st.put(rec, 'root');
|
||||
tx.oncomplete = () => res(true);
|
||||
tx.onerror = () => rej(tx.error);
|
||||
});
|
||||
db.close();
|
||||
return 'ok';
|
||||
} catch (e) { return String(e); }
|
||||
}"""
|
||||
|
||||
READ_META = """async () => {
|
||||
try {
|
||||
const rq = indexedDB.open('H5VideoLocalDB');
|
||||
const db = await new Promise((res, rej) => { rq.onsuccess=()=>res(rq.result); rq.onerror=()=>rej(rq.error); });
|
||||
const tx = db.transaction('projects','readonly');
|
||||
const all = await new Promise((res, rej) => {
|
||||
const r = tx.objectStore('projects').getAll();
|
||||
r.onsuccess=()=>res(r.result); r.onerror=()=>rej(r.error);
|
||||
});
|
||||
return all.map(x => ({id:x.id, name:x.name, dtitle:(x.data&&x.data.title)||null}));
|
||||
} catch(e){ return 'ERR:'+e; }
|
||||
}"""
|
||||
|
||||
|
||||
async def main():
|
||||
from playwright.async_api import async_playwright
|
||||
async with async_playwright() as p:
|
||||
browser = await p.chromium.launch(args=["--ignore-certificate-errors"])
|
||||
ctx = await browser.new_context(ignore_https_errors=True,
|
||||
viewport={"width": 1600, "height": 900})
|
||||
page = await ctx.new_page()
|
||||
errs = []
|
||||
page.on("pageerror", lambda e: errs.append(str(e)))
|
||||
|
||||
await page.goto(f"{BASE}/workspace/draft", wait_until="domcontentloaded", timeout=120000)
|
||||
await page.wait_for_timeout(4000)
|
||||
await page.evaluate(GUARD)
|
||||
await page.reload(wait_until="domcontentloaded")
|
||||
await page.wait_for_timeout(6000)
|
||||
|
||||
inputs = page.locator("input[class*='__name__']")
|
||||
if await inputs.count() == 0:
|
||||
btn = page.get_by_text("创建项目", exact=True).first
|
||||
await btn.click()
|
||||
await page.wait_for_timeout(6000)
|
||||
if "workspace/draft" not in page.url:
|
||||
await page.goto(f"{BASE}/workspace/draft", wait_until="domcontentloaded")
|
||||
await page.wait_for_timeout(5000)
|
||||
inputs = page.locator("input[class*='__name__']")
|
||||
|
||||
print("卡片数:", await inputs.count())
|
||||
print("初始:", json.dumps(await page.evaluate(READ_META), ensure_ascii=False))
|
||||
|
||||
# ① 改名 + 按回车(不点别处)
|
||||
await inputs.first.click()
|
||||
await page.keyboard.press("Control+a")
|
||||
await page.keyboard.type("VIA_ENTER_KEY")
|
||||
await page.keyboard.press("Enter")
|
||||
await page.wait_for_timeout(2500)
|
||||
print("①回车后 input:", repr(await inputs.first.input_value()))
|
||||
print("①回车后 DB:", json.dumps(await page.evaluate(READ_META), ensure_ascii=False))
|
||||
|
||||
# ② 改名后立即点开第一张卡片(打开项目)
|
||||
await inputs.first.click()
|
||||
await page.keyboard.press("Control+a")
|
||||
await page.keyboard.type("VIA_OPEN_PROJECT")
|
||||
await page.keyboard.press("Tab")
|
||||
await page.wait_for_timeout(1500)
|
||||
print("②失焦后 DB:", json.dumps(await page.evaluate(READ_META), ensure_ascii=False))
|
||||
# 点卡片标题区打开项目
|
||||
card_a = page.locator("a[href*='/editor/']").first
|
||||
if await card_a.count():
|
||||
await card_a.click()
|
||||
await page.wait_for_timeout(8000)
|
||||
print("②打开后 URL:", page.url)
|
||||
# 编辑器顶栏标题
|
||||
t = await page.evaluate("""() => {
|
||||
const el = document.querySelector('input[placeholder]');
|
||||
return el ? el.value : null;
|
||||
}""")
|
||||
print("②编辑器标题输入框:", repr(t))
|
||||
print("②DB(编辑器内):", json.dumps(await page.evaluate(READ_META), ensure_ascii=False))
|
||||
# 返回列表
|
||||
await page.goto(f"{BASE}/workspace/draft", wait_until="domcontentloaded")
|
||||
await page.wait_for_timeout(6000)
|
||||
inputs = page.locator("input[class*='__name__']")
|
||||
print("②返回列表 input:", repr(await inputs.first.input_value()) if await inputs.count() else "N/A")
|
||||
print("②返回后 DB:", json.dumps(await page.evaluate(READ_META), ensure_ascii=False))
|
||||
|
||||
print("JS errors:", errs[:5])
|
||||
await browser.close()
|
||||
|
||||
|
||||
sys.exit(asyncio.run(main()))
|
||||
@@ -0,0 +1,102 @@
|
||||
#!/usr/bin/env python3
|
||||
"""反向同步验证:列表卡片改名 -> 打开编辑器顶栏显示新名 -> 再改顶栏 -> 回列表"""
|
||||
import sys, asyncio, json
|
||||
|
||||
BASE = "https://127.0.0.1:3005"
|
||||
|
||||
GUARD = """async () => {
|
||||
try {
|
||||
const root = await navigator.storage.getDirectory();
|
||||
const db = await new Promise((res, rej) => {
|
||||
const rq = indexedDB.open('H5VideoLocalDB');
|
||||
rq.onupgradeneeded = () => rq.result.createObjectStore('folderHandles');
|
||||
rq.onsuccess = () => res(rq.result);
|
||||
rq.onerror = () => rej(rq.error);
|
||||
});
|
||||
await new Promise((res, rej) => {
|
||||
const tx = db.transaction('folderHandles', 'readwrite');
|
||||
const st = tx.objectStore('folderHandles');
|
||||
const rec = { id: 'root', handle: root };
|
||||
if (st.keyPath) st.put(rec); else st.put(rec, 'root');
|
||||
tx.oncomplete = () => res(true);
|
||||
tx.onerror = () => rej(tx.error);
|
||||
});
|
||||
db.close();
|
||||
return 'ok';
|
||||
} catch (e) { return String(e); }
|
||||
}"""
|
||||
|
||||
READ_META = """async () => {
|
||||
try {
|
||||
const rq = indexedDB.open('H5VideoLocalDB');
|
||||
const db = await new Promise((res, rej) => { rq.onsuccess=()=>res(rq.result); rq.onerror=()=>rej(rq.error); });
|
||||
const tx = db.transaction('projects','readonly');
|
||||
const all = await new Promise((res, rej) => {
|
||||
const r = tx.objectStore('projects').getAll();
|
||||
r.onsuccess=()=>res(r.result); r.onerror=()=>rej(r.error);
|
||||
});
|
||||
return all.map(x => ({id:x.id, name:x.name, dtitle:(x.data&&x.data.title)||null}));
|
||||
} catch(e){ return 'ERR:'+e; }
|
||||
}"""
|
||||
|
||||
|
||||
async def main():
|
||||
from playwright.async_api import async_playwright
|
||||
async with async_playwright() as p:
|
||||
browser = await p.chromium.launch(args=["--ignore-certificate-errors"])
|
||||
ctx = await browser.new_context(ignore_https_errors=True,
|
||||
viewport={"width": 1600, "height": 900})
|
||||
page = await ctx.new_page()
|
||||
errs = []
|
||||
page.on("pageerror", lambda e: errs.append(str(e)))
|
||||
|
||||
await page.goto(f"{BASE}/workspace/draft", wait_until="domcontentloaded", timeout=120000)
|
||||
await page.wait_for_timeout(4000)
|
||||
await page.evaluate(GUARD)
|
||||
await page.reload(wait_until="domcontentloaded")
|
||||
await page.wait_for_timeout(6000)
|
||||
|
||||
inputs = page.locator("input[class*='__name__']")
|
||||
if await inputs.count() == 0:
|
||||
btn = page.get_by_text("创建项目", exact=True).first
|
||||
await btn.click()
|
||||
await page.wait_for_timeout(6000)
|
||||
if "workspace/draft" not in page.url:
|
||||
await page.goto(f"{BASE}/workspace/draft", wait_until="domcontentloaded")
|
||||
await page.wait_for_timeout(5000)
|
||||
inputs = page.locator("input[class*='__name__']")
|
||||
|
||||
# ① 列表改名
|
||||
await inputs.first.click()
|
||||
await page.keyboard.press("Control+a")
|
||||
await page.keyboard.type("LIST_RENAME_X")
|
||||
await page.keyboard.press("Tab")
|
||||
await page.wait_for_timeout(2500)
|
||||
print("①列表改名后 DB:", json.dumps(await page.evaluate(READ_META), ensure_ascii=False))
|
||||
|
||||
# ② 打开项目,看顶栏
|
||||
await page.locator("div[class*='__item__'] a").first.click()
|
||||
await page.wait_for_timeout(10000)
|
||||
inp = page.locator("#projectName")
|
||||
top = await inp.input_value() if await inp.count() else "N/A"
|
||||
print("②顶栏显示:", repr(top), "PASS" if top == "LIST_RENAME_X" else "FAIL")
|
||||
|
||||
# ③ 顶栏再改 -> 回列表
|
||||
await inp.click()
|
||||
await page.keyboard.press("Control+a")
|
||||
await page.keyboard.type("TOPBAR_RENAME_Y")
|
||||
await inp.press("Tab") # 触发失焦即时同步
|
||||
await page.wait_for_timeout(2500)
|
||||
print("③顶栏改后 DB:", json.dumps(await page.evaluate(READ_META), ensure_ascii=False))
|
||||
|
||||
await page.goto(f"{BASE}/workspace/draft", wait_until="domcontentloaded")
|
||||
await page.wait_for_timeout(6000)
|
||||
inputs2 = page.locator("input[class*='__name__']")
|
||||
v = await inputs2.first.input_value() if await inputs2.count() else "N/A"
|
||||
print("④回列表卡片名:", repr(v), "PASS" if v == "TOPBAR_RENAME_Y" else "FAIL")
|
||||
print("④DB:", json.dumps(await page.evaluate(READ_META), ensure_ascii=False))
|
||||
print("JS errors:", errs[:5])
|
||||
await browser.close()
|
||||
|
||||
|
||||
sys.exit(asyncio.run(main()))
|
||||
@@ -0,0 +1,119 @@
|
||||
#!/usr/bin/env python3
|
||||
"""复现:编辑器顶栏项目名输入框修改是否有效(即时值/落库/刷新/列表名)"""
|
||||
import sys, asyncio, json
|
||||
|
||||
BASE = "https://127.0.0.1:3005"
|
||||
GUID = None # 用现有第一个项目
|
||||
|
||||
GUARD = """async () => {
|
||||
try {
|
||||
const root = await navigator.storage.getDirectory();
|
||||
const db = await new Promise((res, rej) => {
|
||||
const rq = indexedDB.open('H5VideoLocalDB');
|
||||
rq.onupgradeneeded = () => rq.result.createObjectStore('folderHandles');
|
||||
rq.onsuccess = () => res(rq.result);
|
||||
rq.onerror = () => rej(rq.error);
|
||||
});
|
||||
await new Promise((res, rej) => {
|
||||
const tx = db.transaction('folderHandles', 'readwrite');
|
||||
const st = tx.objectStore('folderHandles');
|
||||
const rec = { id: 'root', handle: root };
|
||||
if (st.keyPath) st.put(rec); else st.put(rec, 'root');
|
||||
tx.oncomplete = () => res(true);
|
||||
tx.onerror = () => rej(tx.error);
|
||||
});
|
||||
db.close();
|
||||
return 'ok';
|
||||
} catch (e) { return String(e); }
|
||||
}"""
|
||||
|
||||
READ_META = """async () => {
|
||||
try {
|
||||
const rq = indexedDB.open('H5VideoLocalDB');
|
||||
const db = await new Promise((res, rej) => { rq.onsuccess=()=>res(rq.result); rq.onerror=()=>rej(rq.error); });
|
||||
const tx = db.transaction('projects','readonly');
|
||||
const all = await new Promise((res, rej) => {
|
||||
const r = tx.objectStore('projects').getAll();
|
||||
r.onsuccess=()=>res(r.result); r.onerror=()=>rej(r.error);
|
||||
});
|
||||
return all.map(x => ({id:x.id, name:x.name, dtitle:(x.data&&x.data.title)||null}));
|
||||
} catch(e){ return 'ERR:'+e; }
|
||||
}"""
|
||||
|
||||
|
||||
async def main():
|
||||
from playwright.async_api import async_playwright
|
||||
async with async_playwright() as p:
|
||||
browser = await p.chromium.launch(args=["--ignore-certificate-errors"])
|
||||
ctx = await browser.new_context(ignore_https_errors=True,
|
||||
viewport={"width": 1600, "height": 900})
|
||||
page = await ctx.new_page()
|
||||
errs = []
|
||||
page.on("pageerror", lambda e: errs.append(str(e)))
|
||||
|
||||
# 首页 → 列表
|
||||
await page.goto(f"{BASE}/workspace/draft", wait_until="domcontentloaded", timeout=120000)
|
||||
await page.wait_for_timeout(4000)
|
||||
await page.evaluate(GUARD)
|
||||
await page.reload(wait_until="domcontentloaded")
|
||||
await page.wait_for_timeout(6000)
|
||||
|
||||
inputs = page.locator("input[class*='__name__']")
|
||||
if await inputs.count() == 0:
|
||||
btn = page.get_by_text("创建项目", exact=True).first
|
||||
await btn.click()
|
||||
await page.wait_for_timeout(6000)
|
||||
if "workspace/draft" not in page.url:
|
||||
await page.goto(f"{BASE}/workspace/draft", wait_until="domcontentloaded")
|
||||
await page.wait_for_timeout(5000)
|
||||
inputs = page.locator("input[class*='__name__']")
|
||||
|
||||
print("列表初始:", json.dumps(await page.evaluate(READ_META), ensure_ascii=False))
|
||||
|
||||
# 打开第一个项目(卡片是无 href 的 a[onClick],内部 .pic 区域)
|
||||
a = page.locator("div[class*='__item__'] a").first
|
||||
if await a.count() == 0:
|
||||
a = page.locator("a").filter(has=page.locator("div[class*='__pic__']")).first
|
||||
await a.click()
|
||||
await page.wait_for_timeout(10000)
|
||||
print("URL:", page.url)
|
||||
|
||||
inp = page.locator("#projectName")
|
||||
print("顶栏输入框存在:", await inp.count())
|
||||
if await inp.count():
|
||||
print("顶栏初始值:", repr(await inp.input_value()))
|
||||
await inp.click()
|
||||
await page.keyboard.press("Control+a")
|
||||
await page.keyboard.type("TOPBAR_RENAME_001")
|
||||
await page.wait_for_timeout(1500)
|
||||
print("输入后立即读:", repr(await inp.input_value()))
|
||||
# 等待自动保存(10s周期)+ 主动点云保存
|
||||
cloud = page.locator("a").filter(has=page.locator("svg")).first
|
||||
try:
|
||||
await page.locator("#projectName").press("Control+s")
|
||||
except Exception:
|
||||
pass
|
||||
await page.wait_for_timeout(12000)
|
||||
print("12s后读:", repr(await inp.input_value()))
|
||||
print("DB(编辑器内):", json.dumps(await page.evaluate(READ_META), ensure_ascii=False))
|
||||
|
||||
# 刷新页面看是否保留
|
||||
await page.reload(wait_until="domcontentloaded")
|
||||
await page.wait_for_timeout(10000)
|
||||
inp2 = page.locator("#projectName")
|
||||
if await inp2.count():
|
||||
print("刷新后顶栏:", repr(await inp2.input_value()))
|
||||
print("DB(刷新后):", json.dumps(await page.evaluate(READ_META), ensure_ascii=False))
|
||||
|
||||
# 回列表看卡片名
|
||||
await page.goto(f"{BASE}/workspace/draft", wait_until="domcontentloaded")
|
||||
await page.wait_for_timeout(6000)
|
||||
inputs2 = page.locator("input[class*='__name__']")
|
||||
if await inputs2.count():
|
||||
print("列表卡片名:", repr(await inputs2.first.input_value()))
|
||||
|
||||
print("JS errors:", errs[:6])
|
||||
await browser.close()
|
||||
|
||||
|
||||
sys.exit(asyncio.run(main()))
|
||||
@@ -248,6 +248,7 @@ def main():
|
||||
} catch (e) { resUrl = 'ERR:' + e; }
|
||||
}
|
||||
return {
|
||||
title: d.title,
|
||||
first: f,
|
||||
coverResourceUrl: resUrl.slice(0, 40),
|
||||
imgCount: imgs.length,
|
||||
@@ -307,7 +308,7 @@ def main():
|
||||
const d = (window.__editor && window.__editor.movie && window.__editor.movie.data) || {};
|
||||
const els = (d.elements || []).slice().sort((a,b) => (a.startTime||0) - (b.startTime||0));
|
||||
const f = els[0] || {};
|
||||
return { firstName: f.name, firstT: f.startTime, firstD: f.duration,
|
||||
return { title: d.title, firstName: f.name, firstT: f.startTime, firstD: f.duration,
|
||||
els: els.length, caps: (d.captions||[]).length };
|
||||
}""")
|
||||
log("刷新后: " + json.dumps(after, ensure_ascii=False))
|
||||
@@ -316,6 +317,27 @@ def main():
|
||||
and after.get("firstT") is not None and abs(float(after.get("firstT"))) < 0.01
|
||||
)
|
||||
|
||||
# 断言:用户输入的标题 → 项目文件名(顶栏 title + 刷新后持久化)
|
||||
res_title = res.get("title")
|
||||
log("构建后 title: %s" % res_title)
|
||||
# AI 出片项目文件名须带【AI】前缀
|
||||
checks["title_applied_after_build"] = res_title == "【AI】封面功能端到端验证"
|
||||
checks["title_persist_after_reload"] = after.get("title") == "【AI】封面功能端到端验证"
|
||||
# 项目列表卡片名(meta.name)
|
||||
meta_name = page.evaluate("""async () => {
|
||||
try {
|
||||
const rq = indexedDB.open('H5VideoLocalDB');
|
||||
const db = await new Promise((res, rej) => { rq.onsuccess = () => res(rq.result); rq.onerror = () => rej(rq.error); });
|
||||
const id = window.__editor && window.__editor.appid;
|
||||
const tx = db.transaction('projects', 'readonly');
|
||||
const g = tx.objectStore('projects').get(id);
|
||||
const rec = await new Promise((res, rej) => { g.onsuccess = () => res(g.result); g.onerror = () => rej(g.error); });
|
||||
return (rec && rec.name) || '';
|
||||
} catch (e) { return 'ERR:' + e; }
|
||||
}""")
|
||||
log("项目卡片名: %s" % meta_name)
|
||||
checks["project_card_name"] = meta_name == "【AI】封面功能端到端验证"
|
||||
|
||||
ok = all(checks.values())
|
||||
print(json.dumps({"ok": ok, "checks": checks, "errors": errors[-5:]}, ensure_ascii=False))
|
||||
browser.close()
|
||||
|
||||
@@ -116,6 +116,15 @@ const Header = (props: IProps) => {
|
||||
>
|
||||
MCP 使用说明
|
||||
</NavLink>
|
||||
{/* 更多素材:外部资源站(MinDoc 文档),新窗口打开 */}
|
||||
<a
|
||||
href="https://doc.88531.cn/docs/mrfx/mrfx-1g99qum57n5qk"
|
||||
className={styles.text}
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
>
|
||||
更多素材
|
||||
</a>
|
||||
{/* <a
|
||||
href={languageType === 'en-US' ? '/docs/en' : '/docs'}
|
||||
target="_blank"
|
||||
|
||||
@@ -20,7 +20,7 @@ import Project from './Project';
|
||||
import { language, Intl } from '@language/index';
|
||||
import KeyboardModal from './KeyboardModal';
|
||||
import { stores } from '@stores/index';
|
||||
import { saveProject, canUseLocalSave } from '@services/localStorageService';
|
||||
import { saveProject, canUseLocalSave, updateLocalProjectMeta } from '@services/localStorageService';
|
||||
import HubStatus from '@components/hub';
|
||||
import { AiSettingsButton } from '@components/ai-settings';
|
||||
import { reURL } from '@utils/util';
|
||||
@@ -242,6 +242,18 @@ function Header(props: IProps) {
|
||||
editor.data.title = e.target.value;
|
||||
forceUpdate();
|
||||
}}
|
||||
/* 顶栏改名即项目文件名:失焦立刻写入列表(不等自动保存),
|
||||
否则用户改完名回列表看不到变化,会以为"修改无效" */
|
||||
onBlur={async () => {
|
||||
const t = (editor.data.title || '').trim();
|
||||
if (!t || !editor.appid) return;
|
||||
if (!String(editor.appid).startsWith('local_')) return; // 远程项目由保存链路处理
|
||||
try {
|
||||
await updateLocalProjectMeta(editor.appid, { name: t });
|
||||
} catch (e) {
|
||||
console.warn('同步项目文件名失败:', e);
|
||||
}
|
||||
}}
|
||||
/>
|
||||
</section>
|
||||
{/* <section className={styles.center}></section> */}
|
||||
|
||||
@@ -772,6 +772,32 @@ export default function QuickVideo({
|
||||
if (captions.length) editor.setContorlAndSelectedElemenent?.([]);
|
||||
|
||||
const transCount = fxTrans === 'none' ? 0 : Math.max(0, segs.length - 1);
|
||||
|
||||
// 项目文件名 = 用户输入的标题:顶栏标题、工程数据、项目列表卡片名三处同步
|
||||
// AI 出片的项目文件名带【AI】标识(已带前缀则不重复叠加)
|
||||
const rawTitle = title.trim();
|
||||
const projTitle = rawTitle ? (rawTitle.startsWith('【AI】') ? rawTitle : `【AI】${rawTitle}`) : '';
|
||||
if (projTitle) {
|
||||
editor.data.title = projTitle;
|
||||
// movie.data 若是独立引用,一并改掉(保存走 sortZIndexNewData)
|
||||
const md: any = (editor as any).movie?.data;
|
||||
if (md && md !== editor.data) md.title = projTitle;
|
||||
try {
|
||||
if (typeof (editor as any).saveApp === 'function') {
|
||||
await (editor as any).saveApp();
|
||||
}
|
||||
} catch (e) {
|
||||
console.warn('[qv] 保存标题失败', e);
|
||||
}
|
||||
try {
|
||||
// 本地模式:项目卡片名存的是 meta.name(saveProject 不会用 title 覆盖),需单独同步
|
||||
const { updateLocalProjectMeta } = await import('@services/localStorageService');
|
||||
await updateLocalProjectMeta(editor.appid, { name: projTitle }).catch(() => {});
|
||||
} catch (e) {
|
||||
console.warn('[qv] 同步项目名失败', e);
|
||||
}
|
||||
}
|
||||
|
||||
Toast.success(
|
||||
(cover ? '封面 + ' : '') +
|
||||
`已生成 ${segs.length} 段:图片${fxMotion === 'none' ? '' : '(带动效)'}、配音、字幕已就位` +
|
||||
|
||||
@@ -651,9 +651,12 @@ const projectFileQueue = new Map<string, Promise<void>>();
|
||||
/** 保存项目数据 */
|
||||
export async function saveProject(appId: string, data: any): Promise<void> {
|
||||
const existing = await localDB.projects.get(appId);
|
||||
/* 项目文件名跟随工程标题:顶栏改的是 data.title,此前保存时 name 恒取旧值,
|
||||
导致顶栏改名对列表文件名完全无效。title 为空则沿用原名。 */
|
||||
const titleName = typeof data?.title === 'string' && data.title.trim() ? data.title : '';
|
||||
await localDB.projects.put({
|
||||
id: appId,
|
||||
name: existing?.name || data?.name || 'Untitled',
|
||||
name: titleName || existing?.name || data?.name || 'Untitled',
|
||||
categoryId: existing?.categoryId || data?.categoryId || '0',
|
||||
thumb: existing?.thumb || data?.thumb || '',
|
||||
description: existing?.description || data?.description || '',
|
||||
@@ -826,7 +829,14 @@ export async function updateLocalProjectMeta(
|
||||
): Promise<[any, string | null]> {
|
||||
const record = await localDB.projects.get(id);
|
||||
if (!record) return [null, '项目不存在'];
|
||||
if (params.name !== undefined) record.name = params.name;
|
||||
if (params.name !== undefined) {
|
||||
record.name = params.name;
|
||||
/* 文件名与工程标题双向一致:列表改名时同步 data.title,
|
||||
否则打开编辑器顶栏仍显示旧标题(两处各存各的会分叉) */
|
||||
if (params.name && record.data && typeof record.data === 'object') {
|
||||
(record.data as any).title = params.name;
|
||||
}
|
||||
}
|
||||
if (params.category_id !== undefined) record.categoryId = String(params.category_id);
|
||||
if (params.thumb !== undefined) record.thumb = params.thumb;
|
||||
if (params.description !== undefined) record.description = params.description;
|
||||
|
||||
Reference in new issue
Block a user