@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.
@@ -0,0 +1,446 @@
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 loses its connection, the server builds the notebook again from the file, and the user types into a cell before the tab reconnects.
6
+ test(
7
+ ...story(
8
+ {
9
+ "id": "N1",
10
+ "group": "rebuild",
11
+ "title": "Typing while offline, across a rebuilt notebook",
12
+ "requires": [
13
+ "releaseRoom"
14
+ ]
15
+ },
16
+ async s => {
17
+ await s.notebook(["c0", "c1", "c2"]);
18
+ const tab = s.tab("tab");
19
+
20
+ await s.step(1, "Your tab", "opens the notebook", async () => {
21
+ await tab.open();
22
+ await s.expectTab(tab, ["c0", "c1", "c2"]);
23
+ });
24
+ await s.step(2, "Your tab", "loses its connection", async () => {
25
+ await tab.goOffline();
26
+ });
27
+ await s.step(3, "Server", "lets go of the notebook, then builds it again from the file", async () => {
28
+ await s.releaseRoom();
29
+ });
30
+ await s.step(4, "Your tab", "types “+TYPED” at the end of c0", async () => {
31
+ await tab.type(0, " +TYPED");
32
+ await s.expectTab(tab, ["c0 +TYPED", "c1", "c2"]);
33
+ });
34
+ await s.step(5, "Your tab", "reconnects", async () => {
35
+ await tab.goOnline();
36
+ });
37
+ await s.step(6, "Server", "receives the typing", async () => {
38
+ // nothing for a test to do: the storyboard states what is so
39
+ });
40
+ await s.step(7, "File on disk", "autosave", async () => {
41
+ // nothing for a test to do: the storyboard states what is so
42
+ });
43
+
44
+ await s.ends([
45
+ { label: "As the story ends", ends: { tab: ["c0 +TYPED", "c1", "c2"], server: ["c0 +TYPED", "c1", "c2"], file: ["c0 +TYPED", "c1", "c2"] } },
46
+ ]);
47
+ }
48
+ )
49
+ );
50
+
51
+ // The user moves a cell while the tab is offline, and the server builds the notebook again from the file meanwhile. The rebuilt notebook still has the cell where it was.
52
+ test(
53
+ ...story(
54
+ {
55
+ "id": "M2",
56
+ "group": "rebuild",
57
+ "title": "Moving a cell while offline, across a rebuilt notebook",
58
+ "requires": [
59
+ "releaseRoom"
60
+ ]
61
+ },
62
+ async s => {
63
+ await s.notebook(["c0", "c1", "c2"]);
64
+ const tab = s.tab("tab");
65
+
66
+ await s.step(1, "Your tab", "opens the notebook", async () => {
67
+ await tab.open();
68
+ await s.expectTab(tab, ["c0", "c1", "c2"]);
69
+ });
70
+ await s.step(2, "Your tab", "loses its connection", async () => {
71
+ await tab.goOffline();
72
+ });
73
+ await s.step(3, "Your tab", "moves c0 to the end of the notebook", async () => {
74
+ await tab.moveCell(0, 2);
75
+ await s.expectTab(tab, ["c1", "c2", "c0"]);
76
+ });
77
+ await s.step(4, "Server", "lets go of the notebook, then builds it again from the file", async () => {
78
+ await s.releaseRoom();
79
+ });
80
+ await s.step(5, "Your tab", "reconnects", async () => {
81
+ await tab.goOnline();
82
+ });
83
+ await s.step(6, "Server", "keeps the move: c0 is at the end, once", async () => {
84
+ // nothing for a test to do: the storyboard states what is so
85
+ });
86
+ await s.step(7, "File on disk", "autosave", async () => {
87
+ // nothing for a test to do: the storyboard states what is so
88
+ });
89
+
90
+ await s.ends([
91
+ { label: "As the story ends", ends: { tab: ["c1", "c2", "c0"], server: ["c1", "c2", "c0"], file: ["c1", "c2", "c0"] } },
92
+ ]);
93
+ }
94
+ )
95
+ );
96
+
97
+ // The user deletes a cell while the tab is offline, and the server builds the notebook again from the file meanwhile. The rebuilt notebook still has the cell.
98
+ test(
99
+ ...story(
100
+ {
101
+ "id": "R1",
102
+ "group": "rebuild",
103
+ "title": "Deleting a cell while offline, across a rebuilt notebook",
104
+ "requires": [
105
+ "releaseRoom"
106
+ ]
107
+ },
108
+ async s => {
109
+ await s.notebook(["c0", "c1", "c2"]);
110
+ const tab = s.tab("tab");
111
+
112
+ await s.step(1, "Your tab", "opens the notebook", async () => {
113
+ await tab.open();
114
+ await s.expectTab(tab, ["c0", "c1", "c2"]);
115
+ });
116
+ await s.step(2, "Your tab", "loses its connection", async () => {
117
+ await tab.goOffline();
118
+ });
119
+ await s.step(3, "Server", "lets go of the notebook", async () => {
120
+ await s.releaseRoom();
121
+ });
122
+ await s.step(4, "Your tab", "deletes c1", async () => {
123
+ await tab.deleteCell(1);
124
+ await s.expectTab(tab, ["c0", "c2"]);
125
+ });
126
+ await s.step(5, "Server", "builds the notebook again from the file", async () => {
127
+ // nothing for a test to do: the storyboard states what is so
128
+ });
129
+ await s.step(6, "Your tab", "reconnects", async () => {
130
+ await tab.goOnline();
131
+ });
132
+ await s.step(7, "Server", "keeps the deletion", async () => {
133
+ // nothing for a test to do: the storyboard states what is so
134
+ });
135
+ await s.step(8, "File on disk", "autosave", async () => {
136
+ // nothing for a test to do: the storyboard states what is so
137
+ });
138
+
139
+ await s.ends([
140
+ { label: "As the story ends", ends: { tab: ["c0", "c2"], server: ["c0", "c2"], file: ["c0", "c2"] } },
141
+ ]);
142
+ }
143
+ )
144
+ );
145
+
146
+ // A types into a cell while offline. The server builds the notebook again from the file. Then a colleague opens the notebook in tab B and types into the same cell. Then A comes back. Both typed into the same cell, so there is nothing to choose between.
147
+ test(
148
+ ...story(
149
+ {
150
+ "id": "W1",
151
+ "group": "rebuild",
152
+ "title": "Two people type into one cell; one was offline across a rebuild",
153
+ "requires": [
154
+ "releaseRoom"
155
+ ]
156
+ },
157
+ async s => {
158
+ await s.notebook(["c0", "c1", "c2"]);
159
+ const tab = s.tab("tab");
160
+ const tab2 = s.tab("tab2");
161
+
162
+ await s.step(1, "Tab A", "opens the notebook", async () => {
163
+ await tab.open();
164
+ await s.expectTab(tab, ["c0", "c1", "c2"]);
165
+ });
166
+ await s.step(2, "Tab A", "loses its connection", async () => {
167
+ await tab.goOffline();
168
+ });
169
+ await s.step(3, "Tab A", "types “+A-OFFLINE” at the end of c0", async () => {
170
+ await tab.type(0, " +A-OFFLINE");
171
+ await s.expectTab(tab, ["c0 +A-OFFLINE", "c1", "c2"]);
172
+ });
173
+ await s.step(4, "Server", "lets go of the notebook, then builds it again from the file", async () => {
174
+ await s.releaseRoom();
175
+ });
176
+ await s.step(5, "Tab B (a colleague)", "a colleague opens the rebuilt notebook", async () => {
177
+ await tab2.open();
178
+ await s.expectTab(tab2, ["c0", "c1", "c2"]);
179
+ });
180
+ await s.step(6, "Tab B (a colleague)", "types “+B-ONLINE” at the end of c0", async () => {
181
+ await tab2.type(0, " +B-ONLINE");
182
+ await s.settle(tab2);
183
+ await s.expectTab(tab2, ["c0 +B-ONLINE", "c1", "c2"]);
184
+ });
185
+ await s.step(7, "Server", "has B's typing", async () => {
186
+ // nothing for a test to do: the storyboard states what is so
187
+ });
188
+ await s.step(8, "Tab A", "A comes back and its typing reaches the server", async () => {
189
+ await tab.goOnline();
190
+ });
191
+
192
+ await s.ends([
193
+ { label: "As the story ends", ends: { tab: [E.parts("c0", "+A-OFFLINE", "+B-ONLINE"), "c1", "c2"], tab2: [E.parts("c0", "+A-OFFLINE", "+B-ONLINE"), "c1", "c2"], server: [E.parts("c0", "+A-OFFLINE", "+B-ONLINE"), "c1", "c2"], file: [E.parts("c0", "+A-OFFLINE", "+B-ONLINE"), "c1", "c2"] } },
194
+ ]);
195
+ }
196
+ )
197
+ );
198
+
199
+ // Two tabs of one notebook lose their connection together (a network drop). The user types into c0 in tab A and into c1 in tab B while they are offline, and the server builds the notebook again meanwhile. B reconnects first, then A.
200
+ test(
201
+ ...story(
202
+ {
203
+ "id": "W2",
204
+ "group": "rebuild",
205
+ "title": "Two out-of-date tabs both typed offline",
206
+ "requires": [
207
+ "releaseRoom"
208
+ ]
209
+ },
210
+ async s => {
211
+ await s.notebook(["c0", "c1", "c2"]);
212
+ const tab = s.tab("tab");
213
+ const tab2 = s.tab("tab2");
214
+
215
+ await s.step(1, "Tab A + Tab B", "A and B open the notebook", async () => {
216
+ await tab.open();
217
+ await s.expectTab(tab, ["c0", "c1", "c2"]);
218
+ await tab2.open();
219
+ await s.expectTab(tab2, ["c0", "c1", "c2"]);
220
+ });
221
+ await s.step(2, "Tab A + Tab B", "the network drops: both tabs lose their connection", async () => {
222
+ await tab.goOffline();
223
+ await tab2.goOffline();
224
+ });
225
+ await s.step(3, "Tab A", "A: types “+A-OFFLINE” into c0", async () => {
226
+ await tab.type(0, " +A-OFFLINE");
227
+ await s.expectTab(tab, ["c0 +A-OFFLINE", "c1", "c2"]);
228
+ });
229
+ await s.step(4, "Tab B", "B: types “+B-OFFLINE” into c1", async () => {
230
+ await tab2.type(1, " +B-OFFLINE");
231
+ await s.expectTab(tab2, ["c0", "c1 +B-OFFLINE", "c2"]);
232
+ });
233
+ await s.step(5, "Server", "lets go of the notebook, then builds it again from the file", async () => {
234
+ await s.releaseRoom();
235
+ });
236
+ await s.step(6, "Tab B", "B reconnects first", async () => {
237
+ await tab2.goOnline();
238
+ });
239
+ await s.step(7, "Tab A", "A reconnects second", async () => {
240
+ await tab.goOnline();
241
+ });
242
+ await s.step(8, "File on disk", "autosave", async () => {
243
+ // nothing for a test to do: the storyboard states what is so
244
+ });
245
+
246
+ await s.ends([
247
+ { label: "As the story ends", ends: { tab: ["c0 +A-OFFLINE", "c1 +B-OFFLINE", "c2"], tab2: ["c0 +A-OFFLINE", "c1 +B-OFFLINE", "c2"], server: ["c0 +A-OFFLINE", "c1 +B-OFFLINE", "c2"], file: ["c0 +A-OFFLINE", "c1 +B-OFFLINE", "c2"] } },
248
+ ]);
249
+ }
250
+ )
251
+ );
252
+
253
+ // Like the previous story, but the server has also lost everything it kept about the old session (for instance after a restart on a new machine) when it builds the notebook again.
254
+ test(
255
+ ...story(
256
+ {
257
+ "id": "W3",
258
+ "group": "rebuild",
259
+ "title": "Two out-of-date tabs both typed offline, and the server forgot the old session",
260
+ "requires": [
261
+ "releaseRoom"
262
+ ]
263
+ },
264
+ async s => {
265
+ await s.notebook(["c0", "c1", "c2"]);
266
+ const tab = s.tab("tab");
267
+ const tab2 = s.tab("tab2");
268
+
269
+ await s.step(1, "Tab A + Tab B", "A and B open the notebook", async () => {
270
+ await tab.open();
271
+ await s.expectTab(tab, ["c0", "c1", "c2"]);
272
+ await tab2.open();
273
+ await s.expectTab(tab2, ["c0", "c1", "c2"]);
274
+ });
275
+ await s.step(2, "Tab A + Tab B", "the network drops: both tabs lose their connection", async () => {
276
+ await tab.goOffline();
277
+ await tab2.goOffline();
278
+ });
279
+ await s.step(3, "Tab A", "A: types “+A-OFFLINE” into c0", async () => {
280
+ await tab.type(0, " +A-OFFLINE");
281
+ await s.expectTab(tab, ["c0 +A-OFFLINE", "c1", "c2"]);
282
+ });
283
+ await s.step(4, "Tab B", "B: types “+B-OFFLINE” into c1", async () => {
284
+ await tab2.type(1, " +B-OFFLINE");
285
+ await s.expectTab(tab2, ["c0", "c1 +B-OFFLINE", "c2"]);
286
+ });
287
+ await s.step(5, "Server", "lets go of the notebook and loses everything it kept about the old session; builds the notebook again from the file", async () => {
288
+ await s.releaseRoom();
289
+ });
290
+ await s.step(6, "Tab B", "B reconnects first", async () => {
291
+ await tab2.goOnline();
292
+ });
293
+ await s.step(7, "Tab A", "A reconnects second", async () => {
294
+ await tab.goOnline();
295
+ });
296
+ await s.step(8, "File on disk", "autosave", async () => {
297
+ // nothing for a test to do: the storyboard states what is so
298
+ });
299
+
300
+ await s.ends([
301
+ { label: "As the story ends", ends: { tab: ["c0 +A-OFFLINE", "c1 +B-OFFLINE", "c2"], tab2: ["c0 +A-OFFLINE", "c1 +B-OFFLINE", "c2"], server: ["c0 +A-OFFLINE", "c1 +B-OFFLINE", "c2"], file: ["c0 +A-OFFLINE", "c1 +B-OFFLINE", "c2"] } },
302
+ ]);
303
+ }
304
+ )
305
+ );
306
+
307
+ // A tab adds a cell and types while it is online, loses its connection, and the server builds the notebook again from the file. The user types more while the tab is offline. Then it reconnects.
308
+ test(
309
+ ...story(
310
+ {
311
+ "id": "S1",
312
+ "group": "rebuild",
313
+ "title": "A tab that edited online, then offline, reconnects to a rebuilt notebook",
314
+ "requires": [
315
+ "releaseRoom"
316
+ ]
317
+ },
318
+ async s => {
319
+ await s.notebook(["c0", "c1", "c2"]);
320
+ const tab = s.tab("tab");
321
+
322
+ await s.step(1, "Your tab", "opens the notebook", async () => {
323
+ await tab.open();
324
+ await s.expectTab(tab, ["c0", "c1", "c2"]);
325
+ });
326
+ await s.step(2, "Your tab", "adds a cell “ONLINE CELL” and types “+TYPED” into c0; both reach the server", async () => {
327
+ await tab.type(0, " +TYPED");
328
+ await tab.addCell(3, "ONLINE CELL");
329
+ await s.settle(tab);
330
+ await s.expectTab(tab, ["c0 +TYPED", "c1", "c2", "ONLINE CELL"]);
331
+ });
332
+ await s.step(3, "Your tab", "loses its connection", async () => {
333
+ await tab.goOffline();
334
+ });
335
+ await s.step(4, "Server", "lets go of the notebook (saving it) and builds it again from the file", async () => {
336
+ await s.releaseRoom();
337
+ });
338
+ await s.step(5, "Your tab", "types “+OFFLINE” at the end of c1", async () => {
339
+ await tab.type(1, " +OFFLINE");
340
+ await s.expectTab(tab, ["c0 +TYPED", "c1 +OFFLINE", "c2", "ONLINE CELL"]);
341
+ });
342
+ await s.step(6, "Your tab", "reconnects", async () => {
343
+ await tab.goOnline();
344
+ });
345
+ await s.step(7, "File on disk", "autosave", async () => {
346
+ // nothing for a test to do: the storyboard states what is so
347
+ });
348
+
349
+ await s.ends([
350
+ { label: "As the story ends", ends: { tab: ["c0 +TYPED", "c1 +OFFLINE", "c2", "ONLINE CELL"], server: ["c0 +TYPED", "c1 +OFFLINE", "c2", "ONLINE CELL"], file: ["c0 +TYPED", "c1 +OFFLINE", "c2", "ONLINE CELL"] } },
351
+ ]);
352
+ }
353
+ )
354
+ );
355
+
356
+ // While a tab is offline the server loses everything it kept about the old session (for instance after a restart on a new machine) and builds the notebook again from the file as if it were new. The tab typed meanwhile.
357
+ test(
358
+ ...story(
359
+ {
360
+ "id": "S5",
361
+ "group": "rebuild",
362
+ "title": "The server forgot the old session; a tab typed offline",
363
+ "requires": [
364
+ "releaseRoom"
365
+ ]
366
+ },
367
+ async s => {
368
+ await s.notebook(["c0", "c1", "c2"]);
369
+ const tab = s.tab("tab");
370
+
371
+ await s.step(1, "Your tab", "opens the notebook", async () => {
372
+ await tab.open();
373
+ await s.expectTab(tab, ["c0", "c1", "c2"]);
374
+ });
375
+ await s.step(2, "Your tab", "loses its connection", async () => {
376
+ await tab.goOffline();
377
+ });
378
+ await s.step(3, "Server", "lets go of the notebook, and what it kept about the old session is lost", async () => {
379
+ await s.releaseRoom();
380
+ });
381
+ await s.step(4, "Your tab", "types “+A-OFFLINE” at the end of c0", async () => {
382
+ await tab.type(0, " +A-OFFLINE");
383
+ await s.expectTab(tab, ["c0 +A-OFFLINE", "c1", "c2"]);
384
+ });
385
+ await s.step(5, "Server", "builds the notebook again from the file, with a fresh history", async () => {
386
+ // nothing for a test to do: the storyboard states what is so
387
+ });
388
+ await s.step(6, "Your tab", "reconnects", async () => {
389
+ await tab.goOnline();
390
+ });
391
+ await s.step(7, "File on disk", "autosave", async () => {
392
+ // nothing for a test to do: the storyboard states what is so
393
+ });
394
+
395
+ await s.ends([
396
+ { label: "As the story ends", ends: { tab: ["c0 +A-OFFLINE", "c1", "c2"], server: ["c0 +A-OFFLINE", "c1", "c2"], file: ["c0 +A-OFFLINE", "c1", "c2"] } },
397
+ ]);
398
+ }
399
+ )
400
+ );
401
+
402
+ // Like the previous story, but the server still has what it kept about the old session and finds it unreadable (corrupt, or written by an incompatible version). It must not crash.
403
+ test(
404
+ ...story(
405
+ {
406
+ "id": "S7",
407
+ "group": "rebuild",
408
+ "title": "What the server kept about the old session is damaged",
409
+ "requires": [
410
+ "releaseRoom"
411
+ ]
412
+ },
413
+ async s => {
414
+ await s.notebook(["c0", "c1", "c2"]);
415
+ const tab = s.tab("tab");
416
+
417
+ await s.step(1, "Your tab", "opens the notebook", async () => {
418
+ await tab.open();
419
+ await s.expectTab(tab, ["c0", "c1", "c2"]);
420
+ });
421
+ await s.step(2, "Your tab", "loses its connection", async () => {
422
+ await tab.goOffline();
423
+ });
424
+ await s.step(3, "Server", "lets go of the notebook; what it kept about the old session is now garbage", async () => {
425
+ await s.releaseRoom();
426
+ });
427
+ await s.step(4, "Your tab", "types “+A-OFFLINE” at the end of c0", async () => {
428
+ await tab.type(0, " +A-OFFLINE");
429
+ await s.expectTab(tab, ["c0 +A-OFFLINE", "c1", "c2"]);
430
+ });
431
+ await s.step(5, "Server", "does not crash: builds the notebook again from the file, with a fresh history", async () => {
432
+ // nothing for a test to do: the storyboard states what is so
433
+ });
434
+ await s.step(6, "Your tab", "reconnects", async () => {
435
+ await tab.goOnline();
436
+ });
437
+ await s.step(7, "File on disk", "autosave", async () => {
438
+ // nothing for a test to do: the storyboard states what is so
439
+ });
440
+
441
+ await s.ends([
442
+ { label: "As the story ends", ends: { tab: ["c0 +A-OFFLINE", "c1", "c2"], server: ["c0 +A-OFFLINE", "c1", "c2"], file: ["c0 +A-OFFLINE", "c1", "c2"] } },
443
+ ]);
444
+ }
445
+ )
446
+ );