Scripted multi-client harness against a real server (~110 scenario tests, server-control, managed-websocket, test-runner). Wires the new package into frontend/package.json workspaces and the lint script. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
77 lines
2.1 KiB
TypeScript
77 lines
2.1 KiB
TypeScript
import type { AssertableState } from "../utils/assertable-state";
|
|
import type { TestDefinition } from "../test-definition";
|
|
|
|
export const doubleOfflineCycleTest: TestDefinition = {
|
|
description:
|
|
"Client 0 goes through three offline-edit-reconnect cycles. " +
|
|
"Each offline edit must propagate to client 1 after reconnection.",
|
|
clients: 2,
|
|
steps: [
|
|
{
|
|
type: "create",
|
|
client: 0,
|
|
path: "doc.md",
|
|
content: "initial"
|
|
},
|
|
{ type: "enable-sync", client: 0 },
|
|
{ type: "enable-sync", client: 1 },
|
|
{ type: "barrier" },
|
|
{
|
|
type: "assert-consistent",
|
|
verify: (s: AssertableState): void => {
|
|
s.assertContent("doc.md", "initial");
|
|
}
|
|
},
|
|
|
|
{ type: "disable-sync", client: 0 },
|
|
{
|
|
type: "update",
|
|
client: 0,
|
|
path: "doc.md",
|
|
content: "first edit"
|
|
},
|
|
|
|
{ type: "enable-sync", client: 0 },
|
|
{ type: "barrier" },
|
|
{
|
|
type: "assert-consistent",
|
|
verify: (s: AssertableState): void => {
|
|
s.assertContent("doc.md", "first edit");
|
|
}
|
|
},
|
|
|
|
{ type: "disable-sync", client: 0 },
|
|
{
|
|
type: "update",
|
|
client: 0,
|
|
path: "doc.md",
|
|
content: "second edit"
|
|
},
|
|
|
|
{ type: "enable-sync", client: 0 },
|
|
{ type: "barrier" },
|
|
{
|
|
type: "assert-consistent",
|
|
verify: (s: AssertableState): void => {
|
|
s.assertContent("doc.md", "second edit");
|
|
}
|
|
},
|
|
|
|
{ type: "disable-sync", client: 0 },
|
|
{
|
|
type: "update",
|
|
client: 0,
|
|
path: "doc.md",
|
|
content: "third edit"
|
|
},
|
|
|
|
{ type: "enable-sync", client: 0 },
|
|
{ type: "barrier" },
|
|
{
|
|
type: "assert-consistent",
|
|
verify: (s: AssertableState): void => {
|
|
s.assertFileCount(1).assertContent("doc.md", "third edit");
|
|
}
|
|
}
|
|
]
|
|
};
|