From fe1f775fad04ec2f902dfcfa2e554ed929b6ce50 Mon Sep 17 00:00:00 2001 From: Isak Date: Fri, 13 Dec 2024 11:37:23 +0100 Subject: [PATCH] added flakey timed-out test + unit test that should fail for now(but should be replaced) --- .../src/e2e_tests/e2eUtils.ts | 10 ++++++++++ .../src/e2e_tests/syntaxValidation.spec.tsx | 19 +++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/packages/react-codemirror/src/e2e_tests/e2eUtils.ts b/packages/react-codemirror/src/e2e_tests/e2eUtils.ts index 441dcce09..53d7a74af 100644 --- a/packages/react-codemirror/src/e2e_tests/e2eUtils.ts +++ b/packages/react-codemirror/src/e2e_tests/e2eUtils.ts @@ -59,6 +59,16 @@ export class CypherEditorPage { return this.checkNotificationMessage('warning', queryChunk, expectedMsg); } + async checkNoNotificationMessage(type: 'error' | 'warning') { + await this.page.waitForTimeout(3000); + await expect(this.page.locator('.cm-lintRange-' + type)).toHaveCount(0, { + timeout: 3000, + }); + await expect(this.page.locator('.cm-lintPoint-' + type)).toHaveCount(0, { + timeout: 3000, + }); + } + private async checkNotificationMessage( type: 'error' | 'warning', queryChunk: string, diff --git a/packages/react-codemirror/src/e2e_tests/syntaxValidation.spec.tsx b/packages/react-codemirror/src/e2e_tests/syntaxValidation.spec.tsx index a9dfbcd3a..e2b75f3bc 100644 --- a/packages/react-codemirror/src/e2e_tests/syntaxValidation.spec.tsx +++ b/packages/react-codemirror/src/e2e_tests/syntaxValidation.spec.tsx @@ -48,6 +48,25 @@ test('Syntactic errors are surfaced', async ({ page, mount }) => { ); }); +test('Does not trigger syntax errors for backticked parameters in parameter creation', async ({ page, mount }) => { + const editorPage = new CypherEditorPage(page); + + const query = ':param x => "abc"'; + await mount(); + + await editorPage.checkNoNotificationMessage('error'); +}); + +test('Unit test that checkNoNotification fails on query with error', async ({ page, mount }) => { + const editorPage = new CypherEditorPage(page); + + const query = 'METCH (n) RETURN n'; + await mount(); + + await editorPage.checkNoNotificationMessage('error'); + await editorPage.checkNoNotificationMessage('warning'); +}); + test('Errors for undefined labels are surfaced', async ({ page, mount }) => { const editorPage = new CypherEditorPage(page); const query = 'MATCH (n: Person) RETURN n';