chore: fix flaky tests (#7778)

This commit is contained in:
Louis Lam authored and GitHub committed 2026-08-27 09:59:53 +08:00
1 parent baf83f59da
commit ca57c5e9bb
2 files changed
+13 -6

No files matched your search

+2 -2
View File
@@ -48,9 +48,9 @@ describe("SystemServiceMonitorType", { skip: shouldSkip() }, () => {
});
test("check() returns UP for a running service", async () => {
// Windows: 'Dnscache' is always running.
// Windows: 'EventLog' is always running.
// Linux: 'dbus' or 'cron' are standard services.
const serviceName = process.platform === "win32" ? "Dnscache" : "dbus";
const serviceName = process.platform === "win32" ? "EventLog" : "dbus";
const monitor = {
system_service_name: serviceName,
+11 -4
View File
@@ -308,10 +308,17 @@ test.describe("Status Page", () => {
await page.getByTestId("save-button").click();
await expect(page.getByTestId("edit-sidebar")).toHaveCount(0);
// Fetch RSS feed again - should use custom RSS title
const rssResponseCustom = await page.request.get("/status/security-test/rss");
expect(rssResponseCustom.status()).toBe(200);
const rssContentCustom = await rssResponseCustom.text();
// Fetch RSS feed again - retry until custom title appears (DB write may not be committed yet)
let rssContentCustom;
for (let i = 0; i < 10; i++) {
const rssResponseCustom = await page.request.get("/status/security-test/rss");
expect(rssResponseCustom.status()).toBe(200);
rssContentCustom = await rssResponseCustom.text();
if (rssContentCustom.includes(`<title>${customRssTitle}</title>`)) {
break;
}
await page.waitForTimeout(500);
}
// Verify RSS feed uses custom title
expect(rssContentCustom).toContain(`<title>${customRssTitle}</title>`);