Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 7 additions & 10 deletions example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,15 @@
"start:standalone": "cross-env MODE=standalone react-app-rewired start",
"start:remote": "cross-env MODE=remote react-app-rewired start",
"init:build": "shx mkdir -p build",
"init:dist": "cross-env-shell shx mkdir -p dist/$MODE",
"delete:dist": "cross-env-shell shx rm -rf dist/$MODE",
"copy:build": "cross-env-shell shx cp -r build/. dist/$MODE",
"prebuild": "cross-env-shell run-s init:build delete:dist init:dist",
"postbuild": "cross-env-shell npm run copy:build",
"build:remote": "cross-env-shell MODE=remote run-s prebuild build:react postbuild",
"build:standalone": "cross-env-shell MODE=standalone run-s prebuild build:react postbuild",
"build:react": "cross-env-shell MODE=$MODE react-app-rewired build && echo $MODE",
"copy:build": "node ./scripts/copy-build-to-dist.cjs",
"prebuild": "npm run init:build",
"build:remote": "cross-env MODE=remote npm run init:build && cross-env MODE=remote npm run build:react && cross-env MODE=remote npm run copy:build",
"build:standalone": "cross-env MODE=standalone npm run init:build && cross-env MODE=standalone npm run build:react && cross-env MODE=standalone npm run copy:build",
"build:react": "react-app-rewired build",
"build:react:analyze": "react-app-rewired build --analyze",
"build": "npm run build:standalone && npm run build:remote",
"build:standalone:analyze": "cross-env MODE=standalone run-s prebuild build:react:analyze postbuild",
"build:remote:analyze": "cross-env MODE=remote run-s prebuild build:react:analyze postbuild",
"build:standalone:analyze": "cross-env MODE=standalone npm run init:build && cross-env MODE=standalone npm run build:react:analyze && cross-env MODE=standalone npm run copy:build",
"build:remote:analyze": "cross-env MODE=remote npm run init:build && cross-env MODE=remote npm run build:react:analyze && cross-env MODE=remote npm run copy:build",
"test": "run-s test:prettier test:stylelint test:eslint:quiet test:types test:unit",
"test:eslint": "eslint . --ext .ts,.js,.jsx,.tsx",
"test:eslint:quiet": "npm run test:eslint -- --quiet",
Expand Down
25 changes: 25 additions & 0 deletions example/scripts/copy-build-to-dist.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
const { cp, mkdir } = require('fs/promises');
const path = require('path');

async function main() {
const mode = process.env.MODE;

if (!mode) {
throw new Error('MODE env var is required');
}

const rootDir = path.resolve(__dirname, '..');
const buildDir = path.join(rootDir, 'build');
const targetDir = path.join(rootDir, 'dist', mode);

await mkdir(targetDir, { recursive: true });
await cp(buildDir, targetDir, {
recursive: true,
force: true,
});
}

