Skip to content

Commit

Permalink
added flakey timed-out test + unit test that should fail for now(but …
Browse files Browse the repository at this point in the history
…should be replaced)
  • Loading branch information
anderson4j committed Dec 13, 2024
1 parent 0643633 commit fe1f775
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/react-codemirror/src/e2e_tests/e2eUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
19 changes: 19 additions & 0 deletions packages/react-codemirror/src/e2e_tests/syntaxValidation.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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(<CypherEditor value={query} />);

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(<CypherEditor value={query} />);

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';
Expand Down

0 comments on commit fe1f775

Please sign in to comment.