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

Autotests: #4592 - Center to center connections for CHEM-CHEM, CHEM-Peptide, RNA-… #4599

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,49 @@ test.describe('Connection rules for Base monomers: ', () => {
rightMonomersConnectionPoint,
);
}

async function bondTwoMonomersByCenterToCenter(
page: Page,
leftMonomer: IMonomer,
rightMonomer: IMonomer,
) {
const leftMonomerLocator = page
.getByText(leftMonomer.alias)
.locator('..')
.first();

const rightMonomerLocator =
(await page.getByText(leftMonomer.alias).count()) > 1
? page.getByText(rightMonomer.alias).nth(1).locator('..').first()
: page.getByText(rightMonomer.alias).locator('..').first();

await bondTwoMonomersPointToPoint(
page,
leftMonomerLocator,
rightMonomerLocator,
);

if (await page.getByRole('dialog').isVisible()) {
const firstConnectionPointKeyForLeftMonomer = Object.keys(
leftMonomer.connectionPoints,
)[0];
const leftMonomerConnectionPoint =
leftMonomer.connectionPoints[firstConnectionPointKeyForLeftMonomer];
await page.getByTitle(leftMonomerConnectionPoint).first().click();

const firstConnectionPointKeyForRightMonomer = Object.keys(
rightMonomer.connectionPoints,
)[0];
const rightMonomerConnectionPoint =
rightMonomer.connectionPoints[firstConnectionPointKeyForRightMonomer];
(await page.getByTitle(rightMonomerConnectionPoint).count()) > 1
? await page.getByTitle(rightMonomerConnectionPoint).nth(1).click()
: await page.getByTitle(rightMonomerConnectionPoint).first().click();

await page.getByTitle('Connect').first().click();
}
}

