-
Notifications
You must be signed in to change notification settings - Fork 46.2k
feat(ci): add integration test job and rename e2e test job #11820
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…d document testing rules.
- Introduced new npm scripts for unit testing: `test:unit` and `test:unit:watch`. - Updated Vitest configuration to include test files located in `src/**/*.test.tsx`.
- Added `NEXT_PUBLIC_IS_TESTING_ENVIRONMENT` variable to `.env.default` for testing environment indication. - Updated `orval.config.ts` to enable mocking during API calls. - Modified `layout.tsx` to initialize mocks when in testing environment. - Removed `has_sensitive_action` properties from `openapi.json` to streamline API schema. - Implemented `isTestingEnvironment` function in `environment` service for environment checks.
… setup - Removed `NEXT_PUBLIC_IS_TESTING_ENVIRONMENT` variable from `.env.default` as it is no longer needed. - Updated Vitest configuration to include a setup file for tests. - Cleaned up `layout.tsx` by removing the testing environment check and mock initialization. - Updated `MainMarketplacePage.test.tsx` to use a custom render utility for better test isolation. - Deleted unused `Badge.test.tsx` file to streamline test suite. - Added comments in `mocks/index.ts` to clarify usage context for mocks.
- Updated `orval.config.ts` to configure MSW for API mocking with detailed settings. - Added `happy-dom` as a new dependency for testing environment. - Modified `vitest.config.mts` to use `happy-dom` for the testing environment. - Introduced new boolean properties `has_sensitive_action` and `sensitive_action_safe_mode` in `openapi.json` for better control over agent behavior. - Removed obsolete test files and utility functions to streamline the testing process. - Updated test setup to improve isolation and configuration.
- Removed `happy-dom` from dependencies in `package.json` and `pnpm-lock.yaml`. - Re-added `happy-dom` to `devDependencies` in `package.json` and updated its entry in `pnpm-lock.yaml` to ensure proper testing environment setup.
- Modified the `refreshSession` method in the mock Supabase client to return a session object along with the user, improving the accuracy of the mock implementation for testing purposes.
- Deleted AGENTS.md, which contained frontend testing rules and guidelines, as it is no longer relevant to the current testing framework and practices.
- Renamed the existing test job to `e2e_test` for clarity. - Added a new `integration_test` job that runs on `ubuntu-latest`. - Configured steps for checking out the repository, setting up Node.js, enabling corepack, restoring dependencies, and running unit tests using pnpm.
WalkthroughThe pull request introduces a new CI job for running integration tests alongside unit tests in the frontend pipeline. It also renames the existing test job to e2e_test for clarity and adds a unit test for the MainMarketplacePage component. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This stack of pull requests is managed by Graphite. Learn more about stacking. |
- Added a step to generate the API client using `pnpm generate:api:force` in the CI workflow before executing integration tests.
- Modified the CI workflow to use `pnpm generate:api` instead of `pnpm generate:api:force` for generating the API client, streamlining the process before running integration tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In
`@autogpt_platform/frontend/src/app/`(platform)/marketplace/components/MainMarketplacePage/__tests__/main.test.tsx:
- Line 3: The test imports/uses the misspelled component name
MainMarkeplacePage—rename the export/import to MainMarketplacePage so the
component symbol matches the folder/file; remove the unrelated mock handler
getDeleteV2DeleteStoreSubmissionMockHandler422 from this featured-agents test
(either replace it with the proper featured-agents mock or delete it), and
simplify the assertion that checks for agent text by removing the redundant
toBeDefined() call or replacing it with toBeInTheDocument() when using getByText
(update references in the test file to MainMarketplacePage and adjust the mock
and assertion accordingly).
🧹 Nitpick comments (4)
autogpt_platform/frontend/src/app/(platform)/marketplace/components/MainMarketplacePage/__tests__/main.test.tsx (2)
5-9: Mock handler doesn't match the test purpose.The test verifies "Featured agents" renders, but the mock handler
getDeleteV2DeleteStoreSubmissionMockHandler422intercepts DELETE requests for store submissions with a 422 error. This mock is unrelated to fetching/displaying featured agents.Consider using a mock handler for the actual API call that fetches marketplace/featured agents data, or remove the mock if it's not needed for this test.
12-14: UsetoBeInTheDocument()for DOM assertions.The assertion uses
toBeDefined()which only checks that the element is notundefined. For testing-library,toBeInTheDocument()from@testing-library/jest-domis more idiomatic and semantically correct for verifying DOM presence.♻️ Suggested change
- expect( - await screen.findByText("Featured agents", { exact: false }), - ).toBeDefined(); + expect( + await screen.findByText("Featured agents", { exact: false }), + ).toBeInTheDocument();.github/workflows/platform-frontend-ci.yml (2)
262-296: Job naming inconsistency:integration_testruns unit tests.The job is named
integration_testand the step says "Run Integration Tests", but it executespnpm test:unit. Consider aligning the naming:
- Rename the job to
unit_testif it runs unit tests, or- Rename the script to
test:integrationif these are meant to be integration testsThis will reduce confusion about what the job actually runs.
267-270: Removesubmodules: recursivefrom theintegration_testjob.The
integration_testjob runs unit tests (pnpm test:unit) without Docker Compose, so it has no need for recursive submodules. Thee2e_testjob (line 141) appropriately retains this setting for Docker Compose builds. Removing this from the integration job will speed up checkout without affecting test functionality.♻️ Suggested change
- name: Checkout repository uses: actions/checkout@v4 - with: - submodules: recursive
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (2)
.github/workflows/platform-frontend-ci.ymlautogpt_platform/frontend/src/app/(platform)/marketplace/components/MainMarketplacePage/__tests__/main.test.tsx
🧰 Additional context used
📓 Path-based instructions (9)
autogpt_platform/frontend/**/*.{ts,tsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
autogpt_platform/frontend/**/*.{ts,tsx}: Always run pnpm install before frontend development, then use pnpm dev to start development server on port 3000
For frontend code formatting and linting, always run pnpm formatIf adding protected frontend routes, update
frontend/lib/supabase/middleware.ts
autogpt_platform/frontend/**/*.{ts,tsx}: Use generated API hooks from@/app/api/__generated__/endpoints/for data fetching in frontend
Use function declarations (not arrow functions) for components and handlers in frontend
Only use Phosphor Icons in frontend; never use other icon libraries
Never usesrc/components/__legacy__/*or deprecatedBackendAPIin frontend
Files:
autogpt_platform/frontend/src/app/(platform)/marketplace/components/MainMarketplacePage/__tests__/main.test.tsx
autogpt_platform/frontend/**/*.{test,spec}.{ts,tsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
For frontend E2E testing with Playwright, always run pnpm dev first before pnpm test, as Playwright requires a running instance
Run
pnpm testorpnpm test-uifor frontend Playwright tests before committing
Files:
autogpt_platform/frontend/src/app/(platform)/marketplace/components/MainMarketplacePage/__tests__/main.test.tsx
autogpt_platform/frontend/**/*.{ts,tsx,json}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Use Node.js 21+ with pnpm package manager for frontend development
Files:
autogpt_platform/frontend/src/app/(platform)/marketplace/components/MainMarketplacePage/__tests__/main.test.tsx
autogpt_platform/frontend/src/**/*.{ts,tsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
autogpt_platform/frontend/src/**/*.{ts,tsx}: Use generated API hooks from@/app/api/__generated__/endpoints/(generated via Orval from backend OpenAPI spec). Pattern: use{Method}{Version}{OperationName} (e.g., useGetV2ListLibraryAgents). Regenerate with: pnpm generate:api. Never use deprecated BackendAPI or src/lib/autogpt-server-api/*
Use function declarations for components and handlers (not arrow functions). Only arrow functions for small inline lambdas (map, filter, etc.)
Use PascalCase for components, camelCase with use prefix for hooks
No barrel files or index.ts re-exports in frontend
For frontend render errors, use component. For mutation errors, display with toast notifications. For manual exceptions, use Sentry.captureException()
Default to client components (use client). Use server components only for SEO or extreme TTFB needs. Use React Query for server state via generated hooks. Co-locate UI state in components/hooks
Files:
autogpt_platform/frontend/src/app/(platform)/marketplace/components/MainMarketplacePage/__tests__/main.test.tsx
autogpt_platform/frontend/**/*.{js,ts,jsx,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Format frontend code using
pnpm format
Files:
autogpt_platform/frontend/src/app/(platform)/marketplace/components/MainMarketplacePage/__tests__/main.test.tsx
autogpt_platform/frontend/**
📄 CodeRabbit inference engine (autogpt_platform/CLAUDE.md)
autogpt_platform/frontend/**: Install frontend dependencies usingpnpm iinstead of npm
Generate API client from OpenAPI spec usingpnpm generate:api
Regenerate API client hooks usingpnpm generate:apiwhen OpenAPI spec changes
Files:
autogpt_platform/frontend/src/app/(platform)/marketplace/components/MainMarketplacePage/__tests__/main.test.tsx
autogpt_platform/frontend/src/**/*.tsx
📄 CodeRabbit inference engine (autogpt_platform/CLAUDE.md)
Use design system components from
src/components/(atoms, molecules, organisms) in frontend
Files:
autogpt_platform/frontend/src/app/(platform)/marketplace/components/MainMarketplacePage/__tests__/main.test.tsx
autogpt_platform/frontend/src/app/**/*.tsx
📄 CodeRabbit inference engine (autogpt_platform/CLAUDE.md)
Create frontend pages in
src/app/(platform)/feature-name/page.tsxwith correspondingusePageName.tshook and localcomponents/subfolder
Files:
autogpt_platform/frontend/src/app/(platform)/marketplace/components/MainMarketplacePage/__tests__/main.test.tsx
autogpt_platform/frontend/**/*.{ts,tsx,css}
📄 CodeRabbit inference engine (autogpt_platform/CLAUDE.md)
Use only Tailwind CSS for styling in frontend, with design tokens and Phosphor Icons
Files:
autogpt_platform/frontend/src/app/(platform)/marketplace/components/MainMarketplacePage/__tests__/main.test.tsx
🧠 Learnings (5)
📓 Common learnings
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T08:48:55.844Z
Learning: Applies to autogpt_platform/frontend/**/*.{test,spec}.{ts,tsx} : Run `pnpm test` or `pnpm test-ui` for frontend Playwright tests before committing
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/CLAUDE.md:0-0
Timestamp: 2025-11-25T08:49:03.583Z
Learning: Applies to autogpt_platform/frontend/**/*.stories.{ts,tsx} : Add Storybook stories for new frontend components and Playwright E2E tests for features
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-25T08:48:33.246Z
Learning: Applies to autogpt_platform/frontend/**/*.stories.{ts,tsx} : Add or update Storybook stories for UI components (pnpm storybook). Run Playwright E2E tests with pnpm test
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/CLAUDE.md:0-0
Timestamp: 2025-11-25T08:49:03.583Z
Learning: Applies to autogpt_platform/backend/**/*_test.py : Always review snapshot changes before committing using `git diff` when creating or updating test snapshots
📚 Learning: 2025-11-25T08:48:55.844Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T08:48:55.844Z
Learning: Applies to autogpt_platform/frontend/**/*.{test,spec}.{ts,tsx} : Run `pnpm test` or `pnpm test-ui` for frontend Playwright tests before committing
Applied to files:
.github/workflows/platform-frontend-ci.ymlautogpt_platform/frontend/src/app/(platform)/marketplace/components/MainMarketplacePage/__tests__/main.test.tsx
📚 Learning: 2025-11-25T08:48:33.246Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-25T08:48:33.246Z
Learning: Applies to autogpt_platform/frontend/**/*.stories.{ts,tsx} : Add or update Storybook stories for UI components (pnpm storybook). Run Playwright E2E tests with pnpm test
Applied to files:
.github/workflows/platform-frontend-ci.ymlautogpt_platform/frontend/src/app/(platform)/marketplace/components/MainMarketplacePage/__tests__/main.test.tsx
📚 Learning: 2025-11-25T08:49:03.583Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/CLAUDE.md:0-0
Timestamp: 2025-11-25T08:49:03.583Z
Learning: Applies to autogpt_platform/frontend/**/*.stories.{ts,tsx} : Add Storybook stories for new frontend components and Playwright E2E tests for features
Applied to files:
.github/workflows/platform-frontend-ci.ymlautogpt_platform/frontend/src/app/(platform)/marketplace/components/MainMarketplacePage/__tests__/main.test.tsx
📚 Learning: 2025-11-25T08:49:03.583Z
Learnt from: CR
Repo: Significant-Gravitas/AutoGPT PR: 0
File: autogpt_platform/CLAUDE.md:0-0
Timestamp: 2025-11-25T08:49:03.583Z
Learning: Applies to autogpt_platform/frontend/src/app/**/*.tsx : Create frontend pages in `src/app/(platform)/feature-name/page.tsx` with corresponding `usePageName.ts` hook and local `components/` subfolder
Applied to files:
autogpt_platform/frontend/src/app/(platform)/marketplace/components/MainMarketplacePage/__tests__/main.test.tsx
🧬 Code graph analysis (1)
autogpt_platform/frontend/src/app/(platform)/marketplace/components/MainMarketplacePage/__tests__/main.test.tsx (1)
autogpt_platform/frontend/src/mocks/mock-server.ts (1)
server(4-4)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
- GitHub Check: Seer Code Review
- GitHub Check: types
- GitHub Check: e2e_test
- GitHub Check: Check PR Status
🔇 Additional comments (1)
.github/workflows/platform-frontend-ci.yml (1)
131-131: LGTM on renamingtesttoe2e_test.Clear naming that distinguishes this job from the new integration/unit test job.
✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

Changes 🏗️
testjob toe2e_testin the CI workflow for better clarityintegration_testjob to the CI workflow that runs unit tests usingpnpm test:unitChecklist 📋
For code changes:
For configuration changes:
.env.defaultis updated or already compatible with my changesdocker-compose.ymlis updated or already compatible with my changes