Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 42 additions & 1 deletion e2e/regression/realtime-collaboration.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { randomUUID } from "node:crypto";
import { test, expect, type APIRequestContext, type Browser } from "@playwright/test";
import { test, expect, type APIRequestContext, type Browser, type Request } from "@playwright/test";

const APP_URL = process.env.PLAYWRIGHT_BASE_URL ?? "http://localhost:3000";
const SUPABASE_URL = process.env.NEXT_PUBLIC_SUPABASE_URL ?? process.env.SUPABASE_URL ?? "http://127.0.0.1:54321";
Expand Down Expand Up @@ -283,7 +283,7 @@
await contributor.page.keyboard.press("Enter");

await expect(contributor.page.getByText(issueTitle).first()).toBeVisible();
await expect(owner.page.getByText(issueTitle).first()).toBeVisible();

Check failure on line 286 in e2e/regression/realtime-collaboration.spec.ts

View workflow job for this annotation

GitHub Actions / E2E Tests 12/16

[chromium] › e2e/regression/realtime-collaboration.spec.ts:255:7 › Realtime collaboration and series participation › participants can contribute and other live participants see the item without reload

1) [chromium] › e2e/regression/realtime-collaboration.spec.ts:255:7 › Realtime collaboration and series participation › participants can contribute and other live participants see the item without reload Retry #2 ─────────────────────────────────────────────────────────────────────────────────────── Error: expect(locator).toBeVisible() failed Locator: getByText('Realtime participant issue 1780719289666').first() Expected: visible Timeout: 10000ms Error: element(s) not found Call log: - Expect "toBeVisible" with timeout 10000ms - waiting for getByText('Realtime participant issue 1780719289666').first() 284 | 285 | await expect(contributor.page.getByText(issueTitle).first()).toBeVisible(); > 286 | await expect(owner.page.getByText(issueTitle).first()).toBeVisible(); | ^ 287 | } finally { 288 | await owner.context.close(); 289 | await contributor.context.close(); at /home/runner/work/minutia/minutia/e2e/regression/realtime-collaboration.spec.ts:286:64

Check failure on line 286 in e2e/regression/realtime-collaboration.spec.ts

View workflow job for this annotation

GitHub Actions / E2E Tests 12/16

[chromium] › e2e/regression/realtime-collaboration.spec.ts:255:7 › Realtime collaboration and series participation › participants can contribute and other live participants see the item without reload

1) [chromium] › e2e/regression/realtime-collaboration.spec.ts:255:7 › Realtime collaboration and series participation › participants can contribute and other live participants see the item without reload Retry #1 ─────────────────────────────────────────────────────────────────────────────────────── Error: expect(locator).toBeVisible() failed Locator: getByText('Realtime participant issue 1780719267979').first() Expected: visible Timeout: 10000ms Error: element(s) not found Call log: - Expect "toBeVisible" with timeout 10000ms - waiting for getByText('Realtime participant issue 1780719267979').first() 284 | 285 | await expect(contributor.page.getByText(issueTitle).first()).toBeVisible(); > 286 | await expect(owner.page.getByText(issueTitle).first()).toBeVisible(); | ^ 287 | } finally { 288 | await owner.context.close(); 289 | await contributor.context.close(); at /home/runner/work/minutia/minutia/e2e/regression/realtime-collaboration.spec.ts:286:64

Check failure on line 286 in e2e/regression/realtime-collaboration.spec.ts

View workflow job for this annotation

GitHub Actions / E2E Tests 12/16

[chromium] › e2e/regression/realtime-collaboration.spec.ts:255:7 › Realtime collaboration and series participation › participants can contribute and other live participants see the item without reload

1) [chromium] › e2e/regression/realtime-collaboration.spec.ts:255:7 › Realtime collaboration and series participation › participants can contribute and other live participants see the item without reload Error: expect(locator).toBeVisible() failed Locator: getByText('Realtime participant issue 1780719247787').first() Expected: visible Timeout: 10000ms Error: element(s) not found Call log: - Expect "toBeVisible" with timeout 10000ms - waiting for getByText('Realtime participant issue 1780719247787').first() 284 | 285 | await expect(contributor.page.getByText(issueTitle).first()).toBeVisible(); > 286 | await expect(owner.page.getByText(issueTitle).first()).toBeVisible(); | ^ 287 | } finally { 288 | await owner.context.close(); 289 | await contributor.context.close(); at /home/runner/work/minutia/minutia/e2e/regression/realtime-collaboration.spec.ts:286:64
} finally {
await owner.context.close();
await contributor.context.close();
Expand All @@ -293,4 +293,45 @@
await deleteAuthUser(request, participantId);
}
});

test("meeting page relies on realtime, not a 2s polling timer", async ({
browser,
request,
}) => {
const orgId = await getCurrentOrgId(request);
const seriesId = await createSeries(request, orgId, `No-poll meeting ${Date.now()}`);
const meetingId = await createMeeting(request, seriesId, "live");

try {
await addSeriesParticipant(request, seriesId, TEST_USER_ID, "owner");
const { context, page } = await newAuthedPage(browser, request, TEST_USER_EMAIL);

try {
await page.goto(`${APP_URL}/series/${seriesId}/meetings/${meetingId}`);
await expect(page.getByText("Live").first()).toBeVisible();

// Let the initial load and any refetch-on-mount settle.
await page.waitForTimeout(1500);

// Count meeting refetches during a quiet, idle window. The removed
// setInterval(refreshMeeting, 2000) fired roughly twice in 5s, each
// invalidating the meeting detail and list queries, so the old code
// produced several /rest/v1/meetings refetches here. Realtime is
// event-driven, so an idle page must issue none.
let meetingFetches = 0;
const onRequest = (req: Request) => {
if (req.url().includes("/rest/v1/meetings?select=")) meetingFetches += 1;
};
page.on("request", onRequest);
await page.waitForTimeout(5000);
page.off("request", onRequest);

expect(meetingFetches).toBeLessThan(2);
} finally {
await context.close();
}
} finally {
await rest(request, `meeting_series?id=eq.${seriesId}`, { method: "DELETE", headers: serviceHeaders("return=minimal") }).catch(() => undefined);
}
});
});
2 changes: 0 additions & 2 deletions src/lib/hooks/use-meetings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,10 +231,8 @@ export function useMeetingRealtime(meetingId: string, seriesId: string) {
refreshMeeting
)
.subscribe();
const interval = window.setInterval(refreshMeeting, 2000);

return () => {
window.clearInterval(interval);
void supabase.removeChannel(channel);
};
}, [meetingId, queryClient, seriesId]);
Expand Down
Loading