mirror of
https://github.com/louislam/uptime-kuma.git
synced 2026-10-13 17:02:17 -05:00
chore: fix flaky tests (#7778)
This commit is contained in:
1 parent
baf83f59da
commit
ca57c5e9bb
2 files changed
+13
-6
No files matched your search
@@ -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,
|
||||
|
||||
@@ -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>`);
|
||||
|
||||
Reference in new issue
Block a user