Skip to content

Commit 382b295

Browse files
Migrate squish 2D sketcher tests to Playwright e2e
Port the portable intent of the squish suites suite_2D_sketcher and suite_2D_sketcher_new to JavaScript Playwright tests driving the standalone WASM sketcher. Maestro-bound cases (Project Table, 2D Viewer panel, file/help menus) and index-based interaction cases (which need an atom/bond hit-testing binding) are out of scope. New test files: - problematic_structures.test.js: each SDF record / .mae structure imports without throwing (multi-structure SDF and .mae are split per record) - import_formats.test.js: methylphenidate across 11 formats canonicalizes consistently; InChI/SMARTS/complex-SMILES import; 200-atom limit rejects - miscellaneous.test.js: SHARED-6974 regression structures import - keyboard_shortcuts.test.js: element key shortcuts place the matching atom Helpers: add clearSketcher, tryImport (with getExceptionMessage decoding). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 42188a8 commit 382b295

30 files changed

Lines changed: 37246 additions & 0 deletions

test/wasm/e2e/e2e_helpers.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,42 @@ export async function isSketcherEmpty(page) {
8585
return page.evaluate(() => Module.sketcher_is_empty());
8686
}
8787

88+
/**
89+
* Clear all contents from the sketcher canvas.
90+
*/
91+
export async function clearSketcher(page) {
92+
await page.evaluate(() => Module.sketcher_clear());
93+
}
94+
95+
/**
96+
* Import a structure string and report the outcome without throwing, so
97+
* callers can sweep many structures and collect failures. Returns
98+
* {ok, empty, error} where `ok` is false if the import threw, and `empty`
99+
* reflects whether anything was actually rendered afterward.
100+
*/
101+
export async function tryImport(page, text) {
102+
return page.evaluate((t) => {
103+
try {
104+
Module.sketcher_import_text(t);
105+
return { ok: true, empty: Module.sketcher_is_empty(), error: null };
106+
} catch (e) {
107+
// Emscripten throws C++ exceptions as a raw pointer (a number).
108+
// Decode it into the original what() message when possible.
109+
let error;
110+
if (typeof e === 'number' && typeof Module.getExceptionMessage === 'function') {
111+
try {
112+
error = Module.getExceptionMessage(e).join(': ');
113+
} catch {
114+
error = `uncaught C++ exception (ptr ${e})`;
115+
}
116+
} else {
117+
error = String(e && e.message ? e.message : e);
118+
}
119+
return { ok: false, empty: true, error };
120+
}
121+
}, text);
122+
}
123+
88124
/**
89125
* Click a toolbar button by its Qt objectName (e.g. "c_btn").
90126
* Uses the generic getWidgetRect to find the button's position.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
COC(=O)[C@@H](C1=CC=CC=C1)[C@@H]1CCCCN1 |a:4,11|
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
COC(=O)[C@@H](C1=CC=CC=C1)[C@@H]1CCCCN1 |a:4,11|
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
MODEL 1
2+
HETATM 1 C1 UNL 1 -5.083 1.885 0.000 1.00 0.00 C
3+
HETATM 2 O1 UNL 1 -3.846 1.170 0.000 1.00 0.00 O
4+
HETATM 3 C2 UNL 1 -2.609 1.883 0.000 1.00 0.00 C
5+
HETATM 4 O2 UNL 1 -2.607 3.311 0.000 1.00 0.00 O
6+
HETATM 5 C3 UNL 1 -1.372 1.168 0.000 1.00 0.00 C
7+
HETATM 6 C4 UNL 1 -0.134 1.881 0.000 1.00 0.00 C
8+
HETATM 7 C5 UNL 1 1.102 1.166 0.000 1.00 0.00 C
9+
HETATM 8 C6 UNL 1 2.340 1.879 0.000 1.00 0.00 C
10+
HETATM 9 C7 UNL 1 2.341 3.308 0.000 1.00 0.00 C
11+
HETATM 10 C8 UNL 1 1.105 4.023 0.000 1.00 0.00 C
12+
HETATM 11 N1 UNL 1 -0.133 3.310 0.000 1.00 0.00 N
13+
HETATM 12 C9 UNL 1 -1.373 -0.261 0.000 1.00 0.00 C
14+
HETATM 13 C10 UNL 1 -0.137 -0.976 0.000 1.00 0.00 C
15+
HETATM 14 C11 UNL 1 -0.138 -2.405 0.000 1.00 0.00 C
16+
HETATM 15 C12 UNL 1 -1.375 -3.118 0.000 1.00 0.00 C
17+
HETATM 16 C13 UNL 1 -2.612 -2.403 0.000 1.00 0.00 C
18+
HETATM 17 C14 UNL 1 -2.611 -0.974 0.000 1.00 0.00 C
19+
CONECT 1 2
20+
CONECT 2 3
21+
CONECT 3 4 4 5
22+
CONECT 5 6 12
23+
CONECT 6 7 11
24+
CONECT 7 8
25+
CONECT 8 9
26+
CONECT 9 10
27+
CONECT 10 11
28+
CONECT 12 13 13 17
29+
CONECT 13 14
30+
CONECT 14 15 15
31+
CONECT 15 16
32+
CONECT 16 17 17
33+
ENDMDL
34+
MODEL 2
35+
HETATM 1 C1 UNL 1 -1.829 -1.261 -0.000 1.00 0.00 C
36+
HETATM 2 O1 UNL 1 -0.449 -1.281 -0.000 1.00 0.00 O
37+
HETATM 3 C2 UNL 1 0.000 0.000 0.000 1.00 0.00 C
38+
HETATM 4 O2 UNL 1 -0.745 0.973 0.000 1.00 0.00 O
39+
HETATM 5 C3 UNL 1 1.500 0.000 0.000 1.00 0.00 C
40+
HETATM 6 C4 UNL 1 2.000 1.414 0.000 1.00 0.00 C
41+
HETATM 7 C5 UNL 1 3.538 1.424 -0.015 1.00 0.00 C
42+
HETATM 8 C6 UNL 1 4.076 2.860 0.038 1.00 0.00 C
43+
HETATM 9 C7 UNL 1 3.456 3.593 1.234 1.00 0.00 C
44+
HETATM 10 C8 UNL 1 1.921 3.498 1.199 1.00 0.00 C
45+
HETATM 11 N1 UNL 1 1.509 2.096 1.195 1.00 0.00 N
46+
HETATM 12 C9 UNL 1 2.000 -0.707 -1.225 1.00 0.00 C
47+
HETATM 13 C10 UNL 1 2.810 -1.853 -1.095 1.00 0.00 C
48+
HETATM 14 C11 UNL 1 3.279 -2.517 -2.246 1.00 0.00 C
49+
HETATM 15 C12 UNL 1 2.939 -2.036 -3.525 1.00 0.00 C
50+
HETATM 16 C13 UNL 1 2.129 -0.890 -3.655 1.00 0.00 C
51+
HETATM 17 C14 UNL 1 1.660 -0.226 -2.504 1.00 0.00 C
52+
CONECT 1 2
53+
CONECT 2 3
54+
CONECT 3 4 4 5
55+
CONECT 5 6 12
56+
CONECT 6 7 11
57+
CONECT 7 8
58+
CONECT 8 9
59+
CONECT 9 10
60+
CONECT 10 11
61+
CONECT 12 13 13 17
62+
CONECT 13 14
63+
CONECT 14 15 15
64+
CONECT 15 16
65+
CONECT 16 17 17
66+
ENDMDL
67+
END
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
InChI=1S/C14H19NO2/c1-17-14(16)13(11-7-3-2-4-8-11)12-9-5-6-10-15-12/h2-4,7-8,12-13,15H,5-6,9-10H2,1H3/t12-,13-/m0/s1
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
2+
RDKit 2D
3+
4+
0 0 0 0 0 0 0 0 0 0999 V3000
5+
M V30 BEGIN CTAB
6+
M V30 COUNTS 17 18 0 0 0
7+
M V30 BEGIN ATOM
8+
M V30 1 C -5.082857 1.884857 0.000000 0
9+
M V30 2 O -3.846286 1.169714 0.000000 0
10+
M V30 3 C -2.608572 1.882857 0.000000 0
11+
M V30 4 O -2.607429 3.311429 0.000000 0
12+
M V30 5 C -1.372000 1.167714 0.000000 0
13+
M V30 6 C -0.134286 1.880857 0.000000 0
14+
M V30 7 C 1.102286 1.165714 0.000000 0
15+
M V30 8 C 2.340000 1.878857 0.000000 0
16+
M V30 9 C 2.341143 3.307714 0.000000 0
17+
M V30 10 C 1.104571 4.022857 0.000000 0
18+
M V30 11 N -0.133143 3.309714 0.000000 0
19+
M V30 12 C -1.373143 -0.261143 0.000000 0
20+
M V30 13 C -0.136571 -0.976000 0.000000 0
21+
M V30 14 C -0.137714 -2.404857 0.000000 0
22+
M V30 15 C -1.375429 -3.118000 0.000000 0
23+
M V30 16 C -2.612000 -2.402857 0.000000 0
24+
M V30 17 C -2.610857 -0.974000 0.000000 0
25+
M V30 END ATOM
26+
M V30 BEGIN BOND
27+
M V30 1 1 2 1
28+
M V30 2 1 3 2
29+
M V30 3 2 4 3
30+
M V30 4 1 5 3 CFG=3
31+
M V30 5 1 6 5
32+
M V30 6 1 6 7 CFG=1
33+
M V30 7 1 8 7
34+
M V30 8 1 9 8
35+
M V30 9 1 10 9
36+
M V30 10 1 6 11
37+
M V30 11 1 11 10
38+
M V30 12 1 12 5
39+
M V30 13 2 13 12
40+
M V30 14 1 14 13
41+
M V30 15 2 15 14
42+
M V30 16 1 16 15
43+
M V30 17 1 17 12
44+
M V30 18 2 17 16
45+
M V30 END BOND
46+
M V30 BEGIN COLLECTION
47+
M V30 MDLV30/STEABS ATOMS=(2 5 6)
48+
M V30 END COLLECTION
49+
M V30 END CTAB
50+
M END
51+
$$$$
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
2+
RDKit 2D
3+
4+
0 0 0 0 0 0 0 0 0 0999 V3000
5+
M V30 BEGIN CTAB
6+
M V30 COUNTS 17 18 0 0 0
7+
M V30 BEGIN ATOM
8+
M V30 1 C -5.082857 1.884857 0.000000 0
9+
M V30 2 O -3.846286 1.169714 0.000000 0
10+
M V30 3 C -2.608572 1.882857 0.000000 0
11+
M V30 4 O -2.607429 3.311429 0.000000 0
12+
M V30 5 C -1.372000 1.167714 0.000000 0
13+
M V30 6 C -0.134286 1.880857 0.000000 0
14+
M V30 7 C 1.102286 1.165714 0.000000 0
15+
M V30 8 C 2.340000 1.878857 0.000000 0
16+
M V30 9 C 2.341143 3.307714 0.000000 0
17+
M V30 10 C 1.104571 4.022857 0.000000 0
18+
M V30 11 N -0.133143 3.309714 0.000000 0
19+
M V30 12 C -1.373143 -0.261143 0.000000 0
20+
M V30 13 C -0.136571 -0.976000 0.000000 0
21+
M V30 14 C -0.137714 -2.404857 0.000000 0
22+
M V30 15 C -1.375429 -3.118000 0.000000 0
23+
M V30 16 C -2.612000 -2.402857 0.000000 0
24+
M V30 17 C -2.610857 -0.974000 0.000000 0
25+
M V30 END ATOM
26+
M V30 BEGIN BOND
27+
M V30 1 1 2 1
28+
M V30 2 1 3 2
29+
M V30 3 2 4 3
30+
M V30 4 1 5 3 CFG=3
31+
M V30 5 1 6 5
32+
M V30 6 1 6 7 CFG=1
33+
M V30 7 1 8 7
34+
M V30 8 1 9 8
35+
M V30 9 1 10 9
36+
M V30 10 1 6 11
37+
M V30 11 1 11 10
38+
M V30 12 1 12 5
39+
M V30 13 2 13 12
40+
M V30 14 1 14 13
41+
M V30 15 2 15 14
42+
M V30 16 1 16 15
43+
M V30 17 1 17 12
44+
M V30 18 2 17 16
45+
M V30 END BOND
46+
M V30 BEGIN COLLECTION
47+
M V30 MDLV30/STEABS ATOMS=(2 5 6)
48+
M V30 END COLLECTION
49+
M V30 END CTAB
50+
M END
51+
$$$$
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
MODEL 1
2+
HETATM 1 C1 UNL 1 -5.083 1.885 0.000 1.00 0.00 C
3+
HETATM 2 O1 UNL 1 -3.846 1.170 0.000 1.00 0.00 O
4+
HETATM 3 C2 UNL 1 -2.609 1.883 0.000 1.00 0.00 C
5+
HETATM 4 O2 UNL 1 -2.607 3.311 0.000 1.00 0.00 O
6+
HETATM 5 C3 UNL 1 -1.372 1.168 0.000 1.00 0.00 C
7+
HETATM 6 C4 UNL 1 -0.134 1.881 0.000 1.00 0.00 C
8+
HETATM 7 C5 UNL 1 1.102 1.166 0.000 1.00 0.00 C
9+
HETATM 8 C6 UNL 1 2.340 1.879 0.000 1.00 0.00 C
10+
HETATM 9 C7 UNL 1 2.341 3.308 0.000 1.00 0.00 C
11+
HETATM 10 C8 UNL 1 1.105 4.023 0.000 1.00 0.00 C
12+
HETATM 11 N1 UNL 1 -0.133 3.310 0.000 1.00 0.00 N
13+
HETATM 12 C9 UNL 1 -1.373 -0.261 0.000 1.00 0.00 C
14+
HETATM 13 C10 UNL 1 -0.137 -0.976 0.000 1.00 0.00 C
15+
HETATM 14 C11 UNL 1 -0.138 -2.405 0.000 1.00 0.00 C
16+
HETATM 15 C12 UNL 1 -1.375 -3.118 0.000 1.00 0.00 C
17+
HETATM 16 C13 UNL 1 -2.612 -2.403 0.000 1.00 0.00 C
18+
HETATM 17 C14 UNL 1 -2.611 -0.974 0.000 1.00 0.00 C
19+
CONECT 1 2
20+
CONECT 2 3
21+
CONECT 3 4 4 5
22+
CONECT 5 6 12
23+
CONECT 6 7 11
24+
CONECT 7 8
25+
CONECT 8 9
26+
CONECT 9 10
27+
CONECT 10 11
28+
CONECT 12 13 13 17
29+
CONECT 13 14
30+
CONECT 14 15 15
31+
CONECT 15 16
32+
CONECT 16 17 17
33+
ENDMDL
34+
MODEL 2
35+
HETATM 1 C1 UNL 1 -1.829 -1.261 -0.000 1.00 0.00 C
36+
HETATM 2 O1 UNL 1 -0.449 -1.281 -0.000 1.00 0.00 O
37+
HETATM 3 C2 UNL 1 0.000 0.000 0.000 1.00 0.00 C
38+
HETATM 4 O2 UNL 1 -0.745 0.973 0.000 1.00 0.00 O
39+
HETATM 5 C3 UNL 1 1.500 0.000 0.000 1.00 0.00 C
40+
HETATM 6 C4 UNL 1 2.000 1.414 0.000 1.00 0.00 C
41+
HETATM 7 C5 UNL 1 3.538 1.424 -0.015 1.00 0.00 C
42+
HETATM 8 C6 UNL 1 4.076 2.860 0.038 1.00 0.00 C
43+
HETATM 9 C7 UNL 1 3.456 3.593 1.234 1.00 0.00 C
44+
HETATM 10 C8 UNL 1 1.921 3.498 1.199 1.00 0.00 C
45+
HETATM 11 N1 UNL 1 1.509 2.096 1.195 1.00 0.00 N
46+
HETATM 12 C9 UNL 1 2.000 -0.707 -1.225 1.00 0.00 C
47+
HETATM 13 C10 UNL 1 2.810 -1.853 -1.095 1.00 0.00 C
48+
HETATM 14 C11 UNL 1 3.279 -2.517 -2.246 1.00 0.00 C
49+
HETATM 15 C12 UNL 1 2.939 -2.036 -3.525 1.00 0.00 C
50+
HETATM 16 C13 UNL 1 2.129 -0.890 -3.655 1.00 0.00 C
51+
HETATM 17 C14 UNL 1 1.660 -0.226 -2.504 1.00 0.00 C
52+
CONECT 1 2
53+
CONECT 2 3
54+
CONECT 3 4 4 5
55+
CONECT 5 6 12
56+
CONECT 6 7 11
57+
CONECT 7 8
58+
CONECT 8 9
59+
CONECT 9 10
60+
CONECT 10 11
61+
CONECT 12 13 13 17
62+
CONECT 13 14
63+
CONECT 14 15 15
64+
CONECT 15 16
65+
CONECT 16 17 17
66+
ENDMDL
67+
END
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
2+
RDKit 2D
3+
4+
0 0 0 0 0 0 0 0 0 0999 V3000
5+
M V30 BEGIN CTAB
6+
M V30 COUNTS 17 18 0 0 0
7+
M V30 BEGIN ATOM
8+
M V30 1 C -5.082857 1.884857 0.000000 0
9+
M V30 2 O -3.846286 1.169714 0.000000 0
10+
M V30 3 C -2.608572 1.882857 0.000000 0
11+
M V30 4 O -2.607429 3.311429 0.000000 0
12+
M V30 5 C -1.372000 1.167714 0.000000 0
13+
M V30 6 C -0.134286 1.880857 0.000000 0
14+
M V30 7 C 1.102286 1.165714 0.000000 0
15+
M V30 8 C 2.340000 1.878857 0.000000 0
16+
M V30 9 C 2.341143 3.307714 0.000000 0
17+
M V30 10 C 1.104571 4.022857 0.000000 0
18+
M V30 11 N -0.133143 3.309714 0.000000 0
19+
M V30 12 C -1.373143 -0.261143 0.000000 0
20+
M V30 13 C -0.136571 -0.976000 0.000000 0
21+
M V30 14 C -0.137714 -2.404857 0.000000 0
22+
M V30 15 C -1.375429 -3.118000 0.000000 0
23+
M V30 16 C -2.612000 -2.402857 0.000000 0
24+
M V30 17 C -2.610857 -0.974000 0.000000 0
25+
M V30 END ATOM
26+
M V30 BEGIN BOND
27+
M V30 1 1 2 1
28+
M V30 2 1 3 2
29+
M V30 3 2 4 3
30+
M V30 4 1 5 3 CFG=3
31+
M V30 5 1 6 5
32+
M V30 6 1 6 7 CFG=1
33+
M V30 7 1 8 7
34+
M V30 8 1 9 8
35+
M V30 9 1 10 9
36+
M V30 10 1 6 11
37+
M V30 11 1 11 10
38+
M V30 12 1 12 5
39+
M V30 13 2 13 12
40+
M V30 14 1 14 13
41+
M V30 15 2 15 14
42+
M V30 16 1 16 15
43+
M V30 17 1 17 12
44+
M V30 18 2 17 16
45+
M V30 END BOND
46+
M V30 BEGIN COLLECTION
47+
M V30 MDLV30/STEABS ATOMS=(2 5 6)
48+
M V30 END COLLECTION
49+
M V30 END CTAB
50+
M END
51+
$$$$
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
2+
RDKit 2D
3+
4+
0 0 0 0 0 0 0 0 0 0999 V3000
5+
M V30 BEGIN CTAB
6+
M V30 COUNTS 17 18 0 0 0
7+
M V30 BEGIN ATOM
8+
M V30 1 C -5.082857 1.884857 0.000000 0
9+
M V30 2 O -3.846286 1.169714 0.000000 0
10+
M V30 3 C -2.608572 1.882857 0.000000 0
11+
M V30 4 O -2.607429 3.311429 0.000000 0
12+
M V30 5 C -1.372000 1.167714 0.000000 0
13+
M V30 6 C -0.134286 1.880857 0.000000 0
14+
M V30 7 C 1.102286 1.165714 0.000000 0
15+
M V30 8 C 2.340000 1.878857 0.000000 0
16+
M V30 9 C 2.341143 3.307714 0.000000 0
17+
M V30 10 C 1.104571 4.022857 0.000000 0
18+
M V30 11 N -0.133143 3.309714 0.000000 0
19+
M V30 12 C -1.373143 -0.261143 0.000000 0
20+
M V30 13 C -0.136571 -0.976000 0.000000 0
21+
M V30 14 C -0.137714 -2.404857 0.000000 0
22+
M V30 15 C -1.375429 -3.118000 0.000000 0
23+
M V30 16 C -2.612000 -2.402857 0.000000 0
24+
M V30 17 C -2.610857 -0.974000 0.000000 0
25+
M V30 END ATOM
26+
M V30 BEGIN BOND
27+
M V30 1 1 2 1
28+
M V30 2 1 3 2
29+
M V30 3 2 4 3
30+
M V30 4 1 5 3 CFG=3
31+
M V30 5 1 6 5
32+
M V30 6 1 6 7 CFG=1
33+
M V30 7 1 8 7
34+
M V30 8 1 9 8
35+
M V30 9 1 10 9
36+
M V30 10 1 6 11
37+
M V30 11 1 11 10
38+
M V30 12 1 12 5
39+
M V30 13 2 13 12
40+
M V30 14 1 14 13
41+
M V30 15 2 15 14
42+
M V30 16 1 16 15
43+
M V30 17 1 17 12
44+
M V30 18 2 17 16
45+
M V30 END BOND
46+
M V30 BEGIN COLLECTION
47+
M V30 MDLV30/STEABS ATOMS=(2 5 6)
48+
M V30 END COLLECTION
49+
M V30 END CTAB
50+
M END
51+
$$$$

0 commit comments

Comments
 (0)