* feat(variables): add variable persistence with scripting
feat(collections): implement script-driven update for collection variables, ensuring direct root modification and draft synchronization
feat(collections): enhance script variable management with baseline tracking and draft preservation
* feat(variables): add runtime variable updates and optimize disk writes by implementing dirty flags
fix(collections): handle errors during environment persistence in script execution
feat(collections): implement baseline clearing for script execution and optimize variable update handling
feat(tests): add default persistence tests for environment variables and update runtime variable handling
refactor(collections): streamline variable update handling and improve draft management by removing redundant comments and optimizing code clarity
test(collection-vars): add verification for draft edits and script variable visibility in collection settings UI
refactor(collection-vars): update header value selection logic for improved clarity and accuracy in draft isolation tests
* feat(global-environments): enhance global environment updates to resolve stale active UIDs and improve persistence logic
- Updated the `updateGlobalEnvironments` reducer to handle stale active UIDs by matching against environment names.
- Improved the logic for setting global environments and active UIDs to ensure consistency after disk reloads.
- Removed outdated tests related to persisted values in favor of more relevant assertions for environment variable handling.
* feat(variables): enhance typed value handling and persistence in global and collection environments
- Added tests to infer data types (number, boolean, object) when setting environment and collection variables.
- Updated the logic to preserve existing data types when variables are not modified by scripts.
- Implemented dirty flags to track changes in typed variables, ensuring accurate persistence across sessions.
- Refactored related tests to verify the correct behavior of typed variables in various scenarios.
* refactor(variables): streamline data type inference and enhance deletion methods
- Removed redundant data type inference logic from global and collection variable updates to simplify the codebase.
- Updated deletion methods in the Bru class to use Object.keys for improved resilience against user-defined properties.
- Added tests to ensure deletion methods function correctly even when properties are shadowed.
- Enhanced clarity in draft merge tests by standardizing keyboard shortcuts for selecting all text.
* fix(tests): correct variable naming and improve environment panel interactions
- Updated test cases to reflect the correct variable name 'wasSaved' instead of 'was-saved'.
- Modified environment panel interaction to remove forced click, enhancing test reliability.
- Added a utility function to close the environment panel in safe mode tests for better readability and maintainability.
* feat(runtime): enhance variable management and cleanup logic
- Introduced a new method to clear script-driven variable baselines for collections, ensuring no stale data leaks into new requests.
- Updated the handling of runtime variables in the Bru class to track changes with a new dirty flag, improving state management.
- Refactored the application of script environment variables to prevent direct mutations, ensuring immutability and cleaner state updates.
- Enhanced the response handling in the script runtime to conditionally include runtime variables based on their dirty state.
* feat(variables): improve request handling and state management for collections and environments
- Enhanced event listeners to clear global environment baselines on both 'testrun-started' and 'request-queued' events, preventing stale data issues.
- Updated global environment and collection variable update events to ignore stale updates from superseded requests, ensuring accurate state management.
- Refactored the Bru class to optimize variable management, including checks for existing keys before updates and deletions, improving performance and reliability.
- Introduced request UID tracking to maintain consistency across variable updates during concurrent requests.
* refactor(collections): update action to clear script variable baselines
- Replaced the dispatch of `_clearScriptGlobalEnvBaseline` with `clearScriptVariableBaselines` to improve clarity and maintainability in the Redux action handling for collections.
* feat(environments): introduce getScriptModifiedKeys utility for improved variable management
- Added a new utility function, `getScriptModifiedKeys`, to identify keys modified by scripts relative to a baseline, enhancing the handling of data types during variable updates.
- Updated the application of script environment variables to prevent overwriting user-defined draft changes during no-op writes.
- Refactored related logic in collections and global environments to utilize the new utility, ensuring accurate state management and improved clarity in the Redux slices.
* refactor(global-environments): simplify active UID resolution logic in updateGlobalEnvironments reducer
- Streamlined the logic for resolving the active global environment UID by consolidating conditions into a more concise format.
- Removed outdated comments to enhance code clarity and maintainability.
- Updated tests to ensure accurate resolution of active UIDs based on incoming environment data.
* refactor(tests): remove outdated comments and streamline environment variable row expectations
- Eliminated comments related to state sync and inference issues to enhance code clarity.
- Adjusted expectations for environment variable row rendering in tests, focusing on relevant assertions.
* feat(tests): add comprehensive tests for secret variable persistence in environments
- Introduced new test cases to validate the preservation of secret variables when updated via scripts in both collection and global environments.
- Implemented tests to ensure that secret values are encrypted before storage and can be correctly decrypted for subsequent requests.
- Added fixtures and environment configurations for testing secret variable behavior in both bru and yml formats.
- Enhanced utility functions for managing environment configurations and interactions within the test suite.
* feat(tests): enhance environment variable tests and add global variable persistence
- Updated MultiLineEditor and SingleLineEditor components to include data-testid for secret reveal toggle buttons, improving testability.
- Introduced new tests for global environment variable persistence, ensuring non-secret variables survive app restarts and are correctly interpolated.
- Added fixtures for workspace and collections to support the new global variable tests, enhancing the overall test coverage for environment management.
- Refactored utility functions to streamline interactions with environment variables in tests.
* refactor(collections): optimize environment and collection saving logic
- Simplified the persistence logic for active environments by directly constructing the environment copy, reducing unnecessary cloning.
- Updated the collection saving process to utilize the fresh collection state, ensuring accurate data is saved without drafts.
- Enhanced error handling during the save operations to improve reliability and maintainability.
* feat(tests): implement collection variable persistence tests
- Added multiple test cases to validate the persistence of collection variables across app restarts, including typed values and multiple variable settings.
- Created new fixtures for collection variables to support the tests, ensuring accurate simulation of variable management scenarios.
- Enhanced the existing collection management logic to ensure that variables are correctly set and deleted as per the test requirements.
* feat(tests): add tests for typed global environment variable persistence
- Introduced a new test suite to validate the persistence of typed global environment variables across app restarts, ensuring correct data types are maintained.
- Created a fixture for the test collection to simulate setting global variables with various data types, including number, boolean, object, and string.
- Enhanced the test logic to verify that the environment file reflects the correct state before and after application restarts.
* fix(tests): update request tab close interaction in variable persistence tests
* fix(tests): improve hover interaction for collection actions in runner tests
- Updated the hover logic for revealing collection actions to handle sidebar re-renders more reliably.
- Replaced one-shot hover with a polling mechanism to ensure visibility of actions, enhancing test stability.
* refactor(environments): streamline environment variable handling and remove ephemeral metadata logic
- Simplified the comparison logic for environment variables by removing unnecessary ephemeral metadata handling.
- Updated the saving process to directly use the environment variables without stripping metadata, enhancing clarity and maintainability.
- Removed outdated comments and unused utility functions related to ephemeral variables, improving code cleanliness.
* fix(ipc): update persistActiveEnvironment to handle requestUid for stale updates
- Modified the persistActiveEnvironment function to accept a requestUid parameter, allowing for better management of stale updates.
- Enhanced the logic to prevent disk writes for superseded requests, improving data integrity during environment persistence.
* refactor(bru): remove unused envName variable in deleteAllEnvVars method
- Eliminated the envName variable from the deleteAllEnvVars method, simplifying the logic for deleting environment variables.
- Cleaned up the method by removing unnecessary checks related to the envName, enhancing code clarity and maintainability.
* fix(bru): prevent deletion of internal __name__ variable in deleteEnvVar method
- Added a check in the deleteEnvVar method to silently ignore attempts to delete the internal __name__ variable, preserving its integrity.
- Updated tests to verify that the __name__ variable remains unchanged when deleteEnvVar is called with this key.
- Enhanced runtime tests to ensure compatibility with QuickJS by confirming that environment variables set with persist options are handled correctly.
* feat(tests): add legacy support test for environment variable persistence
- Introduced a new test suite to validate that the legacy argument for setting environment variables with persistence is still functional in version 4.
- Created a fixture to simulate the legacy syntax, ensuring that the variable is correctly persisted on disk without errors.
- Enhanced integration testing to confirm that the legacy behavior aligns with the current implementation, maintaining backward compatibility.
* test(tests): enhance legacy environment variable persistence tests for safe and developer modes
- Updated the test suite for `bru.setEnvVar` to verify that the legacy persist flag is correctly handled in both safe and developer modes.
- Introduced a helper function to streamline the verification process and ensure consistent behavior across different execution contexts.
- Adjusted the test logic to reset the environment state between mode switches, maintaining test integrity.
- Improved hover interaction in multiple persistent variable tests to ensure reliable visibility of actions during execution.
* fix(EnvironmentVariablesTable): correct change detection logic for environment variables
- Updated the logic for determining changes in environment variables to compare active current and saved values instead of previously used variablesToSave and savedValues.
- This change ensures accurate detection of modifications before saving, improving user feedback when no changes are present.
* test(tests): enhance secret variable persistence tests for environment configurations
- Updated the test suites for `bru.setEnvVar` and `bru.setGlobalEnvVar` to include interactions with the secrets tab, ensuring visibility of secret variables during various states of the environment.
- Added checks to confirm that the eye toggle functionality correctly reveals the values of secret variables after setting and overwriting them.
- Improved test coverage for secret variable persistence, validating that the expected values are displayed in both collection and global environment contexts.
* feat: enhance environment variable resolution in EnvironmentVariablesTable
- Added logic to populate process environment variables from the active workspace when no collection is selected, allowing for proper resolution of {{process.env.X}}.
- Updated workspace actions to map scratch collections to their respective workspaces, ensuring that environment variables can be resolved correctly.
This improves the user experience by providing access to workspace-specific environment variables in the environment variables table.
* refactor: improve state selection and add test IDs for better testing
- Refactored the state selection logic in EnvironmentVariablesTable for clarity.
- Added data-testid attributes to various components including CollapsibleSection, DotEnvFileDetails, DotEnvRawView, and EnvironmentList to enhance testability.
- This change aims to streamline component interactions and facilitate easier testing.
* feat: add test IDs to EnvironmentList for improved testability
- Introduced data-testid attributes to the EnvironmentList component, enhancing the ability to target elements in tests.
- This update includes test IDs for the CollapsibleSection, create .env file button, and the input field for the .env name, facilitating better integration with testing frameworks.
* refactor: simplify global environment test setup
- Removed unnecessary timeout setting and afterEach cleanup logic from the global environment process.env resolution test.
- This change streamlines the test structure, focusing on the core functionality being tested.
* fix: update placeholder text for environment variable input
* fix: handle undefined color in environment objects
Don't export if `undefined`
* fix: update collection import logic for YML and BRU formats
* fix: ensure error icon is not visible after header validation
* fix: specify format for collection and environment serialization
* feat: Set JavaScript sandbox to safe mode by default for new collections
* rm: sandbox code in playwright test
* rm: safe mode code in var interpolation test
* rm: sandbox modal code
* fix
* fix
* fix
* fix
* improve
* improvement
* fix
* fix
* refactor: update AppTitleBar and SidebarHeader components to use MenuDropdown and ActionIcon for improved UI consistency
* refactor: update button locators in tests to use data-testid for consistency and improved readability
* feat: enhance Bru grammar to support response blocks and examples
- Added new grammar rules for response headers, status, and body types (JSON, XML, text).
- Introduced parsing logic for example blocks, allowing multiple examples with various body types.
- Implemented tests for example parsing, including edge cases and complex examples with authentication.
- Created fixture files for simple and complex examples to validate parsing functionality.
feat: extend jsonToBru functionality to support response handling and examples
- Updated jsonToBru to include parsing for response headers, status, and body types (JSON, XML, text).
- Enhanced example handling to support multiple examples with various body types.
- Added comprehensive tests for example parsing, including edge cases and complex scenarios with authentication.
- Created fixture files for testing the new features and validating parsing functionality.
move: files to fixtures folder
refactor: simplify response body handling in Bru grammar and JSON conversion
- Removed specific body type handling (JSON, XML, text) from grammar and semantics.
- Updated response body parsing in jsonToBru to handle a unified response body format.
- Adjusted tests and fixtures to reflect changes in response body structure, ensuring compatibility with the new format.
feat: add response bookmarking functionality to ResponsePane
- Introduced ResponseBookmark component to allow users to save responses as examples.
- Added NameExampleModal for naming saved examples.
- Updated ResponsePane to include the new bookmarking feature.
- Implemented Redux actions to manage response examples in the collections state.
- Enhanced CollectionItem to display saved examples and allow for expansion.
fix: remove unnecessary padding from ExampleItem component
feat: implement delete and rename functionality for examples in ExampleItem component
- Added DeleteExampleModal for confirming deletion of examples.
- Integrated modal for renaming examples with state management.
- Enhanced ExampleItem to handle example deletion and renaming through modals.
- Updated Redux actions to support example updates and deletions in the collections state.
fix: example writing to disc properly
fix: example parsing errors
fix: request with example parsing error
fix: handle examples in collections and requests
feat: implement response example functionality in the application
- Added ResponseExample component to handle displaying and editing response examples.
- Integrated ResponseExampleRequestPane and ResponseExampleResponsePane for structured request and response handling.
- Enhanced RequestTabPanel and RequestTab components to support response-example tabs.
- Introduced new styled components for better UI/UX in response examples.
- Updated theme files to include styles for response examples.
- Implemented URL bar for editing request URLs in response examples.
- Added functionality for managing headers and parameters in response examples.
- Improved overall structure and organization of response example components.
add styles for example url bar
feat: add Checkbox component and Table-v2 for enhanced UI
- Introduced a new Checkbox component for better user interaction in forms.
- Added Table-v2 component to improve table rendering and resizing functionality.
- Updated existing components to utilize the new Checkbox and Table-v2 for managing headers and parameters in response examples.
- Enhanced styling for better visual consistency across components.
- Updated theme files to include styles for the new components.
feat: implement custom scrollbar styles for response example components
fix: features
add actions , view more
feat: enhance response example functionality
- Added GenerateCodeItem component for generating code snippets from response examples.
- Integrated modal for code generation within ResponseExample component.
- Updated ResponseExampleTopBar to handle example name and description editing.
- Improved state management for response examples, including new actions for updating names and descriptions.
- Enhanced ResponseExampleRequestPane to support editing and saving request details.
- Refactored URL handling in ResponseExampleUrlBar to utilize example-specific data.
- Improved overall user experience with better UI elements and state management.
feat: enhance response example management and UI components
feat: enhance editing capabilities in response example components
feat: update multipart form parameter handling in response examples
feat: refactor response example parameter handling and enhance UI interactions
feat: introduce RadioButton component and update Checkbox usage in response examples
fix: styles
fix radio button styling
fixed radio button styles
feat: add create example from sidebar
feat: enhance ResponseExample components with layout adjustments and new HeightBoundContainer
feat: add Checkbox and RadioButton components with comprehensive tests for rendering, user interactions, and accessibility
feat: playwright test csaes
rm: comments
fix: linting
fix: tests
refactor: update response example tests and enhance functionality
fix: tests
fix: e2e-tests
refactor: implement hasRequestChanges utility for better change detection
rm: console
rm: consoles
fix: lint
fix: tests
fix: response header disabled by default issue
Feat/with bru example parser (#5892)
* fix: response header disabled by default issue
feat: new parsing logic
fix: change test cases to accomodate new brulang
add: path params features
rm:consoles
six: make tab permanent on double click
fix width
feat: add status editing
feat: review fixes
review fixes
fix: review fixes
fix: post review
mv: test files
fix: review
* fix: lint
* fix: review comments
* fix: icons folder strcuture
fix: tests
fix: lint
fix: unit tests
feat: body mode selector
fix: close all collections
rm: example
feat added tests. lang change
feat: add custom status text
fix: status update
feat: add body mode, update tests
add default name prefilled for example
fix: active tab styles, prefilled name, text fixes
fix : pkg lock
fix: review
fix: review comments
fix: hide cursor when readonly
fix: height
fix: null body
fix: response body parsing
fix: test cases
feat: add method support for examples
fix: reponse parsing
fix: update response body type when content type is updated
rm : commented code
feat: update parser logic
fix: organize files
feat: enhance examples handling in collection export and import
feat: postman imports fro examples
feat: enhance OpenAPI import functionality to support examples
feat: support postman export
fix: postman export import
fix: open api tests, remove requestbody related logic
rm: examples
fix: move common attributes files
ui fixes
fix: clone issue
fix: create example from request menu
review fixes
more review fixes
mv: files, fix mode req error
organize files
fix:tests
fix: save dot issue
fix: bugs
fix: postman export
fix: import path params
* chore:improve modal handling in environment and response example tests
fix: test issues resolved
* chore: update response example tests to use new fixture files and improve cleanup logic
---------
Co-authored-by: Abhishek S Lal <abhishek@usebruno.com>
Co-authored-by: Bijin Bruno <bijin@usebruno.com>
* refactor: change how test runner opens pageWithUserData instances
* fix: test move tabs
* fix: custom ca cert tests
* fix: update file patterns and improve error messages
* fix: improve electron app launch logic
* fix: update temporary directory handling for Electron app
* fix: ensure newline at end of file in index.ts
This change adds a newline at the end of the file to comply with coding standards.
* fix: improve error handling in recursiveCopy function
- Simplified error message when source path does not exist.
- Enhanced error handling to provide clearer guidance on usage of `page` fixture.
* fix(e2e): close collections after each tests
* fix: reuse the worker instance per file instead of per user data dir
* fix: revert ssl tests as serial run is fixed
* fix: change afterEach to afterAll for cleanup
fix: change afterEach to afterAll for cleanup
---------
Co-authored-by: Bijin Bruno <bijin@usebruno.com>
* fix: resolve global env variable becoming undefined on script execution
Fixes an issue where global disabled environment variables were becoming undefined during request execution when the pre request script is non-empty.
The update ensures that global variables persist as expected and are correctly referenced throughout the request lifecycle.
Closes#5772.
* feat: added test for checking proper global env update through scripts
* refactor: updated comments for more readability and added a new data-testid in modal.
* fix: openapi request import
* fix: js sandbox mode selector doesn't show up while opening new collections in playwright tests
---------
Co-authored-by: Bijin Bruno <bijin@usebruno.com>