diff --git a/ketcher-autotests/tests/File-Management/Open-And-Save-Files/Image-files/image-files.spec.ts b/ketcher-autotests/tests/File-Management/Open-And-Save-Files/Image-files/image-files.spec.ts index d27f7d20e3..4e15b25ef6 100755 --- a/ketcher-autotests/tests/File-Management/Open-And-Save-Files/Image-files/image-files.spec.ts +++ b/ketcher-autotests/tests/File-Management/Open-And-Save-Files/Image-files/image-files.spec.ts @@ -29,6 +29,7 @@ import { screenshotBetweenUndoRedo, selectAllStructuresOnCanvas, selectAromatizeTool, + selectCleanTool, selectClearCanvasTool, selectDearomatizeTool, selectEraseTool, @@ -1349,10 +1350,7 @@ test.describe('Image files', () => { await dragMouseTo(x, y, page); await clickOnCanvas(page, 100, 100); await takeEditorScreenshot(page); - await waitForSpinnerFinishedWork( - page, - async () => await selectTopPanelButton(TopPanelButton.Clean, page), - ); + await selectCleanTool(page); await takeEditorScreenshot(page, { maxDiffPixelRatio: 0.05 }); }); diff --git a/ketcher-autotests/tests/Indigo-Tools/Clean-Tools/clean-tools.spec.ts b/ketcher-autotests/tests/Indigo-Tools/Clean-Tools/clean-tools.spec.ts index 6e6c7e0e61..861e342db6 100644 --- a/ketcher-autotests/tests/Indigo-Tools/Clean-Tools/clean-tools.spec.ts +++ b/ketcher-autotests/tests/Indigo-Tools/Clean-Tools/clean-tools.spec.ts @@ -17,6 +17,7 @@ import { selectPartOfChain, selectPartOfMolecules, saveToFile, + selectCleanTool, } from '@utils'; import { getMolfile } from '@utils/formats/formats'; import { pressUndoButton } from '@utils/macromolecules/topToolBar'; @@ -58,10 +59,7 @@ test.describe('Indigo Tools - Clean Tools', () => { await pressUndoButton(page); - await waitForSpinnerFinishedWork( - page, - async () => await selectTopPanelButton(TopPanelButton.Clean, page), - ); + await selectCleanTool(page); await takeEditorScreenshot(page, { maxDiffPixelRatio: 0.05 }); }); @@ -82,10 +80,7 @@ test.describe('Indigo Tools - Clean Tools', () => { await pressUndoButton(page); - await waitForSpinnerFinishedWork( - page, - async () => await selectTopPanelButton(TopPanelButton.Clean, page), - ); + await selectCleanTool(page); await takeEditorScreenshot(page, { maxDiffPixelRatio: 0.05 }); }); @@ -107,10 +102,7 @@ test.describe('Indigo Tools - Clean Tools', () => { await pressUndoButton(page); - await waitForSpinnerFinishedWork( - page, - async () => await selectTopPanelButton(TopPanelButton.Clean, page), - ); + await selectCleanTool(page); await takeEditorScreenshot(page, { maxDiffPixelRatio: 0.05 }); }); @@ -138,10 +130,7 @@ test.describe('Indigo Tools - Clean Tools', () => { */ await openFileAndAddToCanvas('Molfiles-V2000/layout-distorted.mol', page); - await waitForSpinnerFinishedWork( - page, - async () => await selectTopPanelButton(TopPanelButton.Clean, page), - ); + await selectCleanTool(page); await takeEditorScreenshot(page, { maxDiffPixelRatio: 0.05 }); }); @@ -160,10 +149,7 @@ test.describe('Indigo Tools - Clean Tools', () => { await pressUndoButton(page); - await waitForSpinnerFinishedWork( - page, - async () => await selectTopPanelButton(TopPanelButton.Clean, page), - ); + await selectCleanTool(page); await takeEditorScreenshot(page, { maxDiffPixelRatio: 0.05 }); }); @@ -176,10 +162,7 @@ test.describe('Indigo Tools - Clean Tools', () => { */ await openFileAndAddToCanvas('Molfiles-V2000/clean-appoints.mol', page); - await waitForSpinnerFinishedWork( - page, - async () => await selectTopPanelButton(TopPanelButton.Clean, page), - ); + await selectCleanTool(page); await takeEditorScreenshot(page, { maxDiffPixelRatio: 0.05 }); }); @@ -201,10 +184,7 @@ test.describe('Indigo Tools - Clean Tools', () => { await pressUndoButton(page); - await waitForSpinnerFinishedWork( - page, - async () => await selectTopPanelButton(TopPanelButton.Clean, page), - ); + await selectCleanTool(page); await takeEditorScreenshot(page, { maxDiffPixelRatio: 0.05 }); await pressUndoButton(page); @@ -227,10 +207,7 @@ test.describe('Indigo Tools - Clean Tools', () => { await pressUndoButton(page); - await waitForSpinnerFinishedWork( - page, - async () => await selectTopPanelButton(TopPanelButton.Clean, page), - ); + await selectCleanTool(page); await takeEditorScreenshot(page, { maxDiffPixelRatio: 0.05 }); }); @@ -252,10 +229,7 @@ test.describe('Indigo Tools - Clean Tools', () => { await pressUndoButton(page); - await waitForSpinnerFinishedWork( - page, - async () => await selectTopPanelButton(TopPanelButton.Clean, page), - ); + await selectCleanTool(page); await takeEditorScreenshot(page, { maxDiffPixelRatio: 0.05 }); }); @@ -276,10 +250,7 @@ test.describe('Indigo Tools - Clean Tools', () => { await pressUndoButton(page); - await waitForSpinnerFinishedWork( - page, - async () => await selectTopPanelButton(TopPanelButton.Clean, page), - ); + await selectCleanTool(page); await takeEditorScreenshot(page, { maxDiffPixelRatio: 0.05 }); }); @@ -292,10 +263,7 @@ test.describe('Indigo Tools - Clean Tools', () => { */ await openFileAndAddToCanvas('KET/stereolabels.ket', page); - await waitForSpinnerFinishedWork( - page, - async () => await selectTopPanelButton(TopPanelButton.Clean, page), - ); + await selectCleanTool(page); await takeEditorScreenshot(page, { maxDiffPixelRatio: 0.05 }); await pressUndoButton(page); @@ -317,10 +285,7 @@ test.describe('Indigo Tools - Clean Tools', () => { await pressUndoButton(page); - await waitForSpinnerFinishedWork( - page, - async () => await selectTopPanelButton(TopPanelButton.Clean, page), - ); + await selectCleanTool(page); await takeEditorScreenshot(page, { maxDiffPixelRatio: 0.05 }); }); @@ -362,10 +327,7 @@ test.describe('Indigo Tools - Clean Tools', () => { page, ); await selectPartOfChain(page); - await waitForSpinnerFinishedWork( - page, - async () => await selectTopPanelButton(TopPanelButton.Clean, page), - ); + await selectCleanTool(page); await takeEditorScreenshot(page, { maxDiffPixelRatio: 0.05 }); }); @@ -379,10 +341,7 @@ test.describe('Indigo Tools - Clean Tools', () => { page, ); await selectPartOfChain(page); - await waitForSpinnerFinishedWork( - page, - async () => await selectTopPanelButton(TopPanelButton.Clean, page), - ); + await selectCleanTool(page); await takeEditorScreenshot(page, { maxDiffPixelRatio: 0.05 }); }); @@ -399,10 +358,7 @@ test.describe('Indigo Tools - Clean Tools', () => { page, ); await selectPartOfMolecules(page); - await waitForSpinnerFinishedWork( - page, - async () => await selectTopPanelButton(TopPanelButton.Clean, page), - ); + await selectCleanTool(page); await takeEditorScreenshot(page, { maxDiffPixelRatio: 0.05 }); }); @@ -416,16 +372,10 @@ test.describe('Indigo Tools - Clean Tools', () => { const y = 300; const anyAtom = 0; await openFileAndAddToCanvas('Molfiles-V2000/toluene.mol', page); - await waitForSpinnerFinishedWork( - page, - async () => await selectTopPanelButton(TopPanelButton.Clean, page), - ); + await selectCleanTool(page); await moveOnBond(page, BondType.SINGLE, 0); await dragMouseTo(x, y, page); - await waitForSpinnerFinishedWork( - page, - async () => await selectTopPanelButton(TopPanelButton.Clean, page), - ); + await selectCleanTool(page); await selectAtomInToolbar(AtomButton.Oxygen, page); await clickOnAtom(page, 'C', anyAtom); await takeEditorScreenshot(page, { maxDiffPixelRatio: 0.05 }); @@ -444,10 +394,7 @@ test.describe('Indigo Tools - Clean Tools', () => { page, ); await selectPartOfMolecules(page); - await waitForSpinnerFinishedWork( - page, - async () => await selectTopPanelButton(TopPanelButton.Clean, page), - ); + await selectCleanTool(page); await takeEditorScreenshot(page, { maxDiffPixelRatio: 0.05 }); }); @@ -462,10 +409,7 @@ test.describe('Indigo Tools - Clean Tools', () => { Undo/Redo actions are correct. */ await openFileAndAddToCanvas('Molfiles-V2000/big-rings.mol', page); - await waitForSpinnerFinishedWork( - page, - async () => await selectTopPanelButton(TopPanelButton.Clean, page), - ); + await selectCleanTool(page); await pressUndoButton(page); await waitForSpinnerFinishedWork( page, @@ -488,10 +432,7 @@ test.describe('Indigo Tools - Clean Tools', () => { page, ); await page.getByText(anyRGroupLabel).click(); - await waitForSpinnerFinishedWork( - page, - async () => await selectTopPanelButton(TopPanelButton.Clean, page), - ); + await selectCleanTool(page); await takeEditorScreenshot(page, { maxDiffPixelRatio: 0.05 }); }); @@ -502,10 +443,7 @@ test.describe('Indigo Tools - Clean Tools', () => { Position of the reaction does not change. */ await openFileAndAddToCanvas('Rxn-V2000/distorted-reaction.rxn', page); - await waitForSpinnerFinishedWork( - page, - async () => await selectTopPanelButton(TopPanelButton.Clean, page), - ); + await selectCleanTool(page); await takeEditorScreenshot(page, { maxDiffPixelRatio: 0.05 }); }); @@ -520,10 +458,7 @@ test.describe('Indigo Tools - Clean Tools', () => { page, ); await selectPartOfMolecules(page); - await waitForSpinnerFinishedWork( - page, - async () => await selectTopPanelButton(TopPanelButton.Clean, page), - ); + await selectCleanTool(page); await takeEditorScreenshot(page, { maxDiffPixelRatio: 0.05 }); }); @@ -546,10 +481,7 @@ test.describe('Indigo Tools - Clean Tools', () => { page, ); await selectPartOfMolecules(page); - await waitForSpinnerFinishedWork( - page, - async () => await selectTopPanelButton(TopPanelButton.Clean, page), - ); + await selectCleanTool(page); await takeEditorScreenshot(page, { maxDiffPixelRatio: 0.05 }); }); @@ -562,10 +494,7 @@ test.describe('Indigo Tools - Clean Tools', () => { */ await openFileAndAddToCanvas('Molfiles-V2000/distorted-Sgroups.mol', page); await selectPartOfMolecules(page); - await waitForSpinnerFinishedWork( - page, - async () => await selectTopPanelButton(TopPanelButton.Clean, page), - ); + await selectCleanTool(page); await takeEditorScreenshot(page, { maxDiffPixelRatio: 0.05 }); }); @@ -584,10 +513,7 @@ test.describe('Indigo Tools - Clean Tools', () => { page, ); await selectPartOfMolecules(page); - await waitForSpinnerFinishedWork( - page, - async () => await selectTopPanelButton(TopPanelButton.Clean, page), - ); + await selectCleanTool(page); await takeEditorScreenshot(page, { maxDiffPixelRatio: 0.05 }); }, ); diff --git a/ketcher-autotests/tests/Macromolecule-editor/Macro-Micro-Switcher/macro-micro-switcher.spec.ts b/ketcher-autotests/tests/Macromolecule-editor/Macro-Micro-Switcher/macro-micro-switcher.spec.ts index e760d19d73..68f1763a3c 100644 --- a/ketcher-autotests/tests/Macromolecule-editor/Macro-Micro-Switcher/macro-micro-switcher.spec.ts +++ b/ketcher-autotests/tests/Macromolecule-editor/Macro-Micro-Switcher/macro-micro-switcher.spec.ts @@ -75,6 +75,7 @@ import { selectZoomReset, selectAromatizeTool, selectDearomatizeTool, + selectCleanTool, } from '@utils'; import { addSuperatomAttachmentPoint, @@ -1901,10 +1902,7 @@ test.describe('Macro-Micro-Switcher', () => { */ await openFileAndAddToCanvas('KET/distorted-r1-attachment-point.ket', page); await takeEditorScreenshot(page); - await waitForSpinnerFinishedWork( - page, - async () => await selectTopPanelButton(TopPanelButton.Clean, page), - ); + await selectCleanTool(page); await takeEditorScreenshot(page, { maxDiffPixelRatio: 0.05 }); }); diff --git a/ketcher-autotests/tests/Reactions/Reaction-tools/Multi-Tailed-Arrow-Tool/multi-tailed-arrow-tool.spec.ts b/ketcher-autotests/tests/Reactions/Reaction-tools/Multi-Tailed-Arrow-Tool/multi-tailed-arrow-tool.spec.ts index a05e58637a..b456769fb0 100644 --- a/ketcher-autotests/tests/Reactions/Reaction-tools/Multi-Tailed-Arrow-Tool/multi-tailed-arrow-tool.spec.ts +++ b/ketcher-autotests/tests/Reactions/Reaction-tools/Multi-Tailed-Arrow-Tool/multi-tailed-arrow-tool.spec.ts @@ -26,6 +26,7 @@ import { screenshotBetweenUndoRedo, selectAllStructuresOnCanvas, selectAromatizeTool, + selectCleanTool, selectClearCanvasTool, selectDearomatizeTool, selectDropdownTool, @@ -41,7 +42,6 @@ import { TopPanelButton, waitForPageInit, waitForRender, - waitForSpinnerFinishedWork, } from '@utils'; import { closeErrorAndInfoModals } from '@utils/common/helpers'; import { @@ -3739,10 +3739,7 @@ test.describe('Multi-Tailed Arrow Tool', () => { await dragMouseTo(700, 340, page); await clickOnCanvas(page, 200, 200); await takeEditorScreenshot(page); - await waitForSpinnerFinishedWork( - page, - async () => await selectTopPanelButton(TopPanelButton.Clean, page), - ); + await selectCleanTool(page); await takeEditorScreenshot(page); await verifyFileExport( page, diff --git a/ketcher-autotests/tests/Reactions/Reaction-tools/Plus-and-Arrow-tools/plus-and-arrows-tools.spec.ts b/ketcher-autotests/tests/Reactions/Reaction-tools/Plus-and-Arrow-tools/plus-and-arrows-tools.spec.ts index 5ea6747c0d..d1a3413439 100644 --- a/ketcher-autotests/tests/Reactions/Reaction-tools/Plus-and-Arrow-tools/plus-and-arrows-tools.spec.ts +++ b/ketcher-autotests/tests/Reactions/Reaction-tools/Plus-and-Arrow-tools/plus-and-arrows-tools.spec.ts @@ -24,13 +24,13 @@ import { waitForPageInit, waitForRender, openDropdown, - waitForSpinnerFinishedWork, selectRectangleArea, copyToClipboardByKeyboard, cutToClipboardByKeyboard, pasteFromClipboardByKeyboard, selectAllStructuresOnCanvas, clickOnCanvas, + selectCleanTool, } from '@utils'; import { pressRedoButton, @@ -461,10 +461,7 @@ test.describe('Plus and Arrows tools ', () => { await selectTopPanelButton(TopPanelButton.Layout, page); await takeEditorScreenshot(page); await pressUndoButton(page); - await waitForSpinnerFinishedWork( - page, - async () => await selectTopPanelButton(TopPanelButton.Clean, page), - ); + await selectCleanTool(page); test.fixme( true, diff --git a/ketcher-autotests/tests/Structure-Creating-&-Editing/Actions-With-Structures/Attachment-Point-Tool/attachment-point-tool.spec.ts b/ketcher-autotests/tests/Structure-Creating-&-Editing/Actions-With-Structures/Attachment-Point-Tool/attachment-point-tool.spec.ts index 974092339f..e383c23d8a 100644 --- a/ketcher-autotests/tests/Structure-Creating-&-Editing/Actions-With-Structures/Attachment-Point-Tool/attachment-point-tool.spec.ts +++ b/ketcher-autotests/tests/Structure-Creating-&-Editing/Actions-With-Structures/Attachment-Point-Tool/attachment-point-tool.spec.ts @@ -29,6 +29,7 @@ import { waitForSpinnerFinishedWork, selectAllStructuresOnCanvas, clickOnCanvas, + selectCleanTool, } from '@utils'; import { pressRedoButton, @@ -915,9 +916,7 @@ test.describe('Attachment Point Tool', () => { await pressUndoButton(page); }); - await waitForSpinnerFinishedWork(page, async () => { - await selectTopPanelButton(TopPanelButton.Clean, page); - }); + await selectCleanTool(page); await takeEditorScreenshot(page, { maxDiffPixelRatio: 0.05 }); }); }); diff --git a/ketcher-autotests/tests/Templates/Functional-Groups/Functional-Group-Tools/functional-group-tools.spec.ts b/ketcher-autotests/tests/Templates/Functional-Groups/Functional-Group-Tools/functional-group-tools.spec.ts index 1255da054e..edc1c02190 100644 --- a/ketcher-autotests/tests/Templates/Functional-Groups/Functional-Group-Tools/functional-group-tools.spec.ts +++ b/ketcher-autotests/tests/Templates/Functional-Groups/Functional-Group-Tools/functional-group-tools.spec.ts @@ -34,6 +34,7 @@ import { clickOnCanvas, selectAromatizeTool, selectDearomatizeTool, + selectCleanTool, } from '@utils'; import { getAtomByIndex } from '@utils/canvas/atoms'; import { getRotationHandleCoordinates } from '@utils/clicks/selectButtonByTitle'; @@ -817,9 +818,7 @@ test.describe('Templates - Functional Group Tools3', () => { }); await takeEditorScreenshot(page); - await waitForSpinnerFinishedWork(page, async () => { - await selectTopPanelButton(TopPanelButton.Clean, page); - }); + await selectCleanTool(page); await takeEditorScreenshot(page); }); diff --git a/ketcher-autotests/tests/Templates/User-Templates/user-templates.spec.ts b/ketcher-autotests/tests/Templates/User-Templates/user-templates.spec.ts index e8a1d9cc1c..4d71037994 100644 --- a/ketcher-autotests/tests/Templates/User-Templates/user-templates.spec.ts +++ b/ketcher-autotests/tests/Templates/User-Templates/user-templates.spec.ts @@ -12,7 +12,6 @@ import { TemplateLibrary, selectUserTemplatesAndPlaceInTheMiddle, STRUCTURE_LIBRARY_BUTTON_NAME, - waitForSpinnerFinishedWork, waitForPageInit, copyAndPaste, cutAndPaste, @@ -20,6 +19,7 @@ import { clickOnAtom, getEditorScreenshot, clickOnCanvas, + selectCleanTool, } from '@utils'; const CANVAS_CLICK_X = 300; @@ -222,9 +222,7 @@ test.describe('Create and Save Templates', () => { await page.getByPlaceholder('template').click(); await page.getByPlaceholder('template').fill('user_template_1'); await page.getByRole('button', { name: 'Save', exact: true }).click(); - await waitForSpinnerFinishedWork(page, async () => { - await selectTopPanelButton(TopPanelButton.Clean, page); - }); + await selectCleanTool(page); await openStructureLibrary(page); await page.getByRole('button', { name: 'User Templates (1)' }).click(); diff --git a/ketcher-autotests/tests/utils/canvas/helpers.ts b/ketcher-autotests/tests/utils/canvas/helpers.ts index a632292fb8..de28f924c2 100644 --- a/ketcher-autotests/tests/utils/canvas/helpers.ts +++ b/ketcher-autotests/tests/utils/canvas/helpers.ts @@ -518,3 +518,10 @@ export async function selectDearomatizeTool(page: Page) { async () => await selectTopPanelButton(TopPanelButton.Dearomatize, page), ); } + +export async function selectCleanTool(page: Page) { + await waitForSpinnerFinishedWork( + page, + async () => await selectTopPanelButton(TopPanelButton.Clean, page), + ); +}