mirror of
https://github.com/m1ngsama/TUT.git
synced 2026-02-08 00:54:05 +00:00
feat: Add comprehensive testing tools and improve help
- Add test_browser.sh interactive testing script - Add TESTING.md comprehensive testing guide - Update help text with form interaction details - Include keyboard shortcuts for text input and dropdowns - Add instructions for all new features Improvements: - Help now shows 'i' key for form focus - Text input editing instructions - Dropdown selection navigation guide - Testing checklist for all features - Interactive test script for easy website testing
This commit is contained in:
parent
c7c11e08f8
commit
63fbee6d30
3 changed files with 251 additions and 2 deletions
146
TESTING.md
Normal file
146
TESTING.md
Normal file
|
|
@ -0,0 +1,146 @@
|
|||
# TUT Browser Testing Guide
|
||||
|
||||
This document provides comprehensive testing instructions to ensure the browser works correctly.
|
||||
|
||||
## Quick Start
|
||||
|
||||
```bash
|
||||
# Build the browser
|
||||
cmake -B build -S . -DCMAKE_BUILD_TYPE=Debug
|
||||
cmake --build build
|
||||
|
||||
# Run with a test site
|
||||
./build/tut http://example.com
|
||||
|
||||
# Or use the interactive test script
|
||||
./test_browser.sh
|
||||
```
|
||||
|
||||
## Feature Testing Checklist
|
||||
|
||||
### Basic Navigation
|
||||
- [ ] Browser loads and displays page correctly
|
||||
- [ ] Scroll with j/k works smoothly
|
||||
- [ ] Page up/down (Ctrl+d/u) works
|
||||
- [ ] Go to top (gg) and bottom (G) works
|
||||
- [ ] Back (h) and forward (l) navigation works
|
||||
|
||||
### Link Navigation
|
||||
- [ ] Tab cycles through links
|
||||
- [ ] Shift+Tab goes to previous link
|
||||
- [ ] Enter follows the active link
|
||||
- [ ] Links are highlighted when active
|
||||
- [ ] Link URLs shown in status bar
|
||||
|
||||
### Search
|
||||
- [ ] Press / to enter search mode
|
||||
- [ ] Type search term and press Enter
|
||||
- [ ] Matches are highlighted
|
||||
- [ ] n/N navigate between matches
|
||||
- [ ] Search count shown in status bar
|
||||
|
||||
### Form Interaction
|
||||
- [ ] Press 'i' to focus first form field
|
||||
- [ ] Tab/Shift+Tab navigate between fields
|
||||
- [ ] Enter on text input enters edit mode
|
||||
- [ ] Text can be typed and edited
|
||||
- [ ] Backspace removes characters
|
||||
- [ ] Enter or Esc exits edit mode
|
||||
- [ ] Checkbox toggles with Enter
|
||||
- [ ] SELECT dropdown shows options
|
||||
- [ ] j/k navigate dropdown options
|
||||
- [ ] Enter selects option in dropdown
|
||||
- [ ] Selected option displays correctly
|
||||
|
||||
### Bookmarks
|
||||
- [ ] Press B to bookmark current page
|
||||
- [ ] Press D to remove bookmark
|
||||
- [ ] Type :bookmarks to view all bookmarks
|
||||
- [ ] Bookmarks persist between sessions
|
||||
- [ ] Can click bookmarks to open pages
|
||||
|
||||
### History
|
||||
- [ ] Type :history to view browsing history
|
||||
- [ ] History shows URLs and titles
|
||||
- [ ] History entries are clickable
|
||||
- [ ] History persists between sessions
|
||||
- [ ] Recent pages appear at top
|
||||
|
||||
### Performance
|
||||
- [ ] Page loads are async with spinner
|
||||
- [ ] Esc cancels page loading
|
||||
- [ ] Page cache works (revisit loads instantly)
|
||||
- [ ] Image cache works (images load from cache)
|
||||
- [ ] Status shows "cached: N" for cached images
|
||||
- [ ] Scrolling is smooth
|
||||
- [ ] No noticeable lag in UI
|
||||
|
||||
### Commands
|
||||
- [ ] :o URL opens new URL
|
||||
- [ ] :q quits the browser
|
||||
- [ ] :bookmarks shows bookmarks
|
||||
- [ ] :history shows history
|
||||
- [ ] :help shows help page
|
||||
- [ ] ? also shows help page
|
||||
|
||||
### Edge Cases
|
||||
- [ ] Window resize updates layout correctly
|
||||
- [ ] Very long pages scroll correctly
|
||||
- [ ] Pages without links/forms work
|
||||
- [ ] Unicode text displays correctly
|
||||
- [ ] CJK characters display correctly
|
||||
- [ ] Images render as ASCII art (if stb_image available)
|
||||
- [ ] Error handling for failed page loads
|
||||
|
||||
## Test Websites
|
||||
|
||||
### Simple Test Sites
|
||||
1. **http://example.com** - Basic HTML test
|
||||
2. **http://info.cern.ch** - First website ever, very simple
|
||||
3. **http://motherfuckingwebsite.com** - Minimalist design
|
||||
4. **http://textfiles.com** - Text-only content
|
||||
|
||||
### Form Testing
|
||||
Create a local test file (test_form.html is provided):
|
||||
```bash
|
||||
python3 -m http.server 8000
|
||||
./build/tut http://localhost:8000/test_form.html
|
||||
```
|
||||
|
||||
Test the form features:
|
||||
- Text input editing
|
||||
- Checkbox toggling
|
||||
- Dropdown selection
|
||||
- Tab navigation
|
||||
|
||||
### Performance Testing
|
||||
1. Load a page
|
||||
2. Press 'r' to refresh (should use cache)
|
||||
3. Load the same page again (should be instant from cache)
|
||||
4. Check status bar shows "cached" messages
|
||||
|
||||
## Known Limitations
|
||||
|
||||
- HTTPS support depends on libcurl configuration
|
||||
- Some complex JavaScript-heavy sites won't work (static HTML only)
|
||||
- File:// URLs may not work depending on curl configuration
|
||||
- Form submission is not yet implemented
|
||||
- Cookies are not yet supported
|
||||
|
||||
## Reporting Issues
|
||||
|
||||
When reporting issues, please include:
|
||||
1. The URL you were trying to load
|
||||
2. The exact steps to reproduce
|
||||
3. Expected vs actual behavior
|
||||
4. Any error messages
|
||||
|
||||
## Success Criteria
|
||||
|
||||
The browser is working correctly if:
|
||||
1. ✓ Can load and display simple HTML pages
|
||||
2. ✓ Navigation (scroll, links) works smoothly
|
||||
3. ✓ Form interaction is responsive and intuitive
|
||||
4. ✓ Bookmarks and history persist correctly
|
||||
5. ✓ Caching improves performance noticeably
|
||||
6. ✓ No crashes or hangs during normal use
|
||||
|
|
@ -979,8 +979,29 @@ public:
|
|||
|
||||
<h2>Forms</h2>
|
||||
<ul>
|
||||
<li>Tab - Navigate links and form fields</li>
|
||||
<li>Enter - Activate link or submit form</li>
|
||||
<li>i - Focus first form field</li>
|
||||
<li>Tab/Shift+Tab - Navigate between fields</li>
|
||||
<li>Enter - Activate field (text input/checkbox/dropdown)</li>
|
||||
</ul>
|
||||
|
||||
<h3>Text Input</h3>
|
||||
<ul>
|
||||
<li>Type to edit text</li>
|
||||
<li>Backspace to delete</li>
|
||||
<li>Enter or Esc to finish editing</li>
|
||||
</ul>
|
||||
|
||||
<h3>Dropdown Selection</h3>
|
||||
<ul>
|
||||
<li>Enter on SELECT to open options</li>
|
||||
<li>j/k or arrows to navigate options</li>
|
||||
<li>Enter to select, Esc to cancel</li>
|
||||
</ul>
|
||||
|
||||
<h2>Other</h2>
|
||||
<ul>
|
||||
<li>r - Refresh page (bypass cache)</li>
|
||||
<li>Esc - Cancel loading</li>
|
||||
</ul>
|
||||
|
||||
<hr>
|
||||
|
|
|
|||
82
test_browser.sh
Executable file
82
test_browser.sh
Executable file
|
|
@ -0,0 +1,82 @@
|
|||
#!/bin/bash
|
||||
|
||||
# TUT Browser Interactive Test Script
|
||||
# This script helps test the browser with various real websites
|
||||
|
||||
echo "========================================"
|
||||
echo " TUT 2.0 Browser Interactive Testing"
|
||||
echo "========================================"
|
||||
echo ""
|
||||
echo "This script will help you test the browser with real websites."
|
||||
echo "Press Ctrl+C to exit at any time."
|
||||
echo ""
|
||||
|
||||
# Build the browser
|
||||
echo "Building the browser..."
|
||||
cmake -B build -S . -DCMAKE_BUILD_TYPE=Debug > /dev/null 2>&1
|
||||
cmake --build build > /dev/null 2>&1
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "❌ Build failed!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "✓ Build successful!"
|
||||
echo ""
|
||||
|
||||
# Test sites
|
||||
declare -a sites=(
|
||||
"http://example.com"
|
||||
"http://info.cern.ch"
|
||||
"http://motherfuckingwebsite.com"
|
||||
"http://textfiles.com"
|
||||
)
|
||||
|
||||
echo "Available test sites:"
|
||||
echo "1. example.com - Simple static page"
|
||||
echo "2. info.cern.ch - First website ever (historical)"
|
||||
echo "3. motherfuckingwebsite.com - Minimalist design manifesto"
|
||||
echo "4. textfiles.com - Text-only content"
|
||||
echo "5. Custom URL"
|
||||
echo ""
|
||||
|
||||
read -p "Select a site (1-5): " choice
|
||||
|
||||
case $choice in
|
||||
1) url="${sites[0]}" ;;
|
||||
2) url="${sites[1]}" ;;
|
||||
3) url="${sites[2]}" ;;
|
||||
4) url="${sites[3]}" ;;
|
||||
5)
|
||||
read -p "Enter URL (include http://): " url
|
||||
;;
|
||||
*)
|
||||
echo "Invalid choice, using example.com"
|
||||
url="${sites[0]}"
|
||||
;;
|
||||
esac
|
||||
|
||||
echo ""
|
||||
echo "========================================"
|
||||
echo " Launching TUT Browser"
|
||||
echo "========================================"
|
||||
echo "URL: $url"
|
||||
echo ""
|
||||
echo "Keyboard shortcuts:"
|
||||
echo " j/k - Scroll up/down"
|
||||
echo " Tab - Next link/field"
|
||||
echo " Enter - Follow link/activate field"
|
||||
echo " i - Focus first form field"
|
||||
echo " / - Search"
|
||||
echo " h/l - Back/Forward"
|
||||
echo " B - Bookmark"
|
||||
echo " :o URL - Open URL"
|
||||
echo " :q - Quit"
|
||||
echo ""
|
||||
read -p "Press Enter to start..."
|
||||
|
||||
# Launch the browser
|
||||
./build/tut "$url"
|
||||
|
||||
echo ""
|
||||
echo "Browser exited. Test complete!"
|
||||
Loading…
Reference in a new issue