diff --git a/.cursor/rules/playwright.mdc b/.cursor/rules/playwright.mdc new file mode 100644 index 00000000..bc8d2acb --- /dev/null +++ b/.cursor/rules/playwright.mdc @@ -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. diff --git a/src/alphalib/types/robots/ai-chat.ts b/src/alphalib/types/robots/ai-chat.ts index 523f524d..da94e545 100644 --- a/src/alphalib/types/robots/ai-chat.ts +++ b/src/alphalib/types/robots/ai-chat.ts @@ -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(), @@ -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(), @@ -136,7 +138,7 @@ export const meta: RobotMetaInput = { trackOutputFileSize: true, isInternal: false, removeJobResultFilesFromDiskRightAfterStoringOnS3: false, - stage: 'ga', + stage: 'alpha', } export const vendorModelSchema = z