修复断线提示开关写入错误导致英文提示仍然出现

This commit is contained in:
magicwang1111
2026-10-28 11:43:51 +08:00
parent b9eb357571
commit 0cfaf01747
3 changed files with 9 additions and 4 deletions
+3 -1
View File
@@ -12,6 +12,7 @@ function harness() {
};
const app = {
isGraphReady: true,
ui: { settings: { settingsValues: {} } },
graphToPrompt: async () => ({ workflow: { nodes: [] } }),
extensionManager: {
workflow: { openWorkflows: [] },
@@ -98,7 +99,8 @@ test('disconnect shows one waiting notification and reconnect removes it', async
h.events.get('reconnecting')();
assert.equal(h.toasts.length, 1);
assert.equal(h.toasts[0].summary, '服务器连接已断开,正在等待恢复');
assert.equal(h.app.extensionManager.setting.settings['Comfy.Toast.DisableReconnectingToast'], true);
assert.equal(h.app.ui.settings.settingsValues['Comfy.Toast.DisableReconnectingToast'], true);
assert.equal(h.app.extensionManager.setting.settings['Comfy.Toast.DisableReconnectingToast'], undefined);
await h.events.get('reconnected')();
assert.equal(h.toasts.length, 0);
h.events.get('reconnecting')();
+4 -1
View File
@@ -81,6 +81,8 @@ async function draftImages(page) {
const browser = await chromium.launch({ headless: true, executablePath: process.env.PLAYWRIGHT_CHROMIUM_EXECUTABLE || undefined });
try {
const connection = await harness(browser);
assert.equal(await connection.page.evaluate(() =>
window.comfyAPI.app.app.extensionManager.setting.get('Comfy.Toast.DisableReconnectingToast')), true);
const connectionBefore = connection.navigations();
const waiting = connection.page.getByText('服务器连接已断开,正在等待恢复', { exact: true });
for (let cycle = 0; cycle < 2; cycle++) {
@@ -97,8 +99,9 @@ async function draftImages(page) {
connection.state.disconnected = true;
await connection.sockets.at(-1).close({ code: 1001, reason: 'Test server shutdown' });
await waiting.waitFor();
await connection.page.waitForTimeout(1500);
await connection.page.waitForTimeout(6000);
assert.equal(await waiting.count(), 1);
assert.equal(await connection.page.getByText('Reconnecting', { exact: true }).count(), 0);
assert.equal(await connection.page.getByText('自动刷新已暂停', { exact: true }).count(), 0);
connection.state.disconnected = false;
await waiting.waitFor({ state: 'hidden' });
+2 -2
View File
@@ -142,7 +142,7 @@ async function checkForUpdate() {
}
reloading = true;
// Change only the in-memory preference; the saved setting returns after reload.
app.extensionManager.setting.settings["Comfy.Window.UnloadConfirmation"] = false;
app.ui.settings.settingsValues["Comfy.Window.UnloadConfirmation"] = false;
window.location.reload();
} finally {
busy = false;
@@ -158,7 +158,7 @@ app.registerExtension({
name: "ComfyUI.AccountManager.AutoRefresh",
setup() {
// Replace the built-in reconnect toast for this page only (do not save the setting).
app.extensionManager.setting.settings["Comfy.Toast.DisableReconnectingToast"] = true;
app.ui.settings.settingsValues["Comfy.Toast.DisableReconnectingToast"] = true;
const onDisconnect = () => {
if (!disconnected) {
connectionToast = {