Skip to content

Chore/req helper model#40

Closed
biocodeit wants to merge 29 commits intoDancode-188:mainfrom
biocodeit:chore/reqHelperModel
Closed

Chore/req helper model#40
biocodeit wants to merge 29 commits intoDancode-188:mainfrom
biocodeit:chore/reqHelperModel

Conversation

@biocodeit
Copy link
Copy Markdown
Contributor

Added a comprehensive request builder test
Added test involve headers , variables, auth helper

biocodeit and others added 29 commits November 27, 2025 15:07
the project often requires the script to be saved to the collection.
made all locator search in request build section as parent
added test script locators
added test script writing feature
seperate getrequestResult from apiwrap
combined getreResult with send button
added fill header for request
includes:
set auth variables to request
login token request
set token to env var
user login
dependent models needed restructuring
Dancode-188#32 (Dancode-188#36)

Added comprehensive URL validation to prevent TypeError when users type
partial or invalid URLs in the request input field.

## Changes

### Core Fix
- Added URL validation helper functions in src/lib/url-validator.ts
- Updated RequestBuilder to safely handle invalid URLs in tab name generation
- Prevents crash when typing partial URLs like "h", "ht", "https:", etc.

### User Experience Improvements
- Added visual feedback: red border when URL is invalid
- Added inline error message: "Please enter a valid HTTP(S) URL"
- Smart validation: allows template variables like {{baseUrl}} for environment variables
- Non-blocking: users can still attempt to send requests with variables

### Testing
- Added comprehensive test suite with 30+ test cases
- Tests cover: valid/invalid URLs, template variables, edge cases, partial URLs
- All tests verify the fix handles the crash scenario

## Technical Details
The crash occurred in a useEffect hook that tried to construct a URL object
without validation. The URL constructor throws TypeError for invalid input,
causing the app to crash on every keystroke as users typed.

The fix uses a three-pronged approach:
1. Validate URLs before constructing URL objects
2. Allow template variables for environment variable substitution
3. Gracefully fallback to displaying raw URL string for invalid URLs

Fixes Dancode-188#32
fix: prevent crash when entering invalid URLs in request builder, fix…
WHY:
- test sometime fail in CI
- so throttling cpu will help
- configured throttling only for local
to avoid flaky test and occurance of multiple instance need to wait
till one of the button instance is closed.
with selecting locators with same name in different section
using these could come handy
optional parameter collection and request name
helpfull to select already present request
mimics user behaviour better
to select the environemnt the button is in the top header section
created a locator to be used as parent
inlcuded auth helper, variables, script
added 28 new test taergeting request builder section
rearranged tests into targeting function, components and user workflows
added new functionality of adding headers and variables for testing
identified Dancode-188#38 Dancode-188#39 bug
@Dancode-188
Copy link
Copy Markdown
Owner

Hey @biocodeit,

I'm closing this in favor of #41.

You basically took everything from here and refactored it to be cleaner - the base fixture, the centralized fixture imports, moving the throttle logic out of BasePage. All good improvements.

The request builder tests you wrote here (all 28 of them) are solid and they carried over to #41, just more efficiently organized. And finding bugs #38 and #39 while writing these tests is exactly what comprehensive e2e testing should do.

The work you did here wasn't wasted - it was the foundation for #41. Sometimes the best way to clean architecture is to build it first, then refactor with that knowledge. That's what you did.

Closing this as superseded by #41.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants