Skip to content

Chore/mini projects test#37

Closed
biocodeit wants to merge 20 commits intoDancode-188:mainfrom
biocodeit:chore/miniProjectsTest
Closed

Chore/mini projects test#37
biocodeit wants to merge 20 commits intoDancode-188:mainfrom
biocodeit:chore/miniProjectsTest

Conversation

@biocodeit
Copy link
Copy Markdown
Contributor

Added a comprehensive testing of Login testing by user.
New test features include:

  1. environment setup
  2. environment model
  3. complete-user-login-test
  4. scripting test
  5. authorization variable creation

biocodeit and others added 17 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.
Copy link
Copy Markdown
Owner

@Dancode-188 Dancode-188 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @biocodeit,

Excellent work on this PR! This comprehensively addresses the test script saving functionality from PR #35 and goes above and beyond with extensive e2e test coverage.

I really appreciate that you:

  • ✅ Already resolved the merge conflicts with PR #36
  • ✅ Added comprehensive test coverage including the complete user login flow
  • ✅ Implemented environment variable support and testing
  • ✅ Enhanced the API model with header and test script functionality
  • ✅ All CI checks are passing

This PR supersedes #35, so we'll close that one once this is merged.

Requested Changes

Just two minor filename typos to fix before merging:

  1. Rename: e2e/fixtures/collection.fixure.ts → collection.fixture.ts
  2. Rename: e2e/object-models/environemt-setting.model.ts → environment-setting.model.ts

You can fix these with:

  git mv e2e/fixtures/collection.fixure.ts e2e/fixtures/collection.fixture.ts
  git mv e2e/object-models/environemt-setting.model.ts
  e2e/object-models/environment-setting.model.ts
  git commit -m "fix: correct filename typos in test files"
  git push

Once those are corrected, this is ready to merge! Thanks for the great contribution! 🎉

@biocodeit
Copy link
Copy Markdown
Contributor Author

@Dancode-188 changes have been made. let me know if more changes required.

@Dancode-188
Copy link
Copy Markdown
Owner

Hey @biocodeit,

Closing this one since #41 includes everything here plus the additional test infrastructure you built in #40/#41.

I saw you fixed those typos (collection.fixure → fixture, environemt → environment) right after I left the review. Quick turnaround, appreciated.

The environment model and complete user login test you added here were good additions - they're in #41 now with better fixture organization around them.

This PR was a solid step forward from #35. The progression from here to #40 to #41 shows you were iterating and improving the architecture as you went. That's good engineering.

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