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 - Cases 1-6
  • Loading branch information
AlexeyGirin committed Sep 25, 2024
1 parent 972c840 commit dac9c35
Show file tree
Hide file tree
Showing 6 changed files with 113 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import {
selectSequenceLayoutModeTool,
selectTopPanelButton,
TopPanelButton,
Peptides,
} from '@utils';
import { getKet } from '@utils/formats';
import {
Expand All @@ -45,7 +46,12 @@ import {
toggleSugarsAccordion,
} from '@utils/macromolecules/rnaBuilder';
import { Chems } from '@utils/selectors/macromoleculeEditor';
import { goToCHEMTab } from '@utils/macromolecules/library';
import {
goToCHEMTab,
goToPeptidesTab,
goToRNATab,
} from '@utils/macromolecules/library';
import { Peptide } from 'ketcher-core';

async function drawThreeMonomers(page: Page) {
const x1 = 301;
Expand Down Expand Up @@ -1378,4 +1384,96 @@ test.describe('RNA Library', () => {

await page.getByTestId('cancel-btn').click();
});

test(
'Ambiguous Amino Acids section checks',
{
tag: ['@IncorrectResultBecauseOfBug'],
},
async ({ page }) => {
/*
*Test task: https://github.com/epam/ketcher/issues/5558
*Cases:
* 1. Verify the addition of the "Ambiguous Amino Acids" subsection at the bottom in the peptides section
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"
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 goToPeptidesTab(page);

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');

// 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"
await selectMonomer(page, Peptides.X);
await delay(1);
await takeMonomerLibraryScreenshot(page);

// Test should be skipped if related bug exists
test.fixme(
true,
`That test fails because of https://github.com/epam/ketcher/issues/5578 issue.`,
);
},
);

test(
'Ambiguous Bases section checks',
{
tag: ['@IncorrectResultBecauseOfBug'],
},
async ({ page }) => {
/*
*Test task: https://github.com/epam/ketcher/issues/5558
*Cases:
* 4. Verify the addition of "Ambiguous Bases", "Ambiguous DNA Bases" and
"Ambiguous RNA Bases" subsection in the RNA tab of the library
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))
6. Verify the class designation of ambiguous monomers as "Base" and ambiguous monomers in the "Ambiguous Bases", "Ambiguous DNA Bases" and
"Ambiguous RNA Bases" subsection are classified as "Alternatives"
IMPORTANT: Result of execution is incorrect because of https://github.com/epam/ketcher/issues/5580 issue.
Screenshots needs to be updated after fix
*/
await goToRNATab(page);

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');

// 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))
// 6. Verify the class designation of ambiguous monomers as "Base" and ambiguous monomers in the "Ambiguous Bases", "Ambiguous DNA Bases" and
// "Ambiguous RNA Bases" subsection are classified as "Alternatives"
await selectMonomer(page, Bases.DNA_N);
await delay(1);
await takeMonomerLibraryScreenshot(page);
await toggleBasesAccordion(page);

await selectMonomer(page, Bases.RNA_N);
await delay(1);
await takeMonomerLibraryScreenshot(page);
await toggleBasesAccordion(page);

await selectMonomer(page, Bases.M);
await delay(1);
await takeMonomerLibraryScreenshot(page);

// Test should be skipped if related bug exists
test.fixme(
true,
`That test fails because of https://github.com/epam/ketcher/issues/5580 issue.`,
);
},
);
});
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.
15 changes: 14 additions & 1 deletion ketcher-autotests/tests/utils/selectors/templateModal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,12 @@ export enum TemplateLibrary {
Arabinofuranose = 'Arabinofuranose',
}

export enum Peptides {
X = '_A___Alanine_C___Cysteine_D___Aspartic acid_E___Glutamic acid_F___Phenylalanine_G___Glycine_H___' +
'Histidine_I___Isoleucine_K___Lysine_L___Leucine_M___Methionine_N___Asparagine_O___Pyrrolysine_P__' +
'_Proline_Q___Glutamine_R___Arginine_S___Serine_T___Threonine_U___Selenocysteine_V___Valine_W___Tryptophan_Y___Tyrosine',
}

export enum Sugars {
TwelveddR = "12ddR___1',2'-Di-Deoxy-Ribose",
TwentyFiveR = '25R___2,5-Ribose',
Expand All @@ -112,6 +118,9 @@ export enum Bases {
Adenine = 'A___Adenine',
NBebnzylAdenine = 'baA___N-benzyl-adenine',
TClampOMe = 'clA___T-clamp OMe',
DNA_N = '_A___Adenine_C___Cytosine_G___Guanine_T___Thymine',
RNA_N = '_A___Adenine_C___Cytosine_G___Guanine_U___Uracil',
M = '_A___Adenine_C___Cytosine',
}

export async function selectBase(baseName: Bases, page: Page) {
Expand Down Expand Up @@ -140,13 +149,14 @@ export enum RnaPartDropDown {

export async function selectMonomer(
page: Page,
monomerType: Sugars | Bases | Phosphates,
monomerType: Sugars | Bases | Phosphates | Peptides,
) {
const isSugar = Object.values(Sugars).includes(monomerType as Sugars);
const isBase = Object.values(Bases).includes(monomerType as Bases);
const isPhosphate = Object.values(Phosphates).includes(
monomerType as Phosphates,
);
const isPeptide = Object.values(Peptides).includes(monomerType as Peptides);

if (isSugar) {
await page.getByTestId(RnaPartDropDown.Sugars).click();
Expand All @@ -157,6 +167,9 @@ export async function selectMonomer(
if (isPhosphate) {
await page.getByTestId(RnaPartDropDown.Phosphates).click();
}
if (isPeptide) {
await page.getByTestId('PEPTIDES-TAB').click();
}
await page.getByTestId(monomerType).click();
}

Expand Down

0 comments on commit dac9c35

Please sign in to comment.