Skip to content

Commit

Permalink
Autotests: #5289 - Test cases for sequence representation (#5294)
Browse files Browse the repository at this point in the history
* - added tests;
- added test file;
- added expected snapshots

* - deleted delay

* - added tests;
- added helper method;
- added expected snapshots

* - update 1 snapshot

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

* - added tests;
- added function;
- added expected snapshots

* - added tests;
- added expected snapshots

* - updated snapshot

* - updated snapshots

* - updated snapshot

* - updated snapshot
  • Loading branch information
Zhirnoff authored and Guch1g0v committed Oct 17, 2024
1 parent 52066d1 commit f590fce
Show file tree
Hide file tree
Showing 104 changed files with 9,121 additions and 11 deletions.

Large diffs are not rendered by default.

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
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
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.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import {
} from '@utils';
import { getKet } from '@utils/formats';
import {
expandCollapseRnaBuilder,
goToCHEMTab,
gotoRNA,
pressNewPresetButton,
Expand All @@ -46,14 +47,6 @@ import {
} from '@utils/macromolecules/rnaBuilder';
import { Chems } from '@utils/selectors/macromoleculeEditor';

async function expandCollapseRnaBuilder(page: Page) {
await page
.locator('div')
.filter({ hasText: /^RNA Builder$/ })
.getByRole('button')
.click();
}

async function drawThreeMonomers(page: Page) {
const x1 = 301;
const y1 = 102;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@ import { test } from '@playwright/test';
import {
moveMouseAway,
openFileAndAddToCanvasMacro,
selectClearCanvasTool,
selectFlexLayoutModeTool,
selectSequenceLayoutModeTool,
selectSnakeLayoutModeTool,
SequenceType,
startNewSequence,
switchSequenceEnteringType,
takeEditorScreenshot,
takePageScreenshot,
typePeptideAlphabet,
typeRNADNAAlphabet,
waitForPageInit,
Expand All @@ -17,7 +20,18 @@ import {
enterSequence,
turnOnMacromoleculesEditor,
} from '@utils/macromolecules';
import { clickOnSequenceSymbol } from '@utils/macromolecules/sequence';
import {
expandCollapseRnaBuilder,
toggleBasesAccordion,
toggleNucleotidesAccordion,
togglePhosphatesAccordion,
toggleSugarsAccordion,
} from '@utils/macromolecules/rnaBuilder';
import {
clickOnSequenceSymbol,
doubleClickOnSequenceSymbol,
hoverOnSequenceSymbol,
} from '@utils/macromolecules/sequence';

test.describe('Sequence edit mode', () => {
test.beforeEach(async ({ page }) => {
Expand Down Expand Up @@ -262,4 +276,328 @@ test.describe('Sequence edit mode', () => {
await page.keyboard.press('Control+v');
await takeEditorScreenshot(page);
});

test('Validate that attachment point on preview tooltip marked gray if an attachment point participates in a bond', async ({
page,
}) => {
/*
Test case: #4880
Description: Attachment point on preview tooltip marked gray if an attachment point participates in a bond.
*/
await openFileAndAddToCanvasMacro('KET/sequence-with-monomers.ket', page);
await hoverOnSequenceSymbol(page, 'A');
await takeEditorScreenshot(page);
await hoverOnSequenceSymbol(page, 'K');
await takeEditorScreenshot(page);
});

test('Validate that preview tooltip for each type of monomer on the canvas (flex mode)', async ({
page,
}) => {
/*
Test case: #4880
Description: Attachment point on preview tooltip marked gray if an attachment point participates in a bond.
*/
await selectFlexLayoutModeTool(page);
await openFileAndAddToCanvasMacro('KET/sequence-with-monomers.ket', page);
await hoverOnSequenceSymbol(page, 'A');
await takeEditorScreenshot(page);
await hoverOnSequenceSymbol(page, 'Aad');
await takeEditorScreenshot(page);
});

test('Validate that preview tooltip for each type of monomer Sugar/Base/Phosphate/Nucleotide/CHEM (flex mode)', async ({
page,
}) => {
/*
Test case: #4880
Description: Attachment point on preview tooltip marked gray if an attachment point participates in a bond.
*/
await selectFlexLayoutModeTool(page);
await openFileAndAddToCanvasMacro('KET/rna-nucleotide-chem.ket', page);

const sequenceSymbols = ['25d3r', '4ime6A', 'bP', 'A6OH'];

for (const symbol of sequenceSymbols) {
await hoverOnSequenceSymbol(page, symbol);
await takeEditorScreenshot(page);
await moveMouseAway(page);
}
await page.getByText('5HydMe').locator('..').locator('..').first().click();
await takeEditorScreenshot(page);
});

test('Validate that preview tooltip for Peptide type of monomer in the library', async ({
page,
}) => {
/*
Test case: #4880
Description: Preview tooltip for Peptide type of monomer in the library appears.
*/
await page.getByTestId('A___Alanine').click();
await takePageScreenshot(page);
});

test('Validate that preview tooltip for Sugar type of monomer in the library', async ({
page,
}) => {
/*
Test case: #4880
Description: Preview tooltip for Sugar type of monomer in the library appears.
*/
await page.getByTestId('RNA-TAB').click();
await toggleSugarsAccordion(page);
await page.getByTestId('25d3r___3-Deoxyribose (2,5 connectivity)').click();
await takePageScreenshot(page);
});

test('Validate that preview tooltip for Base type of monomer in the library', async ({
page,
}) => {
/*
Test case: #4880
Description: Preview tooltip for Base type of monomer in the library appears.
*/
await page.getByTestId('RNA-TAB').click();
await toggleBasesAccordion(page);
await page.getByTestId('c7A___7-Deazaadenine').click();
await takePageScreenshot(page);
});

test('Validate that preview tooltip for Phosphate type of monomer in the library', async ({
page,
}) => {
/*
Test case: #4880
Description: Preview tooltip for Phosphate type of monomer in the library appears.
*/
await page.getByTestId('RNA-TAB').click();
await togglePhosphatesAccordion(page);
await page.getByTestId('ibun___Isobutylamino').click();
await takePageScreenshot(page);
});

test('Validate that preview tooltip for Nucleotide type of monomer in the library', async ({
page,
}) => {
/*
Test case: #4880
Description: Preview tooltip for Nucleotide type of monomer in the library appears.
*/
await page.getByTestId('RNA-TAB').click();
await toggleNucleotidesAccordion(page);
await page.getByTestId('Super T___5-hydroxybutynl-2’-deoxyuridine').click();
await takePageScreenshot(page);
});

test('Validate that preview tooltip for CHEM type of monomer in the library', async ({
page,
}) => {
/*
Test case: #4880
Description: Preview tooltip for CHEM type of monomer in the library appears.
*/
await page.getByTestId('CHEM-TAB').click();
await page.getByTestId('DOTA___Tetraxetan').click();
await takePageScreenshot(page);
});

test('Validate that preview tooltip for each type of monomer in sequence mode', async ({
page,
}) => {
/*
Test case: #4880
Description: Attachment point on preview tooltip marked gray if an attachment point participates in a bond.
*/
await selectSequenceLayoutModeTool(page);
await openFileAndAddToCanvasMacro('KET/rna-nucleotide-chem.ket', page);

const sequenceSymbols = ['A', 'C', '@'];

for (const symbol of sequenceSymbols) {
await hoverOnSequenceSymbol(page, symbol);
await takePageScreenshot(page);
await moveMouseAway(page);
}
});

test('Check that system show full set of IDT aliases at preview tooltip', async ({
page,
}) => {
/*
Test case: #4928
Description: System show full set of IDT aliases at preview tooltip.
*/
await page.getByTestId('RNA-TAB').click();
await expandCollapseRnaBuilder(page);
await page.getByTestId('dR(U)P_U_dR_P').hover();
await takePageScreenshot(page);
});

test('Validate that it is possible to start new sequence by using UI that appears if user hover mouse between squences', async ({
page,
}) => {
/*
Test case: #4887
Description: It is possible to start new sequence by using UI that appears if user hover mouse between squences or below bottom sequence or above the top sequence.
*/
await enterSequence(page, 'aaaaaaaaaa');
await page.getByTestId('ketcher-canvas').locator('div').click();
await takeEditorScreenshot(page);
});

test('Hover mouse over any letter in sequence, verify that the cursor should be displayed as a arrow', async ({
page,
}) => {
/*
Test case: #4888
Description: Hover mouse over any letter in sequence, cursor displayed as a arrow.
*/
await enterSequence(page, 'aaaaaaaaaa');
await hoverOnSequenceSymbol(page, 'A', 0);
await takePageScreenshot(page);
});

test('Hover mouse between two letters in sequence, verify that the cursor should be displayed as a caret', async ({
page,
}) => {
/*
Test case: #4888
Description: Hover mouse between two letters in sequence, cursor displayed as a caret.
*/
await enterSequence(page, 'aaaagaaaaaa');
await clickOnSequenceSymbol(page, 'G');
await takeEditorScreenshot(page);
});

test('Double-click on any symbol of sequence, verify that the edit mode turned on and the symbol highlighted', async ({
page,
}) => {
/*
Test case: #4888
Description: Double-click on any symbol of sequence, the edit mode turned on AND cursor (blinking line)
placed in corresponding cell of the grid before the symbol AND that symbol highlighted.
*/
await openFileAndAddToCanvasMacro('KET/sequence-with-monomers.ket', page);
await doubleClickOnSequenceSymbol(page, 'G');
await takeEditorScreenshot(page);
});

test('Switch to RNA mode and type any RNA symbol - A, C, G, U, T', async ({
page,
}) => {
/*
Test case: #5136
Description: Result in adding the monomer represented by that symbol as the first (and only) monomer in the sequence,
turning on "text edit" mode and placing of the caret after the first monomer.
*/
const sequenceSymbols = ['a', 'c', 'g', 'u', 't'];
for (const symbol of sequenceSymbols) {
await enterSequence(page, symbol);
await takeEditorScreenshot(page);
await selectClearCanvasTool(page);
}
});

test('Clear canvas, switch to RNA mode, type any non-RNA symbol (i.e. any but A, C, G, U, T) Verify that nothing happens', async ({
page,
}) => {
/*
Test case: #5136
Description: Nothing happens. Monomer not added to canvas.
*/
const sequenceSymbols = ['d', 'e', 'f'];
for (const symbol of sequenceSymbols) {
await enterSequence(page, symbol);
await takeEditorScreenshot(page);
await selectClearCanvasTool(page);
}
});

test('Switch to DNA mode and type any DNA symbol - A, C, G, U, T', async ({
page,
}) => {
/*
Test case: #5136
Description: Result in adding the monomer represented by that symbol as the first (and only) monomer in the sequence,
turning on "text edit" mode and placing of the caret after the first monomer.
*/
const sequenceSymbols = ['a', 'c', 'g', 'u', 't'];
await switchSequenceEnteringType(page, SequenceType.DNA);
for (const symbol of sequenceSymbols) {
await enterSequence(page, symbol);
await takeEditorScreenshot(page);
await selectClearCanvasTool(page);
}
});

test('Clear canvas, switch to DNA mode, type any non-DNA symbol (i.e. any but A, C, G, U, T) Verify that nothing happens', async ({
page,
}) => {
/*
Test case: #5136
Description: Nothing happens. Monomer not added to canvas.
*/
const sequenceSymbols = ['d', 'e', 'f'];
await switchSequenceEnteringType(page, SequenceType.DNA);
for (const symbol of sequenceSymbols) {
await enterSequence(page, symbol);
await takeEditorScreenshot(page);
await selectClearCanvasTool(page);
}
});

test('Switch to Peptide mode and type any Peptide symbol - A, C, D, E, F, G, H, I, K, L, M, N, P, Q, R, S, T, V, W, Y', async ({
page,
}) => {
/*
Test case: #5136
Description: Result in adding the monomer represented by that symbol as the first (and only) monomer in the sequence,
turning on "text edit" mode and placing of the caret after the first monomer.
*/
const sequenceSymbols = [
'a',
'c',
'd',
'e',
'f',
'g',
'h',
'i',
'k',
'l',
'm',
'n',
'p',
'q',
'r',
's',
't',
'v',
'w',
'y',
];
await switchSequenceEnteringType(page, SequenceType.PEPTIDE);
for (const symbol of sequenceSymbols) {
await enterSequence(page, symbol);
await takeEditorScreenshot(page);
await selectClearCanvasTool(page);
}
});

test('Switch to Peptide mode, type any non-Peptide symbol (i.e. any but A, C, D, E, F, G, H, I, K, L, M, N, P, Q, R, S, T, V, W, Y) Verify that nothing happens', async ({
page,
}) => {
/*
Test case: #5136
Description: Nothing happens. Monomer not added to canvas.
*/
const sequenceSymbols = ['b', 'j', 'u', 'z'];
await switchSequenceEnteringType(page, SequenceType.PEPTIDE);
for (const symbol of sequenceSymbols) {
await enterSequence(page, symbol);
await takeEditorScreenshot(page);
await selectClearCanvasTool(page);
}
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
>Sequence1
EF
1 change: 1 addition & 0 deletions ketcher-autotests/tests/test-data/IDT/moe-idt-expected.idt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/5Phos//32MOErA/
Loading

0 comments on commit f590fce

Please sign in to comment.