Skip to content

Commit

Permalink
Autotests: #4386 - Sequence representation (#4390)
Browse files Browse the repository at this point in the history
* - added tests to 'sequence-mode';
- added 1 test file;
- added expected screenshots

* - added tests to 'sequence-mode';
- added expected snapshots

* - added tests to 'sequence-mode';
- added 8 test files;
- added expected snapshots

* - added tests to 'sequence-mode';
- added 1 test file;
- added function 'enterSequence';
- added expected snapshots

* - added no magic number for 'helpers.ts'

* - added tests to 'sequence-mode-edit';
- added 2 test files;
- added expected snapshots

* - added tests;
- added 2 test files;
- added expected snapshots

* - changed description

* - updated 3 snapshots for 'sequence-mode'

* - added tests to 'sequence-mode';
- added 1 helper method;
- added 1 test file;
- added expected snapshots

* - added tests;
- added expected snapshots

* - updated snapshots

* - added tests to 'sequence-mode-copy-paste';
- added 1 test file;
- added expected snapshots

* - deleted unused imports

* - added tests ;
- added 1 test file;
- added expected snapshots

* - added tests to 'sequence-mode-edit-in-rna-builder';
- added 2 test files;
- added expected snapshots

* - added tests;
- added 2 test files;
- added expected snapshots

* - added tests;
- added 6 test files;
- added expected snapshots
  • Loading branch information
Zhirnoff authored May 7, 2024
1 parent 1ae7c45 commit 76fe0bc
Show file tree
Hide file tree
Showing 132 changed files with 52,087 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable no-magic-numbers */
import { test } from '@playwright/test';
import {
takeEditorScreenshot,
Expand All @@ -11,8 +12,14 @@ import {
clickUndo,
openPasteFromClipboard,
readFileContents,
startNewSequence,
selectSnakeLayoutModeTool,
waitForRender,
} from '@utils';
import { turnOnMacromoleculesEditor } from '@utils/macromolecules';
import {
enterSequence,
turnOnMacromoleculesEditor,
} from '@utils/macromolecules';
import {
clickOnSequenceSymbol,
getSequenceSymbolLocator,
Expand Down Expand Up @@ -58,6 +65,21 @@ test.describe('Sequence mode copy&paste for view mode', () => {
await clickUndo(page);
await takeEditorScreenshot(page);
});

test('Verify that when there is at least one sequence on canvas, pasting is performed in next row, and canvas is moved to make newly added sequence visible', async ({
page,
}) => {
await page.keyboard.down('Control');
await getSequenceSymbolLocator(page, 'G').click();
await page.keyboard.up('Control');
await page.keyboard.press('Control+c');

for (let i = 0; i < 10; i++) {
await page.keyboard.press('Control+v');
}

await takeEditorScreenshot(page);
});
});

test.describe('Sequence mode copy&paste for edit mode', () => {
Expand Down Expand Up @@ -147,3 +169,142 @@ test.describe('Sequence mode copy&paste for edit mode', () => {
await takeEditorScreenshot(page);
});
});

test.describe('Sequence-edit mode', () => {
test.beforeEach(async ({ page }) => {
await waitForPageInit(page);
await turnOnMacromoleculesEditor(page);
await selectSequenceLayoutModeTool(page);
});

test('Check If cursor is located in the first cell of empty row of a grid, then pasted fragment is considered as new chain', async ({
page,
}) => {
/*
Test case: #3894
Description: Pasted fragment is considered as new chain.
*/
await startNewSequence(page);
await enterSequence(page, 'tcgtuctucc');
await page.keyboard.press('Escape');
await page.keyboard.down('Control');
await clickOnSequenceSymbol(page, 'G');
await page.keyboard.up('Control');
await page.keyboard.press('Control+c');
await page.keyboard.press('Enter');
await page.keyboard.press('Control+v');
await takeEditorScreenshot(page);
await selectSnakeLayoutModeTool(page);
await takeEditorScreenshot(page);
});

test('Verify that if an unsupported symbol is entered during paste from clipboard, system displays an error message', async ({
page,
}) => {
/*
Test case: #3894
Description: Pasted fragment is considered as new chain.
*/
await openPasteFromClipboard(page, '>');
await page.keyboard.press('Control+a');
await page.keyboard.press('Control+c');
await page.getByTitle('Close window').click();
await startNewSequence(page);
await page.keyboard.press('Control+v');
await takeEditorScreenshot(page);
});

test('Pasting a large sequence from clipboard in sequence edit mode (500 symbols)', async ({
page,
}) => {
/*
Test case: #3894
Description: Sequence pasted on canvas.
*/
const fileContent = await readFileContents(
'tests/test-data/Sequence/sequence-500-symbols.seq',
);
await openPasteFromClipboard(page, fileContent);
await page.keyboard.press('Control+a');
await page.keyboard.press('Control+c');
await page.getByTitle('Close window').click();
await startNewSequence(page);
await waitForRender(page, async () => {
await page.keyboard.press('Control+v');
});
await waitForRender(page, async () => {
await takeEditorScreenshot(page);
});
});

test('Verify that when multiple unconnected fragments are selected, they are pasted as separate chains in view mode', async ({
page,
}) => {
/*
Test case: #3916
Description: Multiple unconnected fragments are pasted as separate chains in view mode.
*/
await startNewSequence(page);
await enterSequence(page, 'aaaaaaagaaaaaataaaaaauaaaaaacaaaaa');
await page.keyboard.press('Escape');
await page.keyboard.down('Shift');
await clickOnSequenceSymbol(page, 'G');
await clickOnSequenceSymbol(page, 'T');
await clickOnSequenceSymbol(page, 'U');
await clickOnSequenceSymbol(page, 'C');
await page.keyboard.up('Shift');
await page.keyboard.press('Control+c');
await page.keyboard.press('Control+v');
await takeEditorScreenshot(page);
await selectSnakeLayoutModeTool(page);
await takeEditorScreenshot(page);
});

test('Pasting several separate monomers are prohibited in text-editing mode', async ({
page,
}) => {
/*
Test case: #3916
Description: Pasting several separate monomers are prohibited in text-editing mode.
*/
await startNewSequence(page);
await enterSequence(page, 'aaaaaaagaaaaaataaaaaauaaaaaacaaaaa');
await page.keyboard.press('Escape');
await page.keyboard.down('Shift');
await clickOnSequenceSymbol(page, 'G');
await clickOnSequenceSymbol(page, 'T');
await clickOnSequenceSymbol(page, 'U');
await clickOnSequenceSymbol(page, 'C');
await page.keyboard.up('Shift');
await page.keyboard.press('Control+c');
await getSequenceSymbolLocator(page, 'G').click({ button: 'right' });
await page.getByTestId('edit_sequence').click();
await page.keyboard.press('ArrowLeft');
await page.keyboard.press('Control+v');
await takeEditorScreenshot(page);
});

test('After pasting between two nucleotides in text-editing mode,bond R2-R1 between them is broken,and pasted fragment is merged with existing chain', async ({
page,
}) => {
/*
Test case: #3916
Description: Bond R2-R1 between them is broken,and pasted fragment is merged with existing chain.
*/
await startNewSequence(page);
await enterSequence(page, 'aaagtgtuaaaaaauaaaaaacaaaaa');
await page.keyboard.down('Shift');
await clickOnSequenceSymbol(page, 'G');
for (let i = 0; i < 4; i++) {
await page.keyboard.press('ArrowRight');
}
await page.keyboard.up('Shift');
await page.keyboard.press('Control+c');
await clickOnSequenceSymbol(page, 'G');
await page.keyboard.press('ArrowLeft');
await page.keyboard.press('Control+v');
await takeEditorScreenshot(page);
await selectSnakeLayoutModeTool(page);
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.
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

0 comments on commit 76fe0bc

Please sign in to comment.