Comfy-Org / Comfy-Org/ComfyUI_frontend
lint: enforce comfyPageFixture/comfyExpect imports in browser_tests — forbid raw @playwright/test test/expect
- Dominant language
- TypeScript
- Stars
- 2k
- Forks
- 704
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 512
Description
## Summary
Tests under `browser_tests/` must import `comfyPageFixture as test` and `comfyExpect as expect` from the `browser_tests/fixtures/ComfyPage` module rather than the raw `@playwright/test` equivalents. Using the raw Playwright imports bypasses ComfyUI-specific fixture setup and custom matchers, which can silently produce incorrect or incomplete test behaviour.
This proscription is currently documented as **Check #9** in `.agents/checks/playwright-e2e.md` (added in #10684), but is not yet enforced automatically.
## Proposed lint rule
Add an ESLint rule (e.g. `no-restricted-imports` or a custom rule) that:
- **Errors** on `import { test } from '@playwright/test'` inside `browser_tests/**/*.spec.ts`.
- **Errors** on `import { expect } from '@playwright/test'` inside `browser_tests/**/*.spec.ts` when `comfyExpect` provides the needed matchers.
- **Allows** `expect` from `@playwright/test` only when `comfyExpect` does not cover the required assertion (this exception may need a comment-based escape hatch).
## References
- PR: https://github.com/Comfy-Org/ComfyUI_frontend/pull/10684
- Review comment: https://github.com/Comfy-Org/ComfyUI_frontend/pull/10684#discussion_r3005461285
- Requested by: @DrJKL
┆Issue is synchronized with this [Notion page](https://www.notion.so/Issue-10692-lint-enforce-comfyPageFixture-comfyExpect-imports-in-browser_tests-forbid-raw-pla-3316d73d365081feb3a4e502218a57f4) by [Unito](https://www.unito.io)
Contributor guide
Assessment
This issue has not been assessed yet.