A stalled server no longer reads as "your clock is ahead" #251
@@ -257,12 +257,21 @@ test.describe('local homeserver regression', () => {
|
||||
await page.clock.install({ time: Date.now() + 14 * 60 * 1000 });
|
||||
await loginUI(page, alice);
|
||||
await openRoom(page, room);
|
||||
for (let i = 0; i < 4; i += 1) {
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
await sendText(bob, room, `tick ${i}`);
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
await page.waitForTimeout(500);
|
||||
}
|
||||
const ticks = async (from: number, n: number) => {
|
||||
for (let i = from; i < from + n; i += 1) {
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
await sendText(bob, room, `tick ${i}`);
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
await page.waitForTimeout(500);
|
||||
}
|
||||
};
|
||||
await ticks(0, 4);
|
||||
// "Ahead" could be a late delivery (a stalled server), so it is only
|
||||
// reported once it has held for a minute of fresh samples.
|
||||
await page.waitForTimeout(2000);
|
||||
await expect(page.getByText(/clock is .*ahead of the server/)).toHaveCount(0);
|
||||
await page.clock.fastForward('01:05');
|
||||
await ticks(4, 2);
|
||||
await expect(page.getByText(/clock is .*14 minutes ahead of the server/)).toBeVisible();
|
||||
await page.getByRole('button', { name: 'Dismiss for 24 h' }).click();
|
||||
await expect(page.getByText(/clock is .*ahead of the server/)).toHaveCount(0);
|
||||
|
||||
Reference in New Issue
Block a user