Skip to content

Commit

Permalink
#3298 - Add simple atom query primitives to the query specific proper…
Browse files Browse the repository at this point in the history
…ties

- merge master into branch
  • Loading branch information
AKZhuk committed Sep 15, 2023
2 parents 846e212 + 6c4458b commit 0d9b954
Show file tree
Hide file tree
Showing 351 changed files with 2,593 additions and 1,014 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,23 @@ jobs:
run: cd ketcher-autotests && npm run docker:build
- name: Run playwright tests in docker
run: cd ketcher-autotests && npm run docker:test

# For macromolecule tests
- name: Add ENABLE_POLYMER_EDITOR=true
run: export ENABLE_POLYMER_EDITOR=true
- name: Build all packages
run: npm run build:packages && npm run build:example:standalone
- name: Run example in standalone mode
run: cd example/ && nohup npm run serve:standalone &
- name: Create env file
run: |
cd ketcher-autotests
echo "ENABLE_POLYMER_EDITOR=true" >> .env
- name: Build autotests for docker
run: cd ketcher-autotests && npm run docker:build
- name: Run playwright tests in docker
run: cd ketcher-autotests && npm run docker:test

- uses: actions/upload-artifact@v3
# run even if previous steps fails
if: always()
Expand Down
2 changes: 1 addition & 1 deletion ketcher-autotests/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

FROM node:18-alpine
FROM mcr.microsoft.com/playwright:v1.36.0-jammy
FROM mcr.microsoft.com/playwright:v1.37.0-jammy

WORKDIR /app

Expand Down
4 changes: 2 additions & 2 deletions ketcher-autotests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"test": "npx playwright test",
"test:debug": "npx playwright test --debug",
"test:update": "npx playwright test --update-snapshots",
"test:trace": "npx playwright test --trace on --grep @check",
"test:trace": "npx playwright test --trace on",
"check:code": "npm run check:types && npm run check:lint",
"check:types": "tsc --noEmit",
"check:lint": "eslint .",
Expand All @@ -24,7 +24,7 @@
"author": "Nitvex",
"license": "ISC",
"devDependencies": {
"@playwright/test": "^1.36.1",
"@playwright/test": "1.37.0",
"eslint": "^8.44.0",
"lint-staged": "^13.1.2",
"prettier": "2.8.4"
Expand Down
31 changes: 30 additions & 1 deletion ketcher-autotests/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,22 @@ const ignoredTests = [
'utils/**',
];

const regularTests = [
'API/**',
'Examples/**',
'File-Management/**',
'Indigo-Tools/**',
'R-group-tool/**',
'Reactions/**',
'Reagents/**',
'Structure-Creating-&-Editing/**',
'Templates/**',
'User-Interface/**',
'utils/**',
];

const macromoleculeTests = ['Macromolecule-editor/**'];

const testDir = './tests';

function baseURL(): string {
Expand All @@ -47,11 +63,24 @@ const MIN_AMOUNT_OF_WORKERS = 2;
// const MAX_NUMBER_OF_FAILURES = 3;
const isCI = process.env.CI_ENVIRONMENT === 'true';

function getIgnoredFiles(): string[] {
let ignored = [] as string[];
if (process.env.IGNORE_UNSTABLE_TESTS) {
ignored = ignoredTests;
}
if (process.env.ENABLE_POLYMER_EDITOR === 'true') {
ignored = [...ignored, ...regularTests];
} else {
ignored = [...ignored, ...macromoleculeTests];
}
return ignored;
}

const config: PlaywrightTestConfig = {
testDir,
/* Maximum time one test can run for. */
timeout: 60_000,
testIgnore: process.env.IGNORE_UNSTABLE_TESTS ? ignoredTests : undefined,
testIgnore: getIgnoredFiles(),
expect: {
/**
* Maximum time expect() should wait for the condition to be met.
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.
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 @@ -476,6 +476,7 @@ test.describe('Open and Save InChI file', () => {
await pasteFromClipboardAndAddToCanvas(
page,
'1S/C9H14/c1-3-5-7-9-8-6-4-2/h3,5-9H,4H2,1-2H3/b5-3-,8-6+,9-7+',
false,
);
const convertErrorMessage = await page
.getByTestId('info-modal-body')
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.
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.
21 changes: 17 additions & 4 deletions ketcher-autotests/tests/Indigo-Tools/Layout/layout.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
pressButton,
waitForLoad,
getCoordinatesOfTheMiddleOfTheScreen,
openFileAndAddToCanvas,
waitForPageInit,
} from '@utils';

Expand All @@ -28,8 +29,7 @@ test.describe('Indigo Tools - Layout', () => {

test('Center molecule after layout', async ({ page }) => {
// Related Github issue: https://github.com/epam/ketcher/issues/2078
const anyStructure = 'Molfiles-V2000/benzene-rings.mol';
await openFileWithShift(anyStructure, page);
await openFileAndAddToCanvas('Molfiles-V2000/benzene-rings.mol', page);
await selectTopPanelButton(TopPanelButton.Layout, page);
await takeEditorScreenshot(page);
});
Expand All @@ -39,9 +39,22 @@ test.describe('Indigo Tools - Layout', () => {
}) => {
// Related Github issue: https://github.com/epam/ketcher/issues/3025
const structureWithStereoFlags = 'KET/structure-with-stereo-flags.ket';
const numberOfIterations = 3;
await openFileWithShift(structureWithStereoFlags, page);
await selectTopPanelButton(TopPanelButton.Layout, page);
await selectTopPanelButton(TopPanelButton.Layout, page);
for (let i = 0; i < numberOfIterations; i++) {
await selectTopPanelButton(TopPanelButton.Layout, page);
}
await takeEditorScreenshot(page);
});

test('After applying Layout, the structure does not disappear and can be interacted with', async ({
page,
}) => {
// Related Github issue: https://github.com/epam/ketcher/issues/3208
await openFileAndAddToCanvas(
'Molfiles-V2000/chloro-ethylamino-dimethyl-propoxy-propan-ol.mol',
page,
);
await selectTopPanelButton(TopPanelButton.Layout, page);
await takeEditorScreenshot(page);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { POLYMER_TOGGLER } from '../../../constants/testIdConstants';
Test case: #2497 - Add chem to canvas
*/

test.skip('Select chem and drag it to canvas', async ({ page }) => {
test('Select chem and drag it to canvas', async ({ page }) => {
await waitForPageInit(page);

// Click on POLYMER_TOGGLER
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ test.describe('Open Ketcher', () => {
test.beforeEach(async ({ page }) => {
await waitForPageInit(page);
});
test.skip('Switch to Polymer Editor', async ({ page }) => {
test('Switch to Polymer Editor', async ({ page }) => {
/*
Test case: #2496 - chem monomer library
Description: Switch to Polymer Editor
Expand All @@ -17,7 +17,7 @@ test.describe('Open Ketcher', () => {
await expect(page.getByText('CHEM')).toBeVisible();
});

test.skip('Open Chem tab in library', async ({ page }) => {
test('Open Chem tab in library', async ({ page }) => {
/*
Test case: #2496 - chem monomer library
Description: Open Chem tab in library
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ test.describe('Erase Tool', () => {
await page.goto('');
await turnOnMacromoleculesEditor(page);
});
test.skip('Delete monomer bonded with another monomers', async ({ page }) => {
test('Delete monomer bonded with another monomers', async ({ page }) => {
/*
Test case: #2370 - "Erase" tool for macromolecules editor
Description: Erase Tool
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { POLYMER_TOGGLER } from '../../../constants/testIdConstants';
Test case: #3063 - Add e2e tests for Macromolecule editor
*/

test.skip('Select peptide and drag it to canvas', async ({ page }) => {
test('Select peptide and drag it to canvas', async ({ page }) => {
await waitForPageInit(page);

// Click on POLYMER_TOGGLER
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ test.describe('Polymer Bond Tool', () => {
test.beforeEach(async ({ page }) => {
await waitForPageInit(page);
});
test.skip('Create bond between two peptides', async ({ page }) => {
test('Create bond between two peptides', async ({ page }) => {
/*
Test case: #2334 - Create peptide chain (HELM style) - Center-to-Center
Description: Polymer bond tool
Expand Down Expand Up @@ -63,7 +63,7 @@ test.describe('Polymer Bond Tool', () => {
});
});

test.skip('Create bond between two chems', async ({ page }) => {
test('Create bond between two chems', async ({ page }) => {
/*
Test case: #2497 - Adding chems to canvas - Center-to-Center
Description: Polymer bond tool
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ test.describe('Macromolecules custom presets', () => {
// Press Enter on input
await page.press('[placeholder="Name your structure"]', 'Enter');
});
test.skip('Add new preset and duplicate it', async ({ page }) => {
test('Add new preset and duplicate it', async ({ page }) => {
// Click on <div> "Sugar Not selected"
await page.getByTestId(SUGAR).click();

Expand Down Expand Up @@ -88,7 +88,7 @@ test.describe('Macromolecules custom presets', () => {
});
});

test.skip('Add new preset with two monomers and add it to canvas', async ({
test('Add new preset with two monomers and add it to canvas', async ({
page,
}) => {
await waitForPageInit(page);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ test.describe('Macromolecules default presets', () => {
test.beforeEach(async ({ page }) => {
await waitForPageInit(page);
});
test.skip('Check Guanine in default presets', async ({ page }) => {
test('Check Guanine in default presets', async ({ page }) => {
/*
Test case: #2934 - rna builder: add default presets
Description: Switch to Polymer Editor
Expand All @@ -21,7 +21,7 @@ test.describe('Macromolecules default presets', () => {
});
});

test.skip('Add Guanine to canvas', async ({ page }) => {
test('Add Guanine to canvas', async ({ page }) => {
/*
Test case: #2507 - Add RNA monomers to canvas (by click)
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ test.describe('Rectangle Selection Tool', () => {
await page.goto('');
await turnOnMacromoleculesEditor(page);
});
test.skip('Select monomer and bonds and then erase', async ({ page }) => {
test('Select monomer and bonds and then erase', async ({ page }) => {
/*
Test case: #2360 - "Select" tool for Macromolecules editor
Description: Rectangle Selection Tool
Expand Down Expand Up @@ -72,7 +72,7 @@ test.describe('Rectangle Selection Tool', () => {
});
});

test.skip('Move monomer bonded with another monomers', async ({ page }) => {
test('Move monomer bonded with another monomers', async ({ page }) => {
/*
Test case: #2367 - move items on the canvas
Description: check ability to move items on the canvas
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -735,7 +735,6 @@ test.describe('Plus and Arrows tools ', () => {
* Test case: Test case: EPMLSOPKET - 16947
* Description: All Arrows should have correct tooltip
*/

await selectLeftPanelButton(LeftPanelButton.ArrowOpenAngleTool, page);
await selectLeftPanelButton(LeftPanelButton.ArrowOpenAngleTool, page);
const button = page.getByTestId(id).first();
Expand Down
Loading

0 comments on commit 0d9b954

Please sign in to comment.