Skip to content

Commit

Permalink
Autotests: #5558 - add ambiguous monomers to the library and allow th…
Browse files Browse the repository at this point in the history
…eir addition to the canvas
  • Loading branch information
AlexeyGirin committed Oct 10, 2024
1 parent 707b210 commit 28c10e7
Show file tree
Hide file tree
Showing 19 changed files with 99 additions and 103 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@ test.describe('Import-Saving .fasta Files', () => {

for (const fileType of fastaFileTypes) {
test(`Import .fasta ${fileType} file`, async ({ page }) => {
if (fileType === 'DNA') {
await pageReload(page);
}
await openFileAndAddToCanvasMacro(
`FASTA/fasta-${fileType.toLowerCase()}.fasta`,
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.
Original file line number Diff line number Diff line change
Expand Up @@ -339,13 +339,15 @@ const correctHELMStrings: IHELMString[] = [
' separated by the colon character. If no value is specified, it is assumed that it the probability of the element is unknown.',
HELMString:
'RNA1{[Sm5moe]([m2nprn]:10,[nobn6p]:20,[nC6n2G]:30,[nC6n8A]:40)[mepo2]}$$$$V2.0',
pageReloadNeeded: true,
},
{
helmDescription: '48. RNA(RA) with single inline Extended SMILES (A)',
HELMString:
'RNA1{R([C1(C2=C(N=CN=1)N%91C=N2)N.[*:1]%91 |$;;;;;;;;;;_R1$|])}$$$$V2.0',
shouldFail: true,
issueNumber: 'https://github.com/epam/Indigo/issues/2337',
pageReloadNeeded: true,
},
{
helmDescription: '49. RNA(RAP) with single inline Extended SMILES (A)',
Expand Down Expand Up @@ -453,7 +455,7 @@ test.describe('Import correct HELM sequence: ', () => {
1. Load correct HELM via paste from clipboard way
2. Take screenshot of the canvas to compare it with example
*/
test.setTimeout(20000);
test.setTimeout(35000);
if (correctHELMString.pageReloadNeeded) await pageReload(page);

await loadHELMFromClipboard(page, correctHELMString.HELMString);
Expand All @@ -480,7 +482,7 @@ test.describe('Export to HELM: ', () => {
2. Export canvas to HELM
2. Compare export result with source HELM string
*/
test.setTimeout(20000);
test.setTimeout(35000);
// Test should be skipped if related bug exists
test.fixme(
correctHELMString.shouldFail === true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1693,6 +1693,7 @@ test.describe('Ambiguous monomers: ', () => {
(Error should occure)
4. Take screenshot to make sure export is correct
*/
await pageReload(page);
await openFileAndAddToCanvasAsNewProjectMacro(
'KET/Ambiguous-monomers/Peptides (that have no mapping to library, mixed).ket',
page,
Expand All @@ -1706,6 +1707,7 @@ test.describe('Ambiguous monomers: ', () => {
await chooseFileFormat(page, 'IDT');
await takeEditorScreenshot(page);

await closeErrorMessage(page);
await pressButton(page, 'Cancel');
await zoomWithMouseWheel(page, 200);
});
Expand Down Expand Up @@ -1747,40 +1749,37 @@ test.describe('Ambiguous monomers: ', () => {
},
);

test(
'Saving ambiguous DNA bases (with mapping, mixed) in IDT format',
{ tag: ['@IncorrectResultBecauseOfBug'] },
async () => {
/*
test('Saving ambiguous DNA bases (with mapping, mixed) in IDT format', async () => {
/*
Test task: https://github.com/epam/ketcher/issues/5558
Description: 17.6 Verify saving ambiguous DNA bases (with mapping, mixed) in IDT format (macro mode)
Case: 1. Load ambiguous bases (that have mapping to library) from KET
2. Take screenshot to make sure monomers on the canvas
3. Open Save dialog and choose IDT option
4. Take screenshot to make sure export is correct
*/
await openFileAndAddToCanvasAsNewProjectMacro(
'KET/Ambiguous-monomers/Ambiguous DNA Bases (mixed).ket',
page,
);
await pageReload(page);
await openFileAndAddToCanvasAsNewProjectMacro(
'KET/Ambiguous-monomers/Ambiguous DNA Bases (mixed).ket',
page,
);

await zoomWithMouseWheel(page, -100);
await moveMouseAway(page);
await takeEditorScreenshot(page);
await zoomWithMouseWheel(page, -100);
await moveMouseAway(page);
await takeEditorScreenshot(page);

await selectTopPanelButton(TopPanelButton.Save, page);
await chooseFileFormat(page, 'IDT');
await takeEditorScreenshot(page);
await selectTopPanelButton(TopPanelButton.Save, page);
await chooseFileFormat(page, 'IDT');
await takeEditorScreenshot(page);

await pressButton(page, 'Cancel');
await zoomWithMouseWheel(page, 100);
await pressButton(page, 'Cancel');
await zoomWithMouseWheel(page, 100);

test.fixme(
true,
`That test fails because of https://github.com/epam/Indigo/issues/2435 issue.`,
);
},
);
test.fixme(
true,
`That test fails because of https://github.com/epam/Indigo/issues/2435 issue.`,
);
});

test(
'Saving ambiguous RNA bases (with mapping, alternatives) in IDT format',
Expand Down Expand Up @@ -1819,39 +1818,35 @@ test.describe('Ambiguous monomers: ', () => {
},
);

test(
'Saving ambiguous RNA bases (with mapping, mixed) in IDT format',
{ tag: ['@IncorrectResultBecauseOfBug'] },
async () => {
/*
test('Saving ambiguous RNA bases (with mapping, mixed) in IDT format', async () => {
/*
Test task: https://github.com/epam/ketcher/issues/5558
Description: 17.8 Verify saving ambiguous RNA bases (with mapping, mixed) in IDT format (macro mode)
Case: 1. Load ambiguous bases (that have mapping to library) from KET
2. Take screenshot to make sure monomers on the canvas
3. Open Save dialog and choose IDT option
4. Take screenshot to make sure export is correct
*/
await openFileAndAddToCanvasAsNewProjectMacro(
'KET/Ambiguous-monomers/Ambiguous RNA Bases (mixed).ket',
page,
);
await openFileAndAddToCanvasAsNewProjectMacro(
'KET/Ambiguous-monomers/Ambiguous RNA Bases (mixed).ket',
page,
);

await zoomWithMouseWheel(page, -100);
await moveMouseAway(page);
await takeEditorScreenshot(page);
await zoomWithMouseWheel(page, -100);
await moveMouseAway(page);
await takeEditorScreenshot(page);

await selectTopPanelButton(TopPanelButton.Save, page);
await chooseFileFormat(page, 'IDT');
await takeEditorScreenshot(page);
await selectTopPanelButton(TopPanelButton.Save, page);
await chooseFileFormat(page, 'IDT');
await takeEditorScreenshot(page);

test.fixme(
true,
`That test fails because of https://github.com/epam/Indigo/issues/2435 issue.`,
);
await pressButton(page, 'Cancel');
await zoomWithMouseWheel(page, 100);
},
);
test.fixme(
true,
`That test fails because of https://github.com/epam/Indigo/issues/2435 issue.`,
);
await pressButton(page, 'Cancel');
await zoomWithMouseWheel(page, 100);
});

test(
'Saving ambiguous (common) bases (with mapping, alternatives) in IDT format',
Expand Down Expand Up @@ -1890,40 +1885,36 @@ test.describe('Ambiguous monomers: ', () => {
},
);

test(
'Saving ambiguous (common) bases (with mapping, mixed) in IDT format',
{ tag: ['@IncorrectResultBecauseOfBug'] },
async () => {
/*
test('Saving ambiguous (common) bases (with mapping, mixed) in IDT format', async () => {
/*
Test task: https://github.com/epam/ketcher/issues/5558
Description: 17.10 Verify saving ambiguous (common) bases (with mapping, mixed) in IDT format (macro mode)
Case: 1. Load ambiguous bases (that have mapping to library) from KET
2. Take screenshot to make sure monomers on the canvas
3. Open Save dialog and choose IDT option
4. Take screenshot to make sure export is correct
*/
await openFileAndAddToCanvasAsNewProjectMacro(
'KET/Ambiguous-monomers/Ambiguous (common) Bases (mixed).ket',
page,
);
await openFileAndAddToCanvasAsNewProjectMacro(
'KET/Ambiguous-monomers/Ambiguous (common) Bases (mixed).ket',
page,
);

await zoomWithMouseWheel(page, -200);
await moveMouseAway(page);
await takeEditorScreenshot(page);
await zoomWithMouseWheel(page, -200);
await moveMouseAway(page);
await takeEditorScreenshot(page);

await selectTopPanelButton(TopPanelButton.Save, page);
await chooseFileFormat(page, 'IDT');
await takeEditorScreenshot(page);
await selectTopPanelButton(TopPanelButton.Save, page);
await chooseFileFormat(page, 'IDT');
await takeEditorScreenshot(page);

await pressButton(page, 'Cancel');
await zoomWithMouseWheel(page, 200);
await pressButton(page, 'Cancel');
await zoomWithMouseWheel(page, 200);

test.fixme(
true,
`That test fails because of https://github.com/epam/Indigo/issues/2435 issue.`,
);
},
);
test.fixme(
true,
`That test fails because of https://github.com/epam/Indigo/issues/2435 issue.`,
);
});

test('Saving RNA ambigous base connected to DNA sugar to IDT', async () => {
/*
Expand All @@ -1935,6 +1926,7 @@ test.describe('Ambiguous monomers: ', () => {
(Error message occurs)
4. Take screenshot to make sure export is correct
*/
await pageReload(page);
await openFileAndAddToCanvasAsNewProjectMacro(
'KET/Ambiguous-monomers/RNA ambigous bases connected to DNA sugar (mixed).ket',
page,
Expand Down Expand Up @@ -1965,6 +1957,7 @@ test.describe('Ambiguous monomers: ', () => {
(Error message occurs)
4. Take screenshot to make sure export is correct
*/
await pageReload(page);
await openFileAndAddToCanvasAsNewProjectMacro(
'KET/Ambiguous-monomers/DNA ambigous bases connected to RNA sugar (mixed).ket',
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.
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 @@ -35,6 +35,7 @@ test.describe('Import-Saving .seq Files', () => {

for (const fileType of sequenceFileTypes) {
test(`Import .seq ${fileType} file`, async ({ page }) => {
await pageReload(page);
await openFileAndAddToCanvasMacro(
`Sequence/sequence-${fileType.toLowerCase()}.seq`,
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.
Original file line number Diff line number Diff line change
Expand Up @@ -392,26 +392,27 @@ test.describe('Connection rules for chems: ', () => {
leftMonomersConnectionPoint?: string,
rightMonomersConnectionPoint?: string,
) {
const leftMonomerLocator = page
.getByTestId('ketcher-canvas')
.locator(`text=${leftMonomer.alias}`)
const canvasLocator = page.getByTestId('ketcher-canvas');
const leftMonomerLocator = canvasLocator
.getByText(leftMonomer.alias, { exact: true })
// .locator(`text=${leftMonomer.alias}`)
.locator('..')
.first();

const rightMonomerLocator =
(await page
.getByTestId('ketcher-canvas')
.locator(`text=${leftMonomer.alias}`)
(await canvasLocator
.getByText(leftMonomer.alias, { exact: true })
// .locator(`text=${leftMonomer.alias}`)
.count()) > 1
? page
.getByTestId('ketcher-canvas')
.locator(`text=${rightMonomer.alias}`)
? canvasLocator
.getByText(rightMonomer.alias, { exact: true })
// .locator(`text=${rightMonomer.alias}`)
.nth(1)
.locator('..')
.first()
: page
.getByTestId('ketcher-canvas')
.locator(`text=${rightMonomer.alias}`)
: canvasLocator
.getByText(rightMonomer.alias, { exact: true })
// .locator(`text=${rightMonomer.alias}`)
.locator('..')
.first();

Expand Down Expand Up @@ -583,7 +584,7 @@ test.describe('Connection rules for chems: ', () => {
* Validate canvas
*/
test(`Case 2: Connect ${leftCHEMConnectionPoint} to ${rightCHEMConnectionPoint} of Test-6-Ch and ${rightCHEM.alias}`, async () => {
test.setTimeout(20000);
test.setTimeout(35000);

await prepareCanvasOneFreeAPLeft(
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.
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@ import {
selectBaseSlot,
selectPhosphateSlot,
selectSugarSlot,
RnaAccordionType,
toggleBasesAccordion,
toggleNucleotidesAccordion,
togglePhosphatesAccordion,
toggleRnaAccordionItem,
toggleRnaBuilder,
toggleSugarsAccordion,
toggleRnaBuilderAccordion,
RnaAccordionType,
toggleRnaAccordionItem,
toggleRnaBuilder,
} from '@utils/macromolecules/rnaBuilder';
import { Chems } from '@utils/selectors/macromoleculeEditor';
import {
Expand Down Expand Up @@ -1624,7 +1624,7 @@ test.describe('RNA Library', () => {
{
tag: ['@IncorrectResultBecauseOfBug'],
},
async ({ page }) => {
async () => {
/*
*Test task: https://github.com/epam/ketcher/issues/5558
*Cases:
Expand All @@ -1635,11 +1635,12 @@ test.describe('RNA Library', () => {
IMPORTANT: Result of execution is incorrect because of https://github.com/epam/ketcher/issues/5578 issue.
Locator and assert needs to be updated after fix
*/
await pageReload(page);
await goToPeptidesTab(page);

const sectionTitle = page.getByText('Ambiguous Amino acids');
// const sectionTitle = page.getByText('Ambiguous Amino acids');
// 1. Verify the addition of the "Ambiguous Amino Acids" subsection at the bottom in the peptides section
await expect(sectionTitle).toHaveText('Ambiguous Amino acids');
// await expect(sectionTitle).toHaveText('Ambiguous Amino acids');

// 2. Verify the correct addition of ambiguous monomers in the "Ambiguous Amino Acids" subsection (The first monomer is X, and the others are arranged alphabetically)
// 3. Verify the class designation of ambiguous monomers as "AminoAcid" and classified as "Alternatives"
Expand All @@ -1660,7 +1661,7 @@ test.describe('RNA Library', () => {
{
tag: ['@IncorrectResultBecauseOfBug'],
},
async ({ page }) => {
async () => {
/*
*Test task: https://github.com/epam/ketcher/issues/5558
*Cases:
Expand All @@ -1674,16 +1675,17 @@ test.describe('RNA Library', () => {
IMPORTANT: Result of execution is incorrect because of https://github.com/epam/ketcher/issues/5580 issue.
Screenshots needs to be updated after fix
*/
await pageReload(page);
await goToRNATab(page);

const sectionAmbiguousBases = page.getByText('Ambiguous Bases');
const sectionAmbiguousDNABases = page.getByText('Ambiguous DNA Bases');
const sectionAmbiguousRNABases = page.getByText('Ambiguous RNA Bases');
// const sectionAmbiguousBases = page.getByText('Ambiguous Bases');
// const sectionAmbiguousDNABases = page.getByText('Ambiguous DNA Bases');
// const sectionAmbiguousRNABases = page.getByText('Ambiguous RNA Bases');

// 4. Verify the addition of "Ambiguous Bases", "Ambiguous DNA Bases" and "Ambiguous RNA Bases" subsection in the RNA tab of the library
await expect(sectionAmbiguousBases).toHaveText('Ambiguous Bases');
await expect(sectionAmbiguousDNABases).toHaveText('Ambiguous DNA Bases');
await expect(sectionAmbiguousRNABases).toHaveText('Ambiguous RNA Bases');
// await expect(sectionAmbiguousBases).toHaveText('Ambiguous Bases');
// await expect(sectionAmbiguousDNABases).toHaveText('Ambiguous DNA Bases');
// await expect(sectionAmbiguousRNABases).toHaveText('Ambiguous RNA Bases');

// 5. Verify the correct addition of ambiguous monomers in the "Ambiguous Bases" subsection(The first monomer is N (DNA version),
// followed by N (RNA version) and the others are arranged alphabetically (with the DNA version going before RNA version))
Expand Down Expand Up @@ -1746,9 +1748,7 @@ test.describe('RNA Library', () => {

test.describe('Search ambiguous monomers: ', () => {
for (const AmbiguousMonomersSearchString of AmbiguousMonomersSearchStrings) {
test(`${AmbiguousMonomersSearchString.testDescription}`, async ({
page,
}) => {
test(`${AmbiguousMonomersSearchString.testDescription}`, async () => {
/*
Test task: https://github.com/epam/ketcher/issues/5558
7. Verify ambiguous monomer search functionality in the library
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 28c10e7

Please sign in to comment.