Skip to content

Commit cc188a3

Browse files
committed
wait until editor is ready
1 parent beef5b0 commit cc188a3

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

packages/browser-tests/cypress.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const baseUrl = `http://localhost:9999${contextPath}`;
66
module.exports = defineConfig({
77
defaultCommandTimeout: 10000,
88
e2e: {
9-
defaultCommandTimeout: 5000,
9+
defaultCommandTimeout: 30000,
1010
screenshotOnRunFailure: false,
1111
video: false,
1212
baseUrl: baseUrl,

packages/browser-tests/cypress/commands.js

+5
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,11 @@ Cypress.Commands.add("getMountedEditor", () =>
153153
);
154154

155155
Cypress.Commands.add("getEditor", () => {
156+
cy.window().then((win) => {
157+
while (!win.monaco.__ready__) {
158+
cy.wait(100);
159+
}
160+
});
156161
cy.get(".monaco-editor[role='code']");
157162
});
158163

packages/web-console/src/scenes/Editor/Monaco/index.tsx

+8
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,14 @@ const MonacoEditor = () => {
527527
return () => window.removeEventListener("focus", setCompletionProvider)
528528
}, [])
529529

530+
useEffect(() => {
531+
// @ts-ignore
532+
if (editorReady && !window.monaco.__ready__) {
533+
// @ts-ignore
534+
window.monaco.__ready__ = true
535+
}
536+
}, [editorReady])
537+
530538
return (
531539
<Content onClick={handleEditorClick}>
532540
<Editor

0 commit comments

Comments
 (0)