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

Autotests: #6143 - tests for add copy to clipboard to the export window #6151

Merged
Show file tree
Hide file tree
Changes from all 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,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();
}
Loading