Skip to content

Commit 67a5f87

Browse files
committed
🧪 [test] Trigger published upgrades through preload
🧪 [test] Invoke the legacy installUpdate preload API after the updater cache and restart menu confirm the download is ready. 🐛 [fix] Avoid relying on the renderer menu round-trip, which can leave the automated upgrade waiting after the installer has downloaded.
1 parent 589db97 commit 67a5f87

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

tests/playwright/published-upgrade.spec.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -134,13 +134,16 @@ test("published Windows release upgrades through the previous app", async ({
134134
const closePromise = electronApp.waitForEvent("close", {
135135
timeout: updateInstallHandoffTimeoutMs,
136136
});
137-
const restartTriggered = await electronApp.evaluate(({ Menu }) => {
138-
const restartItem =
139-
Menu.getApplicationMenu()?.getMenuItemById("restart-update");
140-
if (!restartItem?.enabled) {
137+
const restartTriggered = await page.evaluate(() => {
138+
const electronApi = (
139+
globalThis as typeof globalThis & {
140+
electronAPI?: { installUpdate?: () => void };
141+
}
142+
).electronAPI;
143+
if (typeof electronApi?.installUpdate !== "function") {
141144
return false;
142145
}
143-
restartItem.click();
146+
electronApi.installUpdate();
144147
return true;
145148
});
146149
expect(restartTriggered).toBe(true);
@@ -153,7 +156,7 @@ test("published Windows release upgrades through the previous app", async ({
153156
fromVersion: configuration.fromVersion,
154157
installHandoffCompleted: true,
155158
notificationActionVisible,
156-
restartTrigger: "application-menu",
159+
restartTrigger: "preload-install-update",
157160
toVersion: configuration.toVersion,
158161
},
159162
null,

0 commit comments

Comments
 (0)