Enable frontend package unit tests in CI and fix broken tests#2802
Enable frontend package unit tests in CI and fix broken tests#2802DonOmalVindula wants to merge 1 commit into
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughEnables package workspace tests in the PR CI shard, updates LCOV strip inputs; removes per-file react-i18next mocks across many frontend tests, updates DOM queries/visible-string assertions, retargets some module mocks to package exports, and simplifies test-utils i18n resource assembly. ChangesFrontend test refactor and CI package activation
Estimated code review effort 🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@frontend/packages/configure-translations/src/components/edit-translation/__tests__/TranslationEditorHeader.test.tsx`:
- Line 92: The test assertion is checking the wrong plural form ("3 unsaved
change"); update the expectation in TranslationEditorHeader.test.tsx to assert
the pluralized text ("3 unsaved changes") and, if the component
TranslationEditorHeader uses i18n keys, ensure the i18n key or pluralization
helper used by TranslationEditorHeader (or its getUnsavedCountLabel helper) is
plural-aware so counts >1 render "unsaved changes" rather than the singular
form.
In
`@frontend/packages/configure-translations/src/pages/__tests__/TranslationsEditPage.test.tsx`:
- Around line 314-315: The test in TranslationsEditPage.test.tsx asserts the
save toast synchronously using screen.getByText('All translations saved.'),
which can be flaky because the toast appears after async mutation; change this
to use the async query: await screen.findByText('All translations saved.') and
then assert (e.g., const toast = await screen.findByText(...);
expect(toast).toBeInTheDocument()), replacing the synchronous screen.getByText
call so the test waits for the toast to appear.
In
`@frontend/packages/configure-users/src/pages/__tests__/UserInvitePage.test.tsx`:
- Around line 384-385: The tests in UserInvitePage.test.tsx use brittle
selectors (document.getElementById and getAllByDisplayValue('')) to target
password inputs; update those assertions to use accessible label-based queries
instead (e.g., screen.getByLabelText or screen.getAllByLabelText with the
visible FormLabel text for the password fields) so they rely on the associated
htmlFor labels rendered by PASSWORD_INPUT; replace occurrences around the shown
lines (and the other instances at 397-399 and 766-770) to assert presence/value
using the label queries and avoid direct id/value-based DOM lookups.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: ae526d75-e234-4e3a-828e-084e8593bd36
📒 Files selected for processing (36)
.github/workflows/pr-builder.ymlfrontend/packages/configure-agent-types/src/components/edit-agent-type/schema-settings/__tests__/EditSchemaSettings.test.tsxfrontend/packages/configure-organization-units/src/components/__tests__/OrganizationUnitDeleteDialog.test.tsxfrontend/packages/configure-organization-units/src/components/__tests__/OrganizationUnitTreePicker.test.tsxfrontend/packages/configure-organization-units/src/components/__tests__/OrganizationUnitsTreeView.test.tsxfrontend/packages/configure-organization-units/src/components/edit-organization-unit/child-organization-unit-settings/__tests__/ManageChildOrganizationUnitSection.test.tsxfrontend/packages/configure-organization-units/src/components/edit-organization-unit/customization-settings/__tests__/AppearanceSection.test.tsxfrontend/packages/configure-organization-units/src/components/edit-organization-unit/general-settings/__tests__/DangerZoneSection.test.tsxfrontend/packages/configure-organization-units/src/components/edit-organization-unit/general-settings/__tests__/EditGeneralSettings.test.tsxfrontend/packages/configure-organization-units/src/components/edit-organization-unit/general-settings/__tests__/ParentSettingsSection.test.tsxfrontend/packages/configure-organization-units/src/components/edit-organization-unit/general-settings/__tests__/QuickCopySection.test.tsxfrontend/packages/configure-organization-units/src/components/edit-organization-unit/group-settings/__tests__/ManageGroupsSection.test.tsxfrontend/packages/configure-organization-units/src/components/edit-organization-unit/user-settings/__tests__/ManageUsersSection.test.tsxfrontend/packages/configure-organization-units/src/pages/__tests__/CreateOrganizationUnitPage.test.tsxfrontend/packages/configure-organization-units/src/pages/__tests__/OrganizationUnitEditPage.test.tsxfrontend/packages/configure-organization-units/src/pages/__tests__/OrganizationUnitsListPage.test.tsxfrontend/packages/configure-translations/src/components/__tests__/TranslationDeleteDialog.test.tsxfrontend/packages/configure-translations/src/components/__tests__/TranslationsList.test.tsxfrontend/packages/configure-translations/src/components/create-translation/__tests__/InitializeLanguage.test.tsxfrontend/packages/configure-translations/src/components/create-translation/__tests__/ReviewLocaleCode.test.tsxfrontend/packages/configure-translations/src/components/create-translation/__tests__/SelectCountry.test.tsxfrontend/packages/configure-translations/src/components/create-translation/__tests__/SelectLanguage.test.tsxfrontend/packages/configure-translations/src/components/edit-translation/__tests__/NamespaceSelector.test.tsxfrontend/packages/configure-translations/src/components/edit-translation/__tests__/TranslationEditorCard.test.tsxfrontend/packages/configure-translations/src/components/edit-translation/__tests__/TranslationEditorHeader.test.tsxfrontend/packages/configure-translations/src/components/edit-translation/__tests__/TranslationFieldsView.test.tsxfrontend/packages/configure-translations/src/components/edit-translation/__tests__/TranslationJsonEditor.test.tsxfrontend/packages/configure-translations/src/pages/__tests__/TranslationCreatePage.test.tsxfrontend/packages/configure-translations/src/pages/__tests__/TranslationsEditPage.test.tsxfrontend/packages/configure-translations/src/pages/__tests__/TranslationsListPage.test.tsxfrontend/packages/configure-users/src/components/create-user/__tests__/ConfigureOrganizationUnit.test.tsxfrontend/packages/configure-users/src/components/create-user/__tests__/ConfigureUserDetails.test.tsxfrontend/packages/configure-users/src/components/create-user/__tests__/ConfigureUserType.test.tsxfrontend/packages/configure-users/src/pages/__tests__/UserCreatePage.test.tsxfrontend/packages/configure-users/src/pages/__tests__/UserInvitePage.test.tsxfrontend/packages/test-utils/src/setup.ts
💤 Files with no reviewable changes (2)
- frontend/packages/configure-organization-units/src/components/tests/OrganizationUnitDeleteDialog.test.tsx
- frontend/packages/configure-organization-units/src/components/tests/OrganizationUnitTreePicker.test.tsx
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/pr-builder.yml:
- Around line 372-375: The merge step "🔀 Merge package coverage reports"
currently masks failures with "|| true" and the artifact upload uses
"if-no-files-found: warn", so adjust both to fail fast: remove "|| true" from
the find command in the "🔀 Merge package coverage reports" step so the step
exits non‑zero when no lcov.info files are found, and change the artifact upload
step’s if-no-files-found behavior from "warn" to "error" (or remove that option)
so the job fails when the merged coverage file is missing or empty; keep the
matrix.shard gating as-is.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 9c6842ff-a890-4b88-a1fd-1df168cb46b0
📒 Files selected for processing (1)
.github/workflows/pr-builder.yml
8ac81e7 to
a39f85d
Compare
There was a problem hiding this comment.
♻️ Duplicate comments (2)
frontend/packages/configure-translations/src/pages/__tests__/TranslationsEditPage.test.tsx (2)
314-314:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winUse async query for toast assertions after async save operations.
After clicking save, the toast is rendered asynchronously following the completion of mutation requests. Using synchronous
getByText()creates timing flakiness.🔄 Suggested fix
- expect(screen.getByText('All translations saved.')).toBeInTheDocument(); + expect(await screen.findByText('All translations saved.')).toBeInTheDocument();🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@frontend/packages/configure-translations/src/pages/__tests__/TranslationsEditPage.test.tsx` at line 314, The assertion expecting the toast uses a synchronous query (screen.getByText('All translations saved.')) which is flaky because the toast appears after async mutation; replace that assertion with an async query such as await screen.findByText('All translations saved.') or wrap the assertion in a waitFor call to wait for the toast after the save click in TranslationsEditPage.test.tsx so the test waits for the async save to complete before asserting. Ensure you update the expectation that currently uses screen.getByText(...) to use the async query and keep the same assertion (.toBeInTheDocument()).
335-335:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winUse async query for error toast assertion.
The error toast also appears asynchronously after the failed save operation completes.
🔄 Suggested fix
- expect(screen.getByText('Failed to save some translations.')).toBeInTheDocument(); + expect(await screen.findByText('Failed to save some translations.')).toBeInTheDocument();🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@frontend/packages/configure-translations/src/pages/__tests__/TranslationsEditPage.test.tsx` at line 335, The test is asserting an error toast synchronously using getByText which can miss an asynchronously-rendered toast; update the assertion in TranslationsEditPage.test (replace expect(screen.getByText('Failed to save some translations.')).toBeInTheDocument()) to use an async query such as await screen.findByText('Failed to save some translations.') (and then assert truthiness or toBeInTheDocument()), or wrap the assertion in await waitFor(() => expect(screen.getByText(...)).toBeInTheDocument()) so the test waits for the toast to appear after the failed save.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Duplicate comments:
In
`@frontend/packages/configure-translations/src/pages/__tests__/TranslationsEditPage.test.tsx`:
- Line 314: The assertion expecting the toast uses a synchronous query
(screen.getByText('All translations saved.')) which is flaky because the toast
appears after async mutation; replace that assertion with an async query such as
await screen.findByText('All translations saved.') or wrap the assertion in a
waitFor call to wait for the toast after the save click in
TranslationsEditPage.test.tsx so the test waits for the async save to complete
before asserting. Ensure you update the expectation that currently uses
screen.getByText(...) to use the async query and keep the same assertion
(.toBeInTheDocument()).
- Line 335: The test is asserting an error toast synchronously using getByText
which can miss an asynchronously-rendered toast; update the assertion in
TranslationsEditPage.test (replace expect(screen.getByText('Failed to save some
translations.')).toBeInTheDocument()) to use an async query such as await
screen.findByText('Failed to save some translations.') (and then assert
truthiness or toBeInTheDocument()), or wrap the assertion in await waitFor(() =>
expect(screen.getByText(...)).toBeInTheDocument()) so the test waits for the
toast to appear after the failed save.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: e6d34ded-d30b-4123-ada6-7363eff55dcd
📒 Files selected for processing (38)
.github/workflows/pr-builder.ymlfrontend/apps/console/src/features/flows/components/visual-flow/__tests__/DecoratedVisualFlow.test.tsxfrontend/apps/console/src/features/roles/components/__tests__/RolesList.test.tsxfrontend/packages/configure-agent-types/src/components/edit-agent-type/schema-settings/__tests__/EditSchemaSettings.test.tsxfrontend/packages/configure-organization-units/src/components/__tests__/OrganizationUnitDeleteDialog.test.tsxfrontend/packages/configure-organization-units/src/components/__tests__/OrganizationUnitTreePicker.test.tsxfrontend/packages/configure-organization-units/src/components/__tests__/OrganizationUnitsTreeView.test.tsxfrontend/packages/configure-organization-units/src/components/edit-organization-unit/child-organization-unit-settings/__tests__/ManageChildOrganizationUnitSection.test.tsxfrontend/packages/configure-organization-units/src/components/edit-organization-unit/customization-settings/__tests__/AppearanceSection.test.tsxfrontend/packages/configure-organization-units/src/components/edit-organization-unit/general-settings/__tests__/DangerZoneSection.test.tsxfrontend/packages/configure-organization-units/src/components/edit-organization-unit/general-settings/__tests__/EditGeneralSettings.test.tsxfrontend/packages/configure-organization-units/src/components/edit-organization-unit/general-settings/__tests__/ParentSettingsSection.test.tsxfrontend/packages/configure-organization-units/src/components/edit-organization-unit/general-settings/__tests__/QuickCopySection.test.tsxfrontend/packages/configure-organization-units/src/components/edit-organization-unit/group-settings/__tests__/ManageGroupsSection.test.tsxfrontend/packages/configure-organization-units/src/components/edit-organization-unit/user-settings/__tests__/ManageUsersSection.test.tsxfrontend/packages/configure-organization-units/src/pages/__tests__/CreateOrganizationUnitPage.test.tsxfrontend/packages/configure-organization-units/src/pages/__tests__/OrganizationUnitEditPage.test.tsxfrontend/packages/configure-organization-units/src/pages/__tests__/OrganizationUnitsListPage.test.tsxfrontend/packages/configure-translations/src/components/__tests__/TranslationDeleteDialog.test.tsxfrontend/packages/configure-translations/src/components/__tests__/TranslationsList.test.tsxfrontend/packages/configure-translations/src/components/create-translation/__tests__/InitializeLanguage.test.tsxfrontend/packages/configure-translations/src/components/create-translation/__tests__/ReviewLocaleCode.test.tsxfrontend/packages/configure-translations/src/components/create-translation/__tests__/SelectCountry.test.tsxfrontend/packages/configure-translations/src/components/create-translation/__tests__/SelectLanguage.test.tsxfrontend/packages/configure-translations/src/components/edit-translation/__tests__/NamespaceSelector.test.tsxfrontend/packages/configure-translations/src/components/edit-translation/__tests__/TranslationEditorCard.test.tsxfrontend/packages/configure-translations/src/components/edit-translation/__tests__/TranslationEditorHeader.test.tsxfrontend/packages/configure-translations/src/components/edit-translation/__tests__/TranslationFieldsView.test.tsxfrontend/packages/configure-translations/src/components/edit-translation/__tests__/TranslationJsonEditor.test.tsxfrontend/packages/configure-translations/src/pages/__tests__/TranslationCreatePage.test.tsxfrontend/packages/configure-translations/src/pages/__tests__/TranslationsEditPage.test.tsxfrontend/packages/configure-translations/src/pages/__tests__/TranslationsListPage.test.tsxfrontend/packages/configure-users/src/components/create-user/__tests__/ConfigureOrganizationUnit.test.tsxfrontend/packages/configure-users/src/components/create-user/__tests__/ConfigureUserDetails.test.tsxfrontend/packages/configure-users/src/components/create-user/__tests__/ConfigureUserType.test.tsxfrontend/packages/configure-users/src/pages/__tests__/UserCreatePage.test.tsxfrontend/packages/configure-users/src/pages/__tests__/UserInvitePage.test.tsxfrontend/packages/test-utils/src/setup.ts
💤 Files with no reviewable changes (2)
- frontend/packages/configure-organization-units/src/components/tests/OrganizationUnitDeleteDialog.test.tsx
- frontend/packages/configure-organization-units/src/components/tests/OrganizationUnitTreePicker.test.tsx
✅ Files skipped from review due to trivial changes (2)
- frontend/packages/configure-organization-units/src/components/edit-organization-unit/customization-settings/tests/AppearanceSection.test.tsx
- frontend/packages/configure-agent-types/src/components/edit-agent-type/schema-settings/tests/EditSchemaSettings.test.tsx
🚧 Files skipped from review as they are similar to previous changes (31)
- frontend/packages/configure-organization-units/src/pages/tests/OrganizationUnitsListPage.test.tsx
- frontend/packages/configure-organization-units/src/components/edit-organization-unit/general-settings/tests/DangerZoneSection.test.tsx
- frontend/packages/configure-organization-units/src/components/edit-organization-unit/child-organization-unit-settings/tests/ManageChildOrganizationUnitSection.test.tsx
- frontend/packages/configure-translations/src/components/create-translation/tests/SelectLanguage.test.tsx
- frontend/packages/configure-organization-units/src/components/edit-organization-unit/general-settings/tests/QuickCopySection.test.tsx
- frontend/apps/console/src/features/flows/components/visual-flow/tests/DecoratedVisualFlow.test.tsx
- frontend/packages/configure-users/src/components/create-user/tests/ConfigureOrganizationUnit.test.tsx
- frontend/packages/configure-translations/src/components/edit-translation/tests/NamespaceSelector.test.tsx
- frontend/packages/configure-translations/src/components/edit-translation/tests/TranslationJsonEditor.test.tsx
- frontend/packages/test-utils/src/setup.ts
- frontend/packages/configure-translations/src/components/tests/TranslationsList.test.tsx
- frontend/packages/configure-translations/src/components/edit-translation/tests/TranslationEditorHeader.test.tsx
- frontend/packages/configure-translations/src/pages/tests/TranslationsListPage.test.tsx
- frontend/packages/configure-users/src/components/create-user/tests/ConfigureUserDetails.test.tsx
- frontend/packages/configure-organization-units/src/components/edit-organization-unit/general-settings/tests/EditGeneralSettings.test.tsx
- frontend/packages/configure-users/src/pages/tests/UserCreatePage.test.tsx
- frontend/packages/configure-users/src/pages/tests/UserInvitePage.test.tsx
- frontend/packages/configure-translations/src/components/edit-translation/tests/TranslationFieldsView.test.tsx
- frontend/packages/configure-organization-units/src/pages/tests/CreateOrganizationUnitPage.test.tsx
- frontend/packages/configure-translations/src/components/create-translation/tests/InitializeLanguage.test.tsx
- frontend/packages/configure-organization-units/src/components/edit-organization-unit/general-settings/tests/ParentSettingsSection.test.tsx
- frontend/packages/configure-users/src/components/create-user/tests/ConfigureUserType.test.tsx
- frontend/packages/configure-organization-units/src/components/edit-organization-unit/user-settings/tests/ManageUsersSection.test.tsx
- frontend/packages/configure-translations/src/components/tests/TranslationDeleteDialog.test.tsx
- frontend/packages/configure-organization-units/src/components/edit-organization-unit/group-settings/tests/ManageGroupsSection.test.tsx
- frontend/packages/configure-translations/src/components/edit-translation/tests/TranslationEditorCard.test.tsx
- .github/workflows/pr-builder.yml
- frontend/packages/configure-organization-units/src/pages/tests/OrganizationUnitEditPage.test.tsx
- frontend/packages/configure-translations/src/components/create-translation/tests/ReviewLocaleCode.test.tsx
- frontend/packages/configure-organization-units/src/components/tests/OrganizationUnitsTreeView.test.tsx
- frontend/packages/configure-translations/src/pages/tests/TranslationCreatePage.test.tsx
a39f85d to
653a08a
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/pr-builder.yml:
- Around line 366-370: The package vitest configs (e.g.,
frontend/packages/components/vitest.config.ts) don’t enable coverage while the
app config (frontend/apps/console/vite.config.ts) does; add coverage
configuration to each package vitest config by updating the exported
defineConfig to include test.coverage with provider: "istanbul" and reporters
including "lcov" (and optional "text"), or adjust package.json test scripts to
invoke vitest with --coverage, so that running pnpm --filter './packages/*' test
collects and emits LCOV coverage consistent with the PR objective.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 423045b1-270a-4f22-965f-9052008e06ff
📒 Files selected for processing (38)
.github/workflows/pr-builder.ymlfrontend/apps/console/src/features/flows/components/visual-flow/__tests__/DecoratedVisualFlow.test.tsxfrontend/apps/console/src/features/roles/components/__tests__/RolesList.test.tsxfrontend/packages/configure-agent-types/src/components/edit-agent-type/schema-settings/__tests__/EditSchemaSettings.test.tsxfrontend/packages/configure-organization-units/src/components/__tests__/OrganizationUnitDeleteDialog.test.tsxfrontend/packages/configure-organization-units/src/components/__tests__/OrganizationUnitTreePicker.test.tsxfrontend/packages/configure-organization-units/src/components/__tests__/OrganizationUnitsTreeView.test.tsxfrontend/packages/configure-organization-units/src/components/edit-organization-unit/child-organization-unit-settings/__tests__/ManageChildOrganizationUnitSection.test.tsxfrontend/packages/configure-organization-units/src/components/edit-organization-unit/customization-settings/__tests__/AppearanceSection.test.tsxfrontend/packages/configure-organization-units/src/components/edit-organization-unit/general-settings/__tests__/DangerZoneSection.test.tsxfrontend/packages/configure-organization-units/src/components/edit-organization-unit/general-settings/__tests__/EditGeneralSettings.test.tsxfrontend/packages/configure-organization-units/src/components/edit-organization-unit/general-settings/__tests__/ParentSettingsSection.test.tsxfrontend/packages/configure-organization-units/src/components/edit-organization-unit/general-settings/__tests__/QuickCopySection.test.tsxfrontend/packages/configure-organization-units/src/components/edit-organization-unit/group-settings/__tests__/ManageGroupsSection.test.tsxfrontend/packages/configure-organization-units/src/components/edit-organization-unit/user-settings/__tests__/ManageUsersSection.test.tsxfrontend/packages/configure-organization-units/src/pages/__tests__/CreateOrganizationUnitPage.test.tsxfrontend/packages/configure-organization-units/src/pages/__tests__/OrganizationUnitEditPage.test.tsxfrontend/packages/configure-organization-units/src/pages/__tests__/OrganizationUnitsListPage.test.tsxfrontend/packages/configure-translations/src/components/__tests__/TranslationDeleteDialog.test.tsxfrontend/packages/configure-translations/src/components/__tests__/TranslationsList.test.tsxfrontend/packages/configure-translations/src/components/create-translation/__tests__/InitializeLanguage.test.tsxfrontend/packages/configure-translations/src/components/create-translation/__tests__/ReviewLocaleCode.test.tsxfrontend/packages/configure-translations/src/components/create-translation/__tests__/SelectCountry.test.tsxfrontend/packages/configure-translations/src/components/create-translation/__tests__/SelectLanguage.test.tsxfrontend/packages/configure-translations/src/components/edit-translation/__tests__/NamespaceSelector.test.tsxfrontend/packages/configure-translations/src/components/edit-translation/__tests__/TranslationEditorCard.test.tsxfrontend/packages/configure-translations/src/components/edit-translation/__tests__/TranslationEditorHeader.test.tsxfrontend/packages/configure-translations/src/components/edit-translation/__tests__/TranslationFieldsView.test.tsxfrontend/packages/configure-translations/src/components/edit-translation/__tests__/TranslationJsonEditor.test.tsxfrontend/packages/configure-translations/src/pages/__tests__/TranslationCreatePage.test.tsxfrontend/packages/configure-translations/src/pages/__tests__/TranslationsEditPage.test.tsxfrontend/packages/configure-translations/src/pages/__tests__/TranslationsListPage.test.tsxfrontend/packages/configure-users/src/components/create-user/__tests__/ConfigureOrganizationUnit.test.tsxfrontend/packages/configure-users/src/components/create-user/__tests__/ConfigureUserDetails.test.tsxfrontend/packages/configure-users/src/components/create-user/__tests__/ConfigureUserType.test.tsxfrontend/packages/configure-users/src/pages/__tests__/UserCreatePage.test.tsxfrontend/packages/configure-users/src/pages/__tests__/UserInvitePage.test.tsxfrontend/packages/test-utils/src/setup.ts
💤 Files with no reviewable changes (2)
- frontend/packages/configure-organization-units/src/components/tests/OrganizationUnitDeleteDialog.test.tsx
- frontend/packages/configure-organization-units/src/components/tests/OrganizationUnitTreePicker.test.tsx
✅ Files skipped from review due to trivial changes (1)
- frontend/packages/configure-organization-units/src/components/edit-organization-unit/general-settings/tests/EditGeneralSettings.test.tsx
🚧 Files skipped from review as they are similar to previous changes (25)
- frontend/apps/console/src/features/roles/components/tests/RolesList.test.tsx
- frontend/packages/configure-agent-types/src/components/edit-agent-type/schema-settings/tests/EditSchemaSettings.test.tsx
- frontend/packages/configure-organization-units/src/components/edit-organization-unit/child-organization-unit-settings/tests/ManageChildOrganizationUnitSection.test.tsx
- frontend/packages/configure-organization-units/src/components/edit-organization-unit/user-settings/tests/ManageUsersSection.test.tsx
- frontend/packages/configure-users/src/components/create-user/tests/ConfigureUserDetails.test.tsx
- frontend/apps/console/src/features/flows/components/visual-flow/tests/DecoratedVisualFlow.test.tsx
- frontend/packages/configure-translations/src/components/create-translation/tests/SelectCountry.test.tsx
- frontend/packages/configure-organization-units/src/pages/tests/CreateOrganizationUnitPage.test.tsx
- frontend/packages/configure-organization-units/src/components/edit-organization-unit/customization-settings/tests/AppearanceSection.test.tsx
- frontend/packages/configure-translations/src/components/edit-translation/tests/NamespaceSelector.test.tsx
- frontend/packages/configure-organization-units/src/components/edit-organization-unit/group-settings/tests/ManageGroupsSection.test.tsx
- frontend/packages/configure-users/src/pages/tests/UserCreatePage.test.tsx
- frontend/packages/configure-organization-units/src/components/edit-organization-unit/general-settings/tests/DangerZoneSection.test.tsx
- frontend/packages/configure-translations/src/components/create-translation/tests/SelectLanguage.test.tsx
- frontend/packages/configure-translations/src/components/edit-translation/tests/TranslationEditorCard.test.tsx
- frontend/packages/test-utils/src/setup.ts
- frontend/packages/configure-organization-units/src/pages/tests/OrganizationUnitsListPage.test.tsx
- frontend/packages/configure-translations/src/components/edit-translation/tests/TranslationJsonEditor.test.tsx
- frontend/packages/configure-translations/src/components/create-translation/tests/ReviewLocaleCode.test.tsx
- frontend/packages/configure-organization-units/src/components/edit-organization-unit/general-settings/tests/QuickCopySection.test.tsx
- frontend/packages/configure-organization-units/src/components/edit-organization-unit/general-settings/tests/ParentSettingsSection.test.tsx
- frontend/packages/configure-users/src/pages/tests/UserInvitePage.test.tsx
- frontend/packages/configure-translations/src/components/tests/TranslationDeleteDialog.test.tsx
- frontend/packages/configure-organization-units/src/pages/tests/OrganizationUnitEditPage.test.tsx
- frontend/packages/configure-translations/src/pages/tests/TranslationCreatePage.test.tsx
868170c to
d8fedcf
Compare
Add a CI step to run frontend package workspace tests with coverage
during PR builds. Previously, only Console and Gate app tests ran
after sharding was introduced — package tests were silently skipped.
Fix broken tests across configure-translations, configure-organization-units,
configure-users, configure-agent-types, and console caused by
vi.mock('react-i18next') not working in Vitest browser mode. Remove
non-functional mocks and update assertions to use real English translations.
Load all i18n namespaces in the test-utils setup for consistent behavior.
Add Istanbul coverage configuration to all 16 package vitest configs and
collect merged LCOV reports uploaded to Codecov under the
frontend-packages-unit flag.
Also fix clipboard mock incompatibility with browser mode, relative mock
paths that don't intercept package imports, and a missing handleInputChange
call in the PASSWORD_INPUT field handler.
Fixes thunder-id#2694
d8fedcf to
fabca93
Compare
Purpose
After sharding was introduced to the test workflow, only Console and Gate app tests were executed during PRs. Tests for frontend package workspaces (
frontend/packages/*) were silently skipped. This PR enables them in CI and fixes all broken tests that were hidden by the omission.Approach
CI workflow (
pr-builder.yml):pnpm --filter './packages/*' testTest-utils setup (
test-utils/src/setup.ts):...enUS) instead of listing them individually.vi.mock('react-i18next')doesn't work in Vitest browser mode, so tests must use real translations — this ensures all namespaces resolve correctly.Test fixes (36 files across 4 packages):
vi.mock('react-i18next'), update assertions to use real English translationsObject.definePropertyinstead ofObject.assignfor read-onlynavigator.clipboard), fixgetInitialsimport error, disambiguate duplicate text selectors../../../organization-units/...) to package (@thunderid/configure-organization-units), fix async React import in mock factory, fix password label selector ambiguityagentTypesnamespace translationsRelated Issues
Related PRs
Checklist
breaking changelabel added.Security checks
Summary by CodeRabbit