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

#3553 - macro while pulling bond onto monomer a preview is shown when hover monomer #3600

Merged
Show file tree
Hide file tree
Changes from 4 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 @@ -4,7 +4,6 @@ import {
selectNestedTool,
openFileAndAddToCanvas,
takeEditorScreenshot,
pressButton,
selectTopPanelButton,
TopPanelButton,
clickOnTheCanvas,
Expand Down
6 changes: 4 additions & 2 deletions ketcher-autotests/tests/Settings/Atoms/atoms-settings.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@ import {
} from '@utils';
import { scrollSettingBar } from '@utils/scrollSettingBar';

const DEFAULT_SCROLLBAR_DELAY = 150;

async function setHydrogenLabelsOn(page: Page) {
await selectTopPanelButton(TopPanelButton.Settings, page);
await page.getByText('Atoms', { exact: true }).click();
await scrollSettingBar(page, 150);
await scrollSettingBar(page, DEFAULT_SCROLLBAR_DELAY);
await page.getByTestId('show-hydrogen-labels-input-span').click();
await page.getByTestId('On-option').click();
await pressButton(page, 'Apply');
Expand All @@ -31,7 +33,7 @@ async function selectExtendedTableElements(page: Page, element: string) {
async function atomDefaultSettings(page: Page) {
await selectTopPanelButton(TopPanelButton.Settings, page);
await page.getByText('Atoms', { exact: true }).click();
await scrollSettingBar(page,150);
await scrollSettingBar(page, DEFAULT_SCROLLBAR_DELAY);
}

async function ringBondCountQuery(page: Page, menuItem: string) {
Expand Down
2 changes: 1 addition & 1 deletion ketcher-autotests/tests/utils/canvas/tools/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Page } from '@playwright/test';
import { pressButton, selectOption } from '@utils';
import { selectOption } from '@utils';
import { selectButtonByTitle } from '@utils/clicks/selectButtonByTitle';
import { clickOnFileFormatDropdown } from '@utils/formats';
import {
Expand Down
16 changes: 8 additions & 8 deletions ketcher-autotests/tests/utils/scrollSettingBar.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { Page } from "@playwright/test";
import { Page } from '@playwright/test';

// It's a temporary workaround and will be eventually refactored to locator
export async function scrollSettingBar (page: Page, scrollLength: number){
const deltaX = 0;
const scrollBarCoordinatesX = 638;
const scrollBarCoordinatesY = 524;
await page.mouse.move(scrollBarCoordinatesX, scrollBarCoordinatesY);
await page.mouse.wheel(deltaX, scrollLength);
}
export async function scrollSettingBar(page: Page, scrollLength: number) {
const deltaX = 0;
const scrollBarCoordinatesX = 638;
const scrollBarCoordinatesY = 524;
await page.mouse.move(scrollBarCoordinatesX, scrollBarCoordinatesY);
await page.mouse.wheel(deltaX, scrollLength);
}
6 changes: 5 additions & 1 deletion packages/ketcher-polymer-editor-react/src/Editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ interface EditorProps {
togglerComponent?: JSX.Element;
}

const noPreviewTools = ['bond-single'];

function EditorContainer({
onInit,
theme,
Expand Down Expand Up @@ -208,7 +210,9 @@ function Editor({ theme, togglerComponent }: EditorProps) {
});
editor?.events.mouseOnMoveMonomer.add((e) => {
handleClosePreview();
handleOpenPreview(e);
if (e.buttons !== 1 || !noPreviewTools.includes(activeTool)) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we move e.buttons !== 1 to constant like isLeftClick (am I right about this number?). Everything else looks good time from code perspective

handleOpenPreview(e);
}
});
}, [editor, activeTool]);

Expand Down