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
11 changes: 11 additions & 0 deletions .cursor/rules/playwright.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
description: Playwright e2e guidelines distilled from PR #4601 feedback
globs: _src/tests/**/*.pwtest.ts,playwright.config.ts
alwaysApply: false
---
- Prefer user-centric locators: `getByRole`/`getByText` with accessible names; avoid `page.locator('body')`, `innerText()`, or raw CSS unless there is no accessible alternative.
- Make positive assertions on expected UI/text instead of looping over regexes to assert absence.
- Keep tests simple: no control-flow loops or extra variables for straightforward assertions.
- Navigate with relative URLs (`page.goto('/path')`) by setting `baseURL` in `playwright.config.ts`; avoid stringing environment URLs in tests.
- Stub or mock external/third‑party requests (Intercom, Sentry, etc.) and any auth/login endpoints to keep tests deterministic; return minimal valid JSON when the app expects data.
- Each unexpected error should surface and fail the test.
8 changes: 5 additions & 3 deletions src/alphalib/types/robots/ai-chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ const imagePartSchema = z.object({
z.string(),
z.instanceof(Uint8Array),
z.instanceof(ArrayBuffer),
z.instanceof(Buffer),
// Note: Buffer is not included here since it's Node.js-only and this code runs in browsers.
// Node.js Buffer extends Uint8Array, so Uint8Array validation handles Buffer values too.
z.instanceof(URL),
]),
mimeType: z.string().optional(),
Expand All @@ -45,7 +46,8 @@ const filePartSchema = z.object({
z.string(),
z.instanceof(Uint8Array),
z.instanceof(ArrayBuffer),
z.instanceof(Buffer),
// Note: Buffer is not included here since it's Node.js-only and this code runs in browsers.
// Node.js Buffer extends Uint8Array, so Uint8Array validation handles Buffer values too.
z.instanceof(URL),
]),
mediaType: z.string(),
Expand Down Expand Up @@ -136,7 +138,7 @@ export const meta: RobotMetaInput = {
trackOutputFileSize: true,
isInternal: false,
removeJobResultFilesFromDiskRightAfterStoringOnS3: false,
stage: 'ga',
stage: 'alpha',
}

export const vendorModelSchema = z
Expand Down