Skip to content

Commit

Permalink
Autotests: #3204 - Charge Tool (#3242)
Browse files Browse the repository at this point in the history
* - added tests for 'charge tool';
- added 1 test file;
- added expected snapshots

* - moved test files to folders

* - added ignored hotkeys to 'hotkeys.ts';
- deleted 'delay'

* - deleted 'delay' from import

* - changed name of folder 'Ket' to 'KET'

* - updated snapshot

* - updated expected snapshots;
- added folder path to some tests;
- delete 'fixme' from some tests

* - updated snapshots;
- code refactoring;
- added 'INPUT_DELAY' to functions 'cutAndPaste' and 'copyAndPaste'

* - deleted duplicate folder with tests

* -updated snapshots;
- fixed some tests

* - updated snapshots;
- fixed some tests

* - fix 1 test

* - fixed some tests;
- removed 'fixme' and 'skip'

* - updated snapshot
  • Loading branch information
Zhirnoff authored Sep 5, 2023
1 parent 7014a25 commit cbd61f2
Show file tree
Hide file tree
Showing 135 changed files with 526 additions and 644 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { test } from '@playwright/test';
import {
clickInTheMiddleOfTheScreen,
TopPanelButton,
selectTopPanelButton,
openFileAndAddToCanvas,
takeEditorScreenshot,
pasteFromClipboardAndAddToCanvas,
Expand All @@ -27,21 +25,19 @@ test.describe('CDX files', () => {
await openFileAndAddToCanvas('cdx-expanded-contracted.cdx', page);
});

test.fixme('opening cdx files with R-group', async ({ page }) => {
test('opening cdx files with R-group', async ({ page }) => {
/*
Test case: EPMLSOPKET-6973
Description: Open CDX files with R-group
*/
await openFileAndAddToCanvas('cdx_file.cdx', page);
await openFileAndAddToCanvas('r_group_cdx.cdx', page);
});

test.fixme('opening cdx files from clipboard', async ({ page }) => {
test('opening cdx files from clipboard', async ({ page }) => {
/*
Test case: EPMLSOPKET-6972
Description: Open structure created in ChemDraw from clickboard
*/
await selectTopPanelButton(TopPanelButton.Open, page);
await page.getByText('Paste from clipboard').click();
await pasteFromClipboardAndAddToCanvas(
page,
// eslint-disable-next-line max-len
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.
Original file line number Diff line number Diff line change
Expand Up @@ -100,27 +100,26 @@ test.describe('CML files', () => {
expect(cmlFile).toEqual(cmlFileExpected);
});

test.fixme(
'Open and Save file - CML - CML for R-group and other features',
async ({ page }) => {
/**
* Test case: EPMLSOPKET-1948
* Description: Saved cml file with structure is compering with paste R-group from a mol file
*/

await openFileAddToCanvasTakeScreenshot(page, 'cml-1948-R-group.mol');
// check that structure opened from file is displayed correctly

const expectedFile = await getCml(page);
await saveToFile('cml-1948-r-group-expected.cml', expectedFile);
const { file: cmlFile, fileExpected: cmlFileExpected } =
await receiveFileComparisonData({
page,
expectedFileName: 'tests/test-data/cml-1948-r-group-expected.cml',
});
// comparing cml file with golden cml file

expect(cmlFile).toEqual(cmlFileExpected);
},
);
test('Open and Save file - CML - CML for R-group and other features', async ({
page,
}) => {
/**
* Test case: EPMLSOPKET-1948
* Description: Saved cml file with structure is compering with paste R-group from a mol file
*/

await openFileAddToCanvasTakeScreenshot(page, 'cml-1948-R-group.mol');
// check that structure opened from file is displayed correctly

const expectedFile = await getCml(page);
await saveToFile('cml-1948-r-group-expected.cml', expectedFile);
const { file: cmlFile, fileExpected: cmlFileExpected } =
await receiveFileComparisonData({
page,
expectedFileName: 'tests/test-data/cml-1948-r-group-expected.cml',
});
// comparing cml file with golden cml file

expect(cmlFile).toEqual(cmlFileExpected);
});
});
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 @@ -92,7 +92,7 @@ test.describe('SMILES files', () => {
);
});

test.skip('SmileString from mol file that contains abbreviation', async ({
test('SmileString from mol file that contains abbreviation', async ({
page,
}) => {
/*
Expand All @@ -106,9 +106,7 @@ test.describe('SMILES files', () => {
await page.getByText('Warnings').click();
});

test.skip('SmileString from mol file that contains Sgroup', async ({
page,
}) => {
test('SmileString from mol file that contains Sgroup', async ({ page }) => {
/*
Test case: EPMLSOPKET-1914
Description: In Daylight SMILES the structure will be saved without S-groups
Expand All @@ -124,7 +122,7 @@ test.describe('SMILES files', () => {

await clearCanvasAndPasteSmiles(
page,
'CCCCCCCCCCCCC.CCCCCCC.CCCCCCC.CCCCCCC.CCCCCCC |Sg:gen:16,17,15:,Sg:n:23,24,22:n:ht|',
'CCCCCCCCCCCCC.CCCCCCC.CCCCCCC.CCCCCCC.CCCCCCC |Sg:gen:16,17,15:,Sg:n:23,24,22:n:ht,SgD:38,37,36:fgfh:dsfsd::: :|',
);
});

Expand All @@ -149,27 +147,29 @@ test.describe('SMILES files', () => {
});

// flaky
test.fixme(
'SmileString from mol file that contains attached data',
async ({ page }) => {
/*
test('SmileString from mol file that contains attached data', async ({
page,
}) => {
/*
Test case: EPMLSOPKET-1916
Description: Warning tab: Structure contains query properties of atoms
and bonds that are not supported in the SMILES. Query properties will not be reflected in the saved file
*/
await openFileAndAddToCanvas('Molfiles-V2000/attached-data.mol', page);
await getAndCompareSmiles(
page,
'tests/test-data/JSON/attached-data-expected.json',
);
await openFileAndAddToCanvas('Molfiles-V2000/attached-data.mol', page);
await getAndCompareSmiles(
page,
'tests/test-data/JSON/attached-data-expected.json',
);

await getPreviewForSmiles(page, 'MDL Molfile V2000', 'Daylight SMILES');
await page.getByText('Warnings').click();
await takeEditorScreenshot(page);
await getPreviewForSmiles(page, 'MDL Molfile V2000', 'Daylight SMILES');
await page.getByText('Warnings').click();
await takeEditorScreenshot(page);

await clearCanvasAndPasteSmiles(page, 'CCCC[C@@H](C)[C@@H](C)CC');
},
);
await clearCanvasAndPasteSmiles(
page,
'CCCC[C@@H](C)[C@@H](C)CC |SgD:4,5:Purity:Purity = 96%::: :|',
);
});

test('SmileString from V2000 mol file contains abs stereochemistry', async ({
page,
Expand Down Expand Up @@ -197,33 +197,32 @@ test.describe('SMILES files', () => {
});

// flaky
test.fixme(
'SmileString from mol file that contains combination of different features',
async ({ page }) => {
/*
test('SmileString from mol file that contains combination of different features', async ({
page,
}) => {
/*
Test case: EPMLSOPKET-1920
Description: SmileString is correctly generated from structure and vise versa structure is
correctly generated from SmileString.
Structure appears without attached data and brackets, query features,
Rgroup labels are rendered as R# symbols.
*/
await openFileAndAddToCanvas('different-features.mol', page);
await getAndCompareSmiles(
page,
'tests/test-data/smiles-different-features-expected.json',
);

await getPreviewForSmiles(page, 'MDL Molfile V2000', 'Daylight SMILES');
await takeEditorScreenshot(page);

await clearCanvasAndPasteSmiles(
page,
// eslint-disable-next-line max-len
'S=CC(F)CCCCC[C@@](CCO)/C=C/[C@@](N)CCC[C]C([13C]CC([C+2]CC(CC%91)CC(C)CCC)CCC)CC%92.[*:2]%92.[*:1]%91 |$;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;_R2;_R1$,rb:32:*,u:3|',
);
await delay(DELAY_IN_SECONDS.THREE);
},
);
await openFileAndAddToCanvas('different-features.mol', page);
await getAndCompareSmiles(
page,
'tests/test-data/smiles-different-features-expected.json',
);

await getPreviewForSmiles(page, 'MDL Molfile V2000', 'Daylight SMILES');
await takeEditorScreenshot(page);

await clearCanvasAndPasteSmiles(
page,
// eslint-disable-next-line max-len
'S=CC(F)CCCCC[C@@](CCO)/C=C/[C@@](N)CCC[C]C([13C]CC([C+2]CC(CC%91)CC(C)CCC)CCC)CC%92.[*:2]%92.[*:1]%91 |$;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;_R2;_R1$,rb:32:*,u:3|',
);
await delay(DELAY_IN_SECONDS.THREE);
});

test('SmileString from file that contains Cis/Trans configuration', async ({
page,
Expand All @@ -248,7 +247,7 @@ test.describe('SMILES files', () => {
);
});

test.skip('SmileString from file that contains alias and pseudoatom', async ({
test('SmileString from file that contains alias and pseudoatom', async ({
page,
}) => {
/*
Expand All @@ -265,7 +264,7 @@ test.describe('SMILES files', () => {
await getPreviewForSmiles(page, 'MDL Molfile V2000', 'Daylight SMILES');
await takeEditorScreenshot(page);

await clearCanvasAndPasteSmiles(page, '');
await clearCanvasAndPasteSmiles(page, 'CCCC*CC |$;;alias123;;GH*;;$|');
});

test('SmileString from reaction consists of two or more reaction arrows and structures', async ({
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.
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 @@ -66,29 +66,28 @@ test.describe('Aromatize/Dearomatize Tool', () => {
await selectTopPanelButton(TopPanelButton.Dearomatize, page);
});

test.fixme(
'Aromatic structures - interchanged Single and Double bonds',
async ({ page }) => {
/*
test('Aromatic structures - interchanged Single and Double bonds', async ({
page,
}) => {
/*
Test case: EPMLSOPKET-1870
Description: The aromatic structures appear with circle inside the cycles.
Aromatize function affects all canvas.
The structures appears in a Kekule form: with interchanged Single and Double bonds.
Dearomatize function affects all canvas.
*/
await openFileAndAddToCanvas(
'Molfiles-V2000/aromatic-structures.mol',
page,
);
await waitForSpinnerFinishedWork(page, async () => {
await selectTopPanelButton(TopPanelButton.Aromatize, page);
});
await takeEditorScreenshot(page);
await waitForSpinnerFinishedWork(page, async () => {
await selectTopPanelButton(TopPanelButton.Dearomatize, page);
});
},
);
await openFileAndAddToCanvas(
'Molfiles-V2000/aromatic-structures.mol',
page,
);
await waitForSpinnerFinishedWork(page, async () => {
await selectTopPanelButton(TopPanelButton.Aromatize, page);
});
await takeEditorScreenshot(page);
await waitForSpinnerFinishedWork(page, async () => {
await selectTopPanelButton(TopPanelButton.Dearomatize, page);
});
});

test('Cycles with Aromatic Bonds', async ({ page }) => {
/*
Expand All @@ -104,26 +103,25 @@ test.describe('Aromatize/Dearomatize Tool', () => {
await selectTopPanelButton(TopPanelButton.Dearomatize, page);
});

test.fixme(
'(Undo/Redo) Manipulations with cyclic structures with a circle inside the cycle',
async ({ page }) => {
/*
test('(Undo/Redo) Manipulations with cyclic structures with a circle inside the cycle', async ({
page,
}) => {
/*
Test case: EPMLSOPKET-1872
Description: Only six-cycle structures appear in a Kekule form: with interchanged Single and Double bonds.
All other structures are rendered with a circle inside the cycles. The actions are Undone/Redone.
*/
await openFileAndAddToCanvas('cycles-with-aromatic-bonds.mol', page);
await waitForSpinnerFinishedWork(page, async () => {
await selectTopPanelButton(TopPanelButton.Aromatize, page);
});
await waitForSpinnerFinishedWork(page, async () => {
await selectTopPanelButton(TopPanelButton.Dearomatize, page);
});
await selectTopPanelButton(TopPanelButton.Undo, page);
await takeEditorScreenshot(page);
await selectTopPanelButton(TopPanelButton.Redo, page);
},
);
await openFileAndAddToCanvas('cycles-with-aromatic-bonds.mol', page);
await waitForSpinnerFinishedWork(page, async () => {
await selectTopPanelButton(TopPanelButton.Aromatize, page);
});
await waitForSpinnerFinishedWork(page, async () => {
await selectTopPanelButton(TopPanelButton.Dearomatize, page);
});
await selectTopPanelButton(TopPanelButton.Undo, page);
await takeEditorScreenshot(page);
await selectTopPanelButton(TopPanelButton.Redo, page);
});

test('(Copy/Paste) Manipulations with cyclic structures with a circle inside the cycle', 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 @@ -184,7 +184,7 @@ test.describe('Calculated Values Tools', () => {
Description: Calculation of exact mass for the reaction
should be correct: '[78.047] > [155.957]'.
*/
await openFileAndAddToCanvas('benzene-bromination.rxn', page);
await openFileAndAddToCanvas('Rxn-V2000/benzene-bromination.rxn', page);
await selectTopPanelButton(TopPanelButton.Calculated, page);
});

Expand Down
2 changes: 1 addition & 1 deletion ketcher-autotests/tests/Indigo-Tools/Layout/layout.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ test.describe('Indigo Tools - Layout', () => {

test('Center molecule after layout', async ({ page }) => {
// Related Github issue: https://github.com/epam/ketcher/issues/2078
const anyStructure = 'benzene-rings.mol';
const anyStructure = 'Molfiles-V2000/benzene-rings.mol';
await openFileWithShift(anyStructure, page);
await selectTopPanelButton(TopPanelButton.Layout, page);
await takeEditorScreenshot(page);
Expand Down
Loading

0 comments on commit cbd61f2

Please sign in to comment.