Skip to content

Commit 2f375c2

Browse files
authored
Stabilize SQL editor E2E state synchronization (#42)
Wait for React to commit Monaco changes in the E2E-only editor bridge before test execution continues.
1 parent 3dd33f7 commit 2f375c2

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

web/src/main.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ declare global {
4343
interface Window {
4444
__HAFA_E2E_EDITOR__?: {
4545
runAction: (actionId: string) => Promise<boolean>
46-
setValue: (value: string) => boolean
46+
setValue: (value: string) => Promise<boolean>
4747
getMarkers: () => Array<{ code: string; message: string; path: string; line: number; column: number }>
4848
}
4949
MonacoEnvironment?: {
@@ -92,8 +92,12 @@ if (e2eAuthEnabled) {
9292
async runAction(actionId) {
9393
return runE2EEditorAction(monaco.editor.getEditors(), actionId)
9494
},
95-
setValue(value) {
96-
return setE2EEditorValue(monaco.editor.getEditors(), value)
95+
async setValue(value) {
96+
const updated = setE2EEditorValue(monaco.editor.getEditors(), value)
97+
if (!updated) return false
98+
99+
await new Promise<void>((resolve) => requestAnimationFrame(() => resolve()))
100+
return true
97101
},
98102
getMarkers() {
99103
return monaco.editor.getModelMarkers({}).map((marker) => ({

0 commit comments

Comments
 (0)