Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion e2e/src/suite/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export async function run() {
await api.setConfiguration({
apiProvider: "openrouter",
openRouterApiKey: process.env.OPENROUTER_API_KEY!,
openRouterModelId: "anthropic/claude-3.5-sonnet",
openRouterModelId: "google/gemini-2.0-flash-001", // "anthropic/claude-3.5-sonnet",
})

await waitUntilReady({ api })
Expand Down
6 changes: 3 additions & 3 deletions e2e/src/suite/modes.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as assert from "assert"

import { getCompletion, getMessage, sleep, waitForCompletion, waitUntilAborted } from "./utils"
import { getCompletion, waitUntilCompleted } from "./utils"

suite("Roo Code Modes", () => {
test("Should handle switching modes correctly", async function () {
Expand All @@ -16,7 +16,7 @@ suite("Roo Code Modes", () => {

await api.setConfiguration({ mode: "Code", alwaysAllowModeSwitch: true, autoApprovalEnabled: true })
const switchModesTaskId = await api.startNewTask(switchModesPrompt)
await waitForCompletion({ api, taskId: switchModesTaskId, timeout: 60_000 })
await waitUntilCompleted({ api, taskId: switchModesTaskId, timeout: 60_000 })

/**
* Grade the response.
Expand All @@ -32,7 +32,7 @@ suite("Roo Code Modes", () => {

await api.setConfiguration({ mode: "Ask" })
const gradeTaskId = await api.startNewTask(gradePrompt)
await waitForCompletion({ api, taskId: gradeTaskId, timeout: 60_000 })
await waitUntilCompleted({ api, taskId: gradeTaskId, timeout: 60_000 })

const completion = getCompletion({ api, taskId: gradeTaskId })
const match = completion?.text?.match(/Grade: (\d+)/)
Expand Down
6 changes: 3 additions & 3 deletions e2e/src/suite/subtasks.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as assert from "assert"

import { sleep, waitFor, getMessage, waitForCompletion } from "./utils"
import { sleep, waitFor, getMessage, waitUntilCompleted } from "./utils"

suite("Roo Code Subtasks", () => {
test("Should handle subtask cancellation and resumption correctly", async function () {
Expand Down Expand Up @@ -48,7 +48,7 @@ suite("Roo Code Subtasks", () => {

// Start a new task with the same message as the subtask.
const anotherTaskId = await api.startNewTask(childPrompt)
await waitForCompletion({ api, taskId: anotherTaskId })
await waitUntilCompleted({ api, taskId: anotherTaskId })

// Wait a bit to ensure any task resumption would have happened.
await sleep(2_000)
Expand All @@ -66,6 +66,6 @@ suite("Roo Code Subtasks", () => {

// Clean up - cancel all tasks.
await api.clearCurrentTask()
await waitForCompletion({ api, taskId: parentTaskId })
await waitUntilCompleted({ api, taskId: parentTaskId })
})
})
15 changes: 9 additions & 6 deletions e2e/src/suite/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,16 @@ export const waitUntilAborted = async ({ api, taskId, ...options }: WaitUntilAbo
await waitFor(() => set.has(taskId), options)
}

export const waitForCompletion = async ({
api,
taskId,
...options
}: WaitUntilReadyOptions & {
type WaitUntilCompletedOptions = WaitForOptions & {
api: RooCodeAPI
taskId: string
}) => waitFor(() => !!getCompletion({ api, taskId }), options)
}

export const waitUntilCompleted = async ({ api, taskId, ...options }: WaitUntilCompletedOptions) => {
const set = new Set<string>()
api.on("taskCompleted", (taskId) => set.add(taskId))
await waitFor(() => set.has(taskId), options)
}

export const getCompletion = ({ api, taskId }: { api: RooCodeAPI; taskId: string }) =>
api.getMessages(taskId).find(({ say, partial }) => say === "completion_result" && partial === false)
Expand Down
Loading