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: #4535 - Failed tests need to be fixed #4537

Merged
merged 20 commits into from
Apr 27, 2024
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,17 @@ test.afterEach(async () => {
});

test.afterAll(async ({ browser }) => {
await browser.close();
const cntxt = page.context();
await page.close();
await cntxt.close();
await browser.contexts().forEach((someContext) => {
someContext.close();
});
// await browser.close();
});

test.describe('1. User can expand hydrogens for ', () => {
/*
/*
Test case: https://github.com/epam/ketcher/issues/4258 - Case 1
Description: User can expand hydrogens for molecules connected by ordinary type of bonds
1. Clear canvas
Expand All @@ -48,7 +54,7 @@ test.describe('1. User can expand hydrogens for ', () => {
4. Validate canvas
5. Press Add/Remove explicit hydrogens button
6. Validate canvas

IMPORTANT: Test results are not correct because of https://github.com/epam/Indigo/issues/1818 issue.
IMPORTANT: Test results are not correct because of https://github.com/epam/Indigo/issues/1819 issue.
IMPORTANT: Test results are not correct because of https://github.com/epam/Indigo/issues/1611 issue.
Expand Down Expand Up @@ -364,7 +370,7 @@ test.describe('1. User can expand hydrogens for ', () => {
});

test.describe('2. User can expand hydrogens for ', () => {
/*
/*
Test case: https://github.com/epam/ketcher/issues/4258 - Case 1
Description: User can (having atomatic atom on the canvas) expand hydrogens for molecules connected by ordinary type of bonds
1. Clear canvas
Expand All @@ -373,7 +379,7 @@ test.describe('2. User can expand hydrogens for ', () => {
4. Validate canvas
5. Press Add/Remove explicit hydrogens button
6. Validate canvas

Note: Cases with atomatic atom on the canvas needed because we process canvas in different way (by another code) if it has query something on the canvas

IMPORTANT: Test results are not correct because of https://github.com/epam/Indigo/issues/1818 issue.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,16 @@ test.afterEach(async () => {
});

test.afterAll(async ({ browser }) => {
await browser.close();
const cntxt = page.context();
await page.close();
await cntxt.close();
await browser.contexts().forEach((someContext) => {
someContext.close();
});
// await browser.close();
});

test.describe('Import-Saving .mol Files', () => {
/*
test.beforeEach(async ({ page }) => {
await waitForPageInit(page);
await turnOnMacromoleculesEditor(page);
});
*/
test('Import monomers and chem', async () => {
await openFileAndAddToCanvasMacro(
'Molfiles-V3000/monomers-and-chem.mol',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,51 +2,60 @@
import { Page, chromium, test } from '@playwright/test';
import {
takeEditorScreenshot,
selectClearCanvasTool,
openFileAndAddToCanvasMacro,
moveMouseAway,
dragMouseTo,
waitForKetcherInit,
waitForIndigoToLoad,
selectClearCanvasTool,
} from '@utils';
import {
turnOnMacromoleculesEditor,
zoomWithMouseWheel,
} from '@utils/macromolecules';
import { bondTwoMonomersPointToPoint } from '@utils/macromolecules/polymerBond';

test.describe('Connection rules for Base monomers: ', () => {
let page: Page;

test.beforeAll(async ({ browser }) => {
let sharedContext;
try {
sharedContext = await browser.newContext();
} catch (error) {
console.error('Error on creation browser context:', error);
console.log('Restarting browser...');
await browser.close();
browser = await chromium.launch();
sharedContext = await browser.newContext();
}

// Reminder: do not pass page as async
page = await sharedContext.newPage();

await page.goto('', { waitUntil: 'domcontentloaded' });
await waitForKetcherInit(page);
await waitForIndigoToLoad(page);
await turnOnMacromoleculesEditor(page);
});

test.afterEach(async () => {
await page.keyboard.press('Control+0');
await selectClearCanvasTool(page);
});
let page: Page;

test.afterAll(async ({ browser }) => {
test.beforeAll(async ({ browser }) => {
let sharedContext;
try {
sharedContext = await browser.newContext();
} catch (error) {
console.error('Error on creation browser context:', error);
console.log('Restarting browser...');
await browser.close();
browser = await chromium.launch();
sharedContext = await browser.newContext();
}

// Reminder: do not pass page as async
page = await sharedContext.newPage();

await page.goto('', { waitUntil: 'domcontentloaded' });
await waitForKetcherInit(page);
await waitForIndigoToLoad(page);
await turnOnMacromoleculesEditor(page);
});

test.afterEach(async () => {
await page.keyboard.press('Control+0');
await selectClearCanvasTool(page);
});

test.afterAll(async ({ browser }) => {
const cntxt = page.context();
await page.close();
await cntxt.close();
await browser.contexts().forEach((someContext) => {
someContext.close();
});
// await browser.close();
});

test.describe('Connection rules for Base monomers: ', () => {
test.setTimeout(15000);
test.describe.configure({ retries: 0 });

interface IMonomer {
fileName: string;
Expand Down Expand Up @@ -170,10 +179,26 @@ test.describe('Connection rules for Base monomers: ', () => {

await takeEditorScreenshot(page);
}

// test(`temporary test for debug purposes`, async ({ }) => {
// await bondTwoMonomersByPointToPoint(page, baseMonomers['(R1,R2,R3)'], baseMonomers['(R1,R3,R4)'], 'R3', 'R1');
// });
/*
test(`temporary test for debug purposes1`, async () => {
await bondTwoMonomersByPointToPoint(
page,
baseMonomers['(R1,R2,R3)'],
baseMonomers['(R1,R3,R4)'],
'R3',
'R1',
);
});
test(`temporary test for debug purposes2`, async () => {
await bondTwoMonomersByPointToPoint(
page,
baseMonomers['(R1,R2,R3)'],
baseMonomers['(R1,R3,R4)'],
'R3',
'R4',
);
});
*/

Object.values(baseMonomers).forEach((leftBase) => {
Object.values(baseMonomers).forEach((rightBase) => {
Expand All @@ -194,7 +219,7 @@ test.describe('Connection rules for Base monomers: ', () => {
* 4. Validate canvas (connection should appear)
*/
test(`Connect ${leftBaseConnectionPoint} to ${rightBaseConnectionPoint} of ${leftBase.alias} and ${rightBase.alias}`, async () => {
test.setTimeout(10000);
test.setTimeout(40000);
await bondTwoMonomersByPointToPoint(
page,
leftBase,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,55 +1,62 @@
/* eslint-disable no-magic-numbers */
import { Page, chromium, test } from '@playwright/test';
import { BrowserContext, Page, chromium, test } from '@playwright/test';
import {
takeEditorScreenshot,
selectClearCanvasTool,
openFileAndAddToCanvasMacro,
moveMouseAway,
dragMouseTo,
waitForKetcherInit,
waitForIndigoToLoad,
selectClearCanvasTool,
} from '@utils';
import {
turnOnMacromoleculesEditor,
zoomWithMouseWheel,
} from '@utils/macromolecules';
import { bondTwoMonomersPointToPoint } from '@utils/macromolecules/polymerBond';

test.describe('Connection rules for Phosphate monomers: ', () => {
let page: Page;
test.setTimeout(300000);
test.describe.configure({ retries: 0 });
let page: Page;
let sharedContext: BrowserContext;

test.beforeAll(async ({ browser }) => {
let sharedContext;
try {
sharedContext = await browser.newContext();
} catch (error) {
console.error('Error on creation browser context:', error);
console.log('Restarting browser...');
await browser.close();
browser = await chromium.launch();
sharedContext = await browser.newContext();
}
test.beforeAll(async ({ browser }) => {
// let sharedContext;
try {
sharedContext = await browser.newContext();
} catch (error) {
console.error('Error on creation browser context:', error);
console.log('Restarting browser...');
await browser.close();
browser = await chromium.launch();
sharedContext = await browser.newContext();
}

// Reminder: do not pass page as async
page = await sharedContext.newPage();
// Reminder: do not pass page as async
page = await sharedContext.newPage();

await page.goto('', { waitUntil: 'domcontentloaded' });
await waitForKetcherInit(page);
await waitForIndigoToLoad(page);
await turnOnMacromoleculesEditor(page);
});
await page.goto('', { waitUntil: 'domcontentloaded' });
await waitForKetcherInit(page);
await waitForIndigoToLoad(page);
await turnOnMacromoleculesEditor(page);
});

test.afterEach(async () => {
await page.keyboard.press('Escape');
await page.keyboard.press('Control+0');
await selectClearCanvasTool(page);
});
test.afterEach(async () => {
await page.keyboard.press('Escape');
await page.keyboard.press('Control+0');
await selectClearCanvasTool(page);
});

test.afterAll(async ({ browser }) => {
await browser.close();
test.afterAll(async ({ browser }) => {
await page.close();
await sharedContext.close();
await browser.contexts().forEach((someContext) => {
someContext.close();
});
// await browser.close();
});

test.describe('Connection rules for Phosphate monomers: ', () => {
test.setTimeout(300000);
// test.describe.configure({ retries: 0 });

interface IMonomer {
fileName: string;
Expand Down Expand Up @@ -251,7 +258,7 @@ test.describe('Connection rules for Phosphate monomers: ', () => {
* 4. Validate canvas (connection dialog should appear)
*/
test(`Test case1: Center-to-center of ${leftBase.alias} and ${rightBase.alias}`, async () => {
test.setTimeout(15000);
// test.setTimeout(15000);
await bondTwoMonomersByCenterToCenter(page, leftBase, rightBase);
});
});
Expand All @@ -276,7 +283,7 @@ test.describe('Connection rules for Phosphate monomers: ', () => {
* 4. Validate canvas (connection should appear)
*/
test(`Test case2: Connect ${leftBaseConnectionPoint} to ${rightBaseConnectionPoint} of ${leftBase.alias} and ${rightBase.alias}`, async () => {
test.setTimeout(15000);
// test.setTimeout(15000);
await bondTwoMonomersByPointToPoint(
page,
leftBase,
Expand All @@ -291,38 +298,4 @@ test.describe('Connection rules for Phosphate monomers: ', () => {
);
});
});

/*
let leftBaseConnectionPoint = 'R1';
let rightBaseConnectionPoint = 'R1';
let leftBase = phosphateMonomers['(R1,R2,R3)'];
let rightBase = phosphateMonomers['(R1,R2,R3)'];

test(`Test case3: Connect ${leftBaseConnectionPoint} to ${rightBaseConnectionPoint} of ${leftBase.alias} and ${rightBase.alias}`, async () => {
test.setTimeout(15000);
await bondTwoMonomersByPointToPoint(
page,
leftBase,
rightBase,
leftBaseConnectionPoint,
rightBaseConnectionPoint,
);
});

leftBaseConnectionPoint = 'R3';
rightBaseConnectionPoint = 'R2';
leftBase = phosphateMonomers['(R1,R3,R4,R5)'];
rightBase = phosphateMonomers['(R1,R2,R3)'];

test(`Test case4: Connect ${leftBaseConnectionPoint} to ${rightBaseConnectionPoint} of ${leftBase.alias} and ${rightBase.alias}`, async () => {
test.setTimeout(15000);
await bondTwoMonomersByPointToPoint(
page,
leftBase,
rightBase,
leftBaseConnectionPoint,
rightBaseConnectionPoint,
);
});
*/
});
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,13 @@ test.afterEach(async () => {
});

test.afterAll(async ({ browser }) => {
await browser.close();
const cntxt = page.context();
await page.close();
await cntxt.close();
await browser.contexts().forEach((someContext) => {
someContext.close();
});
// await browser.close();
});

const MONOMER_NAME_TZA = 'C___Cysteine';
Expand Down
Loading
Loading