Skip to content

Commit c9eaead

Browse files
committed
Add test for when state is too big, still need to implement
1 parent cfbf6ac commit c9eaead

File tree

2 files changed

+333
-1
lines changed

2 files changed

+333
-1
lines changed
Lines changed: 304 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,304 @@
1+
{
2+
"name": "My experiment 1",
3+
"description": "",
4+
"reference": {
5+
"initialState": {
6+
"h_0": 200,
7+
"theta_0": 288,
8+
"dtheta_0": 1,
9+
"q_0": 0.008,
10+
"dq_0": -0.001
11+
},
12+
"timeControl": {
13+
"dt": 60,
14+
"runtime": 43200
15+
},
16+
"mixedLayer": {
17+
"wtheta": 0.1,
18+
"advtheta": 0,
19+
"gammatheta": 0.006,
20+
"wq": 0.0001,
21+
"advq": 0,
22+
"gammaq": 0,
23+
"divU": 0,
24+
"beta": 0.2
25+
}
26+
},
27+
"permutations": [
28+
{
29+
"name": "h_0=100, beta=0.1",
30+
"config": {
31+
"initialState": {
32+
"h_0": 100
33+
},
34+
"mixedLayer": {
35+
"beta": 0.1
36+
}
37+
}
38+
},
39+
{
40+
"name": "h_0=100, beta=0.3",
41+
"config": {
42+
"initialState": {
43+
"h_0": 100
44+
},
45+
"mixedLayer": {
46+
"beta": 0.3
47+
}
48+
}
49+
},
50+
{
51+
"name": "h_0=100, beta=0.4",
52+
"config": {
53+
"initialState": {
54+
"h_0": 100
55+
},
56+
"mixedLayer": {
57+
"beta": 0.4
58+
}
59+
}
60+
},
61+
{
62+
"name": "h_0=100, beta=0.5",
63+
"config": {
64+
"initialState": {
65+
"h_0": 100
66+
},
67+
"mixedLayer": {
68+
"beta": 0.5
69+
}
70+
}
71+
},
72+
{
73+
"name": "h_0=100, beta=0.6",
74+
"config": {
75+
"initialState": {
76+
"h_0": 100
77+
},
78+
"mixedLayer": {
79+
"beta": 0.6
80+
}
81+
}
82+
},
83+
{
84+
"name": "h_0=300, beta=0.1",
85+
"config": {
86+
"initialState": {
87+
"h_0": 300
88+
},
89+
"mixedLayer": {
90+
"beta": 0.1
91+
}
92+
}
93+
},
94+
{
95+
"name": "h_0=300, beta=0.3",
96+
"config": {
97+
"initialState": {
98+
"h_0": 300
99+
},
100+
"mixedLayer": {
101+
"beta": 0.3
102+
}
103+
}
104+
},
105+
{
106+
"name": "h_0=300, beta=0.4",
107+
"config": {
108+
"initialState": {
109+
"h_0": 300
110+
},
111+
"mixedLayer": {
112+
"beta": 0.4
113+
}
114+
}
115+
},
116+
{
117+
"name": "h_0=300, beta=0.5",
118+
"config": {
119+
"initialState": {
120+
"h_0": 300
121+
},
122+
"mixedLayer": {
123+
"beta": 0.5
124+
}
125+
}
126+
},
127+
{
128+
"name": "h_0=300, beta=0.6",
129+
"config": {
130+
"initialState": {
131+
"h_0": 300
132+
},
133+
"mixedLayer": {
134+
"beta": 0.6
135+
}
136+
}
137+
},
138+
{
139+
"name": "h_0=400, beta=0.1",
140+
"config": {
141+
"initialState": {
142+
"h_0": 400
143+
},
144+
"mixedLayer": {
145+
"beta": 0.1
146+
}
147+
}
148+
},
149+
{
150+
"name": "h_0=400, beta=0.3",
151+
"config": {
152+
"initialState": {
153+
"h_0": 400
154+
},
155+
"mixedLayer": {
156+
"beta": 0.3
157+
}
158+
}
159+
},
160+
{
161+
"name": "h_0=400, beta=0.4",
162+
"config": {
163+
"initialState": {
164+
"h_0": 400
165+
},
166+
"mixedLayer": {
167+
"beta": 0.4
168+
}
169+
}
170+
},
171+
{
172+
"name": "h_0=400, beta=0.5",
173+
"config": {
174+
"initialState": {
175+
"h_0": 400
176+
},
177+
"mixedLayer": {
178+
"beta": 0.5
179+
}
180+
}
181+
},
182+
{
183+
"name": "h_0=400, beta=0.6",
184+
"config": {
185+
"initialState": {
186+
"h_0": 400
187+
},
188+
"mixedLayer": {
189+
"beta": 0.6
190+
}
191+
}
192+
},
193+
{
194+
"name": "h_0=500, beta=0.1",
195+
"config": {
196+
"initialState": {
197+
"h_0": 500
198+
},
199+
"mixedLayer": {
200+
"beta": 0.1
201+
}
202+
}
203+
},
204+
{
205+
"name": "h_0=500, beta=0.3",
206+
"config": {
207+
"initialState": {
208+
"h_0": 500
209+
},
210+
"mixedLayer": {
211+
"beta": 0.3
212+
}
213+
}
214+
},
215+
{
216+
"name": "h_0=500, beta=0.4",
217+
"config": {
218+
"initialState": {
219+
"h_0": 500
220+
},
221+
"mixedLayer": {
222+
"beta": 0.4
223+
}
224+
}
225+
},
226+
{
227+
"name": "h_0=500, beta=0.5",
228+
"config": {
229+
"initialState": {
230+
"h_0": 500
231+
},
232+
"mixedLayer": {
233+
"beta": 0.5
234+
}
235+
}
236+
},
237+
{
238+
"name": "h_0=500, beta=0.6",
239+
"config": {
240+
"initialState": {
241+
"h_0": 500
242+
},
243+
"mixedLayer": {
244+
"beta": 0.6
245+
}
246+
}
247+
},
248+
{
249+
"name": "h_0=600, beta=0.1",
250+
"config": {
251+
"initialState": {
252+
"h_0": 600
253+
},
254+
"mixedLayer": {
255+
"beta": 0.1
256+
}
257+
}
258+
},
259+
{
260+
"name": "h_0=600, beta=0.3",
261+
"config": {
262+
"initialState": {
263+
"h_0": 600
264+
},
265+
"mixedLayer": {
266+
"beta": 0.3
267+
}
268+
}
269+
},
270+
{
271+
"name": "h_0=600, beta=0.4",
272+
"config": {
273+
"initialState": {
274+
"h_0": 600
275+
},
276+
"mixedLayer": {
277+
"beta": 0.4
278+
}
279+
}
280+
},
281+
{
282+
"name": "h_0=600, beta=0.5",
283+
"config": {
284+
"initialState": {
285+
"h_0": 600
286+
},
287+
"mixedLayer": {
288+
"beta": 0.5
289+
}
290+
}
291+
},
292+
{
293+
"name": "h_0=600, beta=0.6",
294+
"config": {
295+
"initialState": {
296+
"h_0": 600
297+
},
298+
"mixedLayer": {
299+
"beta": 0.6
300+
}
301+
}
302+
}
303+
]
304+
}

