Skip to content

Commit

Permalink
Autotests: Fix tests (#3255)
Browse files Browse the repository at this point in the history
* fixed failing tests

* Autotests: #3170 - reduce the number of tests with fixme (#3240)

* #3170 – Autotests: Reduce the number of tests with 'fixme'

* #3170 – fixed tests for reagents, reduced timeout for pipelines

* #3170 – removed fixme for functiona-groups and salts and solvents tests
  • Loading branch information
Nitvex authored Sep 5, 2023
1 parent 75c90f7 commit 93c7ebb
Show file tree
Hide file tree
Showing 144 changed files with 591 additions and 594 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ env:
CI_ENVIRONMENT: true
jobs:
playwright_tests:
timeout-minutes: 120
timeout-minutes: 40
runs-on: self-hosted
steps:
- uses: actions/checkout@v3
Expand Down
76 changes: 36 additions & 40 deletions ketcher-autotests/tests/API/api-set-get-molecule.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import {
DELAY_IN_SECONDS,
FILE_TEST_DATA,
receiveFileComparisonData,
waitForKetcherInit,
waitForSpinnerFinishedWork,
clickInTheMiddleOfTheScreen,
waitForIndigoToLoad,
} from '@utils';
import { getAtomByIndex } from '@utils/canvas/atoms';
import {
Expand All @@ -32,7 +32,7 @@ function filteredFile(file: string, filteredIndex: number): string {
test.describe('Tests for API setMolecule/getMolecule', () => {
test.beforeEach(async ({ page }) => {
await page.goto('');
await waitForKetcherInit(page);
await waitForIndigoToLoad(page);
});

test.afterEach(async ({ page }) => {
Expand Down Expand Up @@ -176,6 +176,7 @@ test.describe('Tests for API setMolecule/getMolecule', () => {
},
);

// TO DO: split by two tests; use saveToFile function; do not get molv2000 in one line
test.fixme(
'Set and Get Molecule containing chiral centers',
async ({ page }) => {
Expand All @@ -195,7 +196,7 @@ test.describe('Tests for API setMolecule/getMolecule', () => {
await delay(DELAY_IN_SECONDS.THREE);

const molV2000FileExpected = await readFileContents(
'tests/test-data/test-data-for-chiral-centersv2000.json',
'tests/test-data/Molfiles-V2000/test-data-for-chiral-centersv2000.mol',
);
const molV2000File = await getMolfile(page, 'v2000');
const filteredmolV2000FileExpected = filteredFile(
Expand All @@ -210,7 +211,7 @@ test.describe('Tests for API setMolecule/getMolecule', () => {
expect(filteredmolV2000File).toEqual(filteredmolV2000FileExpected);

const molV3000FileExpected = await readFileContents(
'tests/test-data/test-data-for-chiral-centersv3000.json',
'tests/test-data/Molfiles-V3000/test-data-for-chiral-centersv3000.mol',
);
const molV3000File = await getMolfile(page, 'v3000');
const filteredmolV3000FileExpected = filteredFile(
Expand Down Expand Up @@ -446,55 +447,50 @@ test.describe('Tests for API setMolecule/getMolecule', () => {
await page.getByText('Contract Abbreviation').click();
});

test.fixme(
'Add one contracted Functional Group through API ketcher.setMolecule (V3000)',
async ({ page }) => {
/*
test('Add one contracted Functional Group through API ketcher.setMolecule (V3000)', async ({
page,
}) => {
/*
Test case: EPMLSOPKET-13021
Description: one contracted Functional Group added through API ketcher.setMolecule.
Functional Group is able to expand.
*/
await waitForSpinnerFinishedWork(
page,
async () =>
await setMolecule(
page,
FILE_TEST_DATA.oneFunctionalGroupContractedV3000,
),
);
await waitForSpinnerFinishedWork(
page,
async () =>
await setMolecule(
page,
FILE_TEST_DATA.oneFunctionalGroupContractedV3000,
),
);

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

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

test.fixme(
'Add one expanded Functional Group through API ketcher.setMolecule (V3000)',
async ({ page }) => {
/*
test('Add one expanded Functional Group through API ketcher.setMolecule (V3000)', async ({
page,
}) => {
/*
Test case: EPMLSOPKET-13022
Description: one expanded Functional Group added through API ketcher.setMolecule.
Functional Group is able to contract.
*/
await waitForSpinnerFinishedWork(
page,
async () =>
await setMolecule(
page,
FILE_TEST_DATA.oneFunctionalGroupExpandedV3000,
),
);
await waitForSpinnerFinishedWork(
page,
async () =>
await setMolecule(page, FILE_TEST_DATA.oneFunctionalGroupExpandedV3000),
);

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

// eslint-disable-next-line no-magic-numbers
const point = await getAtomByIndex(page, { label: 'C' }, 3);
await page.mouse.click(point.x, point.y, { button: 'right' });
await page.getByText('Contract Abbreviation').click();
},
);
// eslint-disable-next-line no-magic-numbers
const point = await getAtomByIndex(page, { label: 'C' }, 3);
await page.mouse.click(point.x, point.y, { button: 'right' });
await page.getByText('Contract Abbreviation').click();
});

test('Add Functional Groups expanded/contracted through API ketcher.setMolecule (.ket)', async ({
page,
Expand Down
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.
2 changes: 1 addition & 1 deletion ketcher-autotests/tests/Examples/ketcher-canvas.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ test.describe('Drawing atom, Benzene ring, Single and Double Bond', () => {
await clickOnAtom(page, 'C', 2);
});

test.fixme('single bond tool', async ({ page }) => {
test('single bond tool', async ({ page }) => {
/*
* Test case: EPMLSOPKET-1371
*/
Expand Down
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 @@ -6,18 +6,20 @@ import {
openFileAndAddToCanvas,
takeEditorScreenshot,
pasteFromClipboardAndAddToCanvas,
waitForIndigoToLoad,
} from '@utils';

test.describe('CDX files', () => {
test.beforeEach(async ({ page }) => {
await page.goto('');
await waitForIndigoToLoad(page);
});

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

test.fixme('opening cdx files', async ({ page }) => {
test('opening cdx files', async ({ page }) => {
/*
Test case: EPMLSOPKET-12514
Description: Open CDX files
Expand Down
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 @@ -6,6 +6,7 @@ import {
openFileAndAddToCanvas,
saveToFile,
delay,
waitForIndigoToLoad,
} from '@utils';
import { getCml } from '@utils/formats';

Expand All @@ -17,6 +18,7 @@ async function openFileAddToCanvasTakeScreenshot(page: Page, fileName: string) {
test.describe('CML files', () => {
test.beforeEach(async ({ page }) => {
await page.goto('');
await waitForIndigoToLoad(page);
});

test('Open and Save files - CML - CML for empty canvas', async ({ page }) => {
Expand Down Expand Up @@ -78,29 +80,25 @@ test.describe('CML files', () => {
expect(cmlFile).toEqual(cmlFileExpected);
});

// flaky
test.fixme(
'Open and Save file - CML - CML for reaction',
async ({ page }) => {
/**
test('Open and Save file - CML - CML for reaction', async ({ page }) => {
/**
* Test case: EPMLSOPKET-1947
Description: Saved cml file with structure is compering with paste reaction from rxn file
*/
await openFileAddToCanvasTakeScreenshot(page, 'cml-1947-reaction.rxn');
// check that structure opened from file is displayed correctly
await openFileAddToCanvasTakeScreenshot(page, 'cml-1947-reaction.rxn');
// check that structure opened from file is displayed correctly

const expectedFile = await getCml(page);
await saveToFile('cml-1947-reaction-expected.cml', expectedFile);
const { file: cmlFile, fileExpected: cmlFileExpected } =
await receiveFileComparisonData({
page,
expectedFileName: 'tests/test-data/cml-1947-reaction-expected.cml',
});
// comparing cml file with golden cml file
const expectedFile = await getCml(page);
await saveToFile('cml-1947-reaction-expected.cml', expectedFile);
const { file: cmlFile, fileExpected: cmlFileExpected } =
await receiveFileComparisonData({
page,
expectedFileName: 'tests/test-data/cml-1947-reaction-expected.cml',
});
// comparing cml file with golden cml file

expect(cmlFile).toEqual(cmlFileExpected);
},
);
expect(cmlFile).toEqual(cmlFileExpected);
});

test.fixme(
'Open and Save file - CML - CML for R-group and other features',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
receiveFileComparisonData,
openFileAndAddToCanvas,
saveToFile,
waitForIndigoToLoad,
} from '@utils';
import { getMolfile } from '@utils/formats';

Expand Down Expand Up @@ -91,20 +92,20 @@ test('Open and Save file - Open/Save V3000 file with atom and bond properties 2/
expect(molFile).toEqual(molFileExpected);
});

test.fixme(
'Open and Save file - Open/Save Markush files 1/2 - open',
async ({ page }) => {
/**
* Test case: EPMLSOPKET-1894(1)
* Description: Markush structure is displayed as an RGroup structure.
*/
await page.goto('');

await openFileAndAddToCanvas('Markush.mol', page);
// check that structure opened from file is displayed correctly
await takeEditorScreenshot(page);
},
);
test('Open and Save file - Open/Save Markush files 1/2 - open', async ({
page,
}) => {
/**
* Test case: EPMLSOPKET-1894(1)
* Description: Markush structure is displayed as an RGroup structure.
*/
await page.goto('');
await waitForIndigoToLoad(page);

await openFileAndAddToCanvas('Markush.mol', page);
// check that structure opened from file is displayed correctly
await takeEditorScreenshot(page);
});

test('Open and Save file - Open/Save Markush files 2/2 - save', async ({
page,
Expand Down Expand Up @@ -251,20 +252,20 @@ test('Open and Save file - Open/Save file with R-Groups 2/2 - save', async ({
expect(molFile).toEqual(molFileExpected);
});

test.fixme(
'Open and Save file - Open/Save file contains Heteroatoms 1/2 - open',
async ({ page }) => {
/**
* Test case: EPMLSOPKET-1878(1)
* Description: Structure with heteroatoms is opened from mol file correctly
*/
await page.goto('');

await openFileAndAddToCanvas('Heteroatoms.mol', page);
// check that structure opened from file is displayed correctly
await takeEditorScreenshot(page);
},
);
test('Open and Save file - Open/Save file contains Heteroatoms 1/2 - open', async ({
page,
}) => {
/**
* Test case: EPMLSOPKET-1878(1)
* Description: Structure with heteroatoms is opened from mol file correctly
*/
await page.goto('');
await waitForIndigoToLoad(page);

await openFileAndAddToCanvas('Heteroatoms.mol', page);
// check that structure opened from file is displayed correctly
await takeEditorScreenshot(page);
});

test('Open and Save file - Open/Save file contains Heteroatoms 2/2 - save', async ({
page,
Expand Down
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 @@ -10,13 +10,15 @@ import {
openFileAndAddToCanvas,
TopPanelButton,
selectTopPanelButton,
waitForIndigoToLoad,
} from '@utils';

const X_OFFSET = 200;

test.describe('open files with different formats', () => {
test.beforeEach(async ({ page }) => {
await page.goto('');
await waitForIndigoToLoad(page);
});

test.afterEach(async ({ page }) => {
Expand Down Expand Up @@ -70,7 +72,7 @@ the first one disappears. Couldn't reproduct manually.
await clickOnTheCanvas(page, X_OFFSET, 0);
});

test.fixme('Open file - Input .rxn string', async ({ page }) => {
test('Open file - Input .rxn string', async ({ page }) => {
/**
* Test case: EPMLSOPKET-2860
* Description: Two structures are added to canvas - one opened from clipboard, another from file
Expand Down
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 @@ -78,12 +78,12 @@ test('Save file - Save *.ket file', async ({ page }) => {
);

const expectedFile = await getKet(page);
await saveToFile('Ket/ket-2934-to-compare-expected.ket', expectedFile);
await saveToFile('KET/ket-2934-to-compare-expected.ket', expectedFile);

const { fileExpected: ketFileExpected, file: ketFile } =
await receiveFileComparisonData({
page,
expectedFileName: 'tests/test-data/Ket/ket-2934-to-compare-expected.ket',
expectedFileName: 'tests/test-data/KET/ket-2934-to-compare-expected.ket',
});

expect(ketFile).toEqual(ketFileExpected);
Expand Down
Loading

0 comments on commit 93c7ebb

Please sign in to comment.