Repository navigation
fix(converters): default env variable enabled to true when missing in postman env import - #8775
ravindra-bruno wants to merge 2 commits into
Conversation
… postman env import
WalkthroughPostman environment conversion now defaults missing ChangesPostman environment conversion
Estimated code review effort: 1 (Trivial) | ~5 minutes Possibly related issues
Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
|
@ravindra-bruno I believe there is already an issue and a PR to solve this, Also we may need to verify how the global environment and collection environment behave, are they both defaulting to true? can we merge the community PR to a feature branch, and work on top of it? Like adding tests and all of necessary? Or are we adopting a different approach that what is done in the community PR? #8681 |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
tests/environments/import-environment/global-env-import-missing-enabled.spec.ts (1)
16-16: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winUse the single-collection fixture directory convention.
Line 16 points to
fixtures/collection.json; single-collection E2E fixtures should be organized underfixtures/collection/. Move the collection fixture there and update this path.Based on learnings, single-collection Bruno E2E fixtures use
fixtures/collectionrather than a flat collection fixture file.🤖 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 `@tests/environments/import-environment/global-env-import-missing-enabled.spec.ts` at line 16, Update the fixture path in the test to use the single-collection directory convention, changing the `collectionFile` construction to resolve `fixtures/collection/collection.json`; move the fixture file into that directory so the test continues loading the same collection.Source: Learnings
🤖 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
`@tests/environments/import-environment/global-env-import-missing-enabled.spec.ts`:
- Around line 29-37: Move the import-related selectors and interactions from
this spec into the relevant page module under tests/utils/page, including the
Import control, import modal, file chooser/file input, variable table, and
enabled checkboxes. Expose named locators or actions through that page module,
then update the spec’s import flow and assertions to use those abstractions
instead of page.getByText, page.locator, or raw selector strings; keep the spec
focused on user actions and expectations.
---
Nitpick comments:
In
`@tests/environments/import-environment/global-env-import-missing-enabled.spec.ts`:
- Line 16: Update the fixture path in the test to use the single-collection
directory convention, changing the `collectionFile` construction to resolve
`fixtures/collection/collection.json`; move the fixture file into that directory
so the test continues loading the same collection.
🪄 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: 03a120b2-5b11-488f-9574-cab850d3d045
📒 Files selected for processing (2)
tests/environments/import-environment/fixtures/global-env-missing-enabled.jsontests/environments/import-environment/global-env-import-missing-enabled.spec.ts
| await page.getByText('Import', { exact: true }).click(); | ||
|
|
||
| const importModal = page.locator('[data-testid="import-global-environment-modal"]'); | ||
| await expect(importModal).toBeVisible(); | ||
|
|
||
| const fileChooserPromise = page.waitForEvent('filechooser'); | ||
| await page.locator('[data-testid="import-global-environment"]').click(); | ||
| const fileChooser = await fileChooserPromise; | ||
| await fileChooser.setFiles(globalEnvFile); |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win
Move selectors and import actions into page modules.
This spec directly uses page.getByText, page.locator, and raw selector strings for the import controls, modal, file input, variable table, and enabled checkboxes. Expose these locators/actions through tests/utils/page/*; keep the spec focused on user actions and assertions.
As per path instructions, E2E specs must use locators/actions exposed by tests/utils/page/* and centralize selectors in page modules.
Also applies to: 46-49, 52-55
🤖 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
`@tests/environments/import-environment/global-env-import-missing-enabled.spec.ts`
around lines 29 - 37, Move the import-related selectors and interactions from
this spec into the relevant page module under tests/utils/page, including the
Import control, import modal, file chooser/file input, variable table, and
enabled checkboxes. Expose named locators or actions through that page module,
then update the spec’s import flow and assertions to use those abstractions
instead of page.getByText, page.locator, or raw selector strings; keep the spec
focused on user actions and expectations.
Source: Path instructions
|
@ravindra-bruno We will work on top of the community PR - #8681. Closing this |
Yes @sanishchirayath1 , they are defaulting to true. I have checked both the environment before creating the pr. |
Okay @helloanoop . thanks |
[JIRA: BRU-3960]
Description
Importing a Postman environment fails with variables[N].enabled must be defined and aborts the import whenever a variable has no enabled field which Postman legitimately exports. No environment gets created.
Cause
The Postman environment converter copied enabled straight from the source, producing an undefined value when the field was absent. Environment validation requires enabled to be defined, so the import threw and aborted.
Resolution
Default enabled to true when it's missing (matching Postman, where a variable with no enabled field is treated as enabled) while still preserving an explicit false. Added a regression test covering both cases.
Contribution Checklist:
Note: Keeping the PR small and focused helps make it easier to review and merge. If you have multiple changes you want to make, please consider submitting them as separate pull requests.
Publishing to New Package Managers
Please see here for more information.
Summary by CodeRabbit
Summary by CodeRabbit
Bug Fixes
Tests