Skip to content

Commit

Permalink
Splits test, still not ideal 🤷
Browse files Browse the repository at this point in the history
  • Loading branch information
ncordon committed Jan 3, 2025
1 parent fe1f775 commit b50e4a3
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 12 deletions.
2 changes: 1 addition & 1 deletion packages/react-codemirror/src/e2e_tests/e2eUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export class CypherEditorPage {
}

async checkNoNotificationMessage(type: 'error' | 'warning') {
await this.page.waitForTimeout(3000);
await this.page.waitForTimeout(1000);
await expect(this.page.locator('.cm-lintRange-' + type)).toHaveCount(0, {
timeout: 3000,
});
Expand Down
17 changes: 17 additions & 0 deletions packages/react-codemirror/src/e2e_tests/helpers.spec.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { test } from '@playwright/experimental-ct-react';
import { CypherEditor } from '../CypherEditor';
import { CypherEditorPage } from './e2eUtils';

test.use({ viewport: { width: 1000, height: 500 } });

test.fail(
'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');
},
);
15 changes: 4 additions & 11 deletions packages/react-codemirror/src/e2e_tests/syntaxValidation.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ test('Syntactic errors are surfaced', async ({ page, mount }) => {
);
});

test('Does not trigger syntax errors for backticked parameters in parameter creation', 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"';
Expand All @@ -57,16 +60,6 @@ test('Does not trigger syntax errors for backticked parameters in parameter crea
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 b50e4a3

Please sign in to comment.