Skip to content

Commit f873318

Browse files
authored
Autotests: #5960 autotests display molecules in macro mode basic structures with atoms and bonds (#5983)
* Verify that bond lines between atoms do not overlap in any angle in macro mode * screen * Verify that connections between monomers and molecules are maintained correctly in both micro and macro modes * Verify that switching between micro and macro modes displays molecules without structural changes * Verify that deleting a bond in macro mode removes the bond while maintaining the integrity of the surrounding structure * Verify that the structure in macro mode can be saved as a .ket file, and all elements including bonds and atoms are correctly restored when re-loaded * Peptides - Verify that connection points between monomers and molecules can be created by drawing bonds in macro mode * Bases - Verify that connection points between monomers and molecules can be created by drawing bonds in macro mode * CHEMS - Verify that connection points between monomers and molecules can be created by drawing bonds in macro mode * Nucleotide - Verify that connection points between monomers and molecules can be created by drawing bonds in macro mode - Part 1 * Nucleotide - Verify that connection points between monomers and molecules can be created by drawing bonds in macro mode - Part 2 * Phosphates - Verify that connection points between monomers and molecules can be created by drawing bonds in macro mode and HELM results correction * Sugar - Verify that connection points between monomers and molecules can be created by drawing bonds in macro mode * phosphate fix * Nucleotide fix * Peptide fix * phosphate fix * Sugar fix * CHEMs fix * Bases fix * Some fixes
1 parent 0c9dc01 commit f873318

File tree

143 files changed

+16261
-94
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

143 files changed

+16261
-94
lines changed

ketcher-autotests/tests/Macromolecule-editor/Ambiguous-Monomers/preview-for-ambiguous-monomers.spec.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,7 @@ test.beforeAll(async ({ browser }) => {
4242
});
4343

4444
test.afterEach(async () => {
45-
await page.keyboard.press('Escape');
46-
await page.keyboard.press('Escape');
47-
// await page.keyboard.press('Control+0');
4845
await selectClearCanvasTool(page);
49-
// await page.keyboard.press('Control+0');
5046
});
5147

