@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,237 @@
|
|
|
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
|
+
// While a tab is offline, the server lets go of the notebook and someone edits the file outside Jupyter (git, another editor, an AI agent): one cell is changed, one is added and one is deleted. The user also typed into a cell in the offline tab.
|
|
6
|
+
test(
|
|
7
|
+
...story(
|
|
8
|
+
{
|
|
9
|
+
"id": "S4",
|
|
10
|
+
"group": "files",
|
|
11
|
+
"title": "The file is edited outside Jupyter while a tab is offline",
|
|
12
|
+
"requires": [
|
|
13
|
+
"fileSystem",
|
|
14
|
+
"releaseRoom"
|
|
15
|
+
]
|
|
16
|
+
},
|
|
17
|
+
async s => {
|
|
18
|
+
await s.notebook(["c0", "c1", "c2"]);
|
|
19
|
+
const tab = s.tab("tab");
|
|
20
|
+
|
|
21
|
+
await s.step(1, "Your tab", "opens the notebook", async () => {
|
|
22
|
+
await tab.open();
|
|
23
|
+
await s.expectTab(tab, ["c0", "c1", "c2"]);
|
|
24
|
+
});
|
|
25
|
+
await s.step(2, "Your tab", "loses its connection", async () => {
|
|
26
|
+
await tab.goOffline();
|
|
27
|
+
});
|
|
28
|
+
await s.step(3, "Server", "lets go of the notebook", async () => {
|
|
29
|
+
await s.releaseRoom();
|
|
30
|
+
});
|
|
31
|
+
await s.step(4, "File on disk", "is edited outside Jupyter: c1 is changed, x9 is added, c2 is deleted", async () => {
|
|
32
|
+
await s.writeFileOutside(["c0", "EDITED ON DISK", "x9"]);
|
|
33
|
+
});
|
|
34
|
+
await s.step(5, "Your tab", "types “+A-OFFLINE” at the end of c0", async () => {
|
|
35
|
+
await tab.type(0, " +A-OFFLINE");
|
|
36
|
+
await s.expectTab(tab, ["c0 +A-OFFLINE", "c1", "c2"]);
|
|
37
|
+
});
|
|
38
|
+
await s.step(6, "Server", "builds the notebook again from the changed file", async () => {
|
|
39
|
+
// nothing for a test to do: the storyboard states what is so
|
|
40
|
+
});
|
|
41
|
+
await s.step(7, "Your tab", "reconnects", async () => {
|
|
42
|
+
await tab.goOnline();
|
|
43
|
+
});
|
|
44
|
+
await s.step(8, "File on disk", "autosave", async () => {
|
|
45
|
+
// nothing for a test to do: the storyboard states what is so
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
await s.ends([
|
|
49
|
+
{ label: "As the story ends", ends: { tab: ["c0 +A-OFFLINE", "EDITED ON DISK", "x9"], server: ["c0 +A-OFFLINE", "EDITED ON DISK", "x9"], file: ["c0 +A-OFFLINE", "EDITED ON DISK", "x9"] } },
|
|
50
|
+
]);
|
|
51
|
+
}
|
|
52
|
+
)
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
// While a tab is offline, the file is edited outside Jupyter by a tool that puts the modification time back (a copy or sync tool that keeps file dates, or a file system with a coarse clock). The server must still notice that the file differs when it builds the notebook again.
|
|
56
|
+
test(
|
|
57
|
+
...story(
|
|
58
|
+
{
|
|
59
|
+
"id": "S8",
|
|
60
|
+
"group": "files",
|
|
61
|
+
"title": "An outside edit that keeps the file's modification time",
|
|
62
|
+
"requires": [
|
|
63
|
+
"fileSystem",
|
|
64
|
+
"releaseRoom"
|
|
65
|
+
]
|
|
66
|
+
},
|
|
67
|
+
async s => {
|
|
68
|
+
await s.notebook(["c0", "c1", "c2"]);
|
|
69
|
+
const tab = s.tab("tab");
|
|
70
|
+
|
|
71
|
+
await s.step(1, "Your tab", "opens the notebook", async () => {
|
|
72
|
+
await tab.open();
|
|
73
|
+
await s.expectTab(tab, ["c0", "c1", "c2"]);
|
|
74
|
+
});
|
|
75
|
+
await s.step(2, "Your tab", "loses its connection", async () => {
|
|
76
|
+
await tab.goOffline();
|
|
77
|
+
});
|
|
78
|
+
await s.step(3, "Server", "lets go of the notebook", async () => {
|
|
79
|
+
await s.releaseRoom();
|
|
80
|
+
});
|
|
81
|
+
await s.step(4, "File on disk", "is edited outside Jupyter (c1 rewritten, a cell added) and its modification time is put back", async () => {
|
|
82
|
+
await s.writeFileOutside(["c0", "EXTERNAL EDIT", "c2", "EXTERNAL NEW CELL"]);
|
|
83
|
+
});
|
|
84
|
+
await s.step(5, "Server", "builds the notebook again from the file and sees that it changed", async () => {
|
|
85
|
+
// nothing for a test to do: the storyboard states what is so
|
|
86
|
+
});
|
|
87
|
+
await s.step(6, "Your tab", "reconnects", async () => {
|
|
88
|
+
await tab.goOnline();
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
await s.ends([
|
|
92
|
+
{ label: "As the story ends", ends: { tab: ["c0", "EXTERNAL EDIT", "c2", "EXTERNAL NEW CELL"], server: ["c0", "EXTERNAL EDIT", "c2", "EXTERNAL NEW CELL"], file: ["c0", "EXTERNAL EDIT", "c2", "EXTERNAL NEW CELL"] } },
|
|
93
|
+
]);
|
|
94
|
+
}
|
|
95
|
+
)
|
|
96
|
+
);
|
|
97
|
+
|
|
98
|
+
// The file is edited outside Jupyter (for example by an AI agent that wrote it directly) while a tab is connected: the server reloads it in place and the tab receives the new cell. Then the server dies before it saved anything and starts again from the file; the tab reconnects.
|
|
99
|
+
test(
|
|
100
|
+
...story(
|
|
101
|
+
{
|
|
102
|
+
"id": "S9",
|
|
103
|
+
"group": "files",
|
|
104
|
+
"title": "The file is edited outside while a tab is connected, then the server dies",
|
|
105
|
+
"requires": [
|
|
106
|
+
"crashServer",
|
|
107
|
+
"fileSystem"
|
|
108
|
+
]
|
|
109
|
+
},
|
|
110
|
+
async s => {
|
|
111
|
+
await s.notebook(["c0", "c1", "c2"]);
|
|
112
|
+
const tab = s.tab("tab");
|
|
113
|
+
|
|
114
|
+
await s.step(1, "Your tab", "opens the notebook", async () => {
|
|
115
|
+
await tab.open();
|
|
116
|
+
await s.expectTab(tab, ["c0", "c1", "c2"]);
|
|
117
|
+
});
|
|
118
|
+
await s.step(2, "File on disk", "is edited outside Jupyter: c1 is rewritten and “EXTERNAL NEW CELL” is added", async () => {
|
|
119
|
+
await s.writeFileOutside(["c0", "EXTERNAL EDIT", "c2", "EXTERNAL NEW CELL"]);
|
|
120
|
+
});
|
|
121
|
+
await s.step(3, "Server", "reloads the file in place", async () => {
|
|
122
|
+
// nothing for a test to do: the storyboard states what is so
|
|
123
|
+
});
|
|
124
|
+
await s.step(4, "Your tab", "receives the changes", async () => {
|
|
125
|
+
await s.expectTabEventually(tab, ["c0", "EXTERNAL EDIT", "c2", "EXTERNAL NEW CELL"]);
|
|
126
|
+
});
|
|
127
|
+
await s.step(5, "Your tab", "loses its connection", async () => {
|
|
128
|
+
await tab.goOffline();
|
|
129
|
+
});
|
|
130
|
+
await s.step(6, "Server", "dies before it saved or recorded anything", async () => {
|
|
131
|
+
await s.crashServer();
|
|
132
|
+
});
|
|
133
|
+
await s.step(7, "Server", "starts again from the file", async () => {
|
|
134
|
+
await s.restartServer();
|
|
135
|
+
});
|
|
136
|
+
await s.step(8, "Your tab", "reconnects, already holding the new cell", async () => {
|
|
137
|
+
await tab.goOnline();
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
await s.ends([
|
|
141
|
+
{ label: "As the story ends", ends: { tab: ["c0", "EXTERNAL EDIT", "c2", "EXTERNAL NEW CELL"], server: ["c0", "EXTERNAL EDIT", "c2", "EXTERNAL NEW CELL"], file: ["c0", "EXTERNAL EDIT", "c2", "EXTERNAL NEW CELL"] } },
|
|
142
|
+
]);
|
|
143
|
+
}
|
|
144
|
+
)
|
|
145
|
+
);
|
|
146
|
+
|
|
147
|
+
// The user deletes the notebook through Jupyter. The server stops the notebook and forgets everything it kept about it.
|
|
148
|
+
test(
|
|
149
|
+
...story(
|
|
150
|
+
{
|
|
151
|
+
"id": "S10",
|
|
152
|
+
"group": "files",
|
|
153
|
+
"title": "The notebook is deleted through Jupyter",
|
|
154
|
+
"requires": [
|
|
155
|
+
"fileSystem",
|
|
156
|
+
"historyRecord"
|
|
157
|
+
],
|
|
158
|
+
"appliesIf": [
|
|
159
|
+
"persisted_lineage"
|
|
160
|
+
]
|
|
161
|
+
},
|
|
162
|
+
async s => {
|
|
163
|
+
await s.notebook(["c0", "c1", "c2"]);
|
|
164
|
+
const tab = s.tab("tab");
|
|
165
|
+
|
|
166
|
+
await s.step(1, "Your tab", "opens the notebook", async () => {
|
|
167
|
+
await tab.open();
|
|
168
|
+
await s.expectTab(tab, ["c0", "c1", "c2"]);
|
|
169
|
+
});
|
|
170
|
+
await s.step(2, "History record", "the server keeps a record of the notebook's history", async () => {
|
|
171
|
+
// the server keeps a record of the notebook's history
|
|
172
|
+
});
|
|
173
|
+
await s.step(3, "Your tab", "closes the notebook", async () => {
|
|
174
|
+
await tab.close();
|
|
175
|
+
});
|
|
176
|
+
await s.step(4, "File on disk", "the notebook is deleted through Jupyter", async () => {
|
|
177
|
+
await s.removeFileOutside();
|
|
178
|
+
});
|
|
179
|
+
await s.step(5, "Server", "stops the notebook", async () => {
|
|
180
|
+
// stopped
|
|
181
|
+
});
|
|
182
|
+
await s.step(6, "History record", "its record is removed", async () => {
|
|
183
|
+
// its record is removed
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
await s.ends([
|
|
187
|
+
{ label: "As the story ends", ends: { server: [], file: [] } },
|
|
188
|
+
]);
|
|
189
|
+
}
|
|
190
|
+
)
|
|
191
|
+
);
|
|
192
|
+
|
|
193
|
+
// The notebook file is deleted from outside Jupyter (a terminal, a sync tool). The server notices, stops the notebook and forgets everything it kept about it.
|
|
194
|
+
test(
|
|
195
|
+
...story(
|
|
196
|
+
{
|
|
197
|
+
"id": "S11",
|
|
198
|
+
"group": "files",
|
|
199
|
+
"title": "The notebook is deleted behind the server's back",
|
|
200
|
+
"requires": [
|
|
201
|
+
"fileSystem",
|
|
202
|
+
"historyRecord"
|
|
203
|
+
],
|
|
204
|
+
"appliesIf": [
|
|
205
|
+
"persisted_lineage"
|
|
206
|
+
]
|
|
207
|
+
},
|
|
208
|
+
async s => {
|
|
209
|
+
await s.notebook(["c0", "c1", "c2"]);
|
|
210
|
+
const tab = s.tab("tab");
|
|
211
|
+
|
|
212
|
+
await s.step(1, "Your tab", "opens the notebook", async () => {
|
|
213
|
+
await tab.open();
|
|
214
|
+
await s.expectTab(tab, ["c0", "c1", "c2"]);
|
|
215
|
+
});
|
|
216
|
+
await s.step(2, "History record", "the server keeps a record of the notebook's history", async () => {
|
|
217
|
+
// the server keeps a record of the notebook's history
|
|
218
|
+
});
|
|
219
|
+
await s.step(3, "Your tab", "closes the notebook", async () => {
|
|
220
|
+
await tab.close();
|
|
221
|
+
});
|
|
222
|
+
await s.step(4, "File on disk", "the file is deleted from outside Jupyter", async () => {
|
|
223
|
+
await s.removeFileOutside();
|
|
224
|
+
});
|
|
225
|
+
await s.step(5, "Server", "notices, and stops the notebook", async () => {
|
|
226
|
+
// stopped
|
|
227
|
+
});
|
|
228
|
+
await s.step(6, "History record", "its record is removed", async () => {
|
|
229
|
+
// its record is removed
|
|
230
|
+
});
|
|
231
|
+
|
|
232
|
+
await s.ends([
|
|
233
|
+
{ label: "As the story ends", ends: { server: [], file: [] } },
|
|
234
|
+
]);
|
|
235
|
+
}
|
|
236
|
+
)
|
|
237
|
+
);
|
|
@@ -0,0 +1,429 @@
|
|
|
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 everyday case. A tab loses its connection, the server lets go of the notebook and later builds it again from the file, and the tab reconnects. Everything the tab says reaches the server. Many of the stories below vary this one.
|
|
6
|
+
test(
|
|
7
|
+
...story(
|
|
8
|
+
{
|
|
9
|
+
"id": "A",
|
|
10
|
+
"group": "handshake",
|
|
11
|
+
"title": "Control: a tab reconnects to a notebook the server rebuilt",
|
|
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 (laptop lid closed)", 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", "reconnects and sends its answer; the answer arrives", async () => {
|
|
31
|
+
await tab.goOnline();
|
|
32
|
+
});
|
|
33
|
+
await s.step(5, "Your tab", "the connection drops once more", async () => {
|
|
34
|
+
await tab.goOffline();
|
|
35
|
+
});
|
|
36
|
+
await s.step(6, "Your tab", "reconnects again", async () => {
|
|
37
|
+
await tab.goOnline();
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
await s.ends([
|
|
41
|
+
{ label: "As the story ends", ends: { tab: ["c0", "c1", "c2"], server: ["c0", "c1", "c2"], file: ["c0", "c1", "c2"] } },
|
|
42
|
+
]);
|
|
43
|
+
}
|
|
44
|
+
)
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
// Like the control, but the connection dies just as the tab sends its answer to the server, so the server never hears it. The tab then reconnects a second time.
|
|
48
|
+
test(
|
|
49
|
+
...story(
|
|
50
|
+
{
|
|
51
|
+
"id": "B",
|
|
52
|
+
"group": "handshake",
|
|
53
|
+
"title": "The tab's answer to the server is lost on the way",
|
|
54
|
+
"requires": [
|
|
55
|
+
"releaseRoom",
|
|
56
|
+
"wireFaults"
|
|
57
|
+
]
|
|
58
|
+
},
|
|
59
|
+
async s => {
|
|
60
|
+
await s.notebook(["c0", "c1", "c2"]);
|
|
61
|
+
const tab = s.tab("tab");
|
|
62
|
+
|
|
63
|
+
await s.step(1, "Your tab", "opens the notebook", async () => {
|
|
64
|
+
await tab.open();
|
|
65
|
+
await s.expectTab(tab, ["c0", "c1", "c2"]);
|
|
66
|
+
});
|
|
67
|
+
await s.step(2, "Your tab", "loses its connection", async () => {
|
|
68
|
+
await tab.goOffline();
|
|
69
|
+
});
|
|
70
|
+
await s.step(3, "Server", "lets go of the notebook, then builds it again from the file", async () => {
|
|
71
|
+
await s.releaseRoom();
|
|
72
|
+
});
|
|
73
|
+
await s.step(4, "Your tab", "reconnects to the rebuilt notebook", async () => {
|
|
74
|
+
await tab.goOnline();
|
|
75
|
+
});
|
|
76
|
+
await s.step(5, "Your tab", "its answer to the server is lost on the way", async () => {
|
|
77
|
+
await s.wireFault("lose-reply", tab);
|
|
78
|
+
});
|
|
79
|
+
await s.step(6, "Server", "waits for the answer, then carries on without it", async () => {
|
|
80
|
+
// waits for the answer, then carries on without it: the backend's adapter causes this
|
|
81
|
+
});
|
|
82
|
+
await s.step(7, "Your tab", "the dead connection is closed", async () => {
|
|
83
|
+
await tab.goOffline();
|
|
84
|
+
});
|
|
85
|
+
await s.step(8, "Your tab", "reconnects again; the server still has not heard the answer", async () => {
|
|
86
|
+
await tab.goOnline();
|
|
87
|
+
});
|
|
88
|
+
await s.step(9, "File on disk", "autosave", async () => {
|
|
89
|
+
// nothing for a test to do: the storyboard states what is so
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
await s.ends([
|
|
93
|
+
{ label: "As the story ends", ends: { tab: ["c0", "c1", "c2"], server: ["c0", "c1", "c2"], file: ["c0", "c1", "c2"] } },
|
|
94
|
+
]);
|
|
95
|
+
}
|
|
96
|
+
)
|
|
97
|
+
);
|
|
98
|
+
|
|
99
|
+
// A busy browser (many notebooks open, a big document) takes longer than the server's five-second wait to answer. The answer is on its way, but the server has already moved on.
|
|
100
|
+
test(
|
|
101
|
+
...story(
|
|
102
|
+
{
|
|
103
|
+
"id": "G",
|
|
104
|
+
"group": "handshake",
|
|
105
|
+
"title": "The tab's answer is late, not lost",
|
|
106
|
+
"requires": [
|
|
107
|
+
"releaseRoom",
|
|
108
|
+
"wireFaults"
|
|
109
|
+
]
|
|
110
|
+
},
|
|
111
|
+
async s => {
|
|
112
|
+
await s.notebook(["c0", "c1", "c2"]);
|
|
113
|
+
const tab = s.tab("tab");
|
|
114
|
+
|
|
115
|
+
await s.step(1, "Your tab", "opens the notebook", async () => {
|
|
116
|
+
await tab.open();
|
|
117
|
+
await s.expectTab(tab, ["c0", "c1", "c2"]);
|
|
118
|
+
});
|
|
119
|
+
await s.step(2, "Your tab", "loses its connection", async () => {
|
|
120
|
+
await tab.goOffline();
|
|
121
|
+
});
|
|
122
|
+
await s.step(3, "Server", "lets go of the notebook, then builds it again from the file", async () => {
|
|
123
|
+
await s.releaseRoom();
|
|
124
|
+
});
|
|
125
|
+
await s.step(4, "Your tab", "reconnects to the rebuilt notebook; the browser is busy, so its answer is slow", async () => {
|
|
126
|
+
await tab.goOnline();
|
|
127
|
+
});
|
|
128
|
+
await s.step(5, "Server", "waits five seconds, then carries on; the tab stays connected", async () => {
|
|
129
|
+
// waits five seconds, then carries on; the tab stays connected: the backend's adapter causes this
|
|
130
|
+
});
|
|
131
|
+
await s.step(6, "Your tab", "the answer arrives after the wait", async () => {
|
|
132
|
+
await s.wireFault("late-reply", tab);
|
|
133
|
+
});
|
|
134
|
+
await s.step(7, "Server", "uses the late answer: it now knows everything the tab holds", async () => {
|
|
135
|
+
// nothing for a test to do: the storyboard states what is so
|
|
136
|
+
});
|
|
137
|
+
await s.step(8, "Your tab", "the connection drops once more", async () => {
|
|
138
|
+
await tab.goOffline();
|
|
139
|
+
});
|
|
140
|
+
await s.step(9, "Your tab", "reconnects: the tab and the server already agree", async () => {
|
|
141
|
+
await tab.goOnline();
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
await s.ends([
|
|
145
|
+
{ label: "As the story ends", ends: { tab: ["c0", "c1", "c2"], server: ["c0", "c1", "c2"], file: ["c0", "c1", "c2"] } },
|
|
146
|
+
]);
|
|
147
|
+
}
|
|
148
|
+
)
|
|
149
|
+
);
|
|
150
|
+
|
|
151
|
+
// A tab opens the notebook for the first time and the connection dies right after it received the notebook. Nothing it sends back arrives, neither its answer nor the small mark it writes into the notebook. The notebook was not rebuilt and the tab changed nothing.
|
|
152
|
+
test(
|
|
153
|
+
...story(
|
|
154
|
+
{
|
|
155
|
+
"id": "D1",
|
|
156
|
+
"group": "handshake",
|
|
157
|
+
"title": "A new tab loses everything it sends on its first connection",
|
|
158
|
+
"requires": [
|
|
159
|
+
"wireFaults"
|
|
160
|
+
]
|
|
161
|
+
},
|
|
162
|
+
async s => {
|
|
163
|
+
await s.notebook(["c0", "c1", "c2"]);
|
|
164
|
+
const tab = s.tab("tab");
|
|
165
|
+
|
|
166
|
+
await s.step(1, "Your tab", "opens the notebook for the first time", async () => {
|
|
167
|
+
await tab.open();
|
|
168
|
+
await s.expectTab(tab, ["c0", "c1", "c2"]);
|
|
169
|
+
});
|
|
170
|
+
await s.step(2, "Your tab", "everything it sends back is lost: its answer and its mark in the notebook", async () => {
|
|
171
|
+
await s.wireFault("lose-reply", tab);
|
|
172
|
+
});
|
|
173
|
+
await s.step(3, "Server", "waits, then carries on without having heard from this tab", async () => {
|
|
174
|
+
// waits, then carries on without having heard from this tab: the backend's adapter causes this
|
|
175
|
+
});
|
|
176
|
+
await s.step(4, "Your tab", "the dead connection is closed", async () => {
|
|
177
|
+
await tab.goOffline();
|
|
178
|
+
});
|
|
179
|
+
await s.step(5, "Your tab", "reconnects", async () => {
|
|
180
|
+
await tab.goOnline();
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
await s.ends([
|
|
184
|
+
{ label: "As the story ends", ends: { tab: ["c0", "c1", "c2"], server: ["c0", "c1", "c2"], file: ["c0", "c1", "c2"] } },
|
|
185
|
+
]);
|
|
186
|
+
}
|
|
187
|
+
)
|
|
188
|
+
);
|
|
189
|
+
|
|
190
|
+
// Like the previous story, but the small mark the tab writes into the notebook does arrive; only its answer is lost. This is what a slow browser looks like from the server.
|
|
191
|
+
test(
|
|
192
|
+
...story(
|
|
193
|
+
{
|
|
194
|
+
"id": "D2",
|
|
195
|
+
"group": "handshake",
|
|
196
|
+
"title": "A new tab loses only its answer",
|
|
197
|
+
"requires": [
|
|
198
|
+
"wireFaults"
|
|
199
|
+
]
|
|
200
|
+
},
|
|
201
|
+
async s => {
|
|
202
|
+
await s.notebook(["c0", "c1", "c2"]);
|
|
203
|
+
const tab = s.tab("tab");
|
|
204
|
+
|
|
205
|
+
await s.step(1, "Your tab", "opens the notebook for the first time", async () => {
|
|
206
|
+
await tab.open();
|
|
207
|
+
await s.expectTab(tab, ["c0", "c1", "c2"]);
|
|
208
|
+
});
|
|
209
|
+
await s.step(2, "Your tab", "its answer is lost; its mark in the notebook arrives", async () => {
|
|
210
|
+
await s.wireFault("lose-reply", tab);
|
|
211
|
+
});
|
|
212
|
+
await s.step(3, "Server", "waits, then carries on; the mark of a tab it no longer waits for does no harm", async () => {
|
|
213
|
+
// waits, then carries on; the mark of a tab it no longer waits for does no harm: the backend's adapter causes this
|
|
214
|
+
});
|
|
215
|
+
await s.step(4, "Your tab", "the dead connection is closed", async () => {
|
|
216
|
+
await tab.goOffline();
|
|
217
|
+
});
|
|
218
|
+
await s.step(5, "Your tab", "reconnects", async () => {
|
|
219
|
+
await tab.goOnline();
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
await s.ends([
|
|
223
|
+
{ label: "As the story ends", ends: { tab: ["c0", "c1", "c2"], server: ["c0", "c1", "c2"], file: ["c0", "c1", "c2"] } },
|
|
224
|
+
]);
|
|
225
|
+
}
|
|
226
|
+
)
|
|
227
|
+
);
|
|
228
|
+
|
|
229
|
+
// The most common offline edit is typing in a cell, not adding one. Two tabs have the notebook open; the second loses its connection, the user rewrites the text of a cell, and the tab reconnects to the same server.
|
|
230
|
+
test(
|
|
231
|
+
...story(
|
|
232
|
+
{
|
|
233
|
+
"id": "C3",
|
|
234
|
+
"group": "handshake",
|
|
235
|
+
"title": "A second tab types into a cell while offline",
|
|
236
|
+
"requires": []
|
|
237
|
+
},
|
|
238
|
+
async s => {
|
|
239
|
+
await s.notebook(["c0", "c1", "c2"]);
|
|
240
|
+
const tab = s.tab("tab");
|
|
241
|
+
const tab2 = s.tab("tab2");
|
|
242
|
+
|
|
243
|
+
await s.step(1, "First tab", "opens the notebook", async () => {
|
|
244
|
+
await tab.open();
|
|
245
|
+
await s.expectTab(tab, ["c0", "c1", "c2"]);
|
|
246
|
+
});
|
|
247
|
+
await s.step(2, "Second tab", "opens the same notebook", async () => {
|
|
248
|
+
await tab2.open();
|
|
249
|
+
await s.expectTab(tab2, ["c0", "c1", "c2"]);
|
|
250
|
+
});
|
|
251
|
+
await s.step(3, "Second tab", "loses its connection", async () => {
|
|
252
|
+
await tab2.goOffline();
|
|
253
|
+
});
|
|
254
|
+
await s.step(4, "Second tab", "rewrites c0 as “EDITED OFFLINE”", async () => {
|
|
255
|
+
await tab2.rewrite(0, "EDITED OFFLINE");
|
|
256
|
+
await s.expectTab(tab2, ["EDITED OFFLINE", "c1", "c2"]);
|
|
257
|
+
});
|
|
258
|
+
await s.step(5, "Second tab", "reconnects", async () => {
|
|
259
|
+
await tab2.goOnline();
|
|
260
|
+
});
|
|
261
|
+
await s.step(6, "Server", "receives the typing and shares it", async () => {
|
|
262
|
+
// nothing for a test to do: the storyboard states what is so
|
|
263
|
+
});
|
|
264
|
+
await s.step(7, "File on disk", "autosave", async () => {
|
|
265
|
+
// nothing for a test to do: the storyboard states what is so
|
|
266
|
+
});
|
|
267
|
+
|
|
268
|
+
await s.ends([
|
|
269
|
+
{ 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"] } },
|
|
270
|
+
]);
|
|
271
|
+
}
|
|
272
|
+
)
|
|
273
|
+
);
|
|
274
|
+
|
|
275
|
+
// Two tabs have the notebook open. The second loses its connection, the user adds a cell, and the tab reconnects to the same server. The first tab stays connected throughout.
|
|
276
|
+
test(
|
|
277
|
+
...story(
|
|
278
|
+
{
|
|
279
|
+
"id": "C2",
|
|
280
|
+
"group": "handshake",
|
|
281
|
+
"title": "A second tab adds a cell while offline",
|
|
282
|
+
"requires": []
|
|
283
|
+
},
|
|
284
|
+
async s => {
|
|
285
|
+
await s.notebook(["c0", "c1", "c2"]);
|
|
286
|
+
const tab = s.tab("tab");
|
|
287
|
+
const tab2 = s.tab("tab2");
|
|
288
|
+
|
|
289
|
+
await s.step(1, "First tab", "opens the notebook", async () => {
|
|
290
|
+
await tab.open();
|
|
291
|
+
await s.expectTab(tab, ["c0", "c1", "c2"]);
|
|
292
|
+
});
|
|
293
|
+
await s.step(2, "Second tab", "opens the same notebook", async () => {
|
|
294
|
+
await tab2.open();
|
|
295
|
+
await s.expectTab(tab2, ["c0", "c1", "c2"]);
|
|
296
|
+
});
|
|
297
|
+
await s.step(3, "Second tab", "loses its connection", async () => {
|
|
298
|
+
await tab2.goOffline();
|
|
299
|
+
});
|
|
300
|
+
await s.step(4, "Second tab", "adds a cell “typed while offline”", async () => {
|
|
301
|
+
await tab2.addCell(3, "typed while offline");
|
|
302
|
+
await s.expectTab(tab2, ["c0", "c1", "c2", "typed while offline"]);
|
|
303
|
+
});
|
|
304
|
+
await s.step(5, "Second tab", "reconnects", async () => {
|
|
305
|
+
await tab2.goOnline();
|
|
306
|
+
});
|
|
307
|
+
await s.step(6, "Server", "keeps the new cell and shares it with the first tab", async () => {
|
|
308
|
+
// nothing for a test to do: the storyboard states what is so
|
|
309
|
+
});
|
|
310
|
+
await s.step(7, "File on disk", "autosave", async () => {
|
|
311
|
+
// nothing for a test to do: the storyboard states what is so
|
|
312
|
+
});
|
|
313
|
+
|
|
314
|
+
await s.ends([
|
|
315
|
+
{ label: "As the story ends", ends: { tab: ["c0", "c1", "c2", "typed while offline"], tab2: ["c0", "c1", "c2", "typed while offline"], server: ["c0", "c1", "c2", "typed while offline"], file: ["c0", "c1", "c2", "typed while offline"] } },
|
|
316
|
+
]);
|
|
317
|
+
}
|
|
318
|
+
)
|
|
319
|
+
);
|
|
320
|
+
|
|
321
|
+
// Tabs A and B and a collaborator W work in one notebook. A leaves early, so B holds more of what W did than A does. Then the server lets go of the notebook and builds it again, and A comes back first, B second.
|
|
322
|
+
test(
|
|
323
|
+
...story(
|
|
324
|
+
{
|
|
325
|
+
"id": "H2",
|
|
326
|
+
"group": "handshake",
|
|
327
|
+
"title": "Two out-of-date tabs hold different amounts of the same session",
|
|
328
|
+
"requires": [
|
|
329
|
+
"releaseRoom"
|
|
330
|
+
]
|
|
331
|
+
},
|
|
332
|
+
async s => {
|
|
333
|
+
await s.notebook(["c0", "c1", "c2"]);
|
|
334
|
+
const tab = s.tab("tab");
|
|
335
|
+
const tab2 = s.tab("tab2");
|
|
336
|
+
const tab3 = s.tab("tab3");
|
|
337
|
+
|
|
338
|
+
await s.step(1, "Tab A + Tab B + Collaborator W", "A, B and W open the notebook", async () => {
|
|
339
|
+
await tab.open();
|
|
340
|
+
await s.expectTab(tab, ["c0", "c1", "c2"]);
|
|
341
|
+
await tab2.open();
|
|
342
|
+
await s.expectTab(tab2, ["c0", "c1", "c2"]);
|
|
343
|
+
await tab3.open();
|
|
344
|
+
await s.expectTab(tab3, ["c0", "c1", "c2"]);
|
|
345
|
+
});
|
|
346
|
+
await s.step(2, "Collaborator W", "W adds a cell “X-1”", async () => {
|
|
347
|
+
await tab3.addCell(3, "X-1");
|
|
348
|
+
await s.settle(tab3);
|
|
349
|
+
await s.expectTab(tab3, ["c0", "c1", "c2", "X-1"]);
|
|
350
|
+
});
|
|
351
|
+
await s.step(3, "Tab A + Tab B", "A and B receive X-1", async () => {
|
|
352
|
+
await s.expectTabEventually(tab, ["c0", "c1", "c2", "X-1"]);
|
|
353
|
+
await s.expectTabEventually(tab2, ["c0", "c1", "c2", "X-1"]);
|
|
354
|
+
});
|
|
355
|
+
await s.step(4, "Tab A", "A goes away (laptop closed)", async () => {
|
|
356
|
+
await tab.goOffline();
|
|
357
|
+
});
|
|
358
|
+
await s.step(5, "Collaborator W", "W adds another cell “X-2”", async () => {
|
|
359
|
+
await tab3.addCell(4, "X-2");
|
|
360
|
+
await s.settle(tab3);
|
|
361
|
+
await s.expectTab(tab3, ["c0", "c1", "c2", "X-1", "X-2"]);
|
|
362
|
+
});
|
|
363
|
+
await s.step(6, "Tab B", "only B receives X-2: B now holds more of W's work than A", async () => {
|
|
364
|
+
await s.expectTabEventually(tab2, ["c0", "c1", "c2", "X-1", "X-2"]);
|
|
365
|
+
});
|
|
366
|
+
await s.step(7, "Tab B + Collaborator W", "B and W close their tabs", async () => {
|
|
367
|
+
await tab2.goOffline(); // it goes away and, later in the story, comes back: the tab stays open
|
|
368
|
+
await tab3.close();
|
|
369
|
+
});
|
|
370
|
+
await s.step(8, "File on disk", "holds all five cells", async () => {
|
|
371
|
+
// nothing for a test to do: the storyboard states what is so
|
|
372
|
+
});
|
|
373
|
+
await s.step(9, "Server", "lets go of the notebook, then builds it again from the file", async () => {
|
|
374
|
+
await s.releaseRoom();
|
|
375
|
+
});
|
|
376
|
+
await s.step(10, "Tab A", "A comes back first", async () => {
|
|
377
|
+
await tab.goOnline();
|
|
378
|
+
});
|
|
379
|
+
await s.step(11, "Tab B", "B comes back second; it holds a longer piece of W's work than A did", async () => {
|
|
380
|
+
await tab2.goOnline();
|
|
381
|
+
});
|
|
382
|
+
|
|
383
|
+
await s.ends([
|
|
384
|
+
{ label: "As the story ends", ends: { tab: ["c0", "c1", "c2", "X-1", "X-2"], tab2: ["c0", "c1", "c2", "X-1", "X-2"], server: ["c0", "c1", "c2", "X-1", "X-2"], file: ["c0", "c1", "c2", "X-1", "X-2"] } },
|
|
385
|
+
]);
|
|
386
|
+
}
|
|
387
|
+
)
|
|
388
|
+
);
|
|
389
|
+
|
|
390
|
+
// One tab opens the notebook, loses its connection, the user adds a cell, and the tab reconnects to the same server.
|
|
391
|
+
test(
|
|
392
|
+
...story(
|
|
393
|
+
{
|
|
394
|
+
"id": "C1",
|
|
395
|
+
"group": "handshake",
|
|
396
|
+
"title": "Control: the first tab adds a cell while offline",
|
|
397
|
+
"requires": []
|
|
398
|
+
},
|
|
399
|
+
async s => {
|
|
400
|
+
await s.notebook(["c0", "c1", "c2"]);
|
|
401
|
+
const tab = s.tab("tab");
|
|
402
|
+
|
|
403
|
+
await s.step(1, "Your tab", "opens the notebook", async () => {
|
|
404
|
+
await tab.open();
|
|
405
|
+
await s.expectTab(tab, ["c0", "c1", "c2"]);
|
|
406
|
+
});
|
|
407
|
+
await s.step(2, "Your tab", "loses its connection", async () => {
|
|
408
|
+
await tab.goOffline();
|
|
409
|
+
});
|
|
410
|
+
await s.step(3, "Your tab", "adds a cell “offline edit”", async () => {
|
|
411
|
+
await tab.addCell(3, "offline edit");
|
|
412
|
+
await s.expectTab(tab, ["c0", "c1", "c2", "offline edit"]);
|
|
413
|
+
});
|
|
414
|
+
await s.step(4, "Your tab", "reconnects", async () => {
|
|
415
|
+
await tab.goOnline();
|
|
416
|
+
});
|
|
417
|
+
await s.step(5, "Server", "receives the new cell", async () => {
|
|
418
|
+
// nothing for a test to do: the storyboard states what is so
|
|
419
|
+
});
|
|
420
|
+
await s.step(6, "File on disk", "autosave", async () => {
|
|
421
|
+
// nothing for a test to do: the storyboard states what is so
|
|
422
|
+
});
|
|
423
|
+
|
|
424
|
+
await s.ends([
|
|
425
|
+
{ label: "As the story ends", ends: { tab: ["c0", "c1", "c2", "offline edit"], server: ["c0", "c1", "c2", "offline edit"], file: ["c0", "c1", "c2", "offline edit"] } },
|
|
426
|
+
]);
|
|
427
|
+
}
|
|
428
|
+
)
|
|
429
|
+
);
|