Skip to content

Commit

Permalink
Autotests: #6143 - tests for add copy to clipboard to the export wind…
Browse files Browse the repository at this point in the history
…ow (#6151)

* - add tests;
- add expected snapshots;
- add function 'copyToClipboardByIcon'

* - update snapshot
  • Loading branch information
Zhirnoff authored Dec 20, 2024
1 parent aa7b97e commit ca780ce
Show file tree
Hide file tree
Showing 9 changed files with 83 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Tests below moved here from macro-micro-switcher since they are designed to be e
and can't be executed in "clear canvas way"
*/
import {
chooseFileFormat,
turnOnMacromoleculesEditor,
turnOnMicromoleculesEditor,
} from '@utils/macromolecules';
Expand All @@ -29,9 +30,19 @@ import {
Bases,
selectMacroBond,
moveMouseAway,
selectRingButton,
RingButton,
selectSaveFileFormat,
FileFormatOption,
moveMouseToTheMiddleOfTheScreen,
selectSaveTool,
clickOnCanvas,
pasteFromClipboardByKeyboard,
copyToClipboardByIcon,
} from '@utils';
import { Peptides } from '@utils/selectors/macromoleculeEditor';
import { MacroBondTool } from '@utils/canvas/tools/selectNestedTool/types';
import { closeErrorAndInfoModals } from '@utils/common/helpers';

async function addToFavoritesMonomers(page: Page) {
await page.getByTestId(Peptides.BetaAlanine).getByText('★').click();
Expand Down Expand Up @@ -344,4 +355,72 @@ test.describe('Macro-Micro-Switcher2', () => {
await turnOnMicromoleculesEditor(page);
await takeEditorScreenshot(page);
});

test('Verify that the "Copy to Clipboard" icon appears in the export window in molecules mode', async ({
page,
}) => {
/*
Test case: https://github.com/epam/ketcher/issues/5854
Description: The "Copy to Clipboard" icon appears in the export window in molecules mode
*/
await selectRingButton(RingButton.Benzene, page);
await clickInTheMiddleOfTheScreen(page);
await selectSaveFileFormat(page, FileFormatOption.KET);
await moveMouseToTheMiddleOfTheScreen(page);
await takeEditorScreenshot(page);
});

test('Verify that the "Copy to Clipboard" icon appears in the export window in macromolecules mode', async ({
page,
}) => {
/*
Test case: https://github.com/epam/ketcher/issues/5854
Description: The "Copy to Clipboard" icon appears in the export window in macromolecules mode
*/
await selectRingButton(RingButton.Benzene, page);
await clickInTheMiddleOfTheScreen(page);
await turnOnMacromoleculesEditor(page);
await selectSaveTool(page);
await chooseFileFormat(page, 'Ket');
await moveMouseToTheMiddleOfTheScreen(page);
await takeEditorScreenshot(page);
});

test('Verify that the "Copy to Clipboard" icon disappears after clicking on the preview section and appears when hovering again', async ({
page,
}) => {
/*
Test case: https://github.com/epam/ketcher/issues/5854
Description: The "Copy to Clipboard" icon disappears after clicking on the preview section and appears when hovering again
*/
await selectRingButton(RingButton.Benzene, page);
await clickInTheMiddleOfTheScreen(page);
await selectSaveFileFormat(page, FileFormatOption.KET);
await moveMouseToTheMiddleOfTheScreen(page);
await takeEditorScreenshot(page);
await clickInTheMiddleOfTheScreen(page);
await takeEditorScreenshot(page);
await clickOnCanvas(page, 100, 100);
await moveMouseToTheMiddleOfTheScreen(page);
await takeEditorScreenshot(page);
});

test('Verify that clicking on the "Copy to Clipboard" icon copies all exportable information to the clipboard', async ({
page,
}) => {
/*
Test case: https://github.com/epam/ketcher/issues/5854
Description: Clicking on the "Copy to Clipboard" icon copies all exportable information to the clipboard
*/
await selectRingButton(RingButton.Benzene, page);
await clickInTheMiddleOfTheScreen(page);
await selectSaveFileFormat(page, FileFormatOption.KET);
await moveMouseToTheMiddleOfTheScreen(page);
await copyToClipboardByIcon(page);
await closeErrorAndInfoModals(page);
await pasteFromClipboardByKeyboard(page);
await moveMouseAway(page);
await clickOnCanvas(page, 300, 300);
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
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.
4 changes: 4 additions & 0 deletions ketcher-autotests/tests/utils/canvas/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -498,3 +498,7 @@ export async function selectRedoByKeyboard(
await page.keyboard.press(`${modifier}+Shift+KeyZ`, options);
});
}

export async function copyToClipboardByIcon(page: Page) {
await page.getByTestId('copy-to-clipboard').click();
}

0 comments on commit ca780ce

Please sign in to comment.