Skip to content

Commit

Permalink
#3692 hide attachment points for micro preview
Browse files Browse the repository at this point in the history
  • Loading branch information
StarlaStarla committed Jan 3, 2024
2 parents fdd1c31 + 54fb9aa commit 62705af
Show file tree
Hide file tree
Showing 118 changed files with 1,935 additions and 1,940 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ the first one disappears. Couldn't reproduct manually.

// add second structure from file to canvas
await selectTopPanelButton(TopPanelButton.Open, page);
await openFile('glutamine.mol', page);
await openFile('Molfiles-V2000/glutamine.mol', page);
await waitForLoad(page, async () => {
await pressButton(page, 'Add to Canvas');
});
Expand Down
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 @@ -19,18 +19,23 @@ import {
waitForRender,
} from '@utils';

async function zoomWithMouseWheel(
page: Page,
numberOfMouseWheelScroll: number,
randomMouseWheelScroll: number,
) {
const topLeftCorner = {
x: -425,
y: -235,
};

async function zoomWithMouseWheel(page: Page, scrollValue: number) {
await page.keyboard.down('Control');
for (let i = 0; i < numberOfMouseWheelScroll; i++) {
await page.mouse.wheel(0, randomMouseWheelScroll);
}
await page.mouse.wheel(0, scrollValue);
await page.keyboard.up('Control');
}

async function scrollHorizontally(page: Page, scrollValue: number) {
await page.keyboard.down('Shift');
await page.mouse.wheel(0, scrollValue);
await page.keyboard.up('Shift');
}

async function pasteFromClipboard(page: Page, fileFormats: string) {
await selectTopPanelButton(TopPanelButton.Open, page);
await page.getByText('Paste from clipboard').click();
Expand Down Expand Up @@ -72,9 +77,11 @@ test.describe('Macro-Micro-Switcher', () => {
Description: Preview window of macro structure doesn't change in micro mode
Test working incorrect now because we have bug https://github.com/epam/ketcher/issues/3603
*/
const scrollValue = -400;
const moleculeLabels = ['A', '25R', 'baA', 'Test-6-Ph', 'Test-6-Ch'];
await openFileAndAddToCanvas('KET/five-monomers.ket', page);
await turnOnMicromoleculesEditor(page);
await scrollHorizontally(page, scrollValue);
for (const label of moleculeLabels) {
await page.getByText(label, { exact: true }).hover();
await takeEditorScreenshot(page);
Expand Down Expand Up @@ -105,7 +112,12 @@ test.describe('Macro-Micro-Switcher', () => {
Description: Micromolecules in macromode represented as CHEMs with generated name(F1, F2, ...Fn)
*/
await turnOnMicromoleculesEditor(page);
await openFileAndAddToCanvas('KET/eight-micromolecules.ket', page);
await openFileAndAddToCanvas(
'KET/eight-micromolecules.ket',
page,
topLeftCorner.x,
topLeftCorner.y,
);
await turnOnMacromoleculesEditor(page);
await takeEditorScreenshot(page);
});
Expand Down Expand Up @@ -135,14 +147,19 @@ test.describe('Macro-Micro-Switcher', () => {
await takeEditorScreenshot(page);
});

test('Check that the Ket-structure opened from the file in Macro mode is visible in Micro mode', async ({
test('Check that the Ket-structure opened from the file in Macro mode is visible in Micro mode', async ({
page,
}) => {
/*
Test case: Macro-Micro-Switcher
Description: Mol-structure opened from the file in Macro mode is visible on Micro mode when
*/
await openFileAndAddToCanvas('KET/stereo-and-structure.ket', page);
await openFileAndAddToCanvas(
'KET/stereo-and-structure.ket',
page,
topLeftCorner.x,
topLeftCorner.y,
);
await turnOnMicromoleculesEditor(page);
await takeEditorScreenshot(page);
});
Expand Down Expand Up @@ -256,12 +273,12 @@ test.describe('Macro-Micro-Switcher', () => {
await turnOnMicromoleculesEditor(page);
await turnOnMacromoleculesEditor(page);
// eslint-disable-next-line no-magic-numbers
await zoomWithMouseWheel(page, 5, -80);
await zoomWithMouseWheel(page, -400);

await takeEditorScreenshot(page);

// eslint-disable-next-line no-magic-numbers
await zoomWithMouseWheel(page, 5, 50);
await zoomWithMouseWheel(page, 250);

await takeEditorScreenshot(page);
await page.getByTestId('reset-zoom-button').click();
Expand Down Expand Up @@ -289,7 +306,7 @@ test.describe('Macro-Micro-Switcher', () => {
await takeEditorScreenshot(page);

// eslint-disable-next-line no-magic-numbers
await zoomWithMouseWheel(page, 5, 50);
await zoomWithMouseWheel(page, 250);

await turnOnMacromoleculesEditor(page);
await takeEditorScreenshot(page);
Expand Down Expand Up @@ -371,7 +388,12 @@ test.describe('Macro-Micro-Switcher', () => {
Test case: Macro-Micro-Switcher
Description: Mol-structure opened from the file in Micro mode is visible on Macro mode when hover on it
*/
await openFileAndAddToCanvas('Molfiles-V2000/glutamine.mol', page);
await openFileAndAddToCanvas(
'Molfiles-V2000/glutamine.mol',
page,
topLeftCorner.x,
topLeftCorner.y,
);
await turnOnMacromoleculesEditor(page);
await page.getByText('F1').locator('..').click();
await takeEditorScreenshot(page);
Expand All @@ -384,7 +406,12 @@ test.describe('Macro-Micro-Switcher', () => {
Test case: Macro-Micro-Switcher
Description: Mol-structure opened from the file in Micro mode is visible on Macro mode when hover on it
*/
await openFileAndAddToCanvas('KET/stereo-and-structure.ket', page);
await openFileAndAddToCanvas(
'KET/stereo-and-structure.ket',
page,
topLeftCorner.x,
topLeftCorner.y,
);
await turnOnMacromoleculesEditor(page);
await page.getByText('F1').locator('..').hover();
await takeEditorScreenshot(page);
Expand All @@ -397,7 +424,12 @@ test.describe('Macro-Micro-Switcher', () => {
Test case: Macro-Micro-Switcher
Description: Structure exists on the canvas with changes by Charge Plus (+) Tool and Charge Plus (-).
*/
await openFileAndAddToCanvas('KET/two-benzene-charged.ket', page);
await openFileAndAddToCanvas(
'KET/two-benzene-charged.ket',
page,
topLeftCorner.x,
topLeftCorner.y,
);
await turnOnMacromoleculesEditor(page);
await page.getByText('F2').locator('..').hover();
await takeEditorScreenshot(page);
Expand All @@ -410,7 +442,12 @@ test.describe('Macro-Micro-Switcher', () => {
Test case: Macro-Micro-Switcher
Description: Structure exists on the canvas without text.
*/
await openFileAndAddToCanvas('KET/benzene-rings-with-text.ket', page);
await openFileAndAddToCanvas(
'KET/benzene-rings-with-text.ket',
page,
topLeftCorner.x,
topLeftCorner.y,
);
await turnOnMacromoleculesEditor(page);
await page.getByText('F1').locator('..').hover();
await takeEditorScreenshot(page);
Expand All @@ -423,7 +460,12 @@ test.describe('Macro-Micro-Switcher', () => {
Test case: Macro-Micro-Switcher
Description: Structure exists on the canvas without Shape Ellipse.
*/
await openFileAndAddToCanvas('KET/two-benzene-and-ellipse.ket', page);
await openFileAndAddToCanvas(
'KET/two-benzene-and-ellipse.ket',
page,
topLeftCorner.x,
topLeftCorner.y,
);
await turnOnMacromoleculesEditor(page);
await takeEditorScreenshot(page);
});
Expand All @@ -435,7 +477,12 @@ test.describe('Macro-Micro-Switcher', () => {
Test case: Macro-Micro-Switcher
Description: Structures exists on the canvas without arrow ( Arrow Open Angle Tool )
*/
await openFileAndAddToCanvas('KET/two-benzene-and-arrow.ket', page);
await openFileAndAddToCanvas(
'KET/two-benzene-and-arrow.ket',
page,
topLeftCorner.x,
topLeftCorner.y,
);
await turnOnMacromoleculesEditor(page);
await takeEditorScreenshot(page);
});
Expand All @@ -447,8 +494,12 @@ test.describe('Macro-Micro-Switcher', () => {
Test case: Macro-Micro-Switcher
Description: In Macro mode ABS, AND and OR is not appear
*/
const zoomOutValue = 500;
const scrollRightValue = -500;
await openFileAndAddToCanvas('KET/three-alpha-d-allopyranose.ket', page);
await turnOnMacromoleculesEditor(page);
await zoomWithMouseWheel(page, zoomOutValue);
await scrollHorizontally(page, scrollRightValue);
await page.getByText('F1').locator('..').hover();
await takeEditorScreenshot(page);
});
Expand All @@ -460,23 +511,32 @@ test.describe('Macro-Micro-Switcher', () => {
Test case: Macro-Micro-Switcher
Description: In Macro mode plus sign is not appear
*/
await openFileAndAddToCanvas('KET/two-benzene-and-plus.ket', page);
await openFileAndAddToCanvas(
'KET/two-benzene-and-plus.ket',
page,
topLeftCorner.x,
topLeftCorner.y,
);
await turnOnMacromoleculesEditor(page);
await takeEditorScreenshot(page);
});

test('Check that the Ket-structure pasted from the clipboard in Micro mode is visible in Macro mode when hover on it.', async ({
test('Check that the Ket-structure pasted from the clipboard in Micro mode is visible in Macro mode when hover on it.', async ({
page,
}) => {
/*
Test case: Macro-Micro-Switcher
Description: Ket-structure pasted from the clipboard in Micro mode is visible in Macro mode when hover on it
*/
const topLeftCornerCoords = {
x: 100,
y: 100,
};
await pasteFromClipboard(
page,
FILE_TEST_DATA.oneFunctionalGroupExpandedKet,
);
await clickInTheMiddleOfTheScreen(page);
await page.mouse.click(topLeftCornerCoords.x, topLeftCornerCoords.y);
await turnOnMacromoleculesEditor(page);
await page.getByText('F1').locator('..').click();
await takeEditorScreenshot(page);
Expand All @@ -489,11 +549,17 @@ test.describe('Macro-Micro-Switcher', () => {
Test case: Macro-Micro-Switcher
Description: Mol-structure pasted from the clipboard in Micro mode is visible in Macro mode when hover on it
*/
const coordsToClick = {
x: 200,
y: 100,
};
await pasteFromClipboard(
page,
FILE_TEST_DATA.functionalGroupsExpandedContractedV3000,
);
await clickInTheMiddleOfTheScreen(page);
await waitForRender(page, async () => {
await page.mouse.click(coordsToClick.x, coordsToClick.y);
});
await turnOnMacromoleculesEditor(page);
await page.getByText('F1').locator('..').hover();
await takeEditorScreenshot(page);
Expand All @@ -507,7 +573,12 @@ test.describe('Macro-Micro-Switcher', () => {
Description: Full screen mode is not reset
Test working not properly now because we have bug https://github.com/epam/ketcher/issues/3656
*/
await openFileAndAddToCanvas('KET/two-benzene-and-plus.ket', page);
await openFileAndAddToCanvas(
'KET/two-benzene-and-plus.ket',
page,
topLeftCorner.x,
topLeftCorner.y,
);
await page.getByTestId('fullscreen-mode-button').click();
await turnOnMacromoleculesEditor(page);
await takePageScreenshot(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.
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.
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
Expand Up @@ -21,14 +21,21 @@ function removeNotComparableData(file: string) {
.join('\n');
}

const topLeftCorner = -300;

test.describe('MolV300 Files', () => {
test.beforeEach(async ({ page }) => {
await waitForPageInit(page);
await turnOnMacromoleculesEditor(page);
});

test('Import', async ({ page }) => {
await openFileAndAddToCanvas('Molfiles-V3000/monomers-and-chem.mol', page);
await openFileAndAddToCanvas(
'Molfiles-V3000/monomers-and-chem.mol',
page,
topLeftCorner,
topLeftCorner,
);
await takeEditorScreenshot(page);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ test.describe('Erase Tool', () => {
const [plusElement] = window.ketcher.editor.struct().rxnPluses.values();
return {
plusElement: plusElement || null,
scale: window.ketcher.editor.options().scale,
scale: window.ketcher.editor.options().microModeScale,
};
});

Expand Down Expand Up @@ -110,7 +110,7 @@ test.describe('Erase Tool', () => {
const [element] = window.ketcher.editor.struct().rxnArrows.values();
return {
arrowElement: element || null,
scale: window.ketcher.editor.options().scale,
scale: window.ketcher.editor.options().microModeScale,
};
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,7 @@ test.describe('Template Manupulations', () => {
await dragMouseTo(rotationHandleX, rotationHandleY - shift, page);
});

test('Place template on the Canvas', async ({
page,
}) => {
test('Place template on the Canvas', async ({ page }) => {
/*
Test case: 1678
Description: Choose any template and click on the canvas.
Expand Down
Loading

0 comments on commit 62705af

Please sign in to comment.