Skip to content

Commit

Permalink
Autotests: Fix tests (#3278)
Browse files Browse the repository at this point in the history
* Added waitForRender

* - updated snapshots;
- deleted 'fixme' in few test 'copy-cut-paste';

---------

Co-authored-by: Mikhail Zhirnov <[email protected]>
  • Loading branch information
Nitvex and Zhirnoff authored Sep 8, 2023
1 parent 046f7a7 commit 74390f5
Show file tree
Hide file tree
Showing 118 changed files with 375 additions and 246 deletions.
2 changes: 1 addition & 1 deletion ketcher-autotests/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ const config: PlaywrightTestConfig = {
/* Run tests in files in parallel */
fullyParallel: true,
/* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: Boolean(process.env.CI_ENVIRONMENT),
forbidOnly: isCI,
/* Retry on CI only */
retries: isCI ? MAX_NUMBER_OF_RETRIES : 0,
/* Opt out of parallel tests on CI. */
Expand Down
5 changes: 2 additions & 3 deletions ketcher-autotests/tests/API/api-set-get-molecule.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
receiveFileComparisonData,
waitForSpinnerFinishedWork,
clickInTheMiddleOfTheScreen,
waitForIndigoToLoad,
waitForPageInit,
} from '@utils';
import { getAtomByIndex } from '@utils/canvas/atoms';
import {
Expand All @@ -31,8 +31,7 @@ function filteredFile(file: string, filteredIndex: number): string {

test.describe('Tests for API setMolecule/getMolecule', () => {
test.beforeEach(async ({ page }) => {
await page.goto('');
await waitForIndigoToLoad(page);
await waitForPageInit(page);
});

test.afterEach(async ({ page }) => {
Expand Down
4 changes: 2 additions & 2 deletions ketcher-autotests/tests/Examples/ketcher-api.spec.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { test, expect } from '@playwright/test';
import { molV2000 } from '@tests/test-data/molV2000-result';
import { clickInTheMiddleOfTheScreen } from '@utils';
import { clickInTheMiddleOfTheScreen, waitForPageInit } from '@utils';

test('getting molV2000 from Ketcher API', async ({ page }) => {
await page.goto('');
await waitForPageInit(page);

await page.getByRole('button', { name: 'Benzene (T)' }).click();

Expand Down
3 changes: 2 additions & 1 deletion ketcher-autotests/tests/Examples/ketcher-canvas.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@ import {
clickOnAtom,
BondTool,
selectNestedTool,
waitForPageInit,
} from '@utils';

test.describe('Drawing atom, Benzene ring, Single and Double Bond', () => {
test.beforeEach(async ({ page }) => {
await page.goto('');
await waitForPageInit(page);
});

test.afterEach(async ({ page }) => {
Expand Down
14 changes: 9 additions & 5 deletions ketcher-autotests/tests/Examples/ketcher-files.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import { test } from '@playwright/test';
import { takeEditorScreenshot, openFileAndAddToCanvas } from '@utils';
import {
takeEditorScreenshot,
openFileAndAddToCanvas,
waitForPageInit,
} from '@utils';

test('opening molfile', async ({ page }) => {
await page.goto('');
await waitForPageInit(page);
await openFileAndAddToCanvas('display-abbrev-groups-example.mol', page);
await takeEditorScreenshot(page);
});
Expand All @@ -11,7 +15,7 @@ test('opening rnx files', async ({ page }) => {
/*
Test case: EPMLSOPKET-1839
*/
await page.goto('');
await waitForPageInit(page);
await openFileAndAddToCanvas('Rxn-V2000/1839-ketcher.rxn', page);
await takeEditorScreenshot(page);
});
Expand All @@ -20,7 +24,7 @@ test('opening smi files', async ({ page }) => {
/*
Test case: EPMLSOPKET-1840
*/
await page.goto('');
await waitForPageInit(page);
await openFileAndAddToCanvas('SMILES/1840-cyclopentyl.smi', page);
await takeEditorScreenshot(page);
});
Expand All @@ -29,7 +33,7 @@ test('opening inchi files', async ({ page }) => {
/*
Test case: EPMLSOPKET-1841
*/
await page.goto('');
await waitForPageInit(page);
await openFileAndAddToCanvas('InChI/1841-ketcher.inchi', page);
await takeEditorScreenshot(page);
});
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@ import {
openFileAndAddToCanvas,
takeEditorScreenshot,
pasteFromClipboardAndAddToCanvas,
waitForIndigoToLoad,
} from '@utils';
import { waitForPageInit } from '@utils/common/loaders/waitForPageInit';

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

test.afterEach(async ({ page }) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
receiveFileComparisonData,
saveToFile,
clickOnAtom,
waitForPageInit,
} from '@utils';
import { getCdxml } from '@utils/formats';

Expand All @@ -24,7 +25,7 @@ async function selectRadioButtonForNewGroup(

test.describe('CDXML Enhanced Stereochemistry', () => {
test.beforeEach(async ({ page }) => {
await page.goto('');
await waitForPageInit(page);
});

test.afterEach(async ({ page }) => {
Expand Down Expand Up @@ -78,7 +79,7 @@ test.describe('CDXML Enhanced Stereochemistry', () => {

test.describe('CDXML Enhanced Stereochemistry', () => {
test.beforeEach(async ({ page }) => {
await page.goto('');
await waitForPageInit(page);
});

test('AND stereo marks - Save as *.cdxml file', async ({ page }) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import {
openFileAndAddToCanvas,
saveToFile,
delay,
waitForIndigoToLoad,
} from '@utils';
import { waitForPageInit } from '@utils/common/loaders/waitForPageInit';
import { getCml } from '@utils/formats';

async function openFileAddToCanvasTakeScreenshot(page: Page, fileName: string) {
Expand All @@ -17,8 +17,7 @@ async function openFileAddToCanvasTakeScreenshot(page: Page, fileName: string) {

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

test('Open and Save files - CML - CML for empty canvas', async ({ page }) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ import {
openFromFileViaClipboard,
selectTopPanelButton,
TopPanelButton,
waitForPageInit,
} from '@utils';

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

test.afterEach(async ({ page }) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ import {
openFileAndAddToCanvas,
receiveFileComparisonData,
saveToFile,
waitForPageInit,
} from '@utils';
import { getKet } from '@utils/formats';

test('Open KET file with properties and check properties are saved in struct', async ({
page,
}) => {
await page.goto('');
await waitForPageInit(page);

await openFileAndAddToCanvas('KET/ket-with-properties.ket', page);

Expand Down Expand Up @@ -43,7 +44,7 @@ test('Open KET file with properties and check properties are saved in struct', a
});

test('Save a structure with properties to KET format', async ({ page }) => {
await page.goto('');
await waitForPageInit(page);

await openFileAndAddToCanvas('KET/ket-with-properties.ket', page);

Expand Down
Loading

0 comments on commit 74390f5

Please sign in to comment.