main().catch((error) => {
console.error(error);
process.exitCode = 1;
});
12 changes: 5 additions & 7 deletions ketcher-autotests/tests/specs/API/api-set-get-molecule.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ test.describe('Tests for API setMolecule/getMolecule', () => {
Test case: EPMLSOPKET- 10095
Description: Molecule set and get using V3000 format
*/
await page.waitForTimeout(5000);
const orEnantiomer = await readFileContent(
'Molfiles-V3000/or-enantiomer.mol',
);
Expand Down Expand Up @@ -416,15 +417,12 @@ test.describe('Tests for API setMolecule/getMolecule', () => {
Test case: EPMLSOPKET-13018
Description: Unknown superatom expanded/contracted added through API ketcher.setMolecule
*/
const unknownSuperatomV3000 = await readFileContent(
'Molfiles-V3000/unknown-superatom-expanded-contracted.mol',
);
await waitForSpinnerFinishedWork(
page,
async () =>
await setMolecule(
page,
await readFileContent(
'Molfiles-V3000/unknown-superatom-expanded-contracted.mol',
),
),
async () => await setMolecule(page, unknownSuperatomV3000),
);
await takeEditorScreenshot(page);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ test.describe('Ketcher-3.10 Bugs', () => {
* 3. Load from HELM: CHEM1{[4aPEGMal]}|CHEM2{[4aPEGMal]}$$$$V2.0
* 4. Select Single Bound tool
* 5. Start to connect one monomer to another using center-to-center way
* 6.Expand windows "minimize button" shows "minimize window"
* 6. Expand windows "minimize button" shows "minimize window"
*
* Version 3.10.0
*/
Expand All @@ -113,8 +113,12 @@ test.describe('Ketcher-3.10 Bugs', () => {
MacroFileType.HELM,
'CHEM1{[4aPEGMal]}|CHEM2{[4aPEGMal]}$$$$V2.0',
);
const firstMonomer = getMonomerLocator(page, { monomerId: 2 });
const secondMonomer = getMonomerLocator(page, { monomerId: 3 });
const firstMonomer = getMonomerLocator(page, {
monomerAlias: `4aPEGMal`,
}).nth(0);
const secondMonomer = getMonomerLocator(page, {
monomerAlias: `4aPEGMal`,
}).nth(1);
await bondTwoMonomers(page, firstMonomer, secondMonomer);
await AttachmentPointsDialog(page).isVisible();
await AttachmentPointsDialog(page).expandWindow();
Expand Down Expand Up @@ -178,7 +182,7 @@ test.describe('Ketcher-3.10 Bugs', () => {
* Version 3.10.0
*/
const arrangeAsARing = page.getByTestId(MonomerOption.ArrangeAsARing);
const anyMonomer = getMonomerLocator(page, { monomerId: 90 }).first();
const anyMonomer = getMonomerLocator(page, { monomerId: 376 }).first();
await CommonTopRightToolbar(page).turnOnMacromoleculesEditor({
enableFlexMode: true,
goToPeptides: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ test.describe('Bugs: ketcher-3.11.0 — first trio', () => {
*/

await openFileAndAddToCanvasMacro(page, 'KET/sugar-phosphate-core.ket');
await ContextMenu(page, getBondLocator(page, { bondId: 45 })).open();
await ContextMenu(page, getBondLocator(page, { bondId: 185 })).open();
await expect(page.getByTestId(MacroBondOption.Delete)).toBeVisible();
});

Expand Down Expand Up @@ -784,7 +784,7 @@ test.describe('Bugs: ketcher-3.11.0 — first trio', () => {
);
await CommonLeftToolbar(page).areaSelectionTool();
await selectAllStructuresOnCanvas(page);
const point = getSymbolLocator(page, { symbolId: 14 });
const point = getSymbolLocator(page, { symbolAlias: 'A' }).first();
await ContextMenu(page, point).open();
await takeEditorScreenshot(page);
});
Expand Down Expand Up @@ -838,16 +838,18 @@ test.describe('Bugs: ketcher-3.11.0 — first trio', () => {
);
await CommonLeftToolbar(page).areaSelectionTool();
await selectMonomersAndBonds(page, {
monomerIds: [68, 69, 82, 83, 73, 71, 72, 80, 79, 84],
bondIds: [97, 112, 115, 101, 102, 113, 114, 100, 111, 108],
monomerIds: [217, 222, 220, 218, 221, 232, 229, 231, 233, 228],
bondIds: [250, 251, 246, 249, 264, 260, 261, 257, 262, 263],
// monomerIds: [68, 69, 82, 83, 73, 71, 72, 80, 79, 84],
// bondIds: [97, 112, 115, 101, 102, 113, 114, 100, 111, 108],
});
await ContextMenu(page, getMonomerLocator(page, { monomerId: 80 })).click(
await ContextMenu(page, getMonomerLocator(page, { monomerId: 231 })).click(
MonomerOption.ArrangeAsARing,
);
await CommonTopRightToolbar(page).setZoomInputValue('60');
await takeElementScreenshot(
page,
getMonomerLocator(page, { monomerId: 198 }),
getMonomerLocator(page, { monomerId: 347 }),
{
padding: 150,
},
Expand Down Expand Up @@ -876,7 +878,7 @@ test.describe('Bugs: ketcher-3.11.0 — first trio', () => {
MacroFileType.HELM,
'PEPTIDE1{(A,C,D,E,F,G,H,I,K,L,M,N,O,P,Q,R,S,T,U,V,W,Y)}$$$$V2.0',
);
const monomer = getMonomerLocator(page, { monomerId: 1 });
const monomer = getMonomerLocator(page, Peptide.X);
await monomer.hover({ force: true });
await MonomerPreviewTooltip(page).waitForBecomeVisible();
await takeElementScreenshot(page, monomer, {
Expand All @@ -901,17 +903,15 @@ test.describe('Bugs: ketcher-3.11.0 — first trio', () => {
MacroFileType.HELM,
'CHEM1{[4aPEGMal]}|CHEM2{[4FB]}|CHEM3{[A6OH]}$CHEM2,CHEM1,1:R2-1:R1|CHEM3,CHEM2,1:R2-1:R1$$$V2.0',
);
const chainlocator = getSymbolLocator(page, { symbolId: 7 });
const chainlocator = getSymbolLocator(page, { symbolAlias: '@' });
const locators = await getCoordinatesOfTheMiddleOfTheScreen(page);
await CommonLeftToolbar(page).handTool();
await chainlocator.hover({ force: true });
await dragMouseTo(page, locators.x, locators.y);
await CommonLeftToolbar(page).areaSelectionTool();
await chainlocator.hover({ force: true });
await MonomerPreviewTooltip(page).waitForBecomeVisible();
await takeElementScreenshot(page, chainlocator, {
padding: 120,
});
await takeElementScreenshot(page, MonomerPreviewTooltip(page).window);
});

test('Case 25 - 5NitInd unsplit nucleotide should be shown as X symbol instead of @ one', async ({
Expand All @@ -928,9 +928,7 @@ test.describe('Bugs: ketcher-3.11.0 — first trio', () => {

await Library(page).openRNASection(RNASection.Nucleotides);
await Library(page).selectMonomer(Nucleotide._5NitInd);
await takeElementScreenshot(page, getSymbolLocator(page, { symbolId: 0 }), {
padding: 30,
});
await expect(getSymbolLocator(page, { symbolAlias: 'X' })).toBeVisible();
});

test('Case 26 - In case of multipal R1 or R2 groups second R1/R2 groups should be assigned to the smallest available Rn (n>2) if available', async () => {
Expand Down Expand Up @@ -1074,7 +1072,7 @@ test.describe('Bugs: ketcher-3.11.0 — first trio', () => {
);
await takeElementScreenshot(
page,
getMonomerLocator(page, { monomerId: 6 }),
getMonomerLocator(page, { monomerAlias: `(Unknown2)` }),
{
padding: 100,
},
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
@@ -1,5 +1,5 @@

-INDIGO-03042511542D
-INDIGO-04062612372D

0 0 0 0 0 0 0 0 0 0 0 V3000
M V30 BEGIN CTAB
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@ import { waitForRender } from '../waitForRender';

export const waitForSpinnerFinishedWork = async (
page: Page,
callback: VoidFunction,
callback: () => Promise<void>,
timeout = 250,
) => {
const loadingSpinner = page.getByTestId('loading-spinner');

callback();
await callback();
do {
await page.waitForTimeout(200);
await loadingSpinner.first().waitFor({ state: 'detached' });
Expand Down
2 changes: 1 addition & 1 deletion ketcher-autotests/tests/utils/files/readFile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export function getTestDataDirectory() {
export async function readFileContent(filePath: string) {
const testDataDirectory = getTestDataDirectory();
const resolvedFilePath = path.resolve(testDataDirectory, filePath);
return fs.promises.readFile(resolvedFilePath, 'utf8');
return await fs.promises.readFile(resolvedFilePath, 'utf8');
}

export async function openFile(page: Page, filename: string) {
Expand Down
3 changes: 3 additions & 0 deletions ketcher-autotests/tests/utils/formats/formats.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* eslint-disable no-inline-comments */
/* eslint-disable no-magic-numbers */
import { Page, expect } from '@playwright/test';
import { CommonLeftToolbar } from '@tests/pages/common/CommonLeftToolbar';
import {
Expand Down Expand Up @@ -146,6 +148,7 @@ export async function setMolecule(
structStr: string,
position?: { x: number; y: number },
): Promise<void> {
await new Promise((resolve) => setTimeout(resolve, 300)); // Ensure this runs after any ongoing operations
return await page.evaluate(
({ structStr, position }) =>
window.ketcher.setMolecule(structStr, { position }),
Expand Down
3 changes: 3 additions & 0 deletions ketcher-autotests/tests/utils/macromolecules/monomer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,9 @@ export function getSymbolLocator(
if (Object.hasOwn(options, 'symbolId')) {
attributes['data-symbol-id'] = String(symbolId);
}
if (Object.hasOwn(options, 'symbolAlias')) {
attributes['data-symbol-alias'] = String(symbolAlias);
}
if (Object.hasOwn(options, 'chainId')) {
attributes['data-chain-id'] = String(chainId);
}
Expand Down
5 changes: 0 additions & 5 deletions packages/ketcher-core/docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,7 @@ ketcher-core
- [SGroup](classes/SGroup.md)
- [SGroupBracketParams](classes/SGroupBracketParams.md)
- [SGroupForest](classes/SGroupForest.md)
- [SdfSerializer](classes/SdfSerializer.md)
- [SimpleObject](classes/SimpleObject.md)
- [SmiSerializer](classes/SmiSerializer.md)
- [Struct](classes/Struct.md)
- [Text](classes/Text.md)
- [Vec2](classes/Vec2.md)
Expand Down Expand Up @@ -97,11 +95,8 @@ ketcher-core
- [RxnArrowAttributes](interfaces/RxnArrowAttributes.md)
- [RxnPlusAttributes](interfaces/RxnPlusAttributes.md)
- [ScaleOptions](interfaces/ScaleOptions.md)
- [SdfItem](interfaces/SdfItem.md)
- [Serializer](interfaces/Serializer.md)
- [SimpleObjectAttributes](interfaces/SimpleObjectAttributes.md)
- [SmiSerializerOptions](interfaces/SmiSerializerOptions.md)
- [StructAssociatedData](interfaces/StructAssociatedData.md)
- [StructFormatter](interfaces/StructFormatter.md)
- [StructService](interfaces/StructService.md)
- [StructServiceOptions](interfaces/StructServiceOptions.md)
Expand Down
72 changes: 0 additions & 72 deletions packages/ketcher-core/docs/classes/SdfSerializer.md

This file was deleted.

Loading
Loading