Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/epam/ketcher into 5587-au…
Browse files Browse the repository at this point in the history
…totests-tests-for-png-image-support-in-cdxcdxml
  • Loading branch information
Zhirnoff committed Sep 26, 2024
2 parents dc0c724 + aa54083 commit 31f5c59
Show file tree
Hide file tree
Showing 103 changed files with 1,209 additions and 466 deletions.
42 changes: 38 additions & 4 deletions ketcher-autotests/tests/API/api-set-get-molecule.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@ test.describe('Tests for API setMolecule/getMolecule', () => {
await waitForPageInit(page);
});

test.afterEach(async ({ page }) => {
await takeEditorScreenshot(page);
});

test('Add molecule through API ketcher.setMolecule', async ({ page }) => {
/*
Test case: EPMLSOPKET-2957
Expand All @@ -41,6 +37,7 @@ test.describe('Tests for API setMolecule/getMolecule', () => {
page,
async () => await setMolecule(page, 'C1C=CC=CC=1'),
);
await takeEditorScreenshot(page);
});

test('Add SMILES molecule using ketcher.setMolecule() method', async ({
Expand All @@ -54,6 +51,7 @@ test.describe('Tests for API setMolecule/getMolecule', () => {
page,
async () => await setMolecule(page, 'c1ccccc1'),
);
await takeEditorScreenshot(page);
});

test('Structure import if dearomotize-on-load is true', async ({ page }) => {
Expand All @@ -67,6 +65,7 @@ test.describe('Tests for API setMolecule/getMolecule', () => {
page,
async () => await setMolecule(page, 'c1ccccc1'),
);
await takeEditorScreenshot(page);
});

test(
Expand All @@ -88,6 +87,7 @@ test.describe('Tests for API setMolecule/getMolecule', () => {
page,
async () => await setMolecule(page, MolV2000File),
);
await takeEditorScreenshot(page);
},
);

Expand All @@ -102,6 +102,7 @@ test.describe('Tests for API setMolecule/getMolecule', () => {
page,
async () => await setMolecule(page, 'CCCC |Sg:gen:0,1,2:|'),
);
await takeEditorScreenshot(page);
});

test('Add a molecule with custom atom properties', async ({ page }) => {
Expand All @@ -113,6 +114,7 @@ test.describe('Tests for API setMolecule/getMolecule', () => {
page,
async () => await setMolecule(page, 'CCCC |Sg:n:0,1,2:3-6:eu|'),
);
await takeEditorScreenshot(page);
});

test('Add a fragment using ketcher.addFragment() method', async ({
Expand All @@ -126,6 +128,7 @@ test.describe('Tests for API setMolecule/getMolecule', () => {
page,
async () => await addFragment(page, 'c1ccccc1'),
);
await takeEditorScreenshot(page);
});

test('Add molecules with specified SMARTS patterns using ketcher.setMolecule() method', async ({
Expand All @@ -139,6 +142,7 @@ test.describe('Tests for API setMolecule/getMolecule', () => {
page,
async () => await setMolecule(page, '[#6]~[#6]~[#6]'),
);
await takeEditorScreenshot(page);
});

test('Add molecules with specified SMARTS patterns', async ({ page }) => {
Expand All @@ -150,6 +154,7 @@ test.describe('Tests for API setMolecule/getMolecule', () => {
page,
async () => await setMolecule(page, '[#6]=,:[#6]'),
);
await takeEditorScreenshot(page);
});

test('Add complex molecule', async ({ page }) => {
Expand All @@ -162,6 +167,7 @@ test.describe('Tests for API setMolecule/getMolecule', () => {
async () =>
await setMolecule(page, 'Brc1ccc(COC(Cn2ccnc2)c2ccc(Cl)cc2Cl)c(Cl)c1'),
);
await takeEditorScreenshot(page);
});

test('Set and Get Molecule using V3000 Molfile format', async ({ page }) => {
Expand Down Expand Up @@ -193,6 +199,7 @@ test.describe('Tests for API setMolecule/getMolecule', () => {
fileFormat: 'v3000',
});
expect(molFile).toEqual(molFileExpected);
await takeEditorScreenshot(page);
});

test('Set and Get Molecule containing chiral centers V2000', async ({
Expand Down Expand Up @@ -226,6 +233,7 @@ test.describe('Tests for API setMolecule/getMolecule', () => {
});

expect(molFile).toEqual(molFileExpected);
await takeEditorScreenshot(page);
});

test('Set and Get Molecule containing chiral centers V3000', async ({
Expand Down Expand Up @@ -258,6 +266,7 @@ test.describe('Tests for API setMolecule/getMolecule', () => {
});

expect(molFile).toEqual(molFileExpected);
await takeEditorScreenshot(page);
});

test('Check DisableQueryElements parameter', async ({ page }) => {
Expand All @@ -269,6 +278,7 @@ test.describe('Tests for API setMolecule/getMolecule', () => {
await clickInTheMiddleOfTheScreen(page);
await disableQueryElements(page);
await selectAtomInToolbar(AtomButton.Extended, page);
await takeEditorScreenshot(page);
});

test('Add Functional Groups expanded/contracted through API ketcher.setMolecule', async ({
Expand All @@ -286,6 +296,7 @@ test.describe('Tests for API setMolecule/getMolecule', () => {
FILE_TEST_DATA.functionalGroupsExpandedContractedV2000,
),
);
await takeEditorScreenshot(page);
});

test('Add Unknown superatom expanded/contracted through API ketcher.setMolecule', async ({
Expand All @@ -303,6 +314,7 @@ test.describe('Tests for API setMolecule/getMolecule', () => {
FILE_TEST_DATA.unknownSuperatomExpandedContractedV2000,
),
);
await takeEditorScreenshot(page);
});

test('Add one contracted Unknown Superatom through API ketcher.setMolecule', async ({
Expand All @@ -326,6 +338,7 @@ test.describe('Tests for API setMolecule/getMolecule', () => {

await page.getByText('Some Name').click({ button: 'right' });
await page.getByText('Expand Abbreviation').click();
await takeEditorScreenshot(page);
});

test('Add one expanded Unknown Superatom through API ketcher.setMolecule', async ({
Expand All @@ -351,6 +364,7 @@ test.describe('Tests for API setMolecule/getMolecule', () => {
const point = await getAtomByIndex(page, { label: 'C' }, 3);
await page.mouse.click(point.x, point.y, { button: 'right' });
await page.getByText('Contract Abbreviation').click();
await takeEditorScreenshot(page);
});

test('Add one contracted Functional Group through API ketcher.setMolecule', async ({
Expand All @@ -374,6 +388,7 @@ test.describe('Tests for API setMolecule/getMolecule', () => {

await page.getByText('Boc').click({ button: 'right' });
await page.getByText('Expand Abbreviation').click();
await takeEditorScreenshot(page);
});

test('Add one expanded Functional Group through API ketcher.setMolecule', async ({
Expand All @@ -396,6 +411,7 @@ test.describe('Tests for API setMolecule/getMolecule', () => {
const point = await getAtomByIndex(page, { label: 'C' }, 3);
await page.mouse.click(point.x, point.y, { button: 'right' });
await page.getByText('Contract Abbreviation').click();
await takeEditorScreenshot(page);
});

test('Add Functional Groups expanded/contracted through API ketcher.setMolecule (V3000)', async ({
Expand All @@ -413,6 +429,7 @@ test.describe('Tests for API setMolecule/getMolecule', () => {
FILE_TEST_DATA.functionalGroupsExpandedContractedV3000,
),
);
await takeEditorScreenshot(page);
});

test('Add Unknown superatom expanded/contracted through API ketcher.setMolecule (V3000)', async ({
Expand All @@ -430,6 +447,7 @@ test.describe('Tests for API setMolecule/getMolecule', () => {
FILE_TEST_DATA.unknownSuperatomExpandedContractedV3000,
),
);
await takeEditorScreenshot(page);
});

test('Add one contracted Unknown Superatom through API ketcher.setMolecule (V3000)', async ({
Expand All @@ -453,6 +471,7 @@ test.describe('Tests for API setMolecule/getMolecule', () => {

await page.getByText('Some Name').click({ button: 'right' });
await page.getByText('Expand Abbreviation').click();
await takeEditorScreenshot(page);
});

test('Add one expanded Unknown Superatom through API ketcher.setMolecule (V3000)', async ({
Expand All @@ -478,6 +497,7 @@ test.describe('Tests for API setMolecule/getMolecule', () => {
const point = await getAtomByIndex(page, { label: 'C' }, 3);
await page.mouse.click(point.x, point.y, { button: 'right' });
await page.getByText('Contract Abbreviation').click();
await takeEditorScreenshot(page);
});

test('Add one contracted Functional Group through API ketcher.setMolecule (V3000)', async ({
Expand All @@ -501,6 +521,7 @@ test.describe('Tests for API setMolecule/getMolecule', () => {

await page.getByText('Boc').click({ button: 'right' });
await page.getByText('Expand Abbreviation').click();
await takeEditorScreenshot(page);
});

test('Add one expanded Functional Group through API ketcher.setMolecule (V3000)', async ({
Expand All @@ -523,6 +544,7 @@ test.describe('Tests for API setMolecule/getMolecule', () => {
const point = await getAtomByIndex(page, { label: 'C' }, 3);
await page.mouse.click(point.x, point.y, { button: 'right' });
await page.getByText('Contract Abbreviation').click();
await takeEditorScreenshot(page);
});

test('Add Functional Groups expanded/contracted through API ketcher.setMolecule (.ket)', async ({
Expand All @@ -540,6 +562,7 @@ test.describe('Tests for API setMolecule/getMolecule', () => {
FILE_TEST_DATA.functionalGroupsExpandedContractedKet,
),
);
await takeEditorScreenshot(page);
});

test('Add Unknown superatom expanded/contracted through API ketcher.setMolecule (.ket)', async ({
Expand All @@ -557,6 +580,7 @@ test.describe('Tests for API setMolecule/getMolecule', () => {
FILE_TEST_DATA.unknownSuperatomExpandedContractedKet,
),
);
await takeEditorScreenshot(page);
});

test('Add one contracted Unknown Superatom through API ketcher.setMolecule (.ket)', async ({
Expand All @@ -580,6 +604,7 @@ test.describe('Tests for API setMolecule/getMolecule', () => {

await page.getByText('Some Name').click({ button: 'right' });
await page.getByText('Expand Abbreviation').click();
await takeEditorScreenshot(page);
});

test('Add one expanded Unknown Superatom through API ketcher.setMolecule (.ket)', async ({
Expand All @@ -602,6 +627,7 @@ test.describe('Tests for API setMolecule/getMolecule', () => {
const point = await getAtomByIndex(page, { label: 'C' }, 3);
await page.mouse.click(point.x, point.y, { button: 'right' });
await page.getByText('Contract Abbreviation').click();
await takeEditorScreenshot(page);
});

test('Add one contracted Functional Group through API ketcher.setMolecule (.ket)', async ({
Expand All @@ -622,6 +648,7 @@ test.describe('Tests for API setMolecule/getMolecule', () => {

await page.getByText('Boc').click({ button: 'right' });
await page.getByText('Expand Abbreviation').click();
await takeEditorScreenshot(page);
});

test('Add one expanded Functional Group through API ketcher.setMolecule (.ket)', async ({
Expand All @@ -644,6 +671,7 @@ test.describe('Tests for API setMolecule/getMolecule', () => {
const point = await getAtomByIndex(page, { label: 'C' }, 3);
await page.mouse.click(point.x, point.y, { button: 'right' });
await page.getByText('Contract Abbreviation').click();
await takeEditorScreenshot(page);
});

test('Add Functional Groups expanded/contracted through API ketcher.setMolecule (CML)', async ({
Expand All @@ -661,6 +689,7 @@ test.describe('Tests for API setMolecule/getMolecule', () => {
FILE_TEST_DATA.functionalGroupsExpandedContractedCml,
),
);
await takeEditorScreenshot(page);
});

test('Add one contracted Functional Group through API ketcher.setMolecule (CML)', async ({
Expand All @@ -681,6 +710,7 @@ test.describe('Tests for API setMolecule/getMolecule', () => {

await page.getByText('Boc').click({ button: 'right' });
await page.getByText('Expand Abbreviation').click();
await takeEditorScreenshot(page);
});

test('Add Unknown superatoms expanded/contracted through API ketcher.setMolecule (CML)', async ({
Expand All @@ -698,6 +728,7 @@ test.describe('Tests for API setMolecule/getMolecule', () => {
FILE_TEST_DATA.unknownSuperatomExpandedContractedCml,
),
);
await takeEditorScreenshot(page);
});

test('Add one contracted Unknown Superatom through API ketcher.setMolecule (CML)', async ({
Expand All @@ -721,6 +752,7 @@ test.describe('Tests for API setMolecule/getMolecule', () => {

await page.getByText('Some Name').click({ button: 'right' });
await page.getByText('Expand Abbreviation').click();
await takeEditorScreenshot(page);
});
test('Check that "containsReaction" method returns "true" if structure has a reaction in micro mode', async ({
page,
Expand All @@ -738,6 +770,7 @@ test.describe('Tests for API setMolecule/getMolecule', () => {
});

expect(containsReaction).toBe(true);
await takeEditorScreenshot(page);
});

test('Check that "containsReaction" method returns "false" if structure has not a reaction in micro mode', async ({
Expand All @@ -755,5 +788,6 @@ test.describe('Tests for API setMolecule/getMolecule', () => {
});

expect(containsReaction).not.toBe(true);
await takeEditorScreenshot(page);
});
});
13 changes: 8 additions & 5 deletions ketcher-autotests/tests/Examples/ketcher-canvas.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,6 @@ test.describe('Drawing atom, Benzene ring, Single and Double Bond', () => {
await waitForPageInit(page);
});

test.afterEach(async ({ page }) => {
await resetCurrentTool(page);
await takeEditorScreenshot(page);
});

test('drawing atom, then dragging other atom', async ({ page }) => {
const xDelta = 100;
await selectAtomInToolbar(AtomButton.Carbon, page);
Expand All @@ -38,6 +33,8 @@ test.describe('Drawing atom, Benzene ring, Single and Double Bond', () => {

const { x, y } = await getCoordinatesOfTheMiddleOfTheScreen(page);
await dragMouseTo(x + xDelta, y, page);
await resetCurrentTool(page);
await takeEditorScreenshot(page);
});

test('drawing benzene ring, then adding single bond', async ({ page }) => {
Expand All @@ -46,6 +43,8 @@ test.describe('Drawing atom, Benzene ring, Single and Double Bond', () => {
await selectBond(BondTypeName.Single, page);

await clickOnAtom(page, 'C', 2);
await resetCurrentTool(page);
await takeEditorScreenshot(page);
});

test('single bond tool', async ({ page }) => {
Expand All @@ -56,6 +55,8 @@ test.describe('Drawing atom, Benzene ring, Single and Double Bond', () => {
await selectBond(BondTypeName.Single, page);

await clickInTheMiddleOfTheScreen(page);
await resetCurrentTool(page);
await takeEditorScreenshot(page);
});

test('double bond tool ', async ({ page }) => {
Expand All @@ -65,5 +66,7 @@ test.describe('Drawing atom, Benzene ring, Single and Double Bond', () => {
await selectNestedTool(page, BondTool.DOUBLE);

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

0 comments on commit 31f5c59

Please sign in to comment.