diff --git a/README.md b/README.md index d68a43ba..0563c519 100644 --- a/README.md +++ b/README.md @@ -184,9 +184,9 @@ shortest(` ### Running tests ```bash -pnpm shortest # Run all tests -pnpm shortest login.test.ts # Run specific test -pnpm shortest --headless # Run in headless mode using cli +pnpm shortest # Run all tests +pnpm shortest __tests__/login.test.ts # Run specific test +pnpm shortest --headless # Run in headless mode using cli ``` You can find example tests in the [`examples`](./examples) directory. diff --git a/packages/shortest/src/core/runner/index.ts b/packages/shortest/src/core/runner/index.ts index 2e25b6df..624bc57c 100644 --- a/packages/shortest/src/core/runner/index.ts +++ b/packages/shortest/src/core/runner/index.ts @@ -255,13 +255,6 @@ export class TestRunner { } } - // Execute test with enhanced prompt - const result = await aiClient.processAction(prompt, browserTool); - - if (!result) { - throw new Error("AI processing failed: no result returned"); - } - // Execute before function if present if (test.beforeFn) { try { @@ -274,6 +267,13 @@ export class TestRunner { } } + // Execute test with enhanced prompt + const result = await aiClient.processAction(prompt, browserTool); + + if (!result) { + throw new Error("AI processing failed: no result returned"); + } + // Parse AI result first const finalMessage = result.finalResponse.content.find( (block) =>