Skip to content

Commit

Permalink
Merge branch 'master' of github.com:epam/ketcher into 3041-rna-builde…
Browse files Browse the repository at this point in the history
…r-delete-presets
  • Loading branch information
StarlaStarla committed Oct 20, 2023
1 parent ec3e70c commit 23edb07
Show file tree
Hide file tree
Showing 51 changed files with 588 additions and 339 deletions.
8 changes: 7 additions & 1 deletion .stylelintrc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
{
"extends": ["stylelint-config-standard", "stylelint-config-prettier"],
"rules": {
"at-rule-no-unknown": null
"at-rule-no-unknown": null,
"selector-pseudo-class-no-unknown": [
true,
{
"ignorePseudoClasses": ["global"]
}
]
}
}
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.
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.
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
@@ -1,10 +1,12 @@
import { test } from '@playwright/test';
import { test, expect } from '@playwright/test';
import {
selectSingleBondTool,
waitForPageInit,
takePageScreenshot,
addMonomerToCanvas,
} from '@utils';
import { turnOnMacromoleculesEditor } from '@utils/macromolecules';
import { bondTwoMonomers } from '@utils/macromolecules/polymerBond';
/* eslint-disable no-magic-numbers */

test.describe('Polymer Bond Tool', () => {
Expand Down Expand Up @@ -89,3 +91,44 @@ test.describe('Polymer Bond Tool', () => {
await page.mouse.up();
});
});

test.describe('Signle Bond Tool', () => {
test.beforeEach(async ({ page }) => {
await waitForPageInit(page);
await turnOnMacromoleculesEditor(page);
});
test('Select monomers and pass a bond', async ({ page }) => {
/*
Test case: Macro: #3385 - Overlapping of bonds between 2 monomers
https://github.com/epam/ketcher/issues/3385
Description: The system shall unable user to create more
than 1 bond between the first and the second monomer
*/
const MONOMER_NAME = 'Tza___3-thiazolylalanine';
const MONOMER_ALIAS = 'Tza';
const peptide1 = await addMonomerToCanvas(
page,
MONOMER_NAME,
MONOMER_ALIAS,
300,
300,
0,
);
const peptide2 = await addMonomerToCanvas(
page,
MONOMER_NAME,
MONOMER_ALIAS,
400,
400,
1,
);
await selectSingleBondTool(page);
await bondTwoMonomers(page, peptide1, peptide2);
await bondTwoMonomers(page, peptide2, peptide1);
await page.waitForSelector('#error-tooltip');
const errorTooltip = await page.getByTestId('error-tooltip').innerText();
const errorMessage =
"There can't be more than 1 bond between the first and the second monomer";
expect(errorTooltip).toEqual(errorMessage);
});
});
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.
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.
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.
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
@@ -0,0 +1,159 @@
import { Page, test } from '@playwright/test';
import {
BondType,
clickOnAtom,
clickOnBond,
dragMouseTo,
getControlModifier,
getCoordinatesOfTheMiddleOfTheScreen,
openFileAndAddToCanvas,
selectDropdownTool,
takeEditorScreenshot,
waitForPageInit,
} from '@utils';
import { getAtomByIndex } from '@utils/canvas/atoms';
import { getBondByIndex } from '@utils/canvas/bonds';

