Skip to content

Commit be5aa67

Browse files
authored
#9056 - Autotests: Autotests for Ketcher 3.12.0 bugs - part 1 (#10272)
* #9056 - Completed 4 remaining autotests * #9056 - Refactored test 19 in ketcher-3.12.0-bugs.spec.ts file and added missing screenshots to tests 19-25 where applicable * #9056 - addressed issue with Monomer Creation Wizard (need to close the window before the end of the test)
1 parent 1a34158 commit be5aa67

9 files changed

Lines changed: 417 additions & 1 deletion

ketcher-autotests/tests/specs/Chromium-popup/Bugs/ketcher-3.12.0-bugs.spec.ts

Lines changed: 249 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ import {
2929
dragMouseTo,
3030
clickInTheMiddleOfTheCanvas,
3131
takeTopToolbarScreenshot,
32+
dragTo,
33+
setMolecule,
34+
readFileContent,
3235
} from '@utils';
3336
import { Peptide } from '@tests/pages/constants/monomers/Peptides';
3437
import { CalculateVariablesPanel } from '@tests/pages/macromolecules/CalculateVariablesPanel';
@@ -40,6 +43,7 @@ import { getAtomLocator } from '@utils/canvas/atoms/getAtomLocator/getAtomLocato
4043
import {
4144
AttachmentPoint,
4245
createRNAAntisenseChain,
46+
getAttachmentPointLocator,
4347
getMonomerLocator,
4448
} from '@utils/macromolecules/monomer';
4549
import { Chem } from '@tests/pages/constants/monomers/Chem';
@@ -54,9 +58,15 @@ import { Preset } from '@tests/pages/constants/monomers/Presets';
5458
import { Sugar } from '@tests/pages/constants/monomers/Sugars';
5559
import { Base } from '@tests/pages/constants/monomers/Bases';
5660
import { collapseMonomers } from '@utils/canvas/monomer/helpers';
57-
import { MonomerOption } from '@tests/pages/constants/contextMenu/Constants';
61+
import {
62+
ConnectionPointOption,
63+
MonomerOption,
64+
} from '@tests/pages/constants/contextMenu/Constants';
5865
import { getAbbreviationLocator } from '@utils/canvas/s-group-signes/getAbbreviationLocator';
5966
import { AbbreviationPreviewTooltip } from '@tests/pages/molecules/canvas/AbbreviationPreviewTooltip';
67+
import { ArrowTool } from '@tests/pages/constants/arrowSelectionTool/Constants';
68+
import { getArrowLocator } from '@utils/canvas/arrow-signes/getArrowLocator';
69+
import { EditConnectionPointPopup } from '@tests/pages/molecules/canvas/createMonomer/EditConnectionPointPopup';
6070

6171
let page: Page;
6272

@@ -634,4 +644,242 @@ test.describe('Bugs: ketcher-3.12.0', () => {
634644
await AbbreviationPreviewTooltip(page).waitForBecomeVisible();
635645
await takeElementScreenshot(page, AbbreviationPreviewTooltip(page).window);
636646
});
647+
648+
test("Case 19 — Undo/redo operations doesn't work for atoms, arrows and pluses after changing their positions in Macro mode", async ({
649+
MoleculesCanvas: _,
650+
}) => {
651+
/*
652+
* Test task: https://github.com/epam/ketcher/issues/9056
653+
* Bug: https://github.com/epam/ketcher/issues/8954
654+
* Description: Undo/redo operations doesn't work for atoms, arrows and pluses after changing their positions in Macro mode
655+
*
656+
* Scenario:
657+
* 1. Open Molecules canvas
658+
* 2. In the left toolbar select arrow tool and choose Open Angle Arrow('ArrowType.ArrowOpenAngle')
659+
* 3. Place arrow in the middle of screen
660+
* 4. Turn Macromolecules mode
661+
* 5. Move arrow to new position
662+
* 6. Press 'undo' button in Top Left Toolbar
663+
* 7. Press 'redo' button in Top Left Toolbar
664+
*
665+
* Version 3.12.0
666+
*/
667+
668+
await LeftToolbar(page).selectArrowTool(ArrowTool.ArrowOpenAngle);
669+
await clickInTheMiddleOfTheCanvas(page);
670+
671+
await CommonTopRightToolbar(page).turnOnMacromoleculesEditor();
672+
await CommonLeftToolbar(page).areaSelectionTool();
673+
const arrow = getArrowLocator(page, {}).first();
674+
await dragTo(page, arrow, { x: 350, y: 350 });
675+
await clickOnCanvas(page, 20, 20);
676+
677+
await CommonTopLeftToolbar(page).undo();
678+
await takeEditorScreenshot(page);
679+
680+
await CommonTopLeftToolbar(page).redo();
681+
await takeEditorScreenshot(page);
682+
});
683+
684+
test('Case 20 — Selection ignored in Ketcher API calls', async ({
685+
MoleculesCanvas: _,
686+
}) => {
687+
/*
688+
* Test task: https://github.com/epam/ketcher/issues/9056
689+
* Bug: https://github.com/epam/ketcher/issues/8898
690+
* Description: Selection ignored in Ketcher API calls
691+
*
692+
* Scenario:
693+
* 1. Open Ketcher
694+
* 2. Call Ketcher setMolecule api and pass ket file with selected atoms and bonds to it
695+
* 3. Verify that molecule is drawn on canvas, and atoms and bonds are selected
696+
*
697+
* Version 3.12.0
698+
*/
699+
700+
const ketMolecule = await readFileContent('KET/Bugs/Example 8898.ket');
701+
702+
await setMolecule(page, ketMolecule);
703+
await takeEditorScreenshot(page);
704+
});
705+
706+
test('Case 21 — No bad valence indication on Macromolecules canvas', async ({
707+
MoleculesCanvas: _,
708+
}) => {
709+
/*
710+
* Test task: https://github.com/epam/ketcher/issues/9056
711+
* Bug: https://github.com/epam/ketcher/issues/8837
712+
* Description: No bad valence indication on Macromolecules canvas
713+
*
714+
* Scenario:
715+
* 1. Go to Ketcher Molecules mode (clear canvas)
716+
* 2. Paste following SMILES on the canvas: [Pt](C)(C)(C)(C)C
717+
* 3. Switch mode to Macromolecules mode
718+
* 4. Verify that bad valence indication is highlighted with red
719+
*
720+
* Version 3.12.0
721+
*/
722+
723+
await setMolecule(page, '[Pt](C)(C)(C)(C)C');
724+
await takeEditorScreenshot(page);
725+
726+
await CommonTopRightToolbar(page).turnOnMacromoleculesEditor();
727+
await takeEditorScreenshot(page);
728+
});
729+
730+
test('Case 22 — The hover on a selected atom differs in micro mode and in macro mode', async ({
731+
FlexCanvas: _,
732+
}) => {
733+
/*
734+
* Test task: https://github.com/epam/ketcher/issues/9056
735+
* Bug: https://github.com/epam/ketcher/issues/8800
736+
* Description: The hover on a selected atom differs in micro mode and in macro mode
737+
*
738+
* Scenario:
739+
* 1. Go to Macro mode - Flex
740+
* 2. Load from file: "Carbon label doesn't apper in case of 180 degree angle on macro mode.ket"
741+
* 3. Click and hover mouse over any atom
742+
* 4. Verify that selected atom has the same color in Molecules and Macromolecules mode when hovered over
743+
*
744+
* Version 3.12.0
745+
*/
746+
747+
const ketMolecule = await readFileContent(
748+
"KET/Bugs/Carbon label doesn't apper in case of 180 degree angle on macro mode.ket",
749+
);
750+
await pasteFromClipboardAndAddToMacromoleculesCanvas(
751+
page,
752+
MacroFileType.KetFormat,
753+
ketMolecule,
754+
);
755+
756+
const atomInMacroMode = getAtomLocator(page, {
757+
atomLabel: 'C',
758+
atomId: 0,
759+
});
760+
await atomInMacroMode.click({ force: true });
761+
const greenElementMacro = page.locator(
762+
`[data-testid="ketcher-canvas"] [fill="#57FF8F"]:visible`,
763+
);
764+
765+
await expect(greenElementMacro.first()).toBeVisible();
766+
767+
await CommonTopRightToolbar(page).turnOnMicromoleculesEditor();
768+
const atomInMicroMode = getAtomLocator(page, {
769+
atomLabel: 'C',
770+
atomId: 0,
771+
});
772+
await atomInMicroMode.hover();
773+
await atomInMicroMode.click({ force: true });
774+
775+
const greenElementMicro = page.locator(
776+
`[data-testid="ketcher-canvas"] [fill="#57ff8f"]:visible`,
777+
);
778+
779+
await expect(greenElementMicro.first()).toBeVisible();
780+
});
781+
782+
test("Case 23 — If no selection made, system doesn't define attachment points for monomer", async ({
783+
MoleculesCanvas: _,
784+
}) => {
785+
/*
786+
* Test task: https://github.com/epam/ketcher/issues/9056
787+
* Bug: https://github.com/epam/ketcher/issues/8437
788+
* Description: If no selection made, system doesn't define attachment points for monomer
789+
*
790+
* Scenario:
791+
* 1. Open Molecules mode (clean canvas)
792+
* 2. Load from SMILES: C%91%92%93C.[*:2]%91.[*:1]%92.[*:3]%93 |$;;_R2;_R1;_R3$|
793+
* 3. Press Create a monomer button (or Ctrl+M) having no selection on the canvas made
794+
* 4. Verify that system opens monomer creation wizard with molecule with three attachment points defined based on existed leaving groups (R1, R2 and R3)
795+
*
796+
* Version 3.12.0
797+
*/
798+
799+
const smilesMolecule =
800+
'C%91%92%93C.[*:2]%91.[*:1]%92.[*:3]%93 |$;;_R2;_R1;_R3$|';
801+
await setMolecule(page, smilesMolecule);
802+
803+
await LeftToolbar(page).createMonomer();
804+
805+
await CommonLeftToolbar(page).handTool();
806+
await page.mouse.move(600, 300);
807+
await dragMouseTo(page, 500, 300);
808+
809+
await takeEditorScreenshot(page);
810+
});
811+
812+
test("Case 24 — System shouldn't allow to upload monomers with no base IDT alias defined", async ({
813+
MoleculesCanvas: _,
814+
}) => {
815+
/*
816+
* Test task: https://github.com/epam/ketcher/issues/9056
817+
* Bug: https://github.com/epam/ketcher/issues/7823
818+
* Description: System shouldn't allow to upload monomers with no base IDT alias defined
819+
*
820+
* Scenario:
821+
* 1. Select Molecules mode
822+
* 2. Load below structure from clipboard: [*:1]C%91.[*:2]%91 |$_R1;;_R2$|
823+
* 3. Select whole structure
824+
* 4. Press Create monomer button
825+
* 5. Right click on R1 atom
826+
* 6. Click on Edit connection point context menu option
827+
* 7. Verify that system opens opens Edit connection point dialog
828+
*
829+
* Version 3.12.0
830+
*/
831+
await setMolecule(page, '[*:1]C%91.[*:2]%91 |$_R1;;_R2$|');
832+
await selectAllStructuresOnCanvas(page);
833+
834+
await LeftToolbar(page).createMonomer();
835+
836+
const attachmentPointR1 = getAttachmentPointLocator(
837+
page,
838+
AttachmentPoint.R1,
839+
).first();
840+
await ContextMenu(page, attachmentPointR1).click(
841+
ConnectionPointOption.EditConnectionPoint,
842+
);
843+
844+
await expect(
845+
EditConnectionPointPopup(page).editConnectionPointPopupWindow,
846+
).toBeVisible();
847+
await CreateMonomerDialog(page).discard();
848+
});
849+
850+
test("Case 25 — Underline colour for the base counter in the Calculate Properties window doesn't fit the requirement", async ({
851+
FlexCanvas: _,
852+
}) => {
853+
/*
854+
* Test task: https://github.com/epam/ketcher/issues/9056
855+
* Bug: https://github.com/epam/ketcher/issues/7797
856+
* Description: Underline colour for the base counter in the Calculate Properties window doesn't fit the requirement
857+
*
858+
* Scenario:
859+
* 1. Switch to Macromolecules mode - Flex canvas (clear canvas)
860+
* 2. Load from HELM: RNA1{r([cl6pur])}|PEPTIDE1{[am]}$RNA1,PEPTIDE1,1:R2-1:R1$$$V2.0
861+
* 3. Click Calculate properties button
862+
* 4. Check underline colour for the X base counter in RNA/DNA and in Peptides
863+
* 5. Verify that the grey color is represented by #CAD3DD hex code or the X base counter in RNA/DNA tab and in Peptides tab
864+
*
865+
* Version 3.12.0
866+
*/
867+
868+
const helmMolecule =
869+
'RNA1{r([cl6pur])}|PEPTIDE1{[am]}$RNA1,PEPTIDE1,1:R2-1:R1$$$V2.0';
870+
871+
await pasteFromClipboardAndAddToMacromoleculesCanvas(
872+
page,
873+
MacroFileType.HELM,
874+
helmMolecule,
875+
);
876+
877+
await MacromoleculesTopToolbar(page).calculateProperties();
878+
879+
const rnaBase = page.locator('[href="#rna-base"]');
880+
await expect(rnaBase).toHaveAttribute('fill', '#CAD3DD');
881+
882+
const peptide = page.locator('[href="#peptide"]');
883+
await expect(peptide).toHaveAttribute('fill', '#CAD3DD');
884+
});
637885
});
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
{
2+
"root": {
3+
"nodes": [
4+
{
5+
"$ref": "mol0"
6+
}
7+
],
8+
"connections": [],
9+
"templates": []
10+
},
11+
"mol0": {
12+
"type": "molecule",
13+
"atoms": [
14+
{
15+
"label": "C",
16+
"location": [
17+
13.825000000000001,
18+
-4.175,
19+
0
20+
]
21+
},
22+
{
23+
"label": "C",
24+
"location": [
25+
14.69102540378444,
26+
-4.675,
27+
0
28+
]
29+
},
30+
{
31+
"label": "C",
32+
"location": [
33+
15.53205080756888,
34+
-5.174999999999999,
35+
0
36+
]
37+
}
38+
],
39+
"bonds": [
40+
{
41+
"type": 1,
42+
"atoms": [
43+
0,
44+
1
45+
]
46+
},
47+
{
48+
"type": 1,
49+
"atoms": [
50+
1,
51+
2
52+
]
53+
}
54+
]
55+
}
56+
}

0 commit comments

Comments
 (0)