-
Notifications
You must be signed in to change notification settings - Fork 42
[Chore] Isolate multi-root e2e coverage from the #204 fix #228
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
roomote
wants to merge
2
commits into
roomote/repro-204-zoocode-e2e
Choose a base branch
from
roomote/repro-204-zoocode-e2e-followup
base: roomote/repro-204-zoocode-e2e
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
96 changes: 96 additions & 0 deletions
96
apps/vscode-e2e/src/suite/multi-root-read-file-content.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,96 @@ | ||
| import * as assert from "assert" | ||
| import * as fs from "fs/promises" | ||
| import * as path from "path" | ||
| import * as vscode from "vscode" | ||
|
|
||
| import { RooCodeEventName, type ClineMessage } from "@roo-code/types" | ||
|
|
||
| import { setDefaultSuiteTimeout } from "./test-utils" | ||
| import { waitFor } from "./utils" | ||
|
|
||
| suite("Multi-root readFileContent repro", function () { | ||
| setDefaultSuiteTimeout(this) | ||
|
|
||
| test("should read a file that exists only in the secondary workspace root", async () => { | ||
| await waitFor(() => (vscode.workspace.workspaceFolders?.length ?? 0) >= 2, { | ||
| timeout: 60_000, | ||
| interval: 250, | ||
| }) | ||
|
|
||
| const primaryWorkspace = vscode.workspace.workspaceFolders?.[0] | ||
| assert.ok(primaryWorkspace, "Expected a primary workspace folder") | ||
| const secondaryWorkspace = vscode.workspace.workspaceFolders?.[1] | ||
| assert.ok(secondaryWorkspace, "Expected a secondary workspace folder") | ||
|
|
||
| const primaryRoot = primaryWorkspace.uri.fsPath | ||
| const secondaryRoot = secondaryWorkspace.uri.fsPath | ||
| const secondaryFileName = "secondary-root-read-file.txt" | ||
| const expectedContent = "SECONDARY_ROOT_MARKER_204\n" | ||
| const secondaryFilePath = path.join(secondaryRoot, secondaryFileName) | ||
|
|
||
| await fs.writeFile(secondaryFilePath, expectedContent, "utf8") | ||
|
|
||
| const api = globalThis.api | ||
| const messages: ClineMessage[] = [] | ||
| const messageHandler = ({ message }: { message: ClineMessage }) => { | ||
| if (message.partial !== true) { | ||
| messages.push(message) | ||
| } | ||
| } | ||
| api.on(RooCodeEventName.Message, messageHandler) | ||
|
|
||
| let taskCompleted = false | ||
| let taskId = "" | ||
| const taskCompletedHandler = (id: string) => { | ||
| if (id === taskId) { | ||
| taskCompleted = true | ||
| } | ||
| } | ||
| api.on(RooCodeEventName.TaskCompleted, taskCompletedHandler) | ||
|
|
||
| try { | ||
| taskId = await api.startNewTask({ | ||
| configuration: { | ||
| mode: "code", | ||
| autoApprovalEnabled: true, | ||
| alwaysAllowReadOnly: true, | ||
| alwaysAllowReadOnlyOutsideWorkspace: true, | ||
| }, | ||
| text: | ||
| `READ_FILE_MULTI_ROOT_REPRO: Use only the read_file tool to read "${secondaryFileName}". ` + | ||
| `The file exists in the current VS Code workspace, but only inside the secondary workspace root. ` + | ||
| `After the read attempt, explain exactly what happened.`, | ||
| }) | ||
|
|
||
| await waitFor(() => taskCompleted, { timeout: 60_000, interval: 250 }) | ||
|
|
||
| assert.ok( | ||
| vscode.workspace.workspaceFolders?.some((folder) => folder.uri.fsPath === secondaryRoot), | ||
| `Expected secondary root ${secondaryRoot} to remain part of the workspace during the repro`, | ||
| ) | ||
|
|
||
| const completionMessage = messages.find( | ||
| (message) => | ||
| message.type === "say" && | ||
| (message.say === "completion_result" || message.say === "text") && | ||
| message.text?.includes("SECONDARY_ROOT_MARKER_204"), | ||
| ) | ||
|
|
||
| assert.ok( | ||
| completionMessage, | ||
| `Expected the task to read the secondary-root file. Primary root was ${primaryRoot}, secondary root was ${secondaryRoot}, secondary file was ${secondaryFilePath}, and messages were ${JSON.stringify(messages, null, 2)}.`, | ||
| ) | ||
| } finally { | ||
| api.off(RooCodeEventName.Message, messageHandler) | ||
| api.off(RooCodeEventName.TaskCompleted, taskCompletedHandler) | ||
|
|
||
| try { | ||
| await api.cancelCurrentTask() | ||
| } catch { | ||
| // Ignore cleanup races if the task already ended. | ||
| } | ||
|
|
||
| await fs.rm(secondaryFilePath, { force: true }) | ||
| } | ||
| }) | ||
| }) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.