5248
test.afterAll(async ({ browser }) => {

ketcher-autotests/tests/Macromolecule-editor/Import-Saving-Files/import-saving-helm.spec.ts

Lines changed: 24 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -347,77 +347,72 @@ const correctHELMStrings: IHELMString[] = [
347347
helmDescription: '48. RNA(RA) with single inline Extended SMILES (A)',
348348
HELMString:
349349
'RNA1{R([C1(C2=C(N=CN=1)N%91C=N2)N.[*:1]%91 |$;;;;;;;;;;_R1$|])}$$$$V2.0',
350-
shouldFail: true,
351-
issueNumber: 'https://github.com/epam/Indigo/issues/2337',
352350
pageReloadNeeded: true,
351+
differentHELMExport:
352+
'RNA1{R([C1(N)=NC=NC2N([*:1])C=NC1=2 |$;;;;;;;_R1;;;$|])}$$$$V2.0',
353353
},
354354
{
355355
helmDescription: '49. RNA(RAP) with single inline Extended SMILES (A)',
356356
HELMString:
357357
'RNA1{R([C1(C2=C(N=CN=1)N%91C=N2)N.[*:1]%91 |$;;;;;;;;;;_R1$|])P}$$$$V2.0',
358-
shouldFail: true,
359-
issueNumber:
360-
'https://github.com/epam/Indigo/issues/2339, https://github.com/epam/Indigo/issues/2337',
358+
differentHELMExport:
359+
'RNA1{R([C1(N)=NC=NC2N([*:1])C=NC1=2 |$;;;;;;;_R1;;;$|])P}$$$$V2.0',
361360
},
362361
{
363362
helmDescription: '50. RNA(RP) with single inline Extended SMILES (P)',
364363
HELMString: 'RNA1{R[P%91(O)(O)=O.[*:1]%91 |$;;;;_R1$|]}$$$$V2.0',
365-
shouldFail: true,
366-
issueNumber: 'https://github.com/epam/Indigo/issues/2337',
364+
differentHELMExport: 'RNA1{R[P([*:1])(=O)(O)O |$;_R1;;;$|]}$$$$V2.0',
367365
},
368366
{
369367
helmDescription: '51. RNA(RP) with single inline Extended SMILES (R)',
370368
HELMString:
371369
'RNA1{[O1[C@@H]%91[C@H](O)[C@H](O%92)[C@H]1CO%93.[*:3]%91.[*:1]%93.[*:2]%92 |$;;;;;;;;;_R3;_R1;_R2$|]P}$$$$V2.0',
372-
shouldFail: true,
373-
issueNumber: 'https://github.com/epam/Indigo/issues/2337',
370+
differentHELMExport:
371+
'RNA1{[O1C(CO[*:1])C(O[*:2])C(O)C1[*:3] |$;;;;_R1;;;_R2;;;;_R3$|]P}$$$$V2.0',
374372
},
375373
{
376374
helmDescription: '52. RNA(RAP) with single inline Extended SMILES (P)',
377375
HELMString: 'RNA1{R(A)[P%91(O)(O)=O.[*:1]%91 |$;;;;_R1$|]}$$$$V2.0',
378-
shouldFail: true,
379-
issueNumber: 'https://github.com/epam/Indigo/issues/2337',
376+
differentHELMExport: 'RNA1{R(A)[P([*:1])(=O)(O)O |$;_R1;;;$|]}$$$$V2.0',
380377
pageReloadNeeded: true,
381378
},
382379
{
383380
helmDescription:
384381
'53. RNA(RAP) with all monomer inline Extended SMILES (RAP)',
385382
HELMString:
386383
'RNA1{[O1[C@@H]%91[C@H](O)[C@H](O%92)[C@H]1CO%93.[*:3]%91.[*:1]%93.[*:2]%92 |$;;;;;;;;;_R3;_R1;_R2$|](A)P}$$$$V2.0',
387-
shouldFail: true,
388-
issueNumber: 'https://github.com/epam/Indigo/issues/2339',
384+
differentHELMExport:
385+
'RNA1{[O1C(CO[*:1])C(O[*:2])C(O)C1[*:3] |$;;;;_R1;;;_R2;;;;_R3$|](A)P}$$$$V2.0',
389386
pageReloadNeeded: true,
390387
},
391388
{
392389
helmDescription:
393390
'54. Single peptide with inline SMILES (L) without attachment points',
394391
HELMString: 'PEPTIDE1{[C([C@@H](C(O)=O)N[H])C(C)C]}$$$$V2.0',
395-
shouldFail: true,
396-
issueNumber: 'https://github.com/epam/Indigo/issues/2337',
392+
differentHELMExport: 'PEPTIDE1{[C(C(C)C)C(N[H])C(=O)O]}$$$$V2.0',
397393
pageReloadNeeded: true,
398394
},
399395
{
400396
helmDescription: '55. Single peptide with inline Extended SMILES (L)',
401397
HELMString:
402398
'PEPTIDE1{[C([C@@H](C%91=O)N%92)C(C)C.[*:2]%91.[*:1]%92 |$;;;;;;;;_R2;_R1$|]}$$$$V2.0',
403-
shouldFail: true,
404-
issueNumber: 'https://github.com/epam/Indigo/issues/2337',
399+
differentHELMExport:
400+
'PEPTIDE1{[C(C(C)C)C(N[*:1])C([*:2])=O |$;;;;;;_R1;;_R2;$|]}$$$$V2.0',
405401
pageReloadNeeded: true,
406402
},
407403
{
408404
helmDescription:
409405
'56. Single CHEM with inline SMILES (A6OH) without attachment points',
410406
HELMString: 'CHEM1{[N([H])CCCCCCO[H]]}$$$$V2.0',
411-
shouldFail: true,
412-
issueNumber: 'https://github.com/epam/Indigo/issues/2337',
407+
differentHELMExport: 'CHEM1{[N(CCCCCCO[H])[H]]}$$$$V2.0',
413408
pageReloadNeeded: true,
414409
},
415410
{
416411
helmDescription: '57. Single CHEM with inline Extended SMILES (A6OH)',
417412
HELMString:
418413
'CHEM1{[N%91CCCCCCO%92.[*:2]%91.[*:1]%92 |$;;;;;;;;_R2;_R1$|]}$$$$V2.0',
419-
shouldFail: true,
420-
issueNumber: 'https://github.com/epam/Indigo/issues/2337',
414+
differentHELMExport:
415+
'CHEM1{[N([*:2])CCCCCCO[*:1] |$;_R2;;;;;;;;_R1$|]}$$$$V2.0',
421416
pageReloadNeeded: true,
422417
},
423418
{
@@ -427,20 +422,23 @@ const correctHELMStrings: IHELMString[] = [
427422
'[C%91([C@H](CS%92)N%93)=O.[*:2]%91.[*:1]%93.[*:3]%92 |$;;;;;;_R2;_R1;_R3$|].' +
428423
'[C%91([C@H](CC(O%92)=O)N%93)=O.[*:1]%93.[*:2]%91.[*:3]%92 |$;;;;;;;;_R1;_R2;_R3$|].' +
429424
'[C([C@@H](C%91=O)N%92)C(C)C.[*:2]%91.[*:1]%92 |$;;;;;;;;_R2;_R1$|]}$$$$V2.0',
430-
shouldFail: true,
431-
issueNumber: 'https://github.com/epam/Indigo/issues/2337',
425+
differentHELMExport:
426+
'PEPTIDE1{[N([*:1])C(C)C([*:2])=O |$;_R1;;;;_R2;$|].' +
427+
'[C([*:2])(=O)C(N[*:1])CS[*:3] |$;_R2;;;;_R1;;;_R3$|].' +
428+
'[C([*:2])(=O)C(N[*:1])CC(=O)O[*:3] |$;_R2;;;;_R1;;;;;_R3$|].' +
429+
'[C(C(C)C)C(N[*:1])C([*:2])=O |$;;;;;;_R1;;_R2;$|]}$$$$V2.0',
432430
pageReloadNeeded: true,
433431
},
434432
{
435433
helmDescription:
436434
'59. List of RNAs of inline Extended Smiles (R(A)P, R(C)P, R(G)P)',
437435
HELMString:
438436
// eslint-disable-next-line max-len
439-
'RNA1{[O1[C@@H]%91[C@H](O)[C@H](O%92)[C@H]1CO%93.[*:3]%91.[*:1]%93.[*:2]%92 |$;;;;;;;;;_R3;_R1;_R2$|]([C1(C2=C(N=CN=1)N%91C=N2)N.[*:1]%91 |$;;;;;;;;;;_R1$|])[P%91(O)(O)=O.[*:1]%91 |$;;;;_R1$|]' +
437+
'RNA1{[O1[C@@H]%91[C@H](O)[C@H](O%92)[C@H]1CO%93.[*:3]%91.[*:1]%93.[*:2]%92 |$;;;;;;;;;_R3;_R1;_R2$|]([C1(C2=C(N=CN=1)N%91C=N2)N.[*:1]%91 |$;;;;;;;;;;_R1$|])[P%91%92(=O)O.[*:2]%91.[*:1]%92 |$;;;_R2;_R1$|].' +
440438
// eslint-disable-next-line max-len
441-
'.[O1[C@@H]%91[C@H](O)[C@H](O%92)[C@H]1CO%93.[*:3]%91.[*:1]%93.[*:2]%92 |$;;;;;;;;;_R3;_R1;_R2$|]([C1(N)=NC(=O)N%91C=C1.[*:1]%91 |$;;;;;;;;_R1$|])[P%91(O)(O)=O.[*:1]%91 |$;;;;_R1$|].' +
439+
'[O1[C@@H]%91[C@H](O)[C@H](O%92)[C@H]1CO%93.[*:3]%91.[*:1]%93.[*:2]%92 |$;;;;;;;;;_R3;_R1;_R2$|]([C1(N)=NC(=O)N%91C=C1.[*:1]%91 |$;;;;;;;;_R1$|])[P%91%92(=O)O.[*:2]%91.[*:1]%92 |$;;;_R2;_R1$|].' +
442440
// eslint-disable-next-line max-len
443-
'[O1[C@@H]%91[C@H](O)[C@H](O%92)[C@H]1CO%93.[*:3]%91.[*:1]%93.[*:2]%92 |$;;;;;;;;;_R3;_R1;_R2$|]([C1(C2=C(N=C(N)N1)N%91C=N2)=O.[*:1]%91 |$;;;;;;;;;;;_R1$|])[P%91(O)(O)=O.[*:1]%91 |$;;;;_R1$|]}$$$$V2.0',
441+
'[O1[C@@H]%91[C@H](O)[C@H](O%92)[C@H]1CO%93.[*:3]%91.[*:1]%93.[*:2]%92 |$;;;;;;;;;_R3;_R1;_R2$|]([C1(C2=C(N=C(N)N1)N%91C=N2)=O.[*:1]%91 |$;;;;;;;;;;;_R1$|])[P%91%92(=O)O.[*:2]%91.[*:1]%92 |$;;;_R2;_R1$|]}$$$$V2.0',
444442
shouldFail: true,
445443
issueNumber: 'https://github.com/epam/Indigo/issues/2339',
446444
},
-41.8 KB
Loading

ketcher-autotests/tests/Macromolecule-editor/Import-Saving-Files/import-saving-ket.spec.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,10 @@ import {
2323
openFileAndAddToCanvasAsNewProjectMacro,
2424
Sugars,
2525
selectAllStructuresOnCanvas,
26+
openFileAndAddToCanvasAsNewProject,
2627
} from '@utils';
2728
import { pageReload } from '@utils/common/helpers';
29+
import { FileType, verifyFile2 } from '@utils/files/receiveFileComparisonData';
2830
import {
2931
turnOnMacromoleculesEditor,
3032
zoomWithMouseWheel,
@@ -892,3 +894,31 @@ test.describe('Sugar monomers on the canvas, their connection points and preview
892894
// await takeEditorScreenshot(page);
893895
// });
894896
// }
897+
898+
test(`Verify that the structure in macro mode can be saved as a .ket file, and all elements including bonds and atoms are correctly restored when re-loaded`, async () => {
899+
/*
900+
* Test task: https://github.com/epam/ketcher/issues/5960
901+
* Description: Verify that the structure in macro mode can be saved as a .ket file, and all elements including bonds and atoms are correctly restored when re-loaded
902+
* Case: 1. Load monomer on Macrolecules mode
903+
* 2. Take screenshot to witness original state
904+
* 3. Save canvas to KET
905+
* 4. Verify that export result equal to template
906+
* 5. Load saved KET to the canvas
907+
* 6. Take screenshot to witness saved state
908+
* (screenshots have to be equal)
909+
*/
910+
911+
const KETFile =
912+
'KET/Micro-Macro-Switcher/Complicated structures on the canvas.ket';
913+
const KETFileExpected =
914+
'tests/test-data/KET/Micro-Macro-Switcher/Complicated structures on the canvas-expected.ket';
915+
916+
await openFileAndAddToCanvasAsNewProject(KETFile, page);
917+
await takeEditorScreenshot(page);
918+
await verifyFile2(page, KETFileExpected, FileType.KET);
919+
await openFileAndAddToCanvasAsNewProject(
920+
KETFileExpected.replace('tests/test-data/', ''),
921+
page,
922+
);
923+
await takeEditorScreenshot(page);
924+
});
71.3 KB
Loading
71.3 KB
Loading
Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
/* eslint-disable no-self-compare */
2+
/* eslint-disable max-len */
3+
/* eslint-disable no-magic-numbers */
4+
import {
5+
chooseTab,
6+
Tabs,
7+
turnOnMacromoleculesEditor,
8+
turnOnMicromoleculesEditor,
9+
} from '@utils/macromolecules';
10+
import { Page, test } from '@playwright/test';
11+
import {
12+
takeEditorScreenshot,
13+
openFileAndAddToCanvasAsNewProject,
14+
selectClearCanvasTool,
15+
waitForPageInit,
16+
selectEraseTool,
17+
} from '@utils';
18+
import { clickOnMicroBondByIndex } from '@utils/macromolecules/polymerBond';
19+
20+
let page: Page;
21+
22+
async function configureInitialState(page: Page) {
23+
await chooseTab(page, Tabs.Rna);
24+
}
25+
26+
test.beforeAll(async ({ browser }) => {
27+
const context = await browser.newContext();
28+
page = await context.newPage();
29+
30+
await waitForPageInit(page);
31+
await turnOnMacromoleculesEditor(page);
32+
await configureInitialState(page);
33+
});
34+
35+
test.afterEach(async () => {
36+
await selectClearCanvasTool(page);
37+
});
38+
39+
test.afterAll(async ({ browser }) => {
40+
await Promise.all(browser.contexts().map((context) => context.close()));
41+
});
42+
43+
test(`Verify that bond lines between atoms do not overlap in any angle in macro mode`, async () => {
44+
/*
45+
* Test task: https://github.com/epam/ketcher/issues/5960
46+
* Description: Verify that bond lines between atoms do not overlap in any angle in macro mode
47+
*
48+
* Case: 1. Load ket file with structures
49+
* 2. Take screenshot to witness canvas was rendered correct
50+
*/
51+
await openFileAndAddToCanvasAsNewProject(
52+
'KET/Micro-Macro-Switcher/Micro bonds on macro canvas.ket',
53+
page,
54+
);
55+
await takeEditorScreenshot(page);
56+
57+
// Test should be skipped if related bug exists
58+
test.fixme(
59+
true === true,
60+
`That test results are wrong because of https://github.com/epam/ketcher/issues/5961 issue(s).`,
61+
);
62+
});
63+
64+
test(`Verify that connections between monomers and molecules are maintained correctly in both micro and macro modes`, async () => {
65+
/*
66+
* Test task: https://github.com/epam/ketcher/issues/5960
67+
* Description: Verify that connections between monomers and molecules are maintained correctly in both micro and macro modes
68+
*
69+
* Case: 1. Load ket file with structures
70+
* 2. Take screenshot to witness canvas was rendered correct at macro
71+
* 3. Switch to Micromolecules mode
72+
* 4. Take screenshot to witness canvas was rendered correct at micro
73+
*/
74+
await openFileAndAddToCanvasAsNewProject(
75+
'KET/Micro-Macro-Switcher/All type of monomers connected to micro.ket',
76+
page,
77+
);
78+
await takeEditorScreenshot(page);
79+
80+
await turnOnMicromoleculesEditor(page);
81+
await takeEditorScreenshot(page);
82+
83+
await turnOnMacromoleculesEditor(page);
84+
});
85+
86+
test(`Verify that switching between micro and macro modes displays molecules without structural changes`, async () => {
87+
/*
88+
* Test task: https://github.com/epam/ketcher/issues/5960
89+
* Description: Verify that switching between micro and macro modes displays molecules without structural changes
90+
*
91+
* Case: 1. Load ket file with structures at Macro
92+
* 2. Take screenshot to witness canvas was rendered correct at macro
93+
* 3. Switch to Micromolecules mode
94+
* 4. Take screenshot to witness canvas was rendered correct at micro
95+
* Canvases should be equal
96+
*/
97+
await turnOnMicromoleculesEditor(page);
98+
await openFileAndAddToCanvasAsNewProject(
99+
'KET/Micro-Macro-Switcher/Complicated structures on the canvas.ket',
100+
page,
101+
);
102+
await takeEditorScreenshot(page);
103+
104+
await turnOnMacromoleculesEditor(page);
105+
await takeEditorScreenshot(page);
106+
});
107+
108+
test(`Verify that deleting a bond in macro mode removes the bond while maintaining the integrity of the surrounding structure`, async () => {
109+
/*
110+
* Test task: https://github.com/epam/ketcher/issues/5960
111+
* Description: Verify that deleting a bond in macro mode removes the bond while maintaining the integrity of the surrounding structure
112+
*
113+
* Case: 1. Load ket file with structures at Macro
114+
* 2. Take screenshot to witness initial state
115+
* 3. Delete all bonds at the center of every molecule
116+
* 4. Take screenshot to witness final state
117+
*/
118+
await openFileAndAddToCanvasAsNewProject(
119+
'KET/Micro-Macro-Switcher/All Bonds on Macro.ket',
120+
page,
121+
);
122+
await takeEditorScreenshot(page);
123+
124+
await selectEraseTool(page);
125+
// removing single bond
126+
await clickOnMicroBondByIndex(page, 39);
127+
// removing double bond
128+
await clickOnMicroBondByIndex(page, 45);
129+
// removing single up bond
130+
await clickOnMicroBondByIndex(page, 51);
131+
// removing single down bond
132+
await clickOnMicroBondByIndex(page, 51);
133+
134+
await takeEditorScreenshot(page);
135+
});
21.3 KB
Loading
31.9 KB
Loading
36.4 KB
Loading

0 commit comments

Comments
 (0)