Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit a5a1fc3
Author: Dmitry Baranov <[email protected]>
Date:   Thu May 30 15:58:32 2024 +0500

    Backmerge: #4399 - Different chains shown by the same sequence in sequence mode (system ignores sugar presence) (#4681)

commit 01b189e
Author: Mikhail Zhirnov <[email protected]>
Date:   Thu May 30 11:53:41 2024 +0300

    Autotests: #4668 - api tests (#4673)

    * - added tests to 'API';
    - added functions to 'format.ts'

    * - added tests;
    - added expected snapshots

    * - added tests;
    - added expected snapshots

    * - updated files and screenshots

    * - added tests;
    - added 1 test file;
    - added expected snapshots

    * - added tests;
    - added expected snapshots

    * - updated snapshots

    * - added tests;
    - added expected snapshots

    * - updated playwright version

    * - added tests;
    - added expected snapshots

commit c4042b5
Author: Alexey Girin <[email protected]>
Date:   Thu May 30 10:35:40 2024 +0300

    Autotests: #4422 - GUI tests (#4691)

    * 4422 - GUI tests (test and screenshots)

    * 4422 - more GUI tests

    * Final version

    * Minor corrections

    * More fixes

    * more fixes2

    * More fixes

    * more fixes 2

    * More fixes 3

    * More fixes 4

    * #4422 - broken tests and some flacky are fixed

    * MOde fixes

    * and more

    * More fixes

    * One more fix

    * More fixes

commit a00bf26
Author: Ruslan <[email protected]>
Date:   Thu May 30 02:00:38 2024 +0500