test.describe('Rectangle selection tool', () => {
test.beforeEach(async ({ page }) => {
await waitForPageInit(page);
});

test.afterEach(async ({ page }) => {
await takeEditorScreenshot(page);
});

const xDelta = 30;
const yDelta = 60;
const modifier = getControlModifier();

async function selectObjects(
page: Page,
xAxisRadius: number,
yAxisRadius: number,
) {
const point = await getCoordinatesOfTheMiddleOfTheScreen(page);
await page.mouse.move(point.x - xAxisRadius, point.y - yAxisRadius);
await page.mouse.down();
await page.mouse.move(point.x + xAxisRadius, point.y + yAxisRadius);
await page.mouse.up();
return point;
}

const selectionCoords = { x: 300, y: 200 };
async function clickCanvas(page: Page) {
await page.mouse.click(selectionCoords.x, selectionCoords.y);
}

test('Structure selection with rectangle selection tool', async ({
page,
}) => {
// Test case: EPMLSOPKET-1347
await openFileAndAddToCanvas('KET/two-benzene-with-atoms.ket', page);
await page.getByTestId('select-rectangle').click();
await clickCanvas(page);
await selectObjects(page, selectionCoords.x, selectionCoords.y);
});

test('Drag structure', async ({ page }) => {
// Test case: EPMLSOPKET-1348
const objectSelection = 100;
const atomNumber = 5;
await openFileAndAddToCanvas('KET/two-benzene-with-atoms.ket', page);
await page.getByTestId('select-rectangle').click();
const point = await selectObjects(page, objectSelection, objectSelection);
await clickOnAtom(page, 'C', atomNumber);
await dragMouseTo(point.x + xDelta, point.y - yDelta, page);
});

test('Reaction components selection', async ({ page }) => {
// Test case: EPMLSOPKET-1349
const atomNumber = 5;
const moveMouseCoordinatesY = 10;
const moveMouseCoordinatesX = 270;
await openFileAndAddToCanvas('Rxn-V2000/benzene-chain-reaction.rxn', page);
await page.getByTestId('select-rectangle').click();
const point = await getCoordinatesOfTheMiddleOfTheScreen(page);
await clickCanvas(page);

await page.keyboard.down('Shift');
await page.mouse.click(
point.x - moveMouseCoordinatesX,
point.y + moveMouseCoordinatesY,
);
await page.mouse.click(point.x, point.y + atomNumber);
await page.keyboard.up('Shift');
await clickCanvas(page);

await page.keyboard.press(`${modifier}+KeyA`);
});

test('Reaction components dragging', async ({ page }) => {
// Test case: EPMLSOPKET-1350
const objectSelection = 100;
const moveMouseCoordinatesY = 10;
await openFileAndAddToCanvas('Rxn-V2000/benzene-chain-reaction.rxn', page);
await page.getByTestId('select-rectangle').click();
await clickCanvas(page);
const point = await selectObjects(
page,
selectionCoords.x,
selectionCoords.y,
);
await clickOnAtom(page, 'C', moveMouseCoordinatesY);
await dragMouseTo(
point.x - objectSelection,
point.y - selectionCoords.y,
page,
);
});

test('Fusing atoms together', async ({ page }) => {
// Test case: EPMLSOPKET-1351
const firstAtomNumber = 4;
const secondAtomNumber = 9;
await openFileAndAddToCanvas('KET/two-benzene-with-atoms.ket', page);
await page.getByTestId('select-rectangle').click();
await clickOnAtom(page, 'C', firstAtomNumber);
const atomPoint = await getAtomByIndex(
page,
{ label: 'C' },
secondAtomNumber,
);
await dragMouseTo(atomPoint.x, atomPoint.y, page);
});

test('Fusing bonds together', async ({ page }) => {
// Test case: EPMLSOPKET-1351
const firstBondNumber = 3;
const secondBondnumber = 8;
await openFileAndAddToCanvas('KET/two-benzene-with-atoms.ket', page);
await page.getByTestId('select-rectangle').click();
await clickOnBond(page, BondType.SINGLE, firstBondNumber);
const bondPoint = await getBondByIndex(
page,
{ type: BondType.SINGLE },
secondBondnumber,
);
await dragMouseTo(bondPoint.x, bondPoint.y, page);
});

test('Delete with selection', async ({ page }) => {
// Test case: EPMLSOPKET-1352

async function selectReactionLeftPart() {
const shift = 5;
const emptySpace = { x: 100, y: 100 };
const mostRightAtom = await getAtomByIndex(page, { label: 'Br' }, 0);
await page.mouse.move(emptySpace.x, emptySpace.y);
await dragMouseTo(mostRightAtom.x + shift, mostRightAtom.y + shift, page);
}
const atomOnTheRightSide = 14;
await openFileAndAddToCanvas('Rxn-V2000/benzene-chain-reaction.rxn', page);
await selectDropdownTool(page, 'select-rectangle', 'select-rectangle');
await selectReactionLeftPart();
await page.keyboard.press('Delete');
await clickOnAtom(page, 'C', atomOnTheRightSide);
await page.keyboard.press('Delete');
});
});
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.
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 @@ -47,6 +47,14 @@ async function selectMultipleGroup(
}
}

async function changeRepeatCountValue(page: Page, value: string) {
await page.keyboard.press('Control+a');
await selectLeftPanelButton(LeftPanelButton.S_Group, page);
await page.getByRole('button', { name: 'Data' }).click();
await page.getByTestId('Multiple group-option').click();
await page.getByTestId('file-name-input').fill(value);
}

test.describe('Multiple S-Group tool', () => {
test.beforeEach(async ({ page }) => {
await waitForPageInit(page);
Expand Down Expand Up @@ -296,4 +304,35 @@ test.describe('Multiple S-Group tool', () => {
'Apply',
);
});

test('Multiple Group - Limit on minimum count', async ({ page }) => {
// Test case: EPMLSOPKET-18027
// Verify minimum value of the Repeat count field
await openFileAndAddToCanvas('Molfiles-V2000/templates.mol', page);
await changeRepeatCountValue(page, '1');
await pressButton(page, 'Apply');
});

test('Multiple Group - Limit on maximum count', async ({ page }) => {
// Test case: EPMLSOPKET- EPMLSOPKET-18028
// Verify maximum value of the Repeat count field
await openFileAndAddToCanvas('Molfiles-V2000/templates.mol', page);
await changeRepeatCountValue(page, '200');
await pressButton(page, 'Apply');
});

test('Multiple Group - Limit higher than maximum count', async ({ page }) => {
// Test case: EPMLSOPKET-18028
// Verify system answer after putting a number higher than limit
await openFileAndAddToCanvas('Molfiles-V2000/templates.mol', page);
await changeRepeatCountValue(page, '201');
});

test('Multiple Group - Value in the valid range', async ({ page }) => {
// Test case: EPMLSOPKET-18029
// Verify value in the valid range
await openFileAndAddToCanvas('Molfiles-V2000/templates.mol', page);
await changeRepeatCountValue(page, '50');
await pressButton(page, 'Apply');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ test.describe('Click User Templates on canvas', () => {
Test case: EPMLSOPKET-13158(3)
Description: Template is copied and pasted as expected.
*/
await openFileAndAddToCanvas('templates.mol', page);
await openFileAndAddToCanvas('Molfiles-V2000/templates.mol', page);
await copyAndPaste(page);
await page.mouse.click(CANVAS_CLICK_X, CANVAS_CLICK_Y);
});
Expand All @@ -228,7 +228,7 @@ test.describe('Click User Templates on canvas', () => {
Test case: EPMLSOPKET-13158(4)
Description: Template is cut and pasted as expected.
*/
await openFileAndAddToCanvas('templates.mol', page);
await openFileAndAddToCanvas('Molfiles-V2000/templates.mol', page);
await cutAndPaste(page);
await waitForRender(page, async () => {
await page.mouse.click(CANVAS_CLICK_X, CANVAS_CLICK_Y);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,8 @@ $MOL

1 0 0 0 0 999 V2000
25.8000 -6.3500 0.0000 Br 0 0 0 0 0 0 0 0 0 0 0 0
<<<<<<< HEAD
M END
=======
M END
>>>>>>> e62b0b8839743ff44ba2618abdd05f291237a829
Loading

0 comments on commit 23edb07

Please sign in to comment.