/*
test(`temporary test for debug purposes1`, async () => {
await bondTwoMonomersByPointToPoint(
Expand Down Expand Up @@ -613,4 +656,60 @@ test.describe('Connection rules for Base monomers: ', () => {
);
});
});

Object.values(baseMonomers).forEach((leftBase) => {
Object.values(peptideMonomers).forEach((rightPeptide) => {
/*
* Test case: https://github.com/epam/ketcher/issues/4592 - Case 4 (Base - Peptide)
* Description: User can connect any Phosphate to any Peptide using center-to-center way.
* For each %baseType% from the library (baseMonomers)
* For each %peptideType% from the library (peptideMonomers)
* 1. Clear canvas
* 2. Load %baseType% and %peptideType% and put them on the canvas
* 3. Establish connection between %baseType%(center) and %peptideType%(center)
* 4. Validate canvas (connection should appear)
*/
test(`Case5: Cnnct Center to Center of Base(${leftBase.alias}) and Peptide(${rightPeptide.alias})`, async () => {
test.setTimeout(15000);

await loadTwoMonomers(page, leftBase, rightPeptide);

await bondTwoMonomersByCenterToCenter(page, leftBase, rightPeptide);

await zoomWithMouseWheel(page, -600);
const bondLine = page.locator('g[pointer-events="stroke"]').first();
await bondLine.hover();

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

Object.values(baseMonomers).forEach((leftBase) => {
Object.values(chemMonomers).forEach((rightCHEM) => {
/*
* Test case: https://github.com/epam/ketcher/issues/4592 - Case 7 (Base - CHEM)
* Description: User can connect any Phosphate to any CHEM using center-to-center way.
* For each %baseType% from the library (baseMonomers)
* For each %CHEMType% from the library (chemMonomers)
* 1. Clear canvas
* 2. Load %baseType% and %CHEMType% and put them on the canvas
* 3. Establish connection between %baseType%(center) and %CHEMType%(center)
* 4. Validate canvas (connection should appear)
*/
test(`Case6: Cnnct Center to Center of Base(${leftBase.alias}) and CHEM(${rightCHEM.alias})`, async () => {
test.setTimeout(15000);

await loadTwoMonomers(page, leftBase, rightCHEM);

await bondTwoMonomersByCenterToCenter(page, leftBase, rightCHEM);

await zoomWithMouseWheel(page, -600);
const bondLine = page.locator('g[pointer-events="stroke"]').first();
await bondLine.hover();

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
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 @@ -418,6 +418,57 @@ test.describe('Connection rules for chems: ', () => {
);
}

async function bondTwoMonomersByCenterToCenter(
page: Page,
leftMonomer: IMonomer,
rightMonomer: IMonomer,
) {
const leftMonomerLocator = await page
.getByText(leftMonomer.alias, { exact: true })
.locator('..')
.first();

const rightMonomerLocator =
(await page.getByText(rightMonomer.alias, { exact: true }).count()) > 1
? page
.getByText(rightMonomer.alias, { exact: true })
.nth(1)
.locator('..')
.first()
: page
.getByText(rightMonomer.alias, { exact: true })
.locator('..')
.first();

await bondTwoMonomersPointToPoint(
page,
leftMonomerLocator,
rightMonomerLocator,
undefined,
undefined,
);

if (await page.getByRole('dialog').isVisible()) {
const firstConnectionPointKeyForLeftMonomer = Object.keys(
leftMonomer.connectionPoints,
)[0];
const leftMonomerConnectionPoint =
leftMonomer.connectionPoints[firstConnectionPointKeyForLeftMonomer];
await page.getByTitle(leftMonomerConnectionPoint).first().click();

const firstConnectionPointKeyForRightMonomer = Object.keys(
rightMonomer.connectionPoints,
)[0];
const rightMonomerConnectionPoint =
rightMonomer.connectionPoints[firstConnectionPointKeyForRightMonomer];
(await page.getByTitle(rightMonomerConnectionPoint).count()) > 1
? await page.getByTitle(rightMonomerConnectionPoint).nth(1).click()
: await page.getByTitle(rightMonomerConnectionPoint).first().click();

await page.getByTitle('Connect').first().click();
}
}

// test(`temporary test for debug purposes`, async () => {
// await prepareCanvasOneFreeAPLeft(
// page,
Expand Down Expand Up @@ -831,4 +882,52 @@ test.describe('Connection rules for chems: ', () => {
);
});
});

Object.values(chemMonomers).forEach((leftCHEM) => {
Object.values(chemMonomers).forEach((rightCHEM) => {
/*
* Test case: https://github.com/epam/ketcher/issues/4592 - Case 1
* Description: User can connect any CHEM to any CHEM using center-to-center way.
* Select Connection Points dialog opened.
*/
test(`Case 7: Connect Center to Center of CHEM(${leftCHEM.alias}) and CHEM(${rightCHEM.alias})`, async () => {
test.setTimeout(15000);

await loadTwoMonomers(page, leftCHEM, rightCHEM);

await bondTwoMonomersByCenterToCenter(page, leftCHEM, rightCHEM);

await zoomWithMouseWheel(page, -600);

const bondLine = page.locator('g[pointer-events="stroke"]').first();
await bondLine.hover();

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

Object.values(chemMonomers).forEach((leftCHEM) => {
Object.values(peptideMonomers).forEach((rightPeptide) => {
/*
* Test case: https://github.com/epam/ketcher/issues/4592 - Case 2
* Description: User can connect any CHEM to any Peptide using center-to-center way.
* Select Connection Points dialog opened.
*/
test(`Case 8: Connect Center to Center of CHEM(${leftCHEM.alias}) and Peptide(${rightPeptide.alias})`, async () => {
test.setTimeout(15000);

await loadTwoMonomers(page, leftCHEM, rightPeptide);

await bondTwoMonomersByCenterToCenter(page, leftCHEM, rightPeptide);

await zoomWithMouseWheel(page, -600);

const bondLine = page.locator('g[pointer-events="stroke"]').first();
await bondLine.hover();

// await takeEditorScreenshot(page);
});
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -732,4 +732,64 @@ test.describe('Connection rules for Phosphate monomers: ', () => {
);
});
});

Object.values(phosphateMonomers).forEach((leftPhosphate) => {
Object.values(peptideMonomers).forEach((rightPeptide) => {
/*
* Test case: https://github.com/epam/ketcher/issues/4592 - Case 3 (Phosphate - Peptide)
* Description: User can connect any Phosphate to any Peptide using center-to-center way.
* For each %phosphateType% from the library (phosphateMonomers)
* For each %peptideType% from the library (peptideMonomers)
* 1. Clear canvas
* 2. Load %phosphateType% and %peptideType% and put them on the canvas
* 3. Establish connection between %sphosphateType%(center) and %peptideType%(center)
* 4. Validate canvas (connection should appear)
*/
test(`Case5: Cnnct Center to Center of Ph(${leftPhosphate.alias}) and Peptide(${rightPeptide.alias})`, async () => {
test.setTimeout(15000);

await loadTwoMonomers(page, leftPhosphate, rightPeptide);

await bondTwoMonomersByCenterToCenter(
page,
leftPhosphate,
rightPeptide,
);

await zoomWithMouseWheel(page, -600);
const bondLine = page.locator('g[pointer-events="stroke"]').first();
await bondLine.hover();

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

Object.values(phosphateMonomers).forEach((leftPhosphate) => {
Object.values(chemMonomers).forEach((rightCHEM) => {
/*
* Test case: https://github.com/epam/ketcher/issues/4592 - Case 3 (Phosphate - CHEM)
* Description: User can connect any Phosphate to any CHEM using center-to-center way.
* For each %phosphateType% from the library (phosphateMonomers)
* For each %CHEMType% from the library (CHEMMonomers)
* 1. Clear canvas
* 2. Load %phosphateType% and %CHEMType% and put them on the canvas
* 3. Establish connection between %sphosphateType%(center) and %CHEMType%(center)
* 4. Validate canvas (connection should appear)
*/
test(`Case6: Cnnct Center to Center of Ph(${leftPhosphate.alias}) and CHEM(${rightCHEM.alias})`, async () => {
test.setTimeout(15000);

await loadTwoMonomers(page, leftPhosphate, rightCHEM);

await bondTwoMonomersByCenterToCenter(page, leftPhosphate, rightCHEM);

await zoomWithMouseWheel(page, -600);
const bondLine = page.locator('g[pointer-events="stroke"]').first();
await bondLine.hover();

await takeEditorScreenshot(page);
});
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,48 @@ test.describe('Connection rules for sugars: ', () => {
);
}

async function bondTwoMonomersByCenterToCenter(
page: Page,
leftMonomer: IMonomer,
rightMonomer: IMonomer,
) {
const leftMonomerLocator = page
.getByText(leftMonomer.alias)
.locator('..')
.first();

const rightMonomerLocator =
(await page.getByText(leftMonomer.alias).count()) > 1
? page.getByText(rightMonomer.alias).nth(1).locator('..').first()
: page.getByText(rightMonomer.alias).locator('..').first();

await bondTwoMonomersPointToPoint(
page,
leftMonomerLocator,
rightMonomerLocator,
);

if (await page.getByRole('dialog').isVisible()) {
const firstConnectionPointKeyForLeftMonomer = Object.keys(
leftMonomer.connectionPoints,
)[0];
const leftMonomerConnectionPoint =
leftMonomer.connectionPoints[firstConnectionPointKeyForLeftMonomer];
await page.getByTitle(leftMonomerConnectionPoint).first().click();

const firstConnectionPointKeyForRightMonomer = Object.keys(
rightMonomer.connectionPoints,
)[0];
const rightMonomerConnectionPoint =
rightMonomer.connectionPoints[firstConnectionPointKeyForRightMonomer];
(await page.getByTitle(rightMonomerConnectionPoint).count()) > 1
? await page.getByTitle(rightMonomerConnectionPoint).nth(1).click()
: await page.getByTitle(rightMonomerConnectionPoint).first().click();

await page.getByTitle('Connect').first().click();
}
}

// test(`temporary test for debug purposes`, async () => {
// await prepareCanvasOneFreeAPLeft(
// page,
Expand Down Expand Up @@ -661,4 +703,60 @@ test.describe('Connection rules for sugars: ', () => {
);
});
});

Object.values(sugarMonomers).forEach((leftSugar) => {
Object.values(peptideMonomers).forEach((rightPeptide) => {
/*
* Test case: https://github.com/epam/ketcher/issues/4592 - Case 5 (Sugar - Peptide)
* Description: User can connect any Sugar to any Peptide using center-to-center way.
* For each %baseType% from the library (sugarMonomers)
* For each %peptideType% from the library (peptideMonomers)
* 1. Clear canvas
* 2. Load %baseType% and %peptideType% and put them on the canvas
* 3. Establish connection between %sugarType%(center) and %peptideType%(center)
* 4. Validate canvas (connection should appear)
*/
test(`Case8: Cnnct Center to Center of Base(${leftSugar.alias}) and Peptide(${rightPeptide.alias})`, async () => {
test.setTimeout(15000);

await loadTwoMonomers(page, leftSugar, rightPeptide);

await bondTwoMonomersByCenterToCenter(page, leftSugar, rightPeptide);

await zoomWithMouseWheel(page, -600);
const bondLine = page.locator('g[pointer-events="stroke"]').first();
await bondLine.hover();

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

Object.values(sugarMonomers).forEach((leftSugar) => {
Object.values(chemMonomers).forEach((rightCHEM) => {
/*
* Test case: https://github.com/epam/ketcher/issues/4592 - Case 8 (Sugar - CHEM)
* Description: User can connect any Sugar to any CHEM using center-to-center way.
* For each %baseType% from the library (sugarMonomers)
* For each %CHEMType% from the library (chemMonomers)
* 1. Clear canvas
* 2. Load %baseType% and %CHEMType% and put them on the canvas
* 3. Establish connection between %sugarType%(center) and %CHEMType%(center)
* 4. Validate canvas (connection should appear)
*/
test(`Case9: Cnnct Center to Center of Base(${leftSugar.alias}) and CHEM(${rightCHEM.alias})`, async () => {
test.setTimeout(15000);

await loadTwoMonomers(page, leftSugar, rightCHEM);

await bondTwoMonomersByCenterToCenter(page, leftSugar, rightCHEM);

await zoomWithMouseWheel(page, -600);
const bondLine = page.locator('g[pointer-events="stroke"]').first();
await bondLine.hover();

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