iblai-test
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinese/iblai-test
/iblai-test
AI Assistant: You MUST run these checks before presenting any work to the user. Do NOT show untested code.Useas the default package manager. Fall back topnpmif pnpm is not installed.npm
AI助手: 你在向用户提交任何工作前必须运行这些检查,不要展示未经测试的代码。默认使用作为包管理器,如果没有安装pnpm则回退使用pnpm。npm
Step 1: Build
步骤1:构建
Run the production build to catch TypeScript errors, missing imports, and
config issues:
bash
pnpm buildFix all errors. A failed build means broken code -- do not proceed until
the build passes cleanly.
运行生产构建来捕获TypeScript错误、缺失的导入和配置问题:
bash
pnpm build修复所有错误。构建失败意味着代码有问题——在构建完全通过前不要继续下一步操作。
Step 2: Run Unit Tests
步骤2:运行单元测试
bash
pnpm testThis runs vitest to verify:
- All paths in CSS files resolve to existing directories
@source - The symlink is valid and targets the SDK dist
lib/iblai/sdk - contains compiled JS for Tailwind class generation
lib/iblai/sdk/web-containers/source
If tests fail, the SDK symlink may be broken. Run
to check. If it's missing, run again to recreate it.
ls -la lib/iblai/sdkiblai add authbash
pnpm test这条命令会运行vitest来验证:
- CSS文件中所有路径都指向存在的目录
@source - 软链接有效且指向SDK的dist目录
lib/iblai/sdk - 包含用于Tailwind类生成的编译后JS代码
lib/iblai/sdk/web-containers/source
如果测试失败,可能是SDK软链接损坏。运行检查。如果缺失,重新运行重建链接。
ls -la lib/iblai/sdkiblai add authStep 3: Touch Test Pages
步骤3:页面测试
If this is an agent app (from iblai startapp agent
)
iblai startapp agent如果这是一个Agent应用(通过iblai startapp agent
创建)
iblai startapp agentThe app already has a full Playwright E2E suite in . Use it:
e2e/bash
pnpm test:e2eThis runs auth setup + journey tests across Chromium, Firefox, and WebKit.
Configure credentials in first.
e2e/.env.developmentFor a single browser:
bash
npx playwright test --config e2e/playwright.config.ts --project=chromium应用在目录下已经有完整的Playwright E2E测试套件,直接使用:
e2e/bash
pnpm test:e2e这条命令会在Chromium、Firefox和WebKit浏览器中运行身份验证设置和流程测试。首先在中配置凭证。
e2e/.env.development如果要在单个浏览器运行:
bash
npx playwright test --config e2e/playwright.config.ts --project=chromiumIf this is a vanilla Next.js app
如果这是原生Next.js应用
Install Playwright and a browser:
bash
pnpm add -D @playwright/test
npx playwright install --with-deps chromium--with-depsFor system deps only:
For browser binaries only:
npx playwright install-depsnpx playwright installStart the dev server:
bash
pnpm dev &Wait for http://localhost:3000 to be ready, then screenshot every page
you built:
bash
npx playwright screenshot http://localhost:3000 /tmp/home.png
npx playwright screenshot http://localhost:3000/sso-login-complete /tmp/sso.pngAdd every page you created:
bash
npx playwright screenshot http://localhost:3000/profile /tmp/profile.png
npx playwright screenshot http://localhost:3000/account /tmp/account.png
npx playwright screenshot http://localhost:3000/analytics /tmp/analytics.png
npx playwright screenshot http://localhost:3000/notifications /tmp/notifications.pngIf any command fails, the page has a render error. Fix it and re-run.
Kill the dev server when done.
安装Playwright和浏览器:
bash
pnpm add -D @playwright/test
npx playwright install --with-deps chromium--with-deps仅安装系统依赖:
仅安装浏览器二进制文件:
npx playwright install-depsnpx playwright install启动开发服务器:
bash
pnpm dev &bash
npx playwright screenshot http://localhost:3000 /tmp/home.png
npx playwright screenshot http://localhost:3000/sso-login-complete /tmp/sso.png添加你创建的所有页面:
bash
npx playwright screenshot http://localhost:3000/profile /tmp/profile.png
npx playwright screenshot http://localhost:3000/account /tmp/account.png
npx playwright screenshot http://localhost:3000/analytics /tmp/analytics.png
npx playwright screenshot http://localhost:3000/notifications /tmp/notifications.png如果任何命令执行失败,说明页面存在渲染错误。修复后重新运行。
完成后关闭开发服务器。
How to Tell Which App Type
如何判断应用类型
- Agent app: has directory with
e2e/andplaywright.config.ts, andauth.setup.tshaspackage.jsonscripttest:e2e - Vanilla Next.js app: no directory, no
e2e/scripttest:e2e
- Agent应用:存在包含和
playwright.config.ts的auth.setup.ts目录,且e2e/中存在package.json脚本test:e2e - 原生Next.js应用:没有目录,也没有
e2e/脚本test:e2e
Summary
总结
- -- must pass with zero errors
pnpm build - -- vitest must pass
pnpm test - Touch test every page -- for agent apps, or
pnpm test:e2efor vanilla appsnpx playwright screenshot - Fix any failures before showing work to the user
- —— 必须零错误通过
pnpm build - —— vitest必须通过
pnpm test - 测试每个页面 —— Agent应用运行,原生应用运行
pnpm test:e2enpx playwright screenshot - 在向用户展示工作前修复所有失败项
Full E2E Reference
完整E2E参考
For writing custom authenticated journey tests, auth setup, and
multi-browser patterns, see:
https://github.com/iblai/iblai-app-cli/blob/main/skills/testing/iblai-add-test.md
Brand guidelines: BRAND.md
如需编写自定义身份验证流程测试、身份验证设置和多浏览器测试模式,请参考:
https://github.com/iblai/iblai-app-cli/blob/main/skills/testing/iblai-add-test.md
品牌指南:BRAND.md