Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/epam/ketcher into 3475-ma…
Browse files Browse the repository at this point in the history
…cro-change-rna-preset-configuration
  • Loading branch information
Gayane Chilingaryan committed Nov 6, 2023
2 parents 75e0f4c + 88e827c commit ab84cf9
Show file tree
Hide file tree
Showing 222 changed files with 4,865 additions and 827 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,10 @@ test('Open and Save file - Open/Save file contains Heteroatoms 1/2 - open', asyn
*/
await waitForPageInit(page);

await openFileAndAddToCanvas('Heteroatoms.mol', page);
await openFileAndAddToCanvas(
'Molfiles-V2000/heteroatoms-structure.mol',
page,
);
// check that structure opened from file is displayed correctly
await takeEditorScreenshot(page);
});
Expand All @@ -275,7 +278,10 @@ test('Open and Save file - Open/Save file contains Heteroatoms 2/2 - save', asyn
*/
await waitForPageInit(page);

await openFileAndAddToCanvas('Heteroatoms.mol', page);
await openFileAndAddToCanvas(
'Molfiles-V2000/heteroatoms-structure.mol',
page,
);
const expectedFile = await getMolfile(page, 'v2000');
await saveToFile('heteroatoms-expected.mol', expectedFile);
const METADATA_STRING_INDEX = [1];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ test.describe('Tests for API setMolecule/getMolecule', () => {
* Test case: EPMLSOPKET-2956
* Description: Open/Import structure while openning a CDXML file
*/
await openFileAndAddToCanvas('cdxml-2956.cdxml', page);
await openFileAndAddToCanvas('CDXML/cdxml-2956.cdxml', page);
// check that structure opened from file is displayed correctly
});

Expand All @@ -38,7 +38,7 @@ test.describe('Tests for API setMolecule/getMolecule', () => {
* Test case: EPMLSOPKET-3086
* Description: Open/Import structure while openning a CDXML file
*/
await openFileAndAddToCanvas('cdxml-3086.cdxml', page);
await openFileAndAddToCanvas('CDXML/cdxml-3086.cdxml', page);
// check that structure opened from file is displayed correctly
});

Expand Down Expand Up @@ -68,15 +68,15 @@ test.describe('Tests for API setMolecule/getMolecule', () => {
* Test case: EPMLSOPKET-4713
* Description: Open/Import structure while openning a CDXML file
*/
await openFileAndAddToCanvas('cdxml-4713.cdxml', page);
await openFileAndAddToCanvas('CDXML/cdxml-4713.cdxml', page);
});

test('Text tool - Save as .cdxml file', async ({ page }) => {
/**
* Test case: EPMLSOPKET-4714
* Description: Open/Import structure while openning a CDXML file
*/
await openFileAndAddToCanvas('cdxml-4714.cdxml', page);
await openFileAndAddToCanvas('CDXML/cdxml-4714.cdxml', page);
await page.keyboard.press('Control+a');
await page.keyboard.press('Delete');
});
Expand All @@ -86,7 +86,7 @@ test.describe('Tests for API setMolecule/getMolecule', () => {
* Test case: EPMLSOPKET-4715
* Description: Open/Import structure while openning a CDXML file
*/
await openFileAndAddToCanvas('cdxml-4715.cdxml', page);
await openFileAndAddToCanvas('CDXML/cdxml-4715.cdxml', page);
await page.keyboard.press('Control+a');
await page.keyboard.press('Delete');
});
Expand All @@ -98,7 +98,7 @@ test.describe('Tests for API setMolecule/getMolecule', () => {
* Test case: EPMLSOPKET-4716
* Description: Open/Import structure while openning a CDXML file
*/
await openFileAndAddToCanvas('cdxml-4716.cdxml', page);
await openFileAndAddToCanvas('CDXML/cdxml-4716.cdxml', page);

await selectTopPanelButton(TopPanelButton.Clear, page);
await takeEditorScreenshot(page);
Expand All @@ -114,7 +114,7 @@ test.describe('Tests for API setMolecule/getMolecule', () => {
* Test case: EPMLSOPKET-4717
* Description: Open/Import structure while openning a CDXML file
*/
await openFileAndAddToCanvas('cdxml-4717.cdxml', page);
await openFileAndAddToCanvas('CDXML/cdxml-4717.cdxml', page);
// check that structure opened from file is displayed correctly
});

Expand All @@ -123,7 +123,7 @@ test.describe('Tests for API setMolecule/getMolecule', () => {
* Test case: EPMLSOPKET-4718
* Description: Open/Import structure while openning a CDXML file
*/
await openFileAndAddToCanvas('cdxml-4718-structures.cdxml', page);
await openFileAndAddToCanvas('CDXML/cdxml-4718-structures.cdxml', page);
// check that structure opened from file is displayed correctly
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
waitForLoad,
waitForPageInit,
nonEmptyString,
pasteFromClipboardAndAddToCanvas,
} from '@utils';
import { getSmiles } from '@utils/formats';

Expand Down Expand Up @@ -137,7 +138,10 @@ test.describe('SMILES files', () => {
Description: SmileString is correctly generated from structure and
vise versa structure is correctly generated from SmileString.
*/
await openFileAndAddToCanvas('Heteroatoms.mol', page);
await openFileAndAddToCanvas(
'Molfiles-V2000/heteroatoms-structure.mol',
page,
);
await getAndCompareSmiles(
page,
'tests/test-data/smiles-heteroatoms-expected.json',
Expand Down Expand Up @@ -314,4 +318,58 @@ test.describe('SMILES files', () => {

await clearCanvasAndPasteSmiles(page, 'C1C=CC=CC=1>N>C1C=CC=CC=1');
});

test('Open SMILE file with S-Group Properties', async ({ page }) => {
/*
Test case: https://github.com/epam/Indigo/issues/1040
Description: SMILE file opens and have S-Group Properties
*/
await openFileAndAddToCanvas(
'SMILES/structure-with-s-group-properties.smi',
page,
);
await getAndCompareSmiles(
page,
'tests/test-data/SMILES/structure-with-s-group-properties.smi',
);
await page.getByText('info2').dblclick();
await takeEditorScreenshot(page);

await clearCanvasAndPasteSmiles(page, 'CCC |SgD:1:atropisomer:info2::::|');
});

test('Stereobond is preserved after pasting a SMILES structure', async ({
page,
}) => {
/*
Test case: https://github.com/epam/Indigo/issues/1300
Description: The Single Down stereo bond is on the structure
*/
await pasteFromClipboardAndAddToCanvas(page, 'C1=C(C)C(=O)C[S@]1=O');
});

test('Single Up, Single Down and Single Up/Down stereobonds is preserved after pasting a SMILES structure', async ({
page,
}) => {
/*
Test case: https://github.com/epam/Indigo/issues/1300
Description: The Single Up, Single Down and Single Up/Down stereo bonds is on the structure
The test result is not what it should be. The behavior requires further clarification.
Single Down bond changes to Single Up and two other stereobonds dissapear.
*/
await pasteFromClipboardAndAddToCanvas(page, 'C1[S@](=O)CC(=O)[C@@]=1C');
});

test('Enhanced stereo labels on atropisomers are not lost when opening saved Extended SMILES', async ({
page,
}) => {
/*
Test case: https://github.com/epam/Indigo/issues/1257
Description: Stereo information for bond and atom is kept
*/
await openFileAndAddToCanvas(
'Extended-SMILES/atropoisomer-enhanced-stereo.cxsmi',
page,
);
});
});
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 @@ -72,7 +72,10 @@ test.describe('Calculated Values Tools', () => {
The number of decimal places in the 'Molecular Weight' and 'Exact Mass'
changes according to the selected values in the fields for the decimal places count.
*/
await openFileAndAddToCanvas('calculated-values-rings.mol', page);
await openFileAndAddToCanvas(
'Molfiles-V2000/calculated-values-rings.mol',
page,
);
await selectTopPanelButton(TopPanelButton.Calculated, page);

await takeEditorScreenshot(page);
Expand Down Expand Up @@ -101,7 +104,7 @@ test.describe('Calculated Values Tools', () => {
The number of decimal places in the 'Molecular Weight' and 'Exact Mass'
changes according to the selected values in the fields for the decimal places count.
*/
await openFileAndAddToCanvas('calcvalues-reaction.rxn', page);
await openFileAndAddToCanvas('Rxn-V2000/calcvalues-reaction.rxn', page);
await selectTopPanelButton(TopPanelButton.Calculated, page);

await takeEditorScreenshot(page);
Expand Down Expand Up @@ -569,7 +572,7 @@ test.describe('Calculated Values Tools', () => {
Elemental Analysis:
C 60.1 H 4.1 Br 35.8
*/
await openFileAndAddToCanvas('c14napthylbromide.mol', page);
await openFileAndAddToCanvas('Molfiles-V2000/c14napthylbromide.mol', page);
await selectTopPanelButton(TopPanelButton.Calculated, page);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
waitForPageInit,
} from '@utils';
import { POLYMER_TOGGLER } from '../../../constants/testIdConstants';
import { hideMonomerPreview } from '@utils/macromolecules';

/*
Test case: #2497 - Add chem to canvas
Expand All @@ -23,6 +24,7 @@ test('Select chem and drag it to canvas', async ({ page }) => {

// Click on <svg> #polymer-editor-canvas
await clickInTheMiddleOfTheScreen(page);
await hideMonomerPreview(page);

await takeEditorScreenshot(page);
});
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 @@ -8,7 +8,10 @@ import {
ALANINE,
getFavoriteButtonSelector,
} from '@utils/selectors/macromoleculeEditor';
import { turnOnMacromoleculesEditor } from '@utils/macromolecules';
import {
hideMonomerPreview,
turnOnMacromoleculesEditor,
} from '@utils/macromolecules';

test('Add molecule to favorites, switch to Favorites tab and drag it to the canvas', async ({
page,
Expand All @@ -20,6 +23,7 @@ test('Add molecule to favorites, switch to Favorites tab and drag it to the canv
await page.getByText('Favorites').click();
await page.click(ALANINE);
await clickInTheMiddleOfTheScreen(page);
await hideMonomerPreview(page);

await takeEditorScreenshot(page);
});
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 @@ -7,7 +7,10 @@ import {
waitForPageInit,
} from '@utils';
import { ALANINE } from '@utils/selectors/macromoleculeEditor';
import { turnOnMacromoleculesEditor } from '@utils/macromolecules';
import {
hideMonomerPreview,
turnOnMacromoleculesEditor,
} from '@utils/macromolecules';

/*
Test case: #3063 - Add e2e tests for Macromolecule editor
Expand All @@ -26,6 +29,7 @@ test.describe('Peptide', () => {
test('Select peptide and drag it to canvas', async ({ page }) => {
await page.click(ALANINE);
await clickInTheMiddleOfTheScreen(page);
await hideMonomerPreview(page);
});

test('Add monomer preview on canvas', async ({ page }) => {
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.
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 @@ -34,10 +34,16 @@ test.describe('Macromolecules delete RNA presets', () => {
await page.getByTestId('A_Copy_A_R_P').click();
await page.getByTestId('A_Copy_A_R_P').click({ button: 'right' });

await page.getByTestId('deletepreset').click();
const deletePresetButton = await page.getByTestId('deletepreset');
await deletePresetButton.waitFor({ state: 'visible' });
await deletePresetButton.click();

await page.waitForSelector('[role=dialog]', { state: 'visible' });

await takePageScreenshot(page);

await page.getByTitle('Delete').click();

await page.waitForSelector('[role=dialog]', { state: 'hidden' });
});
});
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,84 @@
import { Page, expect, test } from '@playwright/test';
import {
takeEditorScreenshot,
openFileAndAddToCanvas,
waitForPageInit,
saveToFile,
receiveFileComparisonData,
pasteFromClipboardAndAddToCanvas,
FILE_TEST_DATA,
clickInTheMiddleOfTheScreen,
selectTopPanelButton,
TopPanelButton,
} from '@utils';
import { getCdx } from '@utils/formats';

async function saveFileAsCdxFormat(page: Page) {
await selectTopPanelButton(TopPanelButton.Save, page);
await page.getByRole('button', { name: 'MDL Rxnfile V2000' }).click();
await page.getByRole('option', { name: 'CDX', exact: true }).click();
}

test.describe('Reagents CDX format', () => {
test.beforeEach(async ({ page }) => {
await waitForPageInit(page);
});

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

test('File saves in "CDX" format', async ({ page }) => {
/*
Test case: EPMLSOPKET-4709
Description: File saved in format (e.g. "ketcher.cdx")
*/

await openFileAndAddToCanvas('KET/two-reagents-above-and-below.ket', page);
const expectedFile = await getCdx(page);
await saveToFile(
'CDX/two-reagents-above-and-below-expected.cdx',
expectedFile,
);

const { fileExpected: cdxFileExpected, file: cdxFile } =
await receiveFileComparisonData({
page,
expectedFileName:
'tests/test-data/CDX/two-reagents-above-and-below-expected.cdx',
});

expect(cdxFile).toEqual(cdxFileExpected);
});

test('Open file in "CDX" format', async ({ page }) => {
/*
Test case: EPMLSOPKET-4711
Description: File open in CDX format.
*/
await openFileAndAddToCanvas('CDX/two-reagents.cdx', page);
});

test('Paste from clipboard in "CDX" format', async ({ page }) => {
/*
Test case: EPMLSOPKET-4710
Description: Reagents 'NH3' displays above reaction arrow and HCl below.
*/
await pasteFromClipboardAndAddToCanvas(
page,
FILE_TEST_DATA.reagentsBelowAndAboveArrowCdx,
);
await clickInTheMiddleOfTheScreen(page);
});

test('Detection molecule as reagent and write reagent information in CDX format in "Preview" tab', async ({
page,
}) => {
/*
Test case: EPMLSOPKET-4707, EPMLSOPKET-4708
Description: 'Can not display binary content' in Preview window.
*/
await openFileAndAddToCanvas('CDX/two-reagents.cdx', page);
await saveFileAsCdxFormat(page);
});
});
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 @@ -152,6 +152,6 @@ test.describe('Reagents CDXML format', () => {
Description: The structure opens as it was saved with all structural elements:
plus and two reaction arrows NH3 molecule above first arrow and HCl below second arrow
*/
await openFileAndAddToCanvas('cdxml-multistep.cdxml', page);
await openFileAndAddToCanvas('CDXML/cdxml-multistep.cdxml', page);
});
});
Loading

0 comments on commit ab84cf9

Please sign in to comment.