@zsailer/jupyter-server-side-documents-conformance 0.0.0-stage → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/COVERAGE.md +56 -0
- package/README.md +139 -2
- package/adapters/generic.ts +17 -0
- package/adapters/http.ts +84 -0
- package/bin/args.mjs +202 -0
- package/bin/conformance.mjs +303 -0
- package/bin/picker.mjs +256 -0
- package/bin/welcome.mjs +95 -0
- package/known-gaps/README.md +12 -0
- package/known-gaps/jsd.json +1 -0
- package/package.json +25 -4
- package/playwright.config.ts +32 -0
- package/runtime/adapter.ts +60 -0
- package/runtime/cells.ts +99 -0
- package/runtime/network.ts +84 -0
- package/runtime/recording.ts +159 -0
- package/runtime/report.ts +135 -0
- package/runtime/reporter.ts +60 -0
- package/runtime/story.ts +482 -0
- package/runtime/tab.ts +364 -0
- package/runtime/types.ts +63 -0
- package/scripts/summarize.py +100 -0
- package/server/conformance_config.py +48 -0
- package/server/jsd_control.py +91 -0
- package/stories.json +981 -0
- package/tests/generated/ai.spec.ts +450 -0
- package/tests/generated/crash.spec.ts +267 -0
- package/tests/generated/edges.spec.ts +549 -0
- package/tests/generated/files.spec.ts +237 -0
- package/tests/generated/handshake.spec.ts +429 -0
- package/tests/generated/lineage.spec.ts +241 -0
- package/tests/generated/outputs.spec.ts +258 -0
- package/tests/generated/rebuild.spec.ts +446 -0
- package/tests/generated/residual.spec.ts +356 -0
- package/tests/generated/stop.spec.ts +168 -0
- package/tsconfig.json +14 -0
|
@@ -0,0 +1,549 @@
|
|
|
1
|
+
// GENERATED by compliance/generate.py from the storyboards. Do not edit: change the storyboard, or oracle.yaml, and generate again.
|
|
2
|
+
import { test } from '@jupyterlab/galata';
|
|
3
|
+
import { E, story } from '../../runtime/story';
|
|
4
|
+
|
|
5
|
+
// The tab opened the notebook and has not changed anything yet. Its connection drops, the user adds a cell, and the tab reconnects to the same server.
|
|
6
|
+
test(
|
|
7
|
+
...story(
|
|
8
|
+
{
|
|
9
|
+
"id": "C",
|
|
10
|
+
"group": "edges",
|
|
11
|
+
"title": "A tab that has only been reading adds a cell while offline",
|
|
12
|
+
"requires": []
|
|
13
|
+
},
|
|
14
|
+
async s => {
|
|
15
|
+
await s.notebook(["c0", "c1", "c2"]);
|
|
16
|
+
const tab = s.tab("tab");
|
|
17
|
+
|
|
18
|
+
await s.step(1, "Your tab", "opens the notebook", async () => {
|
|
19
|
+
await tab.open();
|
|
20
|
+
await s.expectTab(tab, ["c0", "c1", "c2"]);
|
|
21
|
+
});
|
|
22
|
+
await s.step(2, "Your tab", "loses its connection", async () => {
|
|
23
|
+
await tab.goOffline();
|
|
24
|
+
});
|
|
25
|
+
await s.step(3, "Your tab", "adds a cell “offline edit”", async () => {
|
|
26
|
+
await tab.addCell(3, "offline edit");
|
|
27
|
+
await s.expectTab(tab, ["c0", "c1", "c2", "offline edit"]);
|
|
28
|
+
});
|
|
29
|
+
await s.step(4, "Your tab", "reconnects", async () => {
|
|
30
|
+
await tab.goOnline();
|
|
31
|
+
});
|
|
32
|
+
await s.step(5, "Server", "receives the new cell", async () => {
|
|
33
|
+
// nothing for a test to do: the storyboard states what is so
|
|
34
|
+
});
|
|
35
|
+
await s.step(6, "File on disk", "autosave", async () => {
|
|
36
|
+
// nothing for a test to do: the storyboard states what is so
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
await s.ends([
|
|
40
|
+
{ label: "As the story ends", ends: { tab: ["c0", "c1", "c2", "offline edit"], server: ["c0", "c1", "c2", "offline edit"], file: ["c0", "c1", "c2", "offline edit"] } },
|
|
41
|
+
]);
|
|
42
|
+
}
|
|
43
|
+
)
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
// A user who may only read the notebook has it open. The connection drops and comes back. Nothing about the notebook has changed.
|
|
47
|
+
test(
|
|
48
|
+
...story(
|
|
49
|
+
{
|
|
50
|
+
"id": "E",
|
|
51
|
+
"group": "edges",
|
|
52
|
+
"title": "A view-only user reconnects",
|
|
53
|
+
"requires": []
|
|
54
|
+
},
|
|
55
|
+
async s => {
|
|
56
|
+
await s.notebook(["c0", "c1", "c2"]);
|
|
57
|
+
const tab = s.tab("tab");
|
|
58
|
+
|
|
59
|
+
await s.step(1, "View-only tab", "opens the notebook, view only", async () => {
|
|
60
|
+
await tab.open();
|
|
61
|
+
await s.expectTab(tab, ["c0", "c1", "c2"]);
|
|
62
|
+
});
|
|
63
|
+
await s.step(2, "View-only tab", "loses its connection", async () => {
|
|
64
|
+
await tab.goOffline();
|
|
65
|
+
});
|
|
66
|
+
await s.step(3, "View-only tab", "reconnects, still view only", async () => {
|
|
67
|
+
await tab.goOnline();
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
await s.ends([
|
|
71
|
+
{ label: "As the story ends", ends: { tab: ["c0", "c1", "c2"], server: ["c0", "c1", "c2"], file: ["c0", "c1", "c2"] } },
|
|
72
|
+
]);
|
|
73
|
+
}
|
|
74
|
+
)
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
// A tab sends one last message and its connection dies. The server must deal with that message without stopping, so that the next person who opens the notebook is served.
|
|
78
|
+
test(
|
|
79
|
+
...story(
|
|
80
|
+
{
|
|
81
|
+
"id": "F",
|
|
82
|
+
"group": "edges",
|
|
83
|
+
"title": "A tab that left does not freeze the notebook for the others",
|
|
84
|
+
"requires": [
|
|
85
|
+
"wireFaults"
|
|
86
|
+
]
|
|
87
|
+
},
|
|
88
|
+
async s => {
|
|
89
|
+
await s.notebook(["c0", "c1", "c2"]);
|
|
90
|
+
const tab = s.tab("tab");
|
|
91
|
+
const tab2 = s.tab("tab2");
|
|
92
|
+
|
|
93
|
+
await s.step(1, "Tab that leaves", "opens the notebook", async () => {
|
|
94
|
+
await tab.open();
|
|
95
|
+
await s.expectTab(tab, ["c0", "c1", "c2"]);
|
|
96
|
+
});
|
|
97
|
+
await s.step(2, "Tab that leaves", "sends a last message, but its answer never arrives", async () => {
|
|
98
|
+
await s.wireFault("lose-reply", tab);
|
|
99
|
+
});
|
|
100
|
+
await s.step(3, "Server", "waits, then stops waiting for this tab", async () => {
|
|
101
|
+
// waits, then stops waiting for this tab: the backend's adapter causes this
|
|
102
|
+
});
|
|
103
|
+
await s.step(4, "Server", "reaches the tab's last message and deals with it without stopping", async () => {
|
|
104
|
+
// nothing for a test to do: the storyboard states what is so
|
|
105
|
+
});
|
|
106
|
+
await s.step(5, "Newcomer", "a newcomer opens the notebook", async () => {
|
|
107
|
+
await tab2.open();
|
|
108
|
+
await s.expectTab(tab2, ["c0", "c1", "c2"]);
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
await s.ends([
|
|
112
|
+
{ label: "As the story ends", ends: { tab2: ["c0", "c1", "c2"], server: ["c0", "c1", "c2"] } },
|
|
113
|
+
]);
|
|
114
|
+
}
|
|
115
|
+
)
|
|
116
|
+
);
|
|
117
|
+
|
|
118
|
+
// The tab types while it is offline, the server builds the notebook again, and the tab reconnects, but its browser is busy and the answer reaches the server only after the five-second wait.
|
|
119
|
+
test(
|
|
120
|
+
...story(
|
|
121
|
+
{
|
|
122
|
+
"id": "G2",
|
|
123
|
+
"group": "edges",
|
|
124
|
+
"title": "A late answer after typing offline",
|
|
125
|
+
"requires": [
|
|
126
|
+
"releaseRoom",
|
|
127
|
+
"wireFaults"
|
|
128
|
+
]
|
|
129
|
+
},
|
|
130
|
+
async s => {
|
|
131
|
+
await s.notebook(["c0", "c1", "c2"]);
|
|
132
|
+
const tab = s.tab("tab");
|
|
133
|
+
|
|
134
|
+
await s.step(1, "Your tab", "opens the notebook", async () => {
|
|
135
|
+
await tab.open();
|
|
136
|
+
await s.expectTab(tab, ["c0", "c1", "c2"]);
|
|
137
|
+
});
|
|
138
|
+
await s.step(2, "Your tab", "loses its connection", async () => {
|
|
139
|
+
await tab.goOffline();
|
|
140
|
+
});
|
|
141
|
+
await s.step(3, "Your tab", "types “+OFFLINE” into c0", async () => {
|
|
142
|
+
await tab.type(0, " +OFFLINE");
|
|
143
|
+
await s.expectTab(tab, ["c0 +OFFLINE", "c1", "c2"]);
|
|
144
|
+
});
|
|
145
|
+
await s.step(4, "Server", "lets go of the notebook, then builds it again from the file", async () => {
|
|
146
|
+
await s.releaseRoom();
|
|
147
|
+
});
|
|
148
|
+
await s.step(5, "Your tab", "reconnects; the browser is busy, so its answer is slow", async () => {
|
|
149
|
+
await tab.goOnline();
|
|
150
|
+
});
|
|
151
|
+
await s.step(6, "Server", "waits five seconds, then carries on; the tab stays connected", async () => {
|
|
152
|
+
// waits five seconds, then carries on; the tab stays connected: the backend's adapter causes this
|
|
153
|
+
});
|
|
154
|
+
await s.step(7, "Your tab", "the answer arrives after the wait", async () => {
|
|
155
|
+
await s.wireFault("late-reply", tab);
|
|
156
|
+
});
|
|
157
|
+
await s.step(8, "Server", "uses it: the typing is in the notebook", async () => {
|
|
158
|
+
// nothing for a test to do: the storyboard states what is so
|
|
159
|
+
});
|
|
160
|
+
await s.step(9, "Your tab", "the connection drops once more", async () => {
|
|
161
|
+
await tab.goOffline();
|
|
162
|
+
});
|
|
163
|
+
await s.step(10, "Your tab", "reconnects again", async () => {
|
|
164
|
+
await tab.goOnline();
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
await s.ends([
|
|
168
|
+
{ label: "As the story ends", ends: { tab: ["c0 +OFFLINE", "c1", "c2"], server: ["c0 +OFFLINE", "c1", "c2"], file: ["c0 +OFFLINE", "c1", "c2"] } },
|
|
169
|
+
]);
|
|
170
|
+
}
|
|
171
|
+
)
|
|
172
|
+
);
|
|
173
|
+
|
|
174
|
+
// Like the story of the second tab that types while offline, but its browser is busy and the answer reaches the server only after the five-second wait.
|
|
175
|
+
test(
|
|
176
|
+
...story(
|
|
177
|
+
{
|
|
178
|
+
"id": "G3",
|
|
179
|
+
"group": "edges",
|
|
180
|
+
"title": "A second tab types offline and its answer is late",
|
|
181
|
+
"requires": [
|
|
182
|
+
"wireFaults"
|
|
183
|
+
]
|
|
184
|
+
},
|
|
185
|
+
async s => {
|
|
186
|
+
await s.notebook(["c0", "c1", "c2"]);
|
|
187
|
+
const tab = s.tab("tab");
|
|
188
|
+
const tab2 = s.tab("tab2");
|
|
189
|
+
|
|
190
|
+
await s.step(1, "First tab", "opens the notebook", async () => {
|
|
191
|
+
await tab.open();
|
|
192
|
+
await s.expectTab(tab, ["c0", "c1", "c2"]);
|
|
193
|
+
});
|
|
194
|
+
await s.step(2, "Second tab", "opens the same notebook", async () => {
|
|
195
|
+
await tab2.open();
|
|
196
|
+
await s.expectTab(tab2, ["c0", "c1", "c2"]);
|
|
197
|
+
});
|
|
198
|
+
await s.step(3, "Second tab", "loses its connection", async () => {
|
|
199
|
+
await tab2.goOffline();
|
|
200
|
+
});
|
|
201
|
+
await s.step(4, "Second tab", "rewrites c0 as “EDITED OFFLINE”", async () => {
|
|
202
|
+
await tab2.rewrite(0, "EDITED OFFLINE");
|
|
203
|
+
await s.expectTab(tab2, ["EDITED OFFLINE", "c1", "c2"]);
|
|
204
|
+
});
|
|
205
|
+
await s.step(5, "Second tab", "reconnects; the browser is busy, so its answer is slow", async () => {
|
|
206
|
+
await tab2.goOnline();
|
|
207
|
+
});
|
|
208
|
+
await s.step(6, "Server", "waits five seconds, then carries on; nobody is disconnected", async () => {
|
|
209
|
+
// waits five seconds, then carries on; nobody is disconnected: the backend's adapter causes this
|
|
210
|
+
});
|
|
211
|
+
await s.step(7, "Second tab", "the answer arrives after the wait", async () => {
|
|
212
|
+
await s.wireFault("late-reply", tab2);
|
|
213
|
+
});
|
|
214
|
+
await s.step(8, "Server", "uses it: the typing is in the notebook", async () => {
|
|
215
|
+
// nothing for a test to do: the storyboard states what is so
|
|
216
|
+
});
|
|
217
|
+
await s.step(9, "File on disk", "autosave", async () => {
|
|
218
|
+
// nothing for a test to do: the storyboard states what is so
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
await s.ends([
|
|
222
|
+
{ label: "As the story ends", ends: { tab: ["EDITED OFFLINE", "c1", "c2"], tab2: ["EDITED OFFLINE", "c1", "c2"], server: ["EDITED OFFLINE", "c1", "c2"], file: ["EDITED OFFLINE", "c1", "c2"] } },
|
|
223
|
+
]);
|
|
224
|
+
}
|
|
225
|
+
)
|
|
226
|
+
);
|
|
227
|
+
|
|
228
|
+
// Like the story of two out-of-date tabs, but B also received the work of a second collaborator V, which A never saw. Then the server builds the notebook again, and A comes back first, B second.
|
|
229
|
+
test(
|
|
230
|
+
...story(
|
|
231
|
+
{
|
|
232
|
+
"id": "H3",
|
|
233
|
+
"group": "edges",
|
|
234
|
+
"title": "Two out-of-date tabs, one also holding the work of a second collaborator",
|
|
235
|
+
"requires": [
|
|
236
|
+
"releaseRoom"
|
|
237
|
+
]
|
|
238
|
+
},
|
|
239
|
+
async s => {
|
|
240
|
+
await s.notebook(["c0", "c1", "c2"]);
|
|
241
|
+
const tab = s.tab("tab");
|
|
242
|
+
const tab2 = s.tab("tab2");
|
|
243
|
+
const tab3 = s.tab("tab3");
|
|
244
|
+
const tab4 = s.tab("tab4");
|
|
245
|
+
|
|
246
|
+
await s.step(1, "Tab A + Tab B + Collaborator W + Collaborator V", "A, B, W and V open the notebook", async () => {
|
|
247
|
+
await tab.open();
|
|
248
|
+
await s.expectTab(tab, ["c0", "c1", "c2"]);
|
|
249
|
+
await tab2.open();
|
|
250
|
+
await s.expectTab(tab2, ["c0", "c1", "c2"]);
|
|
251
|
+
await tab3.open();
|
|
252
|
+
await s.expectTab(tab3, ["c0", "c1", "c2"]);
|
|
253
|
+
await tab4.open();
|
|
254
|
+
await s.expectTab(tab4, ["c0", "c1", "c2"]);
|
|
255
|
+
});
|
|
256
|
+
await s.step(2, "Collaborator W", "W adds a cell “X-1”", async () => {
|
|
257
|
+
await tab3.addCell(3, "X-1");
|
|
258
|
+
await s.settle(tab3);
|
|
259
|
+
});
|
|
260
|
+
await s.step(3, "Tab A + Tab B", "A and B receive X-1", async () => {
|
|
261
|
+
await s.expectTabEventually(tab, ["c0", "c1", "c2", "X-1"]);
|
|
262
|
+
await s.expectTabEventually(tab2, ["c0", "c1", "c2", "X-1"]);
|
|
263
|
+
});
|
|
264
|
+
await s.step(4, "Tab A", "A goes away (laptop closed)", async () => {
|
|
265
|
+
await tab.goOffline();
|
|
266
|
+
});
|
|
267
|
+
await s.step(5, "Collaborator W", "W adds another cell “X-2”", async () => {
|
|
268
|
+
await tab3.addCell(4, "X-2");
|
|
269
|
+
await s.settle(tab3);
|
|
270
|
+
});
|
|
271
|
+
await s.step(6, "Collaborator V", "V adds a cell “Y-1”", async () => {
|
|
272
|
+
await tab4.addCell(5, "Y-1");
|
|
273
|
+
await s.settle(tab4);
|
|
274
|
+
});
|
|
275
|
+
await s.step(7, "Tab B", "only B receives X-2 and Y-1: B holds work that A never saw", async () => {
|
|
276
|
+
await s.expectTabEventually(tab2, ["c0", "c1", "c2", "X-1", "X-2", "Y-1"]);
|
|
277
|
+
});
|
|
278
|
+
await s.step(8, "Tab B + Collaborator W + Collaborator V", "B, W and V close their tabs", async () => {
|
|
279
|
+
await tab2.goOffline(); // it goes away and, later in the story, comes back: the tab stays open
|
|
280
|
+
await tab3.close();
|
|
281
|
+
await tab4.close();
|
|
282
|
+
});
|
|
283
|
+
await s.step(9, "File on disk", "holds all six cells", async () => {
|
|
284
|
+
// nothing for a test to do: the storyboard states what is so
|
|
285
|
+
});
|
|
286
|
+
await s.step(10, "Server", "lets go of the notebook, then builds it again from the file", async () => {
|
|
287
|
+
await s.releaseRoom();
|
|
288
|
+
});
|
|
289
|
+
await s.step(11, "Tab A", "A comes back first", async () => {
|
|
290
|
+
await tab.goOnline();
|
|
291
|
+
});
|
|
292
|
+
await s.step(12, "Tab B", "B comes back second", async () => {
|
|
293
|
+
await tab2.goOnline();
|
|
294
|
+
});
|
|
295
|
+
|
|
296
|
+
await s.ends([
|
|
297
|
+
{ label: "As the story ends", ends: { tab: ["c0", "c1", "c2", "X-1", "X-2", "Y-1"], tab2: ["c0", "c1", "c2", "X-1", "X-2", "Y-1"], server: ["c0", "c1", "c2", "X-1", "X-2", "Y-1"], file: ["c0", "c1", "c2", "X-1", "X-2", "Y-1"] } },
|
|
298
|
+
]);
|
|
299
|
+
}
|
|
300
|
+
)
|
|
301
|
+
);
|
|
302
|
+
|
|
303
|
+
// Like the story of two out-of-date tabs, but the server remembers nothing of the old session when it builds the notebook again, and B typed while it was offline. A comes back first, B second.
|
|
304
|
+
test(
|
|
305
|
+
...story(
|
|
306
|
+
{
|
|
307
|
+
"id": "H4",
|
|
308
|
+
"group": "edges",
|
|
309
|
+
"title": "Two out-of-date tabs, the old session forgotten, one of them typed offline",
|
|
310
|
+
"requires": [
|
|
311
|
+
"releaseRoom"
|
|
312
|
+
]
|
|
313
|
+
},
|
|
314
|
+
async s => {
|
|
315
|
+
await s.notebook(["c0", "c1", "c2"]);
|
|
316
|
+
const tab = s.tab("tab");
|
|
317
|
+
const tab2 = s.tab("tab2");
|
|
318
|
+
const tab3 = s.tab("tab3");
|
|
319
|
+
|
|
320
|
+
await s.step(1, "Tab A + Tab B + Collaborator W", "A, B and W open the notebook", async () => {
|
|
321
|
+
await tab.open();
|
|
322
|
+
await s.expectTab(tab, ["c0", "c1", "c2"]);
|
|
323
|
+
await tab2.open();
|
|
324
|
+
await s.expectTab(tab2, ["c0", "c1", "c2"]);
|
|
325
|
+
await tab3.open();
|
|
326
|
+
await s.expectTab(tab3, ["c0", "c1", "c2"]);
|
|
327
|
+
});
|
|
328
|
+
await s.step(2, "Collaborator W", "W adds a cell “X-1”", async () => {
|
|
329
|
+
await tab3.addCell(3, "X-1");
|
|
330
|
+
await s.settle(tab3);
|
|
331
|
+
});
|
|
332
|
+
await s.step(3, "Tab A + Tab B", "A and B receive X-1", async () => {
|
|
333
|
+
await s.expectTabEventually(tab, ["c0", "c1", "c2", "X-1"]);
|
|
334
|
+
await s.expectTabEventually(tab2, ["c0", "c1", "c2", "X-1"]);
|
|
335
|
+
});
|
|
336
|
+
await s.step(4, "Tab A", "A goes away (laptop closed)", async () => {
|
|
337
|
+
await tab.goOffline();
|
|
338
|
+
});
|
|
339
|
+
await s.step(5, "Collaborator W", "W adds another cell “X-2”", async () => {
|
|
340
|
+
await tab3.addCell(4, "X-2");
|
|
341
|
+
await s.settle(tab3);
|
|
342
|
+
});
|
|
343
|
+
await s.step(6, "Tab B", "only B receives X-2: B holds more of W's work than A", async () => {
|
|
344
|
+
await s.expectTabEventually(tab2, ["c0", "c1", "c2", "X-1", "X-2"]);
|
|
345
|
+
});
|
|
346
|
+
await s.step(7, "Tab B", "B loses its connection too", async () => {
|
|
347
|
+
await tab2.goOffline();
|
|
348
|
+
});
|
|
349
|
+
await s.step(8, "Collaborator W", "W closes its tab", async () => {
|
|
350
|
+
await tab3.close();
|
|
351
|
+
});
|
|
352
|
+
await s.step(9, "Tab B", "B types “+B-OFFLINE” into c0", async () => {
|
|
353
|
+
await tab2.type(0, " +B-OFFLINE");
|
|
354
|
+
await s.expectTab(tab2, ["c0 +B-OFFLINE", "c1", "c2", "X-1", "X-2"]);
|
|
355
|
+
});
|
|
356
|
+
await s.step(10, "File on disk", "holds all five cells", async () => {
|
|
357
|
+
// nothing for a test to do: the storyboard states what is so
|
|
358
|
+
});
|
|
359
|
+
await s.step(11, "Server", "builds the notebook again from the file; it remembers nothing of the old session", async () => {
|
|
360
|
+
await s.releaseRoom();
|
|
361
|
+
});
|
|
362
|
+
await s.step(12, "Tab A", "A comes back first", async () => {
|
|
363
|
+
await tab.goOnline();
|
|
364
|
+
});
|
|
365
|
+
await s.step(13, "Tab B", "B comes back second", async () => {
|
|
366
|
+
await tab2.goOnline();
|
|
367
|
+
});
|
|
368
|
+
|
|
369
|
+
await s.ends([
|
|
370
|
+
{ label: "As the story ends", ends: { tab: ["c0 +B-OFFLINE", "c1", "c2", "X-1", "X-2"], tab2: ["c0 +B-OFFLINE", "c1", "c2", "X-1", "X-2"], server: ["c0 +B-OFFLINE", "c1", "c2", "X-1", "X-2"], file: ["c0 +B-OFFLINE", "c1", "c2", "X-1", "X-2"] } },
|
|
371
|
+
]);
|
|
372
|
+
}
|
|
373
|
+
)
|
|
374
|
+
);
|
|
375
|
+
|
|
376
|
+
// A, B and a collaborator V work in one notebook. A leaves early and V adds a cell that only B receives. The server then builds the notebook again, and B, still offline, adds a cell of its own. A comes back first, B second.
|
|
377
|
+
test(
|
|
378
|
+
...story(
|
|
379
|
+
{
|
|
380
|
+
"id": "K",
|
|
381
|
+
"group": "edges",
|
|
382
|
+
"title": "A cell created offline by a tab the server only partly remembers",
|
|
383
|
+
"requires": [
|
|
384
|
+
"releaseRoom"
|
|
385
|
+
]
|
|
386
|
+
},
|
|
387
|
+
async s => {
|
|
388
|
+
await s.notebook(["c0", "c1", "c2"]);
|
|
389
|
+
const tab = s.tab("tab");
|
|
390
|
+
const tab2 = s.tab("tab2");
|
|
391
|
+
const tab3 = s.tab("tab3");
|
|
392
|
+
|
|
393
|
+
await s.step(1, "Tab A + Tab B + Collaborator V", "A, B and V open the notebook", async () => {
|
|
394
|
+
await tab.open();
|
|
395
|
+
await s.expectTab(tab, ["c0", "c1", "c2"]);
|
|
396
|
+
await tab2.open();
|
|
397
|
+
await s.expectTab(tab2, ["c0", "c1", "c2"]);
|
|
398
|
+
await tab3.open();
|
|
399
|
+
await s.expectTab(tab3, ["c0", "c1", "c2"]);
|
|
400
|
+
});
|
|
401
|
+
await s.step(2, "Tab A", "A goes away (laptop closed)", async () => {
|
|
402
|
+
await tab.goOffline();
|
|
403
|
+
});
|
|
404
|
+
await s.step(3, "Collaborator V", "V adds a cell “Y-1”", async () => {
|
|
405
|
+
await tab3.addCell(3, "Y-1");
|
|
406
|
+
await s.settle(tab3);
|
|
407
|
+
});
|
|
408
|
+
await s.step(4, "Tab B", "only B receives Y-1", async () => {
|
|
409
|
+
await s.expectTabEventually(tab2, ["c0", "c1", "c2", "Y-1"]);
|
|
410
|
+
});
|
|
411
|
+
await s.step(5, "Tab B", "B loses its connection", async () => {
|
|
412
|
+
await tab2.goOffline();
|
|
413
|
+
});
|
|
414
|
+
await s.step(6, "Collaborator V", "V closes its tab", async () => {
|
|
415
|
+
await tab3.close();
|
|
416
|
+
});
|
|
417
|
+
await s.step(7, "File on disk", "holds four cells", async () => {
|
|
418
|
+
// nothing for a test to do: the storyboard states what is so
|
|
419
|
+
});
|
|
420
|
+
await s.step(8, "Server", "lets go of the notebook, then builds it again from the file", async () => {
|
|
421
|
+
await s.releaseRoom();
|
|
422
|
+
});
|
|
423
|
+
await s.step(9, "Tab B", "B, still offline, adds a cell “NEW-B”", async () => {
|
|
424
|
+
await tab2.addCell(4, "NEW-B");
|
|
425
|
+
await s.expectTab(tab2, ["c0", "c1", "c2", "Y-1", "NEW-B"]);
|
|
426
|
+
});
|
|
427
|
+
await s.step(10, "Tab A", "A comes back first", async () => {
|
|
428
|
+
await tab.goOnline();
|
|
429
|
+
});
|
|
430
|
+
await s.step(11, "Tab B", "B comes back second", async () => {
|
|
431
|
+
await tab2.goOnline();
|
|
432
|
+
});
|
|
433
|
+
|
|
434
|
+
await s.ends([
|
|
435
|
+
{ label: "As the story ends", ends: { tab: ["c0", "c1", "c2", "Y-1", "NEW-B"], tab2: ["c0", "c1", "c2", "Y-1", "NEW-B"], server: ["c0", "c1", "c2", "Y-1", "NEW-B"], file: ["c0", "c1", "c2", "Y-1", "NEW-B"] } },
|
|
436
|
+
]);
|
|
437
|
+
}
|
|
438
|
+
)
|
|
439
|
+
);
|
|
440
|
+
|
|
441
|
+
// The mirror of the previous story. The extra cell that B holds was not typed offline: B typed it online earlier, so the server saved it in the file. When B comes back, that cell must not be added a second time.
|
|
442
|
+
test(
|
|
443
|
+
...story(
|
|
444
|
+
{
|
|
445
|
+
"id": "K2",
|
|
446
|
+
"group": "edges",
|
|
447
|
+
"title": "A cell that was already saved is not added a second time",
|
|
448
|
+
"requires": [
|
|
449
|
+
"releaseRoom"
|
|
450
|
+
]
|
|
451
|
+
},
|
|
452
|
+
async s => {
|
|
453
|
+
await s.notebook(["c0", "c1", "c2"]);
|
|
454
|
+
const tab = s.tab("tab");
|
|
455
|
+
const tab2 = s.tab("tab2");
|
|
456
|
+
const tab3 = s.tab("tab3");
|
|
457
|
+
|
|
458
|
+
await s.step(1, "Tab A + Tab B + Collaborator V", "A, B and V open the notebook", async () => {
|
|
459
|
+
await tab.open();
|
|
460
|
+
await s.expectTab(tab, ["c0", "c1", "c2"]);
|
|
461
|
+
await tab2.open();
|
|
462
|
+
await s.expectTab(tab2, ["c0", "c1", "c2"]);
|
|
463
|
+
await tab3.open();
|
|
464
|
+
await s.expectTab(tab3, ["c0", "c1", "c2"]);
|
|
465
|
+
});
|
|
466
|
+
await s.step(2, "Tab A", "A goes away (laptop closed)", async () => {
|
|
467
|
+
await tab.goOffline();
|
|
468
|
+
});
|
|
469
|
+
await s.step(3, "Tab B", "B adds a cell “B-1” while online; it reaches the server", async () => {
|
|
470
|
+
await tab2.addCell(3, "B-1");
|
|
471
|
+
await s.settle(tab2);
|
|
472
|
+
await s.expectTab(tab2, ["c0", "c1", "c2", "B-1"]);
|
|
473
|
+
});
|
|
474
|
+
await s.step(4, "Collaborator V", "V adds a cell “Y-1”", async () => {
|
|
475
|
+
await tab3.addCell(4, "Y-1");
|
|
476
|
+
await s.settle(tab3);
|
|
477
|
+
});
|
|
478
|
+
await s.step(5, "Tab B", "B receives Y-1", async () => {
|
|
479
|
+
await s.expectTabEventually(tab2, ["c0", "c1", "c2", "B-1", "Y-1"]);
|
|
480
|
+
});
|
|
481
|
+
await s.step(6, "Tab B + Collaborator V", "B and V close their tabs", async () => {
|
|
482
|
+
await tab2.goOffline(); // it goes away and, later in the story, comes back: the tab stays open
|
|
483
|
+
await tab3.close();
|
|
484
|
+
});
|
|
485
|
+
await s.step(7, "File on disk", "holds five cells", async () => {
|
|
486
|
+
// nothing for a test to do: the storyboard states what is so
|
|
487
|
+
});
|
|
488
|
+
await s.step(8, "Server", "lets go of the notebook, then builds it again from the file", async () => {
|
|
489
|
+
await s.releaseRoom();
|
|
490
|
+
});
|
|
491
|
+
await s.step(9, "Tab A", "A, which never saw B-1, comes back first", async () => {
|
|
492
|
+
await tab.goOnline();
|
|
493
|
+
});
|
|
494
|
+
await s.step(10, "Tab B", "B comes back second", async () => {
|
|
495
|
+
await tab2.goOnline();
|
|
496
|
+
});
|
|
497
|
+
|
|
498
|
+
await s.ends([
|
|
499
|
+
{ label: "As the story ends", ends: { tab: ["c0", "c1", "c2", "B-1", "Y-1"], tab2: ["c0", "c1", "c2", "B-1", "Y-1"], server: ["c0", "c1", "c2", "B-1", "Y-1"], file: ["c0", "c1", "c2", "B-1", "Y-1"] } },
|
|
500
|
+
]);
|
|
501
|
+
}
|
|
502
|
+
)
|
|
503
|
+
);
|
|
504
|
+
|
|
505
|
+
// Two tabs have the notebook open. The second loses its connection, the user moves a cell to the end, and the tab reconnects to the same server.
|
|
506
|
+
test(
|
|
507
|
+
...story(
|
|
508
|
+
{
|
|
509
|
+
"id": "M1",
|
|
510
|
+
"group": "edges",
|
|
511
|
+
"title": "A second tab moves a cell while offline",
|
|
512
|
+
"requires": []
|
|
513
|
+
},
|
|
514
|
+
async s => {
|
|
515
|
+
await s.notebook(["c0", "c1", "c2"]);
|
|
516
|
+
const tab = s.tab("tab");
|
|
517
|
+
const tab2 = s.tab("tab2");
|
|
518
|
+
|
|
519
|
+
await s.step(1, "First tab", "opens the notebook", async () => {
|
|
520
|
+
await tab.open();
|
|
521
|
+
await s.expectTab(tab, ["c0", "c1", "c2"]);
|
|
522
|
+
});
|
|
523
|
+
await s.step(2, "Second tab", "opens the same notebook", async () => {
|
|
524
|
+
await tab2.open();
|
|
525
|
+
await s.expectTab(tab2, ["c0", "c1", "c2"]);
|
|
526
|
+
});
|
|
527
|
+
await s.step(3, "Second tab", "loses its connection", async () => {
|
|
528
|
+
await tab2.goOffline();
|
|
529
|
+
});
|
|
530
|
+
await s.step(4, "Second tab", "moves c0 to the end of the notebook", async () => {
|
|
531
|
+
await tab2.moveCell(0, 2);
|
|
532
|
+
await s.expectTab(tab2, ["c1", "c2", "c0"]);
|
|
533
|
+
});
|
|
534
|
+
await s.step(5, "Second tab", "reconnects", async () => {
|
|
535
|
+
await tab2.goOnline();
|
|
536
|
+
});
|
|
537
|
+
await s.step(6, "Server", "keeps the moved cell and shares it", async () => {
|
|
538
|
+
// nothing for a test to do: the storyboard states what is so
|
|
539
|
+
});
|
|
540
|
+
await s.step(7, "File on disk", "autosave", async () => {
|
|
541
|
+
// nothing for a test to do: the storyboard states what is so
|
|
542
|
+
});
|
|
543
|
+
|
|
544
|
+
await s.ends([
|
|
545
|
+
{ label: "As the story ends", ends: { tab: ["c1", "c2", "c0"], tab2: ["c1", "c2", "c0"], server: ["c1", "c2", "c0"], file: ["c1", "c2", "c0"] } },
|
|
546
|
+
]);
|
|
547
|
+
}
|
|
548
|
+
)
|
|
549
|
+
);
|