Skip to content

Commit 84fcd82

Browse files
committed
update
1 parent e4eb371 commit 84fcd82

File tree

1 file changed

+42
-23
lines changed

1 file changed

+42
-23
lines changed

apps/remix-ide-e2e/src/tests/mcp_file_permissions.test.ts

Lines changed: 42 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,15 @@ const tests = {
7575
browser
7676
// Clear any existing config to ensure fresh state
7777
.waitForElementVisible('*[data-id="treeViewLitreeViewItemremix.config.json"]', 5000)
78-
.execute(function () {
78+
.executeAsyncScript(function (done: (result: any) => void) {
7979
localStorage.removeItem('remix.config.json');
80-
(window as any).getRemixAIPlugin.call('fileManager', 'remove', 'remix.config.json');
81-
(window as any).getRemixAIPlugin.remixMCPServer.reloadConfig();
82-
})
80+
(window as any).getRemixAIPlugin.call('fileManager', 'remove', 'remix.config.json')
81+
.then(function () {
82+
(window as any).getRemixAIPlugin.remixMCPServer.reloadConfig();
83+
done({ success: true });
84+
})
85+
.catch(function (err: any) { done({ error: err.message }); });
86+
}, [])
8387
.refresh()
8488
// Wait for IDE to be ready
8589
.waitForElementVisible('*[data-id="remixIdeSidePanel"]', 10000)
@@ -114,11 +118,15 @@ const tests = {
114118
.waitForElementVisible('*[data-id="remixIdeSidePanel"]', 10000)
115119
.pause(1000)
116120
.waitForElementVisible('*[data-id="treeViewLitreeViewItemremix.config.json"]', 5000)
117-
.execute(function () {
121+
.executeAsyncScript(function (done: (result: any) => void) {
118122
localStorage.removeItem('remix.config.json');
119-
(window as any).getRemixAIPlugin.call('fileManager', 'remove', 'remix.config.json');
120-
(window as any).getRemixAIPlugin.remixMCPServer.reloadConfig();
121-
})
123+
(window as any).getRemixAIPlugin.call('fileManager', 'remove', 'remix.config.json')
124+
.then(function () {
125+
(window as any).getRemixAIPlugin.remixMCPServer.reloadConfig();
126+
done({ success: true });
127+
})
128+
.catch(function (err: any) { done({ error: err.message }); });
129+
}, [])
122130
.refresh()
123131
.waitForElementVisible('*[data-id="remixIdeSidePanel"]', 10000)
124132
.pause(1000)
@@ -185,11 +193,15 @@ const tests = {
185193
.waitForElementVisible('*[data-id="remixIdeSidePanel"]', 10000)
186194
.waitForElementVisible('*[data-id="treeViewLitreeViewItemremix.config.json"]', 5000)
187195
// Clear config
188-
.execute(function () {
196+
.executeAsyncScript(function (done: (result: any) => void) {
189197
localStorage.removeItem('remix.config.json');
190-
(window as any).getRemixAIPlugin.call('fileManager', 'remove', 'remix.config.json');
191-
(window as any).getRemixAIPlugin.remixMCPServer.reloadConfig();
192-
})
198+
(window as any).getRemixAIPlugin.call('fileManager', 'remove', 'remix.config.json')
199+
.then(function () {
200+
(window as any).getRemixAIPlugin.remixMCPServer.reloadConfig();
201+
done({ success: true });
202+
})
203+
.catch(function (err: any) { done({ error: err.message }); });
204+
}, [])
193205
.refresh()
194206
.waitForElementVisible('*[data-id="remixIdeSidePanel"]', 10000)
195207
// Trigger file write via AI plugin's MCP server
@@ -254,14 +266,19 @@ const tests = {
254266
.refresh()
255267
.waitForElementVisible('*[data-id="remixIdeSidePanel"]', 10000)
256268
.waitForElementVisible('*[data-id="treeViewLitreeViewItemremix.config.json"]', 5000)
257-
.execute(function () {
269+
.executeAsyncScript(function (done: (result: any) => void) {
258270
localStorage.removeItem('remix.config.json');
259-
(window as any).getRemixAIPlugin.call('fileManager', 'remove', 'remix.config.json');
260-
(window as any).getRemixAIPlugin.remixMCPServer.reloadConfig();
261-
})
271+
(window as any).getRemixAIPlugin.call('fileManager', 'remove', 'remix.config.json')
272+
.then(function () {
273+
(window as any).getRemixAIPlugin.remixMCPServer.reloadConfig();
274+
done({ success: true });
275+
})
276+
.catch(function (err: any) { done({ error: err.message }); });
277+
}, [])
262278
.refresh()
263279
.waitForElementVisible('*[data-id="remixIdeSidePanel"]', 10000)
264-
// Trigger file write via AI plugin's MCP server
280+
.waitForElementVisible('*[data-id="treeViewLitreeViewItemremix.config.json"]', 5000)
281+
// Trigger file write via AI plugin's MCP server (fire-and-forget, modal blocks resolution)
265282
.execute(function () {
266283
const aiPlugin = (window as any).getRemixAIPlugin;
267284
if (aiPlugin && aiPlugin.remixMCPServer) {
@@ -270,12 +287,10 @@ const tests = {
270287
arguments: { path: 'denied.txt', content: 'Should not write' }
271288
});
272289
}
273-
console.log("Wrote the denied file")
274290
})
275291
// First modal - Click Deny (Cancel button)
276292
.waitForElementVisible('*[data-id="mcp_file_write_permission_initialModalDialogContainer-react"]', 30000)
277293
.modalFooterCancelClick("mcp_file_write_permission_initial") // Clicks "Deny"
278-
.pause(2000)
279294
// Verify file was NOT created
280295
.execute(function () {
281296
return (window as any).getRemixAIPlugin.call('fileManager', 'exists', 'denied.txt');
@@ -343,11 +358,15 @@ const tests = {
343358
.refresh()
344359
.waitForElementVisible('*[data-id="remixIdeSidePanel"]', 10000)
345360
.waitForElementVisible('*[data-id="treeViewLitreeViewItemremix.config.json"]', 5000)
346-
.execute(function () {
361+
.executeAsyncScript(function (done: (result: any) => void) {
347362
localStorage.removeItem('remix.config.json');
348-
(window as any).getRemixAIPlugin.call('fileManager', 'remove', 'remix.config.json');
349-
(window as any).getRemixAIPlugin.remixMCPServer.reloadConfig();
350-
})
363+
(window as any).getRemixAIPlugin.call('fileManager', 'remove', 'remix.config.json')
364+
.then(function () {
365+
(window as any).getRemixAIPlugin.remixMCPServer.reloadConfig();
366+
done({ success: true });
367+
})
368+
.catch(function (err: any) { done({ error: err.message }); });
369+
}, [])
351370
.refresh()
352371
.waitForElementVisible('*[data-id="remixIdeSidePanel"]', 1000)
353372
.execute(function () {

0 commit comments

Comments
 (0)