Skip to content
Merged
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,16 @@ describe('Form', () => {
agentStore.setState({ jsonSchemaMode: true });
const { container } = render(<NestedTestForm />);

await waitFor(() => {
const message = container.querySelector<HTMLParagraphElement>('[data-slot="form-message"]');
expect(message).toBeInTheDocument();
});
await waitFor(
() => {
// Wait for Monaco editor to fully initialize (not just the skeleton loading state)
expect(container.querySelector('.monaco-editor')).toBeInTheDocument();
// Wait for form validation error message to render
expect(container.querySelector('[data-slot="form-message"]')).toBeInTheDocument();
},
{ timeout: 20_000 }
);

await expect(container).toMatchScreenshot();
}, 30_000);
}, 45_000);
});
19 changes: 16 additions & 3 deletions agents-manage-ui/vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,22 @@ export default defineConfig({
name: pkgJson.name,
globals: true,
onUnhandledError(error) {
// Extract message from Error instances or serialized browser errors.
// Browser-originated errors may lose their prototype chain during
// serialization, so we check .message directly without instanceof.
const message =
(error as { message?: string })?.message ?? (typeof error === 'string' ? error : '');
// Suppress known Vitest worker RPC shutdown race condition.
// Next.js triggers background dynamic imports that can outlive test execution;
// when the worker shuts down, these pending imports cause an unhandled rejection.
// See: https://github.com/vitest-dev/vitest/issues/9458
if (error instanceof Error && error.message?.includes('Closing rpc while')) {
if (message.includes('Closing rpc while')) {
return false;
}
// Suppress Monaco editor web worker initialization errors in browser tests.
// Monaco falls back to main-thread execution when workers fail to load,
// which does not affect test correctness.
if (message.includes('Cannot use import statement outside a module')) {
return false;
}
},
Expand Down Expand Up @@ -60,8 +71,10 @@ export default defineConfig({
instances: [{ browser: 'chromium' }],
expect: {
toMatchScreenshot: {
// Increase timeout because the default `5s` is insufficient on CI
timeout: 15_000,
// Increase timeout because the default `5s` is insufficient on CI.
// Monaco editor requires extra time to stabilize (dynamic imports,
// syntax highlighting, height recalculation).
timeout: 20_000,
resolveScreenshotPath,
resolveDiffPath: resolveScreenshotPath,
comparatorOptions: {
Expand Down