Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:bug: Render mobile Electron tests offscreen https://github.com/siyuan-note/siyuan/issues/20481

Daniel05588a931622
diff --git a/app/tests/iosTouchCaret.test.js b/app/tests/iosTouchCaret.test.js
index 5660fa1078..03c32a7817 100644
--- a/app/tests/iosTouchCaret.test.js
+++ b/app/tests/iosTouchCaret.test.js
@@ -375,8 +375,10 @@ const runElectron = async () => {
app.setPath("userData", process.argv[2]);
app.commandLine.appendSwitch("disable-gpu");
await app.whenReady();
- // 字符坐标和原生选区校正依赖实际渲染帧,测试窗口保持可见。
- const win = new BrowserWindow({show: true, webPreferences: {nodeIntegration: true, contextIsolation: false}});
+ // 离屏渲染持续推进字符坐标和原生选区校正所需的渲染帧。
+ const win = new BrowserWindow({show: false, webPreferences: {
+ nodeIntegration: true, contextIsolation: false, offscreen: true, backgroundThrottling: false,
+ }});
let exitCode = 0;
try {
await win.loadURL("data:text/html,<html><body></body></html>");
diff --git a/app/tests/mobileEditingToolbar.test.js b/app/tests/mobileEditingToolbar.test.js
index b4cea9a47e..21864245f6 100644
--- a/app/tests/mobileEditingToolbar.test.js
+++ b/app/tests/mobileEditingToolbar.test.js
@@ -313,9 +313,9 @@ const runElectron = async () => {
app.setPath("userData", process.argv[2]);
app.commandLine.appendSwitch("disable-gpu");
await app.whenReady();
- // 工具栏位置和选区滚动依赖实际渲染帧,测试窗口保持可见。
- const win = new BrowserWindow({show: true, width: 400, height: 800,
- webPreferences: {nodeIntegration: true, contextIsolation: false, backgroundThrottling: false}});
+ // 离屏渲染持续推进工具栏定位和选区滚动所需的渲染帧。
+ const win = new BrowserWindow({show: false, width: 400, height: 800,
+ webPreferences: {nodeIntegration: true, contextIsolation: false, offscreen: true, backgroundThrottling: false}});
let exitCode = 0;
try {
const ts = require("typescript");