Skip to content

Commit

Permalink
#4701 - Unify toolbars with small molecules mode
Browse files Browse the repository at this point in the history
  • Loading branch information
ilya-asiyuk-epam committed May 31, 2024
1 parent eb9de63 commit 2586f9a
Show file tree
Hide file tree
Showing 86 changed files with 829 additions and 318 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
openFileAndAddToCanvasMacro,
dragMouseTo,
waitForRender,
clickInTheMiddleOfTheScreen,
} from '@utils';

const fileName = 'KET/alanine-monomers-bonded.ket';
Expand Down Expand Up @@ -52,11 +53,13 @@ test.describe('addFragment', () => {
async () => await addFragment(page, fileContents),
);
const numberOfPressZoomOut = 6;
await page.getByTestId('zoom-selector').click();
for (let i = 0; i < numberOfPressZoomOut; i++) {
await waitForRender(page, async () => {
await page.getByTestId('zoom-out-button').click();
});
}
await clickInTheMiddleOfTheScreen(page);
});

test('ket with two monomers bonded', async ({ page }) => {
Expand All @@ -66,10 +69,12 @@ test.describe('addFragment', () => {
async () => await addFragment(page, fileContents),
);
const numberOfPressZoomOut = 6;
await page.getByTestId('zoom-selector').click();
for (let i = 0; i < numberOfPressZoomOut; i++) {
await waitForRender(page, async () => {
await page.getByTestId('zoom-out-button').click();
});
}
await clickInTheMiddleOfTheScreen(page);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
selectSnakeLayoutModeTool,
takeEditorScreenshot,
setZoom,
moveMouseAway,
} from '@utils';

test.describe('setMode', () => {
Expand All @@ -32,6 +33,7 @@ test.describe('setMode', () => {
await selectSnakeLayoutModeTool(page);
await takeEditorScreenshot(page);
await setMode(page, 'flex');
await moveMouseAway(page);
await takeEditorScreenshot(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.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
takeEditorScreenshot,
waitForSpinnerFinishedWork,
waitForRender,
clickInTheMiddleOfTheScreen,
} from '@utils';

test.describe('setMolecule', () => {
Expand All @@ -24,11 +25,13 @@ test.describe('setMolecule', () => {
async () => await setMolecule(page, fileContents),
);
const numberOfPressZoomOut = 6;
await page.getByTestId('zoom-selector').click();
for (let i = 0; i < numberOfPressZoomOut; i++) {
await waitForRender(page, async () => {
await page.getByTestId('zoom-out-button').click();
});
}
await clickInTheMiddleOfTheScreen(page);
await takeEditorScreenshot(page);
});

Expand All @@ -41,11 +44,13 @@ test.describe('setMolecule', () => {
async () => await setMolecule(page, fileContents),
);
const numberOfPressZoomOut = 6;
await page.getByTestId('zoom-selector').click();
for (let i = 0; i < numberOfPressZoomOut; i++) {
await waitForRender(page, async () => {
await page.getByTestId('zoom-out-button').click();
});
}
await clickInTheMiddleOfTheScreen(page);
await takeEditorScreenshot(page);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
turnOnMacromoleculesEditor,
openFileAndAddToCanvasMacro,
setZoom,
clickInTheMiddleOfTheScreen,
} from '@utils';

test.describe('setZoom', () => {
Expand Down Expand Up @@ -36,9 +37,11 @@ test.describe('setZoom', () => {
await takeEditorScreenshot(page);

if (adjustZoom) {
await page.getByTestId('zoom-selector').click();
for (let i = 0; i < 3; i++) {
await page.getByTestId('zoom-in-button').click();
}
await clickInTheMiddleOfTheScreen(page);
await takeEditorScreenshot(page);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { test, expect } from '@playwright/test';
import { waitForPageInit } from '@utils/common';
import { takePageScreenshot } from '@utils';
import { takeMonomerLibraryScreenshot } from '@utils';
import { turnOnMacromoleculesEditor } from '@utils/macromolecules';

test.describe('Open Ketcher', () => {
Expand All @@ -24,6 +24,6 @@ test.describe('Open Ketcher', () => {
*/
await page.getByText('CHEM').click();
await expect(page.getByText('A6OH')).toBeVisible();
await takePageScreenshot(page);
await takeMonomerLibraryScreenshot(page);
});
});
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 @@ -14,6 +14,7 @@ import {
readFileContents,
startNewSequence,
selectSnakeLayoutModeTool,
waitForRender,
// waitForRender,
} from '@utils';
import {
Expand Down Expand Up @@ -307,8 +308,11 @@ test.describe('Sequence-edit mode', () => {
await clickOnSequenceSymbol(page, 'G');
await page.keyboard.press('ArrowLeft');
await page.keyboard.press('Control+v');
await takeEditorScreenshot(page);
await waitForRender(page, async () => {
await takeEditorScreenshot(page);
});
await selectSnakeLayoutModeTool(page);
await moveMouseAway(page);
await takeEditorScreenshot(page);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -320,18 +320,22 @@ test.describe('Erase Tool', () => {
page,
);
await selectEraseTool(page);
await page.getByTestId('zoom-selector').click();
for (let i = 0; i < 5; i++) {
await waitForRender(page, async () => {
await page.getByTestId('zoom-in-button').click();
});
}
await clickInTheMiddleOfTheScreen(page);
await page.getByText('Bal').locator('..').first().click();
await takeEditorScreenshot(page);
await page.getByTestId('zoom-selector').click();
for (let i = 0; i < 8; i++) {
await waitForRender(page, async () => {
await page.getByTestId('zoom-out-button').click();
});
}
await clickInTheMiddleOfTheScreen(page);
await page.getByText('D-2Nal').locator('..').first().click();
await takeEditorScreenshot(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.
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ test.describe('Import-Saving .fasta Files', () => {
}) => {
await openFileAndAddToCanvasMacro('FASTA/fasta-snake-mode-rna.fasta', page);
await selectSnakeLayoutModeTool(page);
await moveMouseAway(page);
await takeEditorScreenshot(page);
});

Expand Down Expand Up @@ -294,6 +295,7 @@ test.describe('Import-Saving .fasta Files', () => {
// await pressButton(page, 'Add to Canvas');
// await takeEditorScreenshot(page);
// await selectSequenceLayoutModeTool(page);
// await moveMouseAway(page);
// await takeEditorScreenshot(page);
// });

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,13 @@ test.describe('Import-Saving .ket Files', () => {
expect(ketFile).toEqual(ketFileExpected);

const numberOfPressZoomOut = 6;
await page.getByTestId('zoom-selector').click();
for (let i = 0; i < numberOfPressZoomOut; i++) {
await waitForRender(page, async () => {
await page.getByTestId('zoom-out-button').click();
});
}
await clickInTheMiddleOfTheScreen(page);
await takeEditorScreenshot(page);
});

Expand All @@ -87,11 +89,13 @@ test.describe('Import-Saving .ket Files', () => {
expect(ketFile).toEqual(ketFileExpected);

const numberOfPressZoomOut = 7;
await page.getByTestId('zoom-selector').click();
for (let i = 0; i < numberOfPressZoomOut; i++) {
await waitForRender(page, async () => {
await page.getByTestId('zoom-out-button').click();
});
}
await clickInTheMiddleOfTheScreen(page);
await takeEditorScreenshot(page);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ import {
receiveFileComparisonData,
waitForRender,
selectEraseTool,
selectOptionInDropdown,
pressButton,
// selectOptionInDropdown,
// pressButton,
selectSnakeLayoutModeTool,
turnOnMicromoleculesEditor,
selectClearCanvasTool,
Expand Down Expand Up @@ -222,11 +222,13 @@ test.describe('Import-Saving .mol Files', () => {
expect(molFile).toEqual(molFileExpected);

const numberOfPressZoomOut = 6;
await page.getByTestId('zoom-selector').click();
for (let i = 0; i < numberOfPressZoomOut; i++) {
await waitForRender(page, async () => {
await page.getByTestId('zoom-out-button').click();
});
}
await clickInTheMiddleOfTheScreen(page);
await takeEditorScreenshot(page);
});

Expand Down Expand Up @@ -321,28 +323,27 @@ test.describe('Import-Saving .mol Files', () => {
await turnOnMacromoleculesEditor(page);
});

test('Check that system does not let uploading corrupted .mol file', async () => {
/*
Test case: Import/Saving files
Description: System does not let uploading corrupted .mol file
*/
// Fail while performance issue on Indigo side
test.fail();
await selectTopPanelButton(TopPanelButton.Open, page);

const filename = 'Molfiles-V3000/corrupted-file.mol';
await openFile(filename, page);
await selectOptionInDropdown(filename, page);
await pressButton(page, 'Add to Canvas');
await takeEditorScreenshot(page);

// Closing page since test expects it to have closed at the end
const context = page.context();
await page.close();
page = await context.newPage();
await waitForPageInit(page);
await turnOnMacromoleculesEditor(page);
});
// Fail while performance issue on Indigo side
// test('Check that system does not let uploading corrupted .mol file', async () => {
// /*
// Test case: Import/Saving files
// Description: System does not let uploading corrupted .mol file
// */
// await selectTopPanelButton(TopPanelButton.Open, page);
//
// const filename = 'Molfiles-V3000/corrupted-file.mol';
// await openFile(filename, page);
// await selectOptionInDropdown(filename, page);
// await pressButton(page, 'Add to Canvas');
// await takeEditorScreenshot(page);
//
// // Closing page since test expects it to have closed at the end
// const context = page.context();
// await page.close();
// page = await context.newPage();
// await waitForPageInit(page);
// await turnOnMacromoleculesEditor(page);
// });

test('Validate correct displaying of snake viewed peptide chain loaded from .mol file format', async () => {
/*
Expand Down Expand Up @@ -491,11 +492,13 @@ test.describe('Import modified .mol files from external editor', () => {
test(`for ${fileName}`, async () => {
await openFileAndAddToCanvasMacro(`Molfiles-V3000/${fileName}`, page);
const numberOfPressZoomOut = 4;
await page.getByTestId('zoom-selector').click();
for (let i = 0; i < numberOfPressZoomOut; i++) {
await waitForRender(page, async () => {
await page.getByTestId('zoom-out-button').click();
});
}
await clickInTheMiddleOfTheScreen(page);
});
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ test.describe('Import-Saving .seq Files', () => {
page,
);
await selectSnakeLayoutModeTool(page);
await moveMouseAway(page);
await takeEditorScreenshot(page);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -286,21 +286,27 @@ test.describe('Macro-Micro-Switcher', () => {
);
await turnOnMicromoleculesEditor(page);
await turnOnMacromoleculesEditor(page);
await page.getByTestId('zoom-selector').click();
for (let i = 0; i < numberOfPressZoomIn; i++) {
await waitForRender(page, async () => {
await page.getByTestId('zoom-in-button').click();
});
}
await clickInTheMiddleOfTheScreen(page);

await takeEditorScreenshot(page);

await page.getByTestId('zoom-selector').click();
for (let i = 0; i < numberOfPressZoomOut; i++) {
await waitForRender(page, async () => {
await page.getByTestId('zoom-out-button').click();
});
}
await clickInTheMiddleOfTheScreen(page);
await takeEditorScreenshot(page);
await page.getByTestId('zoom-selector').click();
await page.getByTestId('reset-zoom-button').click();
await clickInTheMiddleOfTheScreen(page);
await takeEditorScreenshot(page);
});

Expand All @@ -325,7 +331,9 @@ test.describe('Macro-Micro-Switcher', () => {
await zoomWithMouseWheel(page, 250);

await takeEditorScreenshot(page);
await page.getByTestId('zoom-selector').click();
await page.getByTestId('reset-zoom-button').click();
await clickInTheMiddleOfTheScreen(page);
await takeEditorScreenshot(page);
});

Expand All @@ -341,11 +349,13 @@ test.describe('Macro-Micro-Switcher', () => {
'KET/three-monomers-connected-with-bonds.ket',
page,
);
await page.getByTestId('zoom-selector').click();
for (let i = 0; i < numberOfPressZoomIn; i++) {
await waitForRender(page, async () => {
await page.getByTestId('zoom-in-button').click();
});
}
await clickInTheMiddleOfTheScreen(page);
await turnOnMicromoleculesEditor(page);
await takeEditorScreenshot(page);

Expand Down Expand Up @@ -773,11 +783,13 @@ test.describe('Macro-Micro-Switcher', () => {
*/
await openFileAndAddToCanvas('KET/all-type-of-atoms-and-bonds.ket', page);
await turnOnMacromoleculesEditor(page);
await page.getByTestId('zoom-selector').click();
for (let i = 0; i < 3; i++) {
await waitForRender(page, async () => {
await page.getByTestId('zoom-out-button').click();
});
}
await clickInTheMiddleOfTheScreen(page);
await takeEditorScreenshot(page);
});

Expand Down Expand Up @@ -808,11 +820,13 @@ test.describe('Macro-Micro-Switcher', () => {
await setAtomAndBondSettings(page);
await takeEditorScreenshot(page);
await turnOnMacromoleculesEditor(page);
await page.getByTestId('zoom-selector').click();
for (let i = 0; i < 3; i++) {
await waitForRender(page, async () => {
await page.getByTestId('zoom-out-button').click();
});
}
await clickInTheMiddleOfTheScreen(page);
await takeEditorScreenshot(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

0 comments on commit 2586f9a

Please sign in to comment.