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

#5325 - Change natural analogue of monomers #5619

Merged
merged 12 commits into from
Oct 3, 2024
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 @@ -20,6 +20,7 @@ import {
selectClearCanvasTool,
clickUndo,
dragMouseTo,
Sugars,
} from '@utils';
import { pageReload } from '@utils/common/helpers';
import { turnOnMacromoleculesEditor } from '@utils/macromolecules';
Expand Down Expand Up @@ -196,7 +197,7 @@ test.describe('Import-Saving .ket Files', () => {
test.slow();
await page.getByTestId('RNA-TAB').click();
await page.getByTestId('summary-Sugars').click();
await page.getByTestId('25R___2,5-Ribose').click();
await page.getByTestId(Sugars.TwentyFiveR).click();
await clickInTheMiddleOfTheScreen(page);
const expectedFile = await getKet(page);
await saveToFile('KET/25R-expected.ket', expectedFile);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ import {
selectClearCanvasTool,
waitForIndigoToLoad,
waitForKetcherInit,
Sugars,
Bases,
Phosphates,
} from '@utils';
import {
addSuperatomAttachmentPoint,
Expand Down Expand Up @@ -113,9 +116,9 @@ async function addToFavoritesMonomers(page: Page) {
await page.getByTestId('meM___N-Methyl-Methionine').getByText('★').click();
await page.getByTestId('RNA-TAB').click();
await page.getByTestId('summary-Sugars').click();
await page.getByTestId('25R___2,5-Ribose').getByText('★').click();
await page.getByTestId(Sugars.TwentyFiveR).getByText('★').click();
await page.getByTestId('summary-Bases').click();
await page.getByTestId('baA___N-benzyl-adenine').getByText('★').click();
await page.getByTestId(Bases.baA).getByText('★').click();
await page.getByTestId('summary-Phosphates').click();
await page.getByTestId('bP___Boranophosphate').getByText('★').click();
await page.getByTestId('CHEM-TAB').click();
Expand Down Expand Up @@ -1099,21 +1102,21 @@ test.describe('Macro-Micro-Switcher', () => {
{
description: 'Sugar',
monomer: '25R',
monomerTestId: '25R___2,5-Ribose',
monomerTestId: Sugars.TwentyFiveR,
summaryTestId: 'summary-Sugars',
bondEndpoints: { first: 'R1', second: 'R2' },
},
{
description: 'Base',
monomer: 'meA',
monomerTestId: 'meA___N-Methyl-Adenine',
monomerTestId: Bases.meA,
summaryTestId: 'summary-Bases',
bondEndpoints: { first: 'R1', second: 'R1' },
},
{
description: 'Phosphate',
monomer: 'nasP',
monomerTestId: 'nasP___Sodium Phosporothioate',
monomerTestId: Phosphates.nasP,
summaryTestId: 'summary-Phosphates',
bondEndpoints: { first: 'R1', second: 'R2' },
},
Expand Down Expand Up @@ -1190,14 +1193,14 @@ test.describe('Macro-Micro-Switcher', () => {
{
description: 'Sugar',
monomer: '25R',
monomerTestId: '25R___2,5-Ribose',
monomerTestId: Sugars.TwentyFiveR,
summaryTestId: 'summary-Sugars',
bondEndpoints: { first: 'R1', second: 'R2' },
},
{
description: 'Base',
monomer: 'meA',
monomerTestId: 'meA___N-Methyl-Adenine',
monomerTestId: Bases.meA,
summaryTestId: 'summary-Bases',
bondEndpoints: { first: 'R1', second: 'R1' },
},
Expand Down Expand Up @@ -1283,21 +1286,21 @@ test.describe('Macro-Micro-Switcher', () => {
{
description: 'Sugar',
monomer: '25R',
monomerTestId: '25R___2,5-Ribose',
monomerTestId: Sugars.TwentyFiveR,
summaryTestId: 'summary-Sugars',
bondEndpoints: { first: 'R1', second: 'R2' },
},
{
description: 'Base',
monomer: 'meA',
monomerTestId: 'meA___N-Methyl-Adenine',
monomerTestId: Bases.meA,
summaryTestId: 'summary-Bases',
bondEndpoints: { first: 'R1', second: 'R1' },
},
{
description: 'Phosphate',
monomer: 'nasP',
monomerTestId: 'nasP___Sodium Phosporothioate',
monomerTestId: Phosphates.nasP,
summaryTestId: 'summary-Phosphates',
bondEndpoints: { first: 'R1', second: 'R2' },
},
Expand Down Expand Up @@ -1380,21 +1383,21 @@ test.describe('Macro-Micro-Switcher', () => {
{
description: 'Sugar',
monomer: '25R',
monomerTestId: '25R___2,5-Ribose',
monomerTestId: Sugars.TwentyFiveR,
summaryTestId: 'summary-Sugars',
bondEndpoints: { first: 'R1', second: 'R2' },
},
{
description: 'Base',
monomer: 'meA',
monomerTestId: 'meA___N-Methyl-Adenine',
monomerTestId: Bases.meA,
summaryTestId: 'summary-Bases',
bondEndpoints: { first: 'R1', second: 'R1' },
},
{
description: 'Phosphate',
monomer: 'nasP',
monomerTestId: 'nasP___Sodium Phosporothioate',
monomerTestId: Phosphates.nasP,
summaryTestId: 'summary-Phosphates',
bondEndpoints: { first: 'R1', second: 'R2' },
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ import {
selectDropdownTool,
clickInTheMiddleOfTheScreen,
selectClearCanvasTool,
Sugars,
Bases,
} from '@utils';
import { Peptides } from '@utils/selectors/macromoleculeEditor';

Expand All @@ -38,9 +40,9 @@ async function addToFavoritesMonomers(page: Page) {
await page.getByTestId('meM___N-Methyl-Methionine').getByText('★').click();
await page.getByTestId('RNA-TAB').click();
await page.getByTestId('summary-Sugars').click();
await page.getByTestId('25R___2,5-Ribose').getByText('★').click();
await page.getByTestId(Sugars.TwentyFiveR).getByText('★').click();
await page.getByTestId('summary-Bases').click();
await page.getByTestId('baA___N-benzyl-adenine').getByText('★').click();
await page.getByTestId(Bases.baA).getByText('★').click();
await page.getByTestId('summary-Phosphates').click();
await page.getByTestId('bP___Boranophosphate').getByText('★').click();
await page.getByTestId('CHEM-TAB').click();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ import {
} from '@constants/testIdConstants';
import { waitForPageInit } from '@utils/common';
import {
Bases,
moveMouseToTheMiddleOfTheScreen,
Sugars,
takeEditorScreenshot,
takeMonomerLibraryScreenshot,
} from '@utils';
Expand Down Expand Up @@ -63,8 +65,8 @@ test.describe('Macromolecules custom presets', () => {

test('Add new preset and duplicate it', async ({ page }) => {
await selectRNAComponents(page, {
sugar: '25R___2,5-Ribose',
base: 'baA___N-benzyl-adenine',
sugar: Sugars.TwentyFiveR,
base: Bases.baA,
phosphate: 'bP___Boranophosphate',
});
await moveMouseToTheMiddleOfTheScreen(page);
Expand All @@ -75,7 +77,7 @@ test.describe('Macromolecules custom presets', () => {
await page.getByTestId('duplicate-btn').click();

await selectRNAComponents(page, {
sugar: "12ddR___1',2'-Di-Deoxy-Ribose",
sugar: "12ddR___1',2'-dideoxyribose",
base: 'A___Adenine',
phosphate: 'P___Phosphate',
});
Expand Down Expand Up @@ -111,13 +113,13 @@ test.describe('Macromolecules custom presets', () => {
await page.getByTestId(SUGAR).click();

// Click on <div> "25R ★"
await page.click('[data-testid="25R___2,5-Ribose"]');
await page.click(`[data-testid="${Sugars.TwentyFiveR}"]`);

// Click on <div> "Base Not selected"
await page.getByTestId(BASE).click();

// Click on <div> "baA ★"
await page.click('[data-testid="baA___N-benzyl-adenine"]');
await page.click(`[data-testid="${Bases.baA}"]`);

// Click on <button> "Add to Presets"
await page.getByTestId(BUTTON__ADD_TO_PRESETS).click();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ async function drawThreeMonomers(page: Page) {
const y3 = 106;
await selectMonomer(page, Sugars.ThreeA6);
await page.mouse.click(x1, y1);
await selectMonomer(page, Bases.NBebnzylAdenine);
await selectMonomer(page, Bases.baA);
await page.mouse.click(x2, y2);
await selectMonomer(page, Phosphates.Phosphate);
await page.mouse.click(x3, y3);
Expand Down Expand Up @@ -93,7 +93,7 @@ async function drawBasePhosphate(page: Page) {
const base1 = bases.nth(0);
const phosphates = await page.getByText('P').locator('..');
const phosphate1 = phosphates.nth(0);
await selectMonomer(page, Bases.NBebnzylAdenine);
await selectMonomer(page, Bases.baA);
await clickInTheMiddleOfTheScreen(page);
await selectMonomer(page, Phosphates.Phosphate);
await page.mouse.click(x, y);
Expand Down Expand Up @@ -133,7 +133,7 @@ async function drawSugarBase(page: Page) {
const base1 = bases.nth(0);
await selectMonomer(page, Sugars.ThreeA6);
await clickInTheMiddleOfTheScreen(page);
await selectMonomer(page, Bases.NBebnzylAdenine);
await selectMonomer(page, Bases.baA);
await page.mouse.click(x, y);
await selectSingleBondTool(page);
await sugar1.hover();
Expand Down Expand Up @@ -370,7 +370,7 @@ test.describe('RNA Library', () => {
*/
await expandCollapseRnaBuilder(page);
await selectMonomer(page, Sugars.ThreeA6);
await selectMonomer(page, Bases.NBebnzylAdenine);
await selectMonomer(page, Bases.baA);
await selectMonomer(page, Phosphates.Boranophosphate);
await pressAddToPresetsButton(page);
await page.getByTestId('3A6(baA)bP_baA_3A6_bP').click();
Expand All @@ -388,12 +388,10 @@ test.describe('RNA Library', () => {
Test was updated since logic for RNA Builder was changed in a scope of https://github.com/epam/ketcher/issues/3816
*/
await expandCollapseRnaBuilder(page);
await selectMonomer(page, Bases.NBebnzylAdenine);
await selectMonomer(page, Bases.baA);
await selectMonomer(page, Phosphates.Boranophosphate);
await page.getByTestId('rna-builder-slot--sugar').click();
await page
.getByTestId("3SS6___3'-Thiol-Modifier 6 S-S from Glen Research")
.click();
await page.getByTestId(Sugars.ThreeSS6).click();
await page.getByTestId('rna-builder-slot--sugar').click();
await takeRNABuilderScreenshot(page);
});
Expand Down Expand Up @@ -459,7 +457,7 @@ test.describe('RNA Library', () => {
});
await page.getByTestId('edit').locator('div').click();
await page.getByTestId('rna-builder-slot--base').click();
await page.getByTestId('baA___N-benzyl-adenine').click();
await page.getByTestId(Bases.baA).click();
await page.getByTestId('save-btn').click();
await page.getByTestId('25R(baA)Test-6-Ph_baA_25R_Test-6-Ph').click();
// To avoid unstable test execution
Expand Down Expand Up @@ -548,7 +546,7 @@ test.describe('RNA Library', () => {
*/
await expandCollapseRnaBuilder(page);
await selectMonomer(page, Sugars.TwentyFiveR);
await selectMonomer(page, Bases.NBebnzylAdenine);
await selectMonomer(page, Bases.baA);
await selectMonomer(page, Phosphates.Boranophosphate);
await pressAddToPresetsButton(page);
await page.getByTestId('25R(baA)bP_baA_25R_bP').click({
Expand All @@ -571,7 +569,7 @@ test.describe('RNA Library', () => {
await page.getByTestId("3A6___6-amino-hexanol (3' end)").click();
await moveMouseAway(page);
await page.getByTestId('rna-builder-slot--base').click();
await page.getByTestId('baA___N-benzyl-adenine').click();
await page.getByTestId(Bases.baA).click();
await moveMouseAway(page);
await page.getByTestId('rna-builder-slot--phosphate').click();
await page.getByTestId('bP___Boranophosphate').click();
Expand All @@ -586,7 +584,7 @@ test.describe('RNA Library', () => {
*/
await expandCollapseRnaBuilder(page);
await page.getByTestId('rna-builder-slot--sugar').click();
await page.getByTestId('25R___2,5-Ribose').click();
await page.getByTestId(Sugars.TwentyFiveR).click();
// To avoid unstable test execution
// Hide tooltip which overlays 'rna-builder-slot--base' element
await moveMouseAway(page);
Expand Down Expand Up @@ -614,7 +612,7 @@ test.describe('RNA Library', () => {
groupName: 'Sugars',
name: "3A6___6-amino-hexanol (3' end)",
},
{ type: 'base', groupName: 'Bases', name: 'baA___N-benzyl-adenine' },
{ type: 'base', groupName: 'Bases', name: Bases.baA },
{
type: 'phosphate',
groupName: 'Phosphates',
Expand Down Expand Up @@ -642,7 +640,7 @@ test.describe('RNA Library', () => {
*/
await expandCollapseRnaBuilder(page);
await selectMonomer(page, Sugars.ThreeA6);
await selectMonomer(page, Bases.NBebnzylAdenine);
await selectMonomer(page, Bases.baA);
await pressAddToPresetsButton(page);
await page.getByTestId('3A6(baA)_baA_3A6_.').click();
await clickInTheMiddleOfTheScreen(page);
Expand Down Expand Up @@ -673,7 +671,7 @@ test.describe('RNA Library', () => {
Description: Base-Phosphate Combination not added to Presets.
*/
await expandCollapseRnaBuilder(page);
await selectMonomer(page, Bases.NBebnzylAdenine);
await selectMonomer(page, Bases.baA);
await selectMonomer(page, Phosphates.Boranophosphate);
await page.getByTestId('rna-builder-slot--base').click();
await takeRNABuilderScreenshot(page);
Expand Down Expand Up @@ -811,8 +809,8 @@ test.describe('RNA Library', () => {
});

const molecules = [
{ type: 'Sugars', description: '25R___2,5-Ribose' },
{ type: 'Bases', description: 'baA___N-benzyl-adenine' },
{ type: 'Sugars', description: Sugars.TwentyFiveR },
{ type: 'Bases', description: Bases.baA },
{ type: 'Phosphates', description: 'bP___Boranophosphate' },
];

Expand Down Expand Up @@ -959,7 +957,7 @@ test.describe('RNA Library', () => {
*/
await expandCollapseRnaBuilder(page);
await page.getByTestId('rna-builder-slot--sugar').click();
await page.getByTestId(`12ddR___1',2'-Di-Deoxy-Ribose`).click();
await page.getByTestId(Sugars.TwelveddR).click();
await page.getByTestId('rna-builder-slot--base').click();
await takePresetsScreenshot(page);
});
Expand Down Expand Up @@ -1140,7 +1138,7 @@ test.describe('RNA Library', () => {
*/
await expandCollapseRnaBuilder(page);
await page.getByTestId('rna-builder-slot--base').click();
await page.getByTestId(`baA___N-benzyl-adenine`).click();
await page.getByTestId(Bases.baA).click();
await page.getByTestId('rna-builder-slot--sugar').click();
await takePresetsScreenshot(page);
});
Expand Down
Loading
Loading