apps/class-solid/tests/share.spec.ts

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { expect, test } from "@playwright/test";
1+
import { type Page, expect, test } from "@playwright/test";
22
import { parseDownload } from "./helpers";
33

44
test("Create share link from an experiment", async ({ page }) => {
@@ -45,3 +45,31 @@ test("Create share link from an experiment", async ({ page }) => {
4545
/My experiment 1: \d+ m/,
4646
);
4747
});
48+
49+
test("Given large app state, sharing is not possible", async ({ page }) => {
50+
await page.goto("/");
51+
// Upload a big experiment X times
52+
const x = 10;
53+
for (let i = 0; i < x; i++) {
54+
await uploadBigExperiment(page);
55+
}
56+
57+
await page.getByRole("button", { name: "Share" }).click();
58+
await page.waitForSelector(
59+
"text=Cannot share application state, it is too large. Please download each experiment by itself or make it smaller by removing permutations and/or experiments.",
60+
);
61+
});
62+
63+
async function uploadBigExperiment(page: Page) {
64+
await page.getByRole("button", { name: "Add experiment" }).click();
65+
const thisfile = new URL(import.meta.url).pathname;
66+
// Could not get playwrigth to work same way as human
67+
// as file chooser is not shown sometimes
68+
// so using input element directly
69+
const file = thisfile.replace("share.spec.ts", "big-app-state.json");
70+
await page.locator("input[type=file]").setInputFiles(file);
71+
// Wait for experiment to run to completion
72+
await expect(page.getByRole("status", { name: "Running" })).not.toBeVisible();
73+
// Close popup
74+
await page.getByRole("heading", { name: "Experiments" }).click();
75+
}

0 commit comments

Comments
 (0)