Skip to content

Commit 1f197f8

Browse files
committed
fix e2e test
1 parent d89924b commit 1f197f8

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

packages/react-codemirror/src/CypherEditor.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,9 @@ export class CypherEditor extends Component<
190190
theme: 'light',
191191
};
192192

193-
private debouncedOnChange = debounce(this.props.onChange, 200);
193+
private debouncedOnChange = this.props.onChange
194+
? debounce(this.props.onChange, 200)
195+
: undefined;
194196

195197
componentDidMount(): void {
196198
const {

packages/react-codemirror/src/e2e_tests/sanity-checks.spec.tsx

+8-3
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ test('the editors text can be externally controlled ', async ({ mount }) => {
2222
await expect(component).toContainText(newValue);
2323
});
2424

25-
test('the editors can report changes to the text ', async ({ mount, page }) => {
25+
test('the editor can report changes to the text ', async ({ mount, page }) => {
2626
const intitialValue = 'MATCH (n) ';
2727

2828
let editorValueCopy = intitialValue;
@@ -36,11 +36,16 @@ test('the editors can report changes to the text ', async ({ mount, page }) => {
3636

3737
await textField.fill('RETURN 12');
3838

39-
expect(editorValueCopy).toBe('RETURN 12');
39+
// editor update is debounced, retry wait for debounced
40+
await expect(() => {
41+
expect(editorValueCopy).toBe('RETURN 12');
42+
}).toPass({ timeout: 0, intervals: [300, 300, 1000] });
4043

4144
await page.keyboard.type('34');
4245

43-
expect(editorValueCopy).toBe('RETURN 1234');
46+
await expect(() => {
47+
expect(editorValueCopy).toBe('RETURN 12');
48+
}).toPass({ timeout: 0, intervals: [300, 300, 1000] });
4449
});
4550

4651
test('can complete RETURN', async ({ page, mount }) => {

0 commit comments

Comments
 (0)