Skip to content

Commit

Permalink
Autotests: #6134 autotests introduce creating antisense chains (#6186)
Browse files Browse the repository at this point in the history
* first draft

* Validate that selecting a valid backbone with the correct R1-R2 connections and right-clicking displays the "Create Antisense Strand" option (Requirement 1) and creation of antisense is possible

* Ensure that the "Create Antisense Strand" option appears but is disabled when the base connected via R3-R1 is not a sense base

* Check if any of the bases connected to the sugars via R3-R1 have more bonds (hydrogen or covalent), the "Create Antisense Strand" option appear, but disabled

* Check if multiple chains are selected and more than one satisfies the previous requirements(Requirement 1.2), the "Create Antisense Strand" option appear, multiple antisense chains are created

* Check that all non R1-R2 connections of backbone monomers (except R3-R1 for sugar and base!!!) are ignored

* 6. Check that every nucleotide (sugar and phosphate are part of the backbone and connected via R2(s)-R1(p), and the sugar is connected to a "sense base" via R3(s)-R1(b)) transform into a nucleotide on the antisense chain that contains ribose (R), phosphate (P), and the appropriate "antisense base"
7. Check that every nucleoside (not a nucleotide, sugar is connected through R2 to something that is not phosphate, or has a free R2, but is connected to a "sense base" through R3) transform into a nucleoside on the antisense chain that contains ribose (R) and the appropriate "antisense base"

* Check that all other monomers in the backbone that are not a part of the nucleotide or a nucleoside directly copied to the antisense strand

* Check that the antisense chain should be "flipped" in relation to the sense chain:If the left most sugar/amino acid of the sense chain has a terminal indicator of 5'/N, then the left most sugar/amino acid of the antisense chain should have a terminal indicator of 3'/C

* Screens update

* Screen update

* Screen update

* Check that option "Delete" deletes the selected monomers and all the bonds of those monomers and Undo restore all monomers and bonds

* 13. Validate that creating, deleting, and modifying the antisense chain supports the undo/redo functionality

* Validate that both sense and antisense strands can be exported correctly in supported file formats

* Data attribute changes

* Rename verifyFile to verifyFileExport

* Ensure that switching between (Flex, Snake, Sequence) modes does not break the alignment or hydrogen bonding between the sense and antisense strands

* Ensure that switching between macro and micro modes does not break the alignment or hydrogen bonding between the sense and antisense strands

* Verify that copying the sense and antisense strand and pasting it within the same canvas retains the correct orientation and complementary base pairing

* Last fix

* Last last fix

* view-only-mode.spec.ts updated

* view-only-mode.spec.ts updated2

* view-only-mode.spec.ts updated3

* antisense-chains.spec.ts updated

* last fix

* data-monomertype logic update
  • Loading branch information
AlexeyGirin authored Dec 20, 2024
1 parent ca780ce commit f8e15b9
Show file tree
Hide file tree
Showing 134 changed files with 24,972 additions and 180 deletions.
22 changes: 11 additions & 11 deletions ketcher-autotests/tests/API/view-only-mode.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ import {
import { closeErrorAndInfoModals } from '@utils/common/helpers';
import {
FileType,
verifyFile2,
verifyMolfile,
verifyFileExport,
} from '@utils/files/receiveFileComparisonData';
import {
disableViewOnlyMode,
Expand Down Expand Up @@ -180,7 +179,7 @@ test.describe('Tests for API setMolecule/getMolecule', () => {
await takeLeftToolbarScreenshot(page);
});

test('Verify that elements on Canvas can be copied (as MOL) in view-only mode', async ({
test('10. Verify that elements on Canvas can be copied (as MOL) in view-only mode', async ({
page,
}) => {
/*
Expand All @@ -191,12 +190,13 @@ test.describe('Tests for API setMolecule/getMolecule', () => {
await clickInTheMiddleOfTheScreen(page);
await enableViewOnlyModeBySetOptions(page);
await selectAllStructuresOnCanvas(page);
// await copyToClipboardByKeyboard(page);
await page.getByTestId('copy-button-dropdown-triangle').click();
await page.getByTitle('Copy as MOL (Ctrl+M)').click();
await disableViewOnlyModeBySetOptions(page);
await pasteFromClipboardByKeyboard(page);
await clickOnCanvas(page, 200, 200);
await takeEditorScreenshot(page);
await takePageScreenshot(page);
});

test('Verify that elements on Canvas can be copied (as KET) in view-only mode', async ({
Expand Down Expand Up @@ -485,7 +485,7 @@ test.describe('Tests for API setMolecule/getMolecule', () => {
await selectRingButton(RingButton.Benzene, page);
await clickInTheMiddleOfTheScreen(page);
await enableViewOnlyModeBySetOptions(page);
await verifyFile2(
await verifyFileExport(
page,
'KET/benzene-ring-saved-in-view-only-mode-expected.ket',
FileType.KET,
Expand All @@ -507,11 +507,11 @@ test.describe('Tests for API setMolecule/getMolecule', () => {
await selectRingButton(RingButton.Benzene, page);
await clickInTheMiddleOfTheScreen(page);
await enableViewOnlyModeBySetOptions(page);
await verifyMolfile(
await verifyFileExport(
page,
'v2000',
'Molfiles-V2000/benzene-ring-saved-in-view-only-mode-molv2000-expected.mol',
'tests/test-data/Molfiles-V2000/benzene-ring-saved-in-view-only-mode-molv2000-expected.mol',
FileType.MOL,
'v2000',
[1],
);

Expand All @@ -532,11 +532,11 @@ test.describe('Tests for API setMolecule/getMolecule', () => {
await selectRingButton(RingButton.Benzene, page);
await clickInTheMiddleOfTheScreen(page);
await enableViewOnlyModeBySetOptions(page);
await verifyMolfile(
await verifyFileExport(
page,
'v3000',
'Molfiles-V3000/benzene-ring-saved-in-view-only-mode-molv3000-expected.mol',
'tests/test-data/Molfiles-V3000/benzene-ring-saved-in-view-only-mode-molv3000-expected.mol',
FileType.MOL,
'v3000',
[1],
);

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ import {
openPasteFromClipboard,
pressButton,
} from '@utils';
import { FileType, verifyFile2 } from '@utils/files/receiveFileComparisonData';
import {
FileType,
verifyFileExport,
} from '@utils/files/receiveFileComparisonData';
import { getCdx } from '@utils/formats';

test.describe('CDX files', () => {
Expand Down Expand Up @@ -475,7 +478,7 @@ test.describe('CDX files without screenshots', () => {
page,
);
await takeEditorScreenshot(page);
await verifyFile2(
await verifyFileExport(
page,
'CDX/reactant-single-reaction-expected.cdx',
FileType.CDX,
Expand All @@ -500,7 +503,7 @@ test.describe('CDX files without screenshots', () => {
page,
);
await takeEditorScreenshot(page);
await verifyFile2(
await verifyFileExport(
page,
'CDX/products-single-reaction-expected.cdx',
FileType.CDX,
Expand All @@ -525,7 +528,7 @@ test.describe('CDX files without screenshots', () => {
page,
);
await takeEditorScreenshot(page);
await verifyFile2(
await verifyFileExport(
page,
'CDX/ket-cascade-reaction-3-1-2-1-1-expected.cdx',
FileType.CDX,
Expand All @@ -550,7 +553,7 @@ test.describe('CDX files without screenshots', () => {
page,
);
await takeEditorScreenshot(page);
await verifyFile2(
await verifyFileExport(
page,
'CDX/multiple-individual-reactions-expected.cdx',
FileType.CDX,
Expand All @@ -575,7 +578,7 @@ test.describe('CDX files without screenshots', () => {
page,
);
await takeEditorScreenshot(page);
await verifyFile2(
await verifyFileExport(
page,
'CDX/several-cascade-reactions-expected.cdx',
FileType.CDX,
Expand All @@ -600,7 +603,7 @@ test.describe('CDX files without screenshots', () => {
page,
);
await takeEditorScreenshot(page);
await verifyFile2(
await verifyFileExport(
page,
'CDX/combination-of-single-and-cascade-reactions-expected.cdx',
FileType.CDX,
Expand All @@ -625,7 +628,7 @@ test.describe('CDX files without screenshots', () => {
page,
);
await takeEditorScreenshot(page);
await verifyFile2(
await verifyFileExport(
page,
'CDX/cascade-of-multiple-reactions-expected.cdx',
FileType.CDX,
Expand All @@ -650,7 +653,7 @@ test.describe('CDX files without screenshots', () => {
page,
);
await takeEditorScreenshot(page);
await verifyFile2(
await verifyFileExport(
page,
'CDX/pathway-with-mixed-single-reactions-and-cascades-expected.cdx',
FileType.CDX,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ import {
setReactionMarginSizeValue,
selectAllStructuresOnCanvas,
} from '@utils';
import { FileType, verifyFile2 } from '@utils/files/receiveFileComparisonData';
import {
FileType,
verifyFileExport,
} from '@utils/files/receiveFileComparisonData';
import { getCdxml } from '@utils/formats';
import { pressUndoButton } from '@utils/macromolecules/topToolBar';

Expand Down Expand Up @@ -676,7 +679,7 @@ test.describe('Tests for API setMolecule/getMolecule', () => {
page,
);
await takeEditorScreenshot(page);
await verifyFile2(
await verifyFileExport(
page,
'CDXML/reactant-single-reaction-expected.cdxml',
FileType.CDXML,
Expand All @@ -700,7 +703,7 @@ test.describe('Tests for API setMolecule/getMolecule', () => {
page,
);
await takeEditorScreenshot(page);
await verifyFile2(
await verifyFileExport(
page,
'CDXML/products-single-reaction-expected.cdxml',
FileType.CDXML,
Expand All @@ -724,7 +727,7 @@ test.describe('Tests for API setMolecule/getMolecule', () => {
page,
);
await takeEditorScreenshot(page);
await verifyFile2(
await verifyFileExport(
page,
'CDXML/ket-cascade-reaction-3-1-2-1-1-expected.cdxml',
FileType.CDXML,
Expand All @@ -748,7 +751,7 @@ test.describe('Tests for API setMolecule/getMolecule', () => {
page,
);
await takeEditorScreenshot(page);
await verifyFile2(
await verifyFileExport(
page,
'CDXML/multiple-individual-reactions-expected.cdxml',
FileType.CDXML,
Expand All @@ -772,7 +775,7 @@ test.describe('Tests for API setMolecule/getMolecule', () => {
page,
);
await takeEditorScreenshot(page);
await verifyFile2(
await verifyFileExport(
page,
'CDXML/several-cascade-reactions-expected.cdxml',
FileType.CDXML,
Expand All @@ -796,7 +799,7 @@ test.describe('Tests for API setMolecule/getMolecule', () => {
page,
);
await takeEditorScreenshot(page);
await verifyFile2(
await verifyFileExport(
page,
'CDXML/combination-of-single-and-cascade-reactions-expected.cdxml',
FileType.CDXML,
Expand All @@ -820,7 +823,7 @@ test.describe('Tests for API setMolecule/getMolecule', () => {
page,
);
await takeEditorScreenshot(page);
await verifyFile2(
await verifyFileExport(
page,
'CDXML/cascade-of-multiple-reactions-expected.cdxml',
FileType.CDXML,
Expand All @@ -844,7 +847,7 @@ test.describe('Tests for API setMolecule/getMolecule', () => {
page,
);
await takeEditorScreenshot(page);
await verifyFile2(
await verifyFileExport(
page,
'CDXML/pathway-with-mixed-single-reactions-and-cascades-expected.cdxml',
FileType.CDXML,
Expand Down
Loading

0 comments on commit f8e15b9

Please sign in to comment.