Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autotests: #3016 - create autotests for easy to implement TCses #3016

Merged
merged 16 commits into from
Sep 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { test } from '@playwright/test';
import {
selectAtomInToolbar,
AtomButton,
pressButton,
selectFunctionalGroups,
FunctionalGroups,
selectSaltsAndSolvents,
Expand All @@ -14,7 +13,6 @@ import {
moveMouseToTheMiddleOfTheScreen,
takeEditorScreenshot,
resetCurrentTool,
STRUCTURE_LIBRARY_BUTTON_NAME,
moveOnAtom,
waitForPageInit,
} from '@utils';
Expand Down Expand Up @@ -52,8 +50,6 @@ test.describe('Click and drag Atom on canvas', () => {
Test case: EPMLSOPKET-10116
Description: when click & drag with an atom on functional group it should forms a bond between it
*/
await pressButton(page, STRUCTURE_LIBRARY_BUTTON_NAME);
await page.getByRole('tab', { name: 'Functional Groups' }).click();
await selectFunctionalGroups(FunctionalGroups.Cbz, page);
await clickInTheMiddleOfTheScreen(page);

Expand All @@ -72,8 +68,6 @@ test.describe('Click and drag Atom on canvas', () => {
Description: when click & drag with an atom on salts
and solvents atom appears where the left mouse button was released without a connection
*/
await pressButton(page, STRUCTURE_LIBRARY_BUTTON_NAME);
await page.getByRole('tab', { name: 'Salts and Solvents' }).click();
await selectSaltsAndSolvents(SaltsAndSolvents.FormicAcid, page);
await clickInTheMiddleOfTheScreen(page);

Expand Down Expand Up @@ -114,8 +108,6 @@ test.describe('Click and drag Atom on canvas', () => {
await selectAtomInToolbar(AtomButton.Bromine, page);
await clickInTheMiddleOfTheScreen(page);

await pressButton(page, STRUCTURE_LIBRARY_BUTTON_NAME);
await page.getByRole('tab', { name: 'Functional Groups' }).click();
await selectFunctionalGroups(FunctionalGroups.Cbz, page);
await moveMouseToTheMiddleOfTheScreen(page);
const { x, y } = await getCoordinatesOfTheMiddleOfTheScreen(page);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,11 @@ import {
selectAtomInToolbar,
takeEditorScreenshot,
AtomButton,
pressButton,
selectFunctionalGroups,
selectSaltsAndSolvents,
SaltsAndSolvents,
FunctionalGroups,
resetCurrentTool,
STRUCTURE_LIBRARY_BUTTON_NAME,
waitForPageInit,
} from '@utils';

Expand Down Expand Up @@ -47,8 +45,6 @@ test.describe('Click Atom on canvas', () => {
Test case: EPMLSOPKET-10100
Description: when clicking with an atom on a FG template it should replace it
*/
await pressButton(page, STRUCTURE_LIBRARY_BUTTON_NAME);
await page.getByRole('tab', { name: 'Functional Groups' }).click();
await selectFunctionalGroups(FunctionalGroups.FMOC, page);
await clickInTheMiddleOfTheScreen(page);

Expand All @@ -61,8 +57,6 @@ test.describe('Click Atom on canvas', () => {
Test case: EPMLSOPKET-10101
Description: when clicking with an atom on a Salts and Solvents it should replace it
*/
await pressButton(page, STRUCTURE_LIBRARY_BUTTON_NAME);
await page.getByRole('tab', { name: 'Salts and Solvents' }).click();
await selectSaltsAndSolvents(SaltsAndSolvents.FormicAcid, page);
await clickInTheMiddleOfTheScreen(page);

Expand Down Expand Up @@ -96,8 +90,6 @@ test.describe('Click Atom on canvas', () => {
await selectAtomInToolbar(AtomButton.Oxygen, page);
await clickInTheMiddleOfTheScreen(page);

await pressButton(page, STRUCTURE_LIBRARY_BUTTON_NAME);
await page.getByRole('tab', { name: 'Functional Groups' }).click();
await selectFunctionalGroups(FunctionalGroups.Cbz, page);
await moveMouseToTheMiddleOfTheScreen(page);
const { x, y } = await getCoordinatesOfTheMiddleOfTheScreen(page);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {
AtomButton,
clickInTheMiddleOfTheScreen,
dragMouseTo,
pressButton,
moveMouseToTheMiddleOfTheScreen,
selectFunctionalGroups,
selectSaltsAndSolvents,
Expand All @@ -16,7 +15,6 @@ import {
selectLeftPanelButton,
takeEditorScreenshot,
resetCurrentTool,
STRUCTURE_LIBRARY_BUTTON_NAME,
waitForPageInit,
} from '@utils';

Expand Down Expand Up @@ -59,8 +57,6 @@ test.describe('Drag and drop Atom on canvas', () => {
Test case: EPMLSOPKET-11832
Description: when drag & drop an atom on a FG it should replace it
*/
await pressButton(page, STRUCTURE_LIBRARY_BUTTON_NAME);
await page.getByRole('tab', { name: 'Functional Groups' }).click();
await selectFunctionalGroups(FunctionalGroups.FMOC, page);
await clickInTheMiddleOfTheScreen(page);

Expand All @@ -80,8 +76,6 @@ test.describe('Drag and drop Atom on canvas', () => {
Test case: EPMLSOPKET-11833
Description: when drag & drop an atom on a Salts and Solvents it should replace it
*/
await pressButton(page, STRUCTURE_LIBRARY_BUTTON_NAME);
await page.getByRole('tab', { name: 'Salts and Solvents' }).click();
await selectSaltsAndSolvents(SaltsAndSolvents.FormicAcid, page);
await clickInTheMiddleOfTheScreen(page);

Expand Down Expand Up @@ -129,13 +123,9 @@ test.describe('Drag and drop Atom on canvas', () => {
Description: when drag & drop with an atom on a FG connected
with bond to another FG it should replace it
*/
await pressButton(page, STRUCTURE_LIBRARY_BUTTON_NAME);
await page.getByRole('tab', { name: 'Functional Groups' }).click();
await selectFunctionalGroups(FunctionalGroups.FMOC, page);
await clickInTheMiddleOfTheScreen(page);

await pressButton(page, STRUCTURE_LIBRARY_BUTTON_NAME);
await page.getByRole('tab', { name: 'Functional Groups' }).click();
await selectFunctionalGroups(FunctionalGroups.Cbz, page);
await moveMouseToTheMiddleOfTheScreen(page);
const { x, y } = await getCoordinatesOfTheMiddleOfTheScreen(page);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import {
openFileAndAddToCanvas,
selectLeftPanelButton,
pressButton,
STRUCTURE_LIBRARY_BUTTON_NAME,
selectFunctionalGroups,
FunctionalGroups,
selectRingButton,
Expand Down Expand Up @@ -377,8 +376,6 @@ test.describe('Bond Tool', () => {
*Test case: EPMLSOPKET-10086
*Description: A bond is added to a contracted functional group and form a bond
*/
await pressButton(page, STRUCTURE_LIBRARY_BUTTON_NAME);
await page.getByRole('tab', { name: 'Functional Groups' }).click();
await selectFunctionalGroups(FunctionalGroups.Boc, page);
await clickInTheMiddleOfTheScreen(page);
await selectDropdownTool(page, 'bonds', tool);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { test } from '@playwright/test';
import {
selectFunctionalGroups,
selectTopPanelButton,
TopPanelButton,
FunctionalGroups,
Expand All @@ -13,20 +12,18 @@ import {
takeEditorScreenshot,
selectLeftPanelButton,
LeftPanelButton,
delay,
selectRingButton,
RingButton,
selectAtomInToolbar,
AtomButton,
resetCurrentTool,
selectLeftPanelToolClickAndScreenshot,
attachOnTopOfBenzeneBonds,
DELAY_IN_SECONDS,
clickOnAtom,
SelectTool,
selectNestedTool,
STRUCTURE_LIBRARY_BUTTON_NAME,
waitForPageInit,
selectDropdownTool,
selectFunctionalGroups,
} from '@utils';
import { getAtomByIndex } from '@utils/canvas/atoms';
import { getRotationHandleCoordinates } from '@utils/clicks/selectButtonByTitle';
Expand All @@ -48,8 +45,6 @@ test.describe('Templates - Functional Group Tools', () => {
Test case: EPMLSOPKET-10086
Description: A bond is added to a contracted functional group and form a bond
*/
await pressButton(page, STRUCTURE_LIBRARY_BUTTON_NAME);
await page.getByRole('tab', { name: 'Functional Groups' }).click();
await selectFunctionalGroups(FunctionalGroups.Boc, page);
await clickInTheMiddleOfTheScreen(page);

Expand All @@ -62,8 +57,6 @@ test.describe('Templates - Functional Group Tools', () => {
Test case: EPMLSOPKET-10087
Description: A chain is added to a contracted functional group and form a bond
*/
await pressButton(page, STRUCTURE_LIBRARY_BUTTON_NAME);
await page.getByRole('tab', { name: 'Functional Groups' }).click();
await selectFunctionalGroups(FunctionalGroups.FMOC, page);
await clickInTheMiddleOfTheScreen(page);

Expand All @@ -79,10 +72,10 @@ test.describe('Templates - Functional Group Tools', () => {
Test case: EPMLSOPKET-2889
Description: All the Functional Group elements are selected and highlighted on the canvas
*/
const anyAtom = 0;
await openFileAndAddToCanvas('functional-group-expanded.mol', page);
await delay(DELAY_IN_SECONDS.TWO);
await selectNestedTool(page, SelectTool.FRAGMENT_SELECTION);
await clickOnAtom(page, 'C', 0);
await selectDropdownTool(page, 'select-rectangle', 'select-fragment');
await clickOnAtom(page, 'C', anyAtom);
});

test('Rotate of expanded Functional Group', async ({ page }) => {
Expand Down Expand Up @@ -162,8 +155,6 @@ test.describe('Templates - Functional Group Tools', () => {
Test case: EPMLSOPKET-8938
Description: A duplicate is not created, the original Functional Group is dragged with the cursor
*/
await pressButton(page, STRUCTURE_LIBRARY_BUTTON_NAME);
await page.getByRole('tab', { name: 'Functional Groups' }).click();
await selectFunctionalGroups(FunctionalGroups.CO2Et, page);
await clickInTheMiddleOfTheScreen(page);

Expand Down Expand Up @@ -196,13 +187,13 @@ test.describe('Templates - Functional Group Tools', () => {
*/
const x = 650;
const y = 650;
const anyAtom = 1;
await openFileAndAddToCanvas('expanded-fg-CO2Et.mol', page);

await selectLeftPanelButton(LeftPanelButton.Chain, page);
await clickInTheMiddleOfTheScreen(page);
await pressButton(page, 'Remove Abbreviation');
await clickOnAtom(page, 'O', 1);
// const coordinatesWithShift = y + Y_DELTA;
await clickOnAtom(page, 'O', anyAtom);
await dragMouseTo(x, y, page);
});

Expand Down Expand Up @@ -230,8 +221,6 @@ test.describe('Templates - Functional Group Tools', () => {
FG is contracted.
FG is removed (ungrouped and displayed in expanded view).
*/
await pressButton(page, STRUCTURE_LIBRARY_BUTTON_NAME);
await page.getByRole('tab', { name: 'Functional Groups' }).click();
await selectFunctionalGroups(FunctionalGroups.CO2Et, page);
await clickInTheMiddleOfTheScreen(page);

Expand Down Expand Up @@ -333,8 +322,6 @@ test.describe('Templates - Functional Group Tools2', () => {
Expanded Functional Group is removed if were selected by Rectangle selection;
EDIT ABBREVIATION window appears if click by Erase tool on expanded FG without selection.
*/
await pressButton(page, STRUCTURE_LIBRARY_BUTTON_NAME);
await page.getByRole('tab', { name: 'Functional Groups' }).click();
await selectFunctionalGroups(FunctionalGroups.Boc, page);
await clickInTheMiddleOfTheScreen(page);

Expand Down Expand Up @@ -386,8 +373,6 @@ test.describe('Templates - Functional Group Tools2', () => {
3)Functional group is ungrouped and displayed in expanded view.
The 'Remove Abbreviation' option does not remove the atoms and bonds.
*/
await pressButton(page, STRUCTURE_LIBRARY_BUTTON_NAME);
await page.getByRole('tab', { name: 'Functional Groups' }).click();
await selectFunctionalGroups(FunctionalGroups.Boc, page);
await clickInTheMiddleOfTheScreen(page);

Expand Down Expand Up @@ -415,8 +400,6 @@ test.describe('Templates - Functional Group Tools2', () => {
Description: 'Expand/Contract Abbreviation' button can work several times on the same FG.
Undo/Redo actions are correct expand and contract Functional Group.
*/
await pressButton(page, STRUCTURE_LIBRARY_BUTTON_NAME);
await page.getByRole('tab', { name: 'Functional Groups' }).click();
await selectFunctionalGroups(FunctionalGroups.CO2Et, page);
await clickInTheMiddleOfTheScreen(page);

Expand Down Expand Up @@ -453,9 +436,7 @@ test.describe('Templates - Functional Group Tools2', () => {

await openFileAndAddToCanvas('functional-group-expanded.mol', page);

await delay(DELAY_IN_SECONDS.THREE);
await selectLeftPanelButton(LeftPanelButton.RectangleSelection, page);
await page.getByTestId('select-lasso').click();
await selectDropdownTool(page, 'select-rectangle', 'select-lasso');
await clickInTheMiddleOfTheScreen(page);
});

Expand Down Expand Up @@ -497,14 +478,10 @@ test.describe('Templates - Functional Group Tools2', () => {
'Molfiles-V2000/benzene-with-two-bonds.mol',
page,
);
await pressButton(page, STRUCTURE_LIBRARY_BUTTON_NAME);
await page.getByRole('tab', { name: 'Functional Groups' }).click();
await selectFunctionalGroups(FunctionalGroups.CO2Et, page);
await page.mouse.click(clickCoordines.x1, clickCoordines.y1);
await resetCurrentTool(page);

await pressButton(page, STRUCTURE_LIBRARY_BUTTON_NAME);
await page.getByRole('tab', { name: 'Functional Groups' }).click();
await selectFunctionalGroups(FunctionalGroups.CPh3, page);
await page.mouse.click(clickCoordines.x2, clickCoordines.y2);
});
Expand All @@ -518,8 +495,6 @@ test.describe('Templates - Functional Group Tools2', () => {
*/
await openFileAndAddToCanvas('Molfiles-V2000/benzene-with-bonds.mol', page);
await clickInTheMiddleOfTheScreen(page);
await pressButton(page, STRUCTURE_LIBRARY_BUTTON_NAME);
await page.getByRole('tab', { name: 'Functional Groups' }).click();
await selectFunctionalGroups(FunctionalGroups.Ac, page);
await attachOnTopOfBenzeneBonds(page);
});
Expand All @@ -529,8 +504,6 @@ test.describe('Templates - Functional Group Tools2', () => {
Test case: EPMLSOPKET-3994
Description: The FG is replaced by Nitrogen atom
*/
await pressButton(page, STRUCTURE_LIBRARY_BUTTON_NAME);
await page.getByRole('tab', { name: 'Functional Groups' }).click();
await selectFunctionalGroups(FunctionalGroups.FMOC, page);
await clickInTheMiddleOfTheScreen(page);

Expand Down Expand Up @@ -574,8 +547,6 @@ test.describe('Templates - Functional Group Tools3', () => {
*/
const timeout = 120_000;
test.setTimeout(timeout);
await pressButton(page, STRUCTURE_LIBRARY_BUTTON_NAME);
await page.getByRole('tab', { name: 'Functional Groups' }).click();
await selectFunctionalGroups(FunctionalGroups.CO2Et, page);
await clickInTheMiddleOfTheScreen(page);

Expand Down Expand Up @@ -666,4 +637,71 @@ test.describe('Templates - Functional Group Tools3', () => {
await page.getByRole('tab', { name: 'Functional Groups' }).click();
await pressButton(page, 'Save to SDF');
});

test('Check aromatize/dearomatize tool on FG', async ({ page }) => {
/*
Test case: EPMLSOPKET-2954
Description: Two FG's are added. Aromatize funcion is selected, nothing happens.
Dearomatize function is selected, nothing happens.
*/
const clickCoordines = {
x1: 560,
y1: 360,
x2: 700,
y2: 360,
};

await selectFunctionalGroups(FunctionalGroups.Bn, page);
await page.mouse.click(clickCoordines.x1, clickCoordines.y1);
await resetCurrentTool(page);

await selectFunctionalGroups(FunctionalGroups.Boc, page);
await page.mouse.click(clickCoordines.x2, clickCoordines.y2);
await resetCurrentTool(page);

await selectLeftPanelButton(LeftPanelButton.RectangleSelection, page);
await page.getByText('Bn').click({ button: 'right' });
await page.getByText('Expand Abbreviation').click();

await selectTopPanelButton(TopPanelButton.Aromatize, page);
await takeEditorScreenshot(page);

await selectTopPanelButton(TopPanelButton.Dearomatize, page);
await takeEditorScreenshot(page);
});

test('Check layout and cleanup buttons tool on FG', async ({ page }) => {
/*
Test case: EPMLSOPKET-2955
Description: Two FG's are added,
one Expanded and one Contracted.
Layout button is selected, nothing happens.
Clean Up button is selected, nothing happens.
*/

const clickCoordines = {
x1: 560,
y1: 360,
x2: 700,
y2: 360,
};

await selectFunctionalGroups(FunctionalGroups.CCl3, page);
await page.mouse.click(clickCoordines.x1, clickCoordines.y1);
await resetCurrentTool(page);

await selectFunctionalGroups(FunctionalGroups.C2H5, page);
await page.mouse.click(clickCoordines.x2, clickCoordines.y2);
await resetCurrentTool(page);

await selectLeftPanelButton(LeftPanelButton.RectangleSelection, page);
await page.getByText('CCl3').click({ button: 'right' });
await page.getByText('Expand Abbreviation').click();

await selectTopPanelButton(TopPanelButton.Layout, page);
await takeEditorScreenshot(page);

await selectTopPanelButton(TopPanelButton.Clean, 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.
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
Loading