commit 1e7c398
Author: Alexey Girin <[email protected]>
Date:   Wed May 29 11:43:07 2024 +0300

    Bump request: Update playwright.yml (#4707)

    temporary rise execution time for microtests

    [skip ci]

commit d15aa1d
Merge: b7b81e1 5c30180
Author: Ilya Asiyuk <[email protected]>
Date:   Wed May 29 10:23:48 2024 +0400

    Merge pull request #4699 from epam/4697-macro-highlight-connection-point-change-mouse-cursor-on-mouse-hover

commit b7b81e1
Author: Alexey Girin <[email protected]>
Date:   Tue May 28 23:28:00 2024 +0300

commit af5d024
Merge: 52ace78 66d6d0b
Author: Ilya Asiyuk <[email protected]>
Date:   Tue May 28 15:07:24 2024 +0400

    Merge pull request #4696 from epam/4692-macro-cursors-should-be-copied-from-small-mode

commit 5c30180
Author: Ilya Asiyuk <[email protected]>
Date:   Tue May 28 12:37:03 2024 +0400

commit 66d6d0b
Author: Ilya Asiyuk <[email protected]>
Date:   Mon May 27 15:29:14 2024 +0400
  • Loading branch information
vitaepam committed May 30, 2024
1 parent b330438 commit 6f302d3
Show file tree
Hide file tree
Showing 209 changed files with 11,140 additions and 197 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: 60
timeout-minutes: 150
runs-on: self-hosted
steps:
- uses: actions/checkout@v3
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.37.0-jammy
FROM mcr.microsoft.com/playwright:v1.44.1-jammy

WORKDIR /app

Expand Down
2 changes: 1 addition & 1 deletion ketcher-autotests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"author": "Nitvex",
"license": "ISC",
"devDependencies": {
"@playwright/test": "^1.39.0",
"@playwright/test": "^1.44.1",
"eslint": "^8.44.0",
"lint-staged": "^13.1.2",
"prettier": "2.8.4"
Expand Down
3 changes: 2 additions & 1 deletion ketcher-autotests/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ import {
DEFAULT_KETCHER_STANDALONE_URL,
MODES,
} from './constants';
import path from 'path';

dotenv.config();
dotenv.config({ path: path.resolve(__dirname, '.env') });
/**
* See https://playwright.dev/docs/test-configuration.
*/
Expand Down
37 changes: 37 additions & 0 deletions ketcher-autotests/tests/API/api-set-get-molecule.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ import {
clickInTheMiddleOfTheScreen,
waitForPageInit,
saveToFile,
openFileAndAddToCanvasAsNewProject,
drawBenzeneRing,
waitForLoad,
} from '@utils';
import { getAtomByIndex } from '@utils/canvas/atoms';
import {
Expand Down Expand Up @@ -717,4 +720,38 @@ test.describe('Tests for API setMolecule/getMolecule', () => {
await page.getByText('Some Name').click({ button: 'right' });
await page.getByText('Expand Abbreviation').click();
});
test('Check that "containsReaction" method returns "true" if structure has a reaction in micro mode', async ({
page,
}) => {
/**
* Test case: #3531
* Description: "containsReaction" method returns "true" if structure has a reaction in micro mode
*/
await openFileAndAddToCanvasAsNewProject(
'KET/benzene-arrow-benzene-reagent-hcl.ket',
page,
);
const containsReaction = await page.evaluate(() => {
return window.ketcher.containsReaction();
});

expect(containsReaction).toBe(true);
});

test('Check that "containsReaction" method returns "false" if structure has not a reaction in micro mode', async ({
page,
}) => {
/**
* Test case: #3531
* Description: "containsReaction" method returns "false" if structure has not a reaction in micro mode
*/
await waitForLoad(page, async () => {
await drawBenzeneRing(page);
});
const containsReaction = await page.evaluate(() => {
return window.ketcher.containsReaction();
});

expect(containsReaction).not.toBe(true);
});
});
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 @@ -462,12 +462,14 @@ test.describe('Indigo Tools - Calculate CIP Tool', () => {
expect(ketFile).toEqual(ketFileExpected);
});

test('Save as .mol V2000 file structure with stereo labels', async ({
test('Save as .mol V2000 file structure with stereo labels @FlackyTest', async ({
page,
}) => {
/*
Test case: EPMLSOPKET-1911
Description: The file is saved as .mol V2000 file.
IMPORTANT: This test some times fails because of https://github.com/epam/ketcher/issues/2647 and https://github.com/epam/ketcher/issues/3951
*/
await openFileAndAddToCanvas(
'Molfiles-V2000/structure-with-stereo-bonds.mol',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,7 @@ test.describe('1. User can expand hydrogens for ', () => {
for (const fileName of fileNames) {
test(`by ${fileName}`, async ({ page }) => {
if (temporaryFailedTestsFileNames.includes(fileName)) {
// These tests are not stable
test.fail();
}

Expand Down Expand Up @@ -656,6 +657,7 @@ test.describe('2. User can expand hydrogens for ', () => {
for (const fileName of fileNames) {
test(`by ${fileName}`, async ({ page }) => {
if (temporaryFailedTestsFileNames.includes(fileName)) {
// These tests are not stable
test.fail();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
selectRectangleArea,
openFileAndAddToCanvasMacro,
dragMouseTo,
waitForRender,
} from '@utils';

const fileName = 'KET/alanine-monomers-bonded.ket';
Expand Down Expand Up @@ -50,6 +51,12 @@ test.describe('addFragment', () => {
page,
async () => await addFragment(page, fileContents),
);
const numberOfPressZoomOut = 6;
for (let i = 0; i < numberOfPressZoomOut; i++) {
await waitForRender(page, async () => {
await page.getByTestId('zoom-out-button').click();
});
}
});

test('ket with two monomers bonded', async ({ page }) => {
Expand All @@ -58,5 +65,11 @@ test.describe('addFragment', () => {
page,
async () => await addFragment(page, fileContents),
);
const numberOfPressZoomOut = 6;
for (let i = 0; i < numberOfPressZoomOut; i++) {
await waitForRender(page, async () => {
await page.getByTestId('zoom-out-button').click();
});
}
});
});
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
@@ -0,0 +1,88 @@
/* eslint-disable no-magic-numbers */
import { test, expect } from '@playwright/test';
import { waitForPageInit, turnOnMacromoleculesEditor } from '@utils';

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

test('Check that generateImage method works with macromolecules', async ({
page,
}) => {
const jsonString = JSON.stringify({
root: {
nodes: [
{
$ref: 'monomer243878',
},
],
connections: [],
templates: [
{
$ref: 'monomerTemplate-Cya___3-sulfoalanine',
},
],
},
monomer243878: {
type: 'monomer',
id: '243878',
position: {
x: 6.42571029663086,
y: -5.901278495788574,
},
alias: 'Cya',
templateId: 'Cya___3-sulfoalanine',
},
'monomerTemplate-Cya___3-sulfoalanine': {
type: 'monomerTemplate',
atoms: [
{ label: 'C', location: [0.5437, 0.778, 0] },
{ label: 'C', location: [0.5429, -0.7228, 0], stereoLabel: 'abs' },
{ label: 'C', location: [1.8417, -1.4748, 0] },
{ label: 'O', location: [1.841, -2.6748, 0] },
{ label: 'O', location: [2.8815, -0.8757, 0] },
{ label: 'N', location: [-0.756, -1.4748, 0] },
{ label: 'H', location: [-1.7964, -0.8767, 0] },
{ label: 'S', location: [-0.7551, 1.53, 0] },
{ label: 'O', location: [-0.7544, 2.73, 0] },
{ label: 'O', location: [-1.7949, 0.9309, 0] },
{ label: 'O', location: [-1.794, 2.1307, 0] },
],
bonds: [
{ type: 1, atoms: [1, 0], stereo: 1 },
{ type: 1, atoms: [1, 2] },
{ type: 2, atoms: [2, 3] },
{ type: 1, atoms: [2, 4] },
{ type: 1, atoms: [1, 5] },
{ type: 1, atoms: [5, 6] },
{ type: 1, atoms: [0, 7] },
{ type: 2, atoms: [7, 8] },
{ type: 2, atoms: [7, 9] },
{ type: 1, atoms: [7, 10] },
],
class: 'AminoAcid',
classHELM: 'PEPTIDE',
id: 'Cya___3-sulfoalanine',
fullName: '3-sulfoalanine',
alias: 'Cya',
attachmentPoints: [
{ attachmentAtom: 5, leavingGroup: { atoms: [6] }, type: 'left' },
{ attachmentAtom: 2, leavingGroup: { atoms: [4] }, type: 'right' },
],
naturalAnalogShort: 'A',
},
});

await page.waitForFunction(() => window.ketcher);

const image = await page.evaluate(async (jsonString) => {
const result = await window.ketcher.generateImage(jsonString);
return result;
}, jsonString);

expect(image).not.toBeNull();
expect(image).not.toBe('');
});
});
Loading

0 comments on commit 6f302d3

Please sign in to comment.