-
Notifications
You must be signed in to change notification settings - Fork 169
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Autotests: #2884 create autotests for mapping/unmapping and reaction …
…tools (#2917) * - Added test for mapping/unmapping tool * - code refactoring; - added expected snapshot; - renamed 4 test files * - updated tests for 'mapping-tool'; - updated expected snapshots; - added 1 test file; - added 1 AtomLabelType; - updated tests for 'qreaction-tools' * - added assertions * - code refactoring * - code rfactoring * - changed 'selectNestedTool' to 'selectDropdownTool'; - added 'urszula-gawlowska' to 'auto_assign' * - deleted ignore eslint for whole file; - added expected snapshots; - added function 'takeMultitoolDropdownScreenshot' * - added 'Reaction-tool' to const regularTests --------- Co-authored-by: Mikhail Zhirnov <[email protected]>
- Loading branch information
1 parent
4d84438
commit b8ab285
Showing
26 changed files
with
514 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
149 changes: 149 additions & 0 deletions
149
ketcher-autotests/tests/Reaction-tool/Mapping-Unmapping tool/mapping-tool.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,149 @@ | ||
import { test, expect } from '@playwright/test'; | ||
import { | ||
takeEditorScreenshot, | ||
LeftPanelButton, | ||
clickInTheMiddleOfTheScreen, | ||
selectLeftPanelButton, | ||
openFileAndAddToCanvas, | ||
selectRingButton, | ||
RingButton, | ||
getCoordinatesTopAtomOfBenzeneRing, | ||
selectTopPanelButton, | ||
TopPanelButton, | ||
dragMouseTo, | ||
waitForPageInit, | ||
mapTwoAtoms, | ||
clickOnAtom, | ||
receiveFileComparisonData, | ||
saveToFile, | ||
selectDropdownTool, | ||
} from '@utils'; | ||
import { getAtomByIndex } from '@utils/canvas/atoms'; | ||
import { getRxn } from '@utils/formats'; | ||
|
||
test.describe('Mapping Tools', () => { | ||
test.beforeEach(async ({ page }) => { | ||
await waitForPageInit(page); | ||
}); | ||
|
||
test.afterEach(async ({ page }) => { | ||
await takeEditorScreenshot(page); | ||
}); | ||
|
||
test('Click atoms to map atoms in a reaction', async ({ page }) => { | ||
/* Test case: EPMLSOPKET-1799, EPMLSOPKET-8909 | ||
Description: Click atoms to map atoms in a reaction | ||
*/ | ||
await openFileAndAddToCanvas('Rxn-V2000/reaction-3.rxn', page); | ||
await selectDropdownTool(page, 'reaction-map', 'reaction-map'); | ||
await mapTwoAtoms( | ||
page, | ||
{ label: 'C', number: 0 }, | ||
{ label: 'C', number: 10 }, | ||
); | ||
}); | ||
|
||
test.describe('Mapping Tools', () => { | ||
test.beforeEach(async ({ page }) => { | ||
await openFileAndAddToCanvas('Rxn-V2000/mapped-atoms.rxn', page); | ||
}); | ||
|
||
test('Click the single mapped atom to delete mapping', async ({ page }) => { | ||
// EPMLSOPKET-1827 | ||
const anyAtom = 0; | ||
await selectDropdownTool(page, 'reaction-map', 'reaction-unmap'); | ||
await clickOnAtom(page, 'Br', anyAtom); | ||
}); | ||
|
||
test('Map ordering', async ({ page }) => { | ||
await selectDropdownTool(page, 'reaction-map', 'reaction-map'); | ||
await page.getByText('ALK').click(); | ||
await page.getByText('ABH').click(); | ||
await page.getByText('CHC').click(); | ||
await page.getByText('ARY').click(); | ||
}); | ||
}); | ||
|
||
test('No Unmapping after the arrow deleting', async ({ page }) => { | ||
// EPMLSOPKET-1828 | ||
await openFileAndAddToCanvas('Rxn-V2000/mapped-rection-benz.rxn', page); | ||
await selectLeftPanelButton(LeftPanelButton.Erase, page); | ||
await clickInTheMiddleOfTheScreen(page); | ||
}); | ||
|
||
test('Click atoms to map atoms of reactants or products', async ({ | ||
page, | ||
}) => { | ||
await openFileAndAddToCanvas('Rxn-V2000/reaction-3.rxn', page); | ||
await selectDropdownTool(page, 'reaction-map', 'reaction-map'); | ||
const point = await getAtomByIndex(page, { label: 'C' }, 0); | ||
await page.mouse.click(point.x, point.y); | ||
const { x, y } = await getCoordinatesTopAtomOfBenzeneRing(page); | ||
await dragMouseTo(x, y, page); | ||
}); | ||
|
||
test('Undo working in atom mapping, able to remove mapping', async ({ | ||
page, | ||
}) => { | ||
// EPMLSOPKET-12961 | ||
// Undo not working properly https://github.com/epam/ketcher/issues/2174 | ||
await selectRingButton(RingButton.Benzene, page); | ||
await clickInTheMiddleOfTheScreen(page); | ||
await selectDropdownTool(page, 'reaction-map', 'reaction-map'); | ||
const { x, y } = await getCoordinatesTopAtomOfBenzeneRing(page); | ||
await page.mouse.click(x, y); | ||
await takeEditorScreenshot(page); | ||
|
||
await selectTopPanelButton(TopPanelButton.Undo, page); | ||
}); | ||
|
||
test.describe('Mapping reactions', () => { | ||
test.beforeEach(async ({ page }) => { | ||
await openFileAndAddToCanvas('Rxn-V2000/mapped-reaction.rxn', page); | ||
await clickInTheMiddleOfTheScreen(page); | ||
}); | ||
|
||
test('Remove the reaction components', async ({ page }) => { | ||
// EPMLSOPKET-1831 | ||
await selectDropdownTool(page, 'reaction-map', 'reaction-map'); | ||
await page.getByText('CEL').click(); | ||
await page.keyboard.press('Delete'); | ||
await takeEditorScreenshot(page); | ||
|
||
await selectTopPanelButton(TopPanelButton.Undo, page); | ||
}); | ||
|
||
test('Unmap the mapped reaction', async ({ page }) => { | ||
// EPMLSOPKET-1830 | ||
await selectDropdownTool(page, 'reaction-map', 'reaction-unmap'); | ||
await page.getByText('CEL').click(); | ||
}); | ||
}); | ||
}); | ||
|
||
test.describe('Mapping reactions', () => { | ||
test.beforeEach(async ({ page }) => { | ||
await waitForPageInit(page); | ||
}); | ||
|
||
test('Save as *.rxn file', async ({ page }) => { | ||
/* | ||
Test case: EPMLSOPKET-1830 | ||
Description: Structure with attachment points saved as .rxn file | ||
*/ | ||
await openFileAndAddToCanvas('Rxn-V2000/mapped-reaction.rxn', page); | ||
const expectedFile = await getRxn(page); | ||
await saveToFile('Rxn-V2000/mapped-reaction-expected.rxn', expectedFile); | ||
|
||
// eslint-disable-next-line no-magic-numbers | ||
const METADATA_STRING_INDEX = [2, 7, 25, 40, 66]; | ||
const { fileExpected: rxnFileExpected, file: rxnFile } = | ||
await receiveFileComparisonData({ | ||
page, | ||
metaDataIndexes: METADATA_STRING_INDEX, | ||
expectedFileName: | ||
'tests/test-data/Rxn-V2000/mapped-reaction-expected.rxn', | ||
}); | ||
expect(rxnFile).toEqual(rxnFileExpected); | ||
}); | ||
}); |
Binary file added
BIN
+18 KB
...shots/Mapping-Tools-Click-atoms-to-map-atoms-in-a-reaction-1-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+18.2 KB
...ng-Tools-Click-atoms-to-map-atoms-of-reactants-or-products-1-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+20.4 KB
...pping-Tools-Click-the-single-mapped-atom-to-delete-mapping-1-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+21.8 KB
...spec.ts-snapshots/Mapping-Tools-Mapping-Tools-Map-ordering-1-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+24.6 KB
...ing-Tools-Mapping-reactions-Remove-the-reaction-components-1-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+25.3 KB
...ing-Tools-Mapping-reactions-Remove-the-reaction-components-2-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+25.7 KB
...-Tools-Mapping-reactions-Unmap-and-Map-the-mapped-reaction-1-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+25.7 KB
.../Mapping-Tools-Mapping-reactions-Unmap-the-mapped-reaction-1-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+11.7 KB
...pshots/Mapping-Tools-No-Unmapping-after-the-arrow-deleting-1-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+9.22 KB
...-Tools-Undo-working-in-atom-mapping-able-to-remove-mapping-1-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+9.22 KB
...-Tools-Undo-working-in-atom-mapping-able-to-remove-mapping-2-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
41 changes: 41 additions & 0 deletions
41
ketcher-autotests/tests/Reaction-tool/Mapping-Unmapping tool/reaction-tools.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { test } from '@playwright/test'; | ||
import { | ||
LeftPanelButton, | ||
selectLeftPanelButton, | ||
waitForPageInit, | ||
openDropdown, | ||
takeMultitoolDropdownScreenshot, | ||
takeLeftToolbarScreenshot, | ||
} from '@utils'; | ||
|
||
test.describe('Reaction Tools', () => { | ||
test.beforeEach(async ({ page }) => { | ||
await waitForPageInit(page); | ||
}); | ||
|
||
test.afterEach(async ({ page }) => { | ||
await takeLeftToolbarScreenshot(page); | ||
}); | ||
|
||
test('Icons for Plus Tool', async ({ page }) => { | ||
await selectLeftPanelButton(LeftPanelButton.ReactionPlusTool, page); | ||
}); | ||
}); | ||
|
||
test.describe('Reaction Tools', () => { | ||
test.beforeEach(async ({ page }) => { | ||
await waitForPageInit(page); | ||
}); | ||
|
||
test.afterEach(async ({ page }) => { | ||
await takeMultitoolDropdownScreenshot(page); | ||
}); | ||
|
||
test('Icons for Reaction Mapping tools', async ({ page }) => { | ||
await openDropdown(page, 'reaction-map'); | ||
}); | ||
|
||
test('Icons for Arrow Tools', async ({ page }) => { | ||
await openDropdown(page, 'reaction-arrow-open-angle'); | ||
}); | ||
}); |
Binary file added
BIN
+6.51 KB
...-snapshots/Reaction-Tools-Icons-and-tooltips-for-Plus-Tool-1-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+4.07 KB
...ols.spec.ts-snapshots/Reaction-Tools-Icons-for-Arrow-Tools-1-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+6.51 KB
...tools.spec.ts-snapshots/Reaction-Tools-Icons-for-Plus-Tool-1-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.37 KB
...-snapshots/Reaction-Tools-Icons-for-Reaction-Mapping-tools-1-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
71 changes: 71 additions & 0 deletions
71
ketcher-autotests/tests/test-data/Rxn-V2000/mapped-atoms.rxn
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
$RXN | ||
|
||
-INDIGO- 0710231101 | ||
|
||
2 2 | ||
$MOL | ||
|
||
-INDIGO-07102311012D | ||
|
||
6 6 0 0 0 0 0 0 0 0999 V2000 | ||
6.8954 -4.8250 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 | ||
7.7614 -5.3250 0.0000 ABH 0 0 0 0 0 0 0 0 0 0 0 0 | ||
7.7614 -6.3250 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 | ||
6.8954 -6.8250 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 | ||
6.0294 -6.3250 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 | ||
6.0294 -5.3250 0.0000 ALK 0 0 0 0 0 0 0 0 0 0 0 0 | ||
1 2 1 0 0 0 0 | ||
2 3 2 0 0 0 0 | ||
3 4 1 0 0 0 0 | ||
4 5 2 0 0 0 0 | ||
5 6 1 0 0 0 0 | ||
6 1 2 0 0 0 0 | ||
M END | ||
$MOL | ||
|
||
-INDIGO-07102311012D | ||
|
||
5 4 0 0 0 0 0 0 0 0999 V2000 | ||
11.1455 -5.8250 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 | ||
12.0115 -6.3250 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 | ||
12.8776 -5.8250 0.0000 CHC 0 0 0 0 0 0 0 0 0 0 0 0 | ||
13.7436 -6.3250 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 | ||
14.6096 -5.8250 0.0000 Br 0 0 0 0 0 0 0 0 0 1 0 0 | ||
1 2 1 0 0 0 0 | ||
2 3 1 0 0 0 0 | ||
3 4 1 0 0 0 0 | ||
4 5 1 0 0 0 0 | ||
M END | ||
$MOL | ||
|
||
-INDIGO-07102311012D | ||
|
||
10 10 0 0 0 0 0 0 0 0999 V2000 | ||
20.0705 -4.8750 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 | ||
20.9365 -5.3750 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 | ||
20.9365 -6.3750 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 | ||
20.0705 -6.8750 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 | ||
19.2045 -6.3750 0.0000 CEL 0 0 0 0 0 0 0 0 0 1 0 0 | ||
19.2045 -5.3750 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 | ||
21.8025 -4.8750 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 | ||
22.6687 -5.3750 0.0000 ARY 0 0 0 0 0 0 0 0 0 0 0 0 | ||
23.5347 -4.8750 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 | ||
21.8025 -3.8750 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 | ||
1 2 1 0 0 0 0 | ||
2 3 2 0 0 0 0 | ||
3 4 1 0 0 0 0 | ||
4 5 2 0 0 0 0 | ||
5 6 1 0 0 0 0 | ||
6 1 2 0 0 0 0 | ||
2 7 1 0 0 0 0 | ||
7 8 1 0 0 0 0 | ||
8 9 1 0 0 0 0 | ||
7 10 1 0 0 0 0 | ||
M END | ||
$MOL | ||
|
||
-INDIGO-07102311012D | ||
|
||
1 0 0 0 0 0 0 0 0 0999 V2000 | ||
26.5706 -6.1250 0.0000 Br 0 0 0 0 0 0 0 0 0 0 0 0 | ||
M END |
71 changes: 71 additions & 0 deletions
71
ketcher-autotests/tests/test-data/Rxn-V2000/mapped-reaction-expected.rxn
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
$RXN | ||
|
||
-INDIGO- 0914231944 | ||
|
||
2 2 | ||
$MOL | ||
|
||
-INDIGO-09142319442D | ||
|
||
6 6 0 0 0 0 0 0 0 0999 V2000 | ||
5.6648 -7.7497 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 | ||
6.5314 -8.2500 0.0000 C 0 0 0 0 0 0 0 0 0 13 0 0 | ||
5.6648 -9.7509 0.0000 C 0 0 0 0 0 0 0 0 0 4 0 0 | ||
4.7983 -9.2506 0.0000 C 0 0 0 0 0 0 0 0 0 5 0 0 | ||
4.7983 -8.2500 0.0000 C 0 0 0 0 0 0 0 0 0 6 0 0 | ||
6.5314 -9.2256 0.0000 C 0 0 0 0 0 0 0 0 0 14 0 0 | ||
1 2 1 0 0 0 0 | ||
3 4 2 0 0 0 0 | ||
4 5 1 0 0 0 0 | ||
5 1 2 0 0 0 0 | ||
2 6 2 0 0 0 0 | ||
6 3 1 0 0 0 0 | ||
M END | ||
$MOL | ||
|
||
-INDIGO-09142319442D | ||
|
||
5 4 0 0 0 0 0 0 0 0999 V2000 | ||
9.9175 -8.7502 0.0000 C 0 0 0 0 0 0 0 0 0 7 0 0 | ||
10.7840 -9.2506 0.0000 C 0 0 0 0 0 0 0 0 0 8 0 0 | ||
12.5171 -9.2506 0.0000 C 0 0 0 0 0 0 0 0 0 10 0 0 | ||
13.3836 -8.7502 0.0000 Br 0 0 0 0 0 0 0 0 0 11 0 0 | ||
11.6506 -8.7502 0.0000 C 0 0 0 0 0 0 0 0 0 9 0 0 | ||
1 2 1 0 0 0 0 | ||
3 4 1 0 0 0 0 | ||
5 3 1 0 0 0 0 | ||
2 5 1 0 0 0 0 | ||
M END | ||
$MOL | ||
|
||
-INDIGO-09142319442D | ||
|
||
10 10 0 0 0 0 0 0 0 0999 V2000 | ||
18.8478 -7.7997 0.0000 C 0 0 0 0 0 0 0 0 0 15 0 0 | ||
19.7143 -8.2999 0.0000 C 0 0 0 0 0 0 0 0 0 13 0 0 | ||
19.7143 -9.3006 0.0000 CEL 0 0 0 0 0 0 0 0 0 16 0 0 | ||
18.8478 -9.8009 0.0000 C 0 0 0 0 0 0 0 0 0 4 0 0 | ||
17.9812 -9.3006 0.0000 C 0 0 0 0 0 0 0 0 0 5 0 0 | ||
17.9812 -8.2999 0.0000 C 0 0 0 0 0 0 0 0 0 6 0 0 | ||
20.5809 -7.7997 0.0000 C 0 0 0 0 0 0 0 0 0 7 0 0 | ||
21.4475 -8.2999 0.0000 C 0 0 0 0 0 0 0 0 0 9 0 0 | ||
22.3140 -7.7997 0.0000 C 0 0 0 0 0 0 0 0 0 10 0 0 | ||
20.5809 -6.7991 0.0000 C 0 0 0 0 0 0 0 0 0 8 0 0 | ||
1 2 1 0 0 0 0 | ||
2 3 2 0 0 0 0 | ||
3 4 1 0 0 0 0 | ||
4 5 2 0 0 0 0 | ||
5 6 1 0 0 0 0 | ||
6 1 2 0 0 0 0 | ||
2 7 1 0 0 0 0 | ||
7 8 1 0 0 0 0 | ||
8 9 1 0 0 0 0 | ||
7 10 1 0 0 0 0 | ||
M END | ||
$MOL | ||
|
||
-INDIGO-09142319442D | ||
|
||
1 0 0 0 0 0 0 0 0 0999 V2000 | ||
25.3517 -9.0504 0.0000 Br 0 0 0 0 0 0 0 0 0 11 0 0 | ||
M END |
Oops, something went wrong.