cursorflow 2.7.6__tar.gz → 2.7.7__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. {cursorflow-2.7.6 → cursorflow-2.7.7}/PKG-INFO +40 -2
  2. {cursorflow-2.7.6 → cursorflow-2.7.7}/README.md +39 -1
  3. {cursorflow-2.7.6 → cursorflow-2.7.7}/cursorflow/rules/cursorflow-usage.mdc +133 -13
  4. {cursorflow-2.7.6 → cursorflow-2.7.7}/docs/user/USAGE_GUIDE.md +697 -17
  5. {cursorflow-2.7.6 → cursorflow-2.7.7}/pyproject.toml +1 -1
  6. {cursorflow-2.7.6 → cursorflow-2.7.7}/LICENSE +0 -0
  7. {cursorflow-2.7.6 → cursorflow-2.7.7}/MANIFEST.in +0 -0
  8. {cursorflow-2.7.6 → cursorflow-2.7.7}/cursorflow/__init__.py +0 -0
  9. {cursorflow-2.7.6 → cursorflow-2.7.7}/cursorflow/auto_init.py +0 -0
  10. {cursorflow-2.7.6 → cursorflow-2.7.7}/cursorflow/auto_updater.py +0 -0
  11. {cursorflow-2.7.6 → cursorflow-2.7.7}/cursorflow/cli.py +0 -0
  12. {cursorflow-2.7.6 → cursorflow-2.7.7}/cursorflow/core/action_validator.py +0 -0
  13. {cursorflow-2.7.6 → cursorflow-2.7.7}/cursorflow/core/agent.py +0 -0
  14. {cursorflow-2.7.6 → cursorflow-2.7.7}/cursorflow/core/auth_handler.py +0 -0
  15. {cursorflow-2.7.6 → cursorflow-2.7.7}/cursorflow/core/browser_controller.py +0 -0
  16. {cursorflow-2.7.6 → cursorflow-2.7.7}/cursorflow/core/browser_engine.py +0 -0
  17. {cursorflow-2.7.6 → cursorflow-2.7.7}/cursorflow/core/config_validator.py +0 -0
  18. {cursorflow-2.7.6 → cursorflow-2.7.7}/cursorflow/core/css_iterator.py +0 -0
  19. {cursorflow-2.7.6 → cursorflow-2.7.7}/cursorflow/core/cursor_integration.py +0 -0
  20. {cursorflow-2.7.6 → cursorflow-2.7.7}/cursorflow/core/cursorflow.py +0 -0
  21. {cursorflow-2.7.6 → cursorflow-2.7.7}/cursorflow/core/data_presenter.py +0 -0
  22. {cursorflow-2.7.6 → cursorflow-2.7.7}/cursorflow/core/error_context_collector.py +0 -0
  23. {cursorflow-2.7.6 → cursorflow-2.7.7}/cursorflow/core/error_correlator.py +0 -0
  24. {cursorflow-2.7.6 → cursorflow-2.7.7}/cursorflow/core/event_correlator.py +0 -0
  25. {cursorflow-2.7.6 → cursorflow-2.7.7}/cursorflow/core/file_change_monitor.py +0 -0
  26. {cursorflow-2.7.6 → cursorflow-2.7.7}/cursorflow/core/hmr_detector.py +0 -0
  27. {cursorflow-2.7.6 → cursorflow-2.7.7}/cursorflow/core/json_utils.py +0 -0
  28. {cursorflow-2.7.6 → cursorflow-2.7.7}/cursorflow/core/log_collector.py +0 -0
  29. {cursorflow-2.7.6 → cursorflow-2.7.7}/cursorflow/core/log_monitor.py +0 -0
  30. {cursorflow-2.7.6 → cursorflow-2.7.7}/cursorflow/core/mockup_comparator.py +0 -0
  31. {cursorflow-2.7.6 → cursorflow-2.7.7}/cursorflow/core/output_manager.py +0 -0
  32. {cursorflow-2.7.6 → cursorflow-2.7.7}/cursorflow/core/persistent_session.py +0 -0
  33. {cursorflow-2.7.6 → cursorflow-2.7.7}/cursorflow/core/query_engine.py +0 -0
  34. {cursorflow-2.7.6 → cursorflow-2.7.7}/cursorflow/core/report_generator.py +0 -0
  35. {cursorflow-2.7.6 → cursorflow-2.7.7}/cursorflow/core/trace_manager.py +0 -0
  36. {cursorflow-2.7.6 → cursorflow-2.7.7}/cursorflow/install_cursorflow_rules.py +0 -0
  37. {cursorflow-2.7.6 → cursorflow-2.7.7}/cursorflow/log_sources/local_file.py +0 -0
  38. {cursorflow-2.7.6 → cursorflow-2.7.7}/cursorflow/log_sources/ssh_remote.py +0 -0
  39. {cursorflow-2.7.6 → cursorflow-2.7.7}/cursorflow/post_install.py +0 -0
  40. {cursorflow-2.7.6 → cursorflow-2.7.7}/cursorflow/rules/__init__.py +0 -0
  41. {cursorflow-2.7.6 → cursorflow-2.7.7}/cursorflow/rules/cursorflow-installation.mdc +0 -0
  42. {cursorflow-2.7.6 → cursorflow-2.7.7}/cursorflow/updater.py +0 -0
  43. {cursorflow-2.7.6 → cursorflow-2.7.7}/cursorflow.egg-info/SOURCES.txt +0 -0
  44. {cursorflow-2.7.6 → cursorflow-2.7.7}/examples/comprehensive_screenshot_example.py +0 -0
  45. {cursorflow-2.7.6 → cursorflow-2.7.7}/examples/element_inspection_example.py +0 -0
  46. {cursorflow-2.7.6 → cursorflow-2.7.7}/examples/element_measurement_example.py +0 -0
  47. {cursorflow-2.7.6 → cursorflow-2.7.7}/examples/enhanced_screenshot_example.py +0 -0
  48. {cursorflow-2.7.6 → cursorflow-2.7.7}/examples/hot_reload_css_iteration.py +0 -0
  49. {cursorflow-2.7.6 → cursorflow-2.7.7}/examples/mockup_comparison_example.py +0 -0
  50. {cursorflow-2.7.6 → cursorflow-2.7.7}/examples/opensas_example.py +0 -0
  51. {cursorflow-2.7.6 → cursorflow-2.7.7}/examples/react_example.py +0 -0
  52. {cursorflow-2.7.6 → cursorflow-2.7.7}/examples/responsive_testing_example.py +0 -0
  53. {cursorflow-2.7.6 → cursorflow-2.7.7}/examples/v2_comprehensive_demo.py +0 -0
  54. {cursorflow-2.7.6 → cursorflow-2.7.7}/setup.cfg +0 -0
  55. {cursorflow-2.7.6 → cursorflow-2.7.7}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cursorflow
3
- Version: 2.7.6
3
+ Version: 2.7.7
4
4
  Summary: 🔥 Complete page intelligence for AI-driven development with Hot Reload Intelligence - captures DOM, network, console, performance, HMR events, and comprehensive page analysis
5
5
  Author-email: GeekWarrior Development <rbush@cooltheory.com>
6
6
  License-Expression: MIT
@@ -144,6 +144,44 @@ cursorflow cleanup --all --dry-run
144
144
 
145
145
  ---
146
146
 
147
+ ## 🔐 Authentication & Testing Protected Pages
148
+
149
+ Test authenticated pages with automatic session management:
150
+
151
+ ```bash
152
+ # 1. Configure auth in .cursorflow/config.json
153
+ {
154
+ "base_url": "http://localhost:3000",
155
+ "auth": {
156
+ "method": "form",
157
+ "username": "test@example.com",
158
+ "password": "testpass",
159
+ "username_selector": "#email",
160
+ "password_selector": "#password",
161
+ "submit_selector": "#login-button"
162
+ }
163
+ }
164
+
165
+ # 2. Login once and save session
166
+ cursorflow test --base-url http://localhost:3000 \
167
+ --path /login \
168
+ --save-session "user"
169
+
170
+ # 3. Reuse session for protected pages (no re-login!)
171
+ cursorflow test --use-session "user" \
172
+ --path /dashboard \
173
+ --screenshot "dashboard"
174
+ ```
175
+
176
+ **Supports:**
177
+ - Form authentication (username/password)
178
+ - Cookie authentication (JWT tokens, session cookies)
179
+ - Header authentication (Bearer tokens, API keys)
180
+
181
+ **See:** [Complete Authentication Guide](docs/user/USAGE_GUIDE.md#authentication--session-management)
182
+
183
+ ---
184
+
147
185
  ## 🚀 Complete Page Intelligence
148
186
 
149
187
  Every test captures everything needed for debugging:
@@ -157,7 +195,7 @@ Every test captures everything needed for debugging:
157
195
  - **Forms**: All field values at capture time (passwords masked)
158
196
  - **Performance**: Load times, memory usage, reliability indicators
159
197
  - **Visual**: Screenshots with comprehensive page analysis
160
- - **Sessions**: Save/restore authenticated browser state (requires auth_config)
198
+ - **Sessions**: Save/restore authenticated browser state (requires auth_config - see Authentication below)
161
199
 
162
200
  ### **🔄 Hot Reload Intelligence**
163
201
  - **Framework auto-detection** (Vite, Webpack, Next.js, Parcel, Laravel Mix)
@@ -99,6 +99,44 @@ cursorflow cleanup --all --dry-run
99
99
 
100
100
  ---
101
101
 
102
+ ## 🔐 Authentication & Testing Protected Pages
103
+
104
+ Test authenticated pages with automatic session management:
105
+
106
+ ```bash
107
+ # 1. Configure auth in .cursorflow/config.json
108
+ {
109
+ "base_url": "http://localhost:3000",
110
+ "auth": {
111
+ "method": "form",
112
+ "username": "test@example.com",
113
+ "password": "testpass",
114
+ "username_selector": "#email",
115
+ "password_selector": "#password",
116
+ "submit_selector": "#login-button"
117
+ }
118
+ }
119
+
120
+ # 2. Login once and save session
121
+ cursorflow test --base-url http://localhost:3000 \
122
+ --path /login \
123
+ --save-session "user"
124
+
125
+ # 3. Reuse session for protected pages (no re-login!)
126
+ cursorflow test --use-session "user" \
127
+ --path /dashboard \
128
+ --screenshot "dashboard"
129
+ ```
130
+
131
+ **Supports:**
132
+ - Form authentication (username/password)
133
+ - Cookie authentication (JWT tokens, session cookies)
134
+ - Header authentication (Bearer tokens, API keys)
135
+
136
+ **See:** [Complete Authentication Guide](docs/user/USAGE_GUIDE.md#authentication--session-management)
137
+
138
+ ---
139
+
102
140
  ## 🚀 Complete Page Intelligence
103
141
 
104
142
  Every test captures everything needed for debugging:
@@ -112,7 +150,7 @@ Every test captures everything needed for debugging:
112
150
  - **Forms**: All field values at capture time (passwords masked)
113
151
  - **Performance**: Load times, memory usage, reliability indicators
114
152
  - **Visual**: Screenshots with comprehensive page analysis
115
- - **Sessions**: Save/restore authenticated browser state (requires auth_config)
153
+ - **Sessions**: Save/restore authenticated browser state (requires auth_config - see Authentication below)
116
154
 
117
155
  ### **🔄 Hot Reload Intelligence**
118
156
  - **Framework auto-detection** (Vite, Webpack, Next.js, Parcel, Laravel Mix)
@@ -963,21 +963,141 @@ cursorflow test --base-url http://localhost:3000 --actions '[{"navigate": "/dash
963
963
  cursorflow test --base-url http://localhost:3000 --actions '[{"navigate": "/dashboard"}, {"screenshot": "after"}]'
964
964
  ```
965
965
 
966
- ## Authentication Testing
966
+ ## Authentication & Session Management
967
967
 
968
+ ### **Critical: Most Real Apps Need Auth**
969
+
970
+ Testing sophisticated applications requires authentication to access:
971
+ - User dashboards and protected pages
972
+ - Admin panels and settings
973
+ - Role-based features
974
+ - Shopping carts and user data
975
+ - Personalized content
976
+
977
+ ### **Three Authentication Methods**
978
+
979
+ #### **Method 1: Form Authentication (Automatic)**
980
+
981
+ Configure in `.cursorflow/config.json`:
982
+ ```json
983
+ {
984
+ "base_url": "http://localhost:3000",
985
+ "auth": {
986
+ "method": "form",
987
+ "username": "test@example.com",
988
+ "password": "testpass",
989
+ "username_selector": "#email",
990
+ "password_selector": "#password",
991
+ "submit_selector": "#login-button",
992
+ "success_indicators": ["dashboard", "profile"],
993
+ "auth_check_selectors": [".user-menu"]
994
+ }
995
+ }
996
+ ```
997
+
998
+ Then use session management:
968
999
  ```bash
969
- cursorflow test \
970
- --base-url http://localhost:3000 \
971
- --actions '[
972
- {"navigate": "/login"},
973
- {"fill": {"selector": "#username", "value": "test@example.com"}},
974
- {"fill": {"selector": "#password", "value": "testpass"}},
975
- {"click": "#login-button"},
976
- {"wait_for": ".dashboard"},
977
- {"navigate": "/protected-page"},
978
- {"wait_for": "#protected-content"},
979
- {"screenshot": "authenticated"}
980
- ]'
1000
+ # Login once, save session
1001
+ cursorflow test --base-url http://localhost:3000 \
1002
+ --path /login \
1003
+ --save-session "user"
1004
+
1005
+ # Reuse session (no re-login!)
1006
+ cursorflow test --use-session "user" \
1007
+ --path /dashboard \
1008
+ --screenshot "dashboard"
1009
+ ```
1010
+
1011
+ #### **Method 2: Cookie Authentication**
1012
+
1013
+ For JWT tokens, session cookies, or cookies from DevTools:
1014
+ ```json
1015
+ {
1016
+ "auth": {
1017
+ "method": "cookies",
1018
+ "cookies": [
1019
+ {
1020
+ "name": "session_token",
1021
+ "value": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
1022
+ "domain": "example.com",
1023
+ "path": "/",
1024
+ "httpOnly": true,
1025
+ "secure": true
1026
+ }
1027
+ ]
1028
+ }
1029
+ }
1030
+ ```
1031
+
1032
+ #### **Method 3: Header Authentication**
1033
+
1034
+ For API tokens and Bearer authentication:
1035
+ ```json
1036
+ {
1037
+ "auth": {
1038
+ "method": "headers",
1039
+ "headers": {
1040
+ "Authorization": "Bearer your-api-token",
1041
+ "X-API-Key": "your-api-key"
1042
+ }
1043
+ }
1044
+ }
1045
+ ```
1046
+
1047
+ ### **Session Management Benefits**
1048
+
1049
+ **Without sessions**: Re-login on every test (slow, server load)
1050
+ **With sessions**: Login once, reuse state (fast, efficient)
1051
+
1052
+ ```bash
1053
+ # Save sessions for different roles
1054
+ cursorflow test --path /login --save-session "admin"
1055
+ cursorflow test --path /login --save-session "user"
1056
+
1057
+ # Reuse as needed
1058
+ cursorflow test --use-session "admin" --path /admin/settings
1059
+ cursorflow test --use-session "user" --path /dashboard
1060
+ ```
1061
+
1062
+ ### **Manual Authentication (Complex Flows)**
1063
+
1064
+ For 2FA, OAuth, or complex flows, use explicit actions:
1065
+ ```bash
1066
+ cursorflow test --actions '[
1067
+ {"navigate": "/login"},
1068
+ {"fill": {"selector": "#email", "value": "test@example.com"}},
1069
+ {"fill": {"selector": "#password", "value": "testpass"}},
1070
+ {"click": "#login-button"},
1071
+ {"wait_for": "#otp-input"},
1072
+ {"fill": {"selector": "#otp-input", "value": "123456"}},
1073
+ {"click": "#verify-button"},
1074
+ {"wait_for": ".dashboard"},
1075
+ {"screenshot": "authenticated"}
1076
+ ]' --save-session "2fa-user"
1077
+ ```
1078
+
1079
+ ### **Troubleshooting Auth**
1080
+
1081
+ **Auth failing?**
1082
+ ```bash
1083
+ # Inspect login form to get correct selectors
1084
+ cursorflow inspect --base-url http://localhost:3000 \
1085
+ --path /login \
1086
+ --selector "input[type='email']"
1087
+
1088
+ # Test with verbose logging
1089
+ cursorflow test --path /login \
1090
+ --save-session "test" \
1091
+ --verbose
1092
+ ```
1093
+
1094
+ **Session not working?**
1095
+ ```bash
1096
+ # Check saved session
1097
+ cat .cursorflow/sessions/user_session.json
1098
+
1099
+ # Force fresh login
1100
+ cursorflow test --use-session "user" --fresh-session
981
1101
  ```
982
1102
 
983
1103
  ## Best Practices
@@ -529,51 +529,731 @@ cursorflow test --base-url http://localhost:3000 \
529
529
  --quiet # JSON output only
530
530
  ```
531
531
 
532
- ### **Authenticated Session Management**
532
+ ### **Authentication & Session Management**
533
533
 
534
- **Requires auth_config** - Session persistence is designed for testing authenticated pages.
534
+ CursorFlow provides universal authentication support for testing protected pages and features. Session persistence allows you to login once and reuse authentication state across multiple tests.
535
535
 
536
- **Configure authentication in `.cursorflow/config.json`:**
536
+ #### **Why Authentication Matters**
537
+
538
+ Most real applications have:
539
+ - User dashboards and protected pages
540
+ - Role-based access control
541
+ - Personalized content
542
+ - Shopping carts and user data
543
+ - Admin panels and settings
544
+
545
+ Without authentication support, you can only test public pages. CursorFlow's authentication enables comprehensive testing of the entire application.
546
+
547
+ ---
548
+
549
+ #### **Authentication Methods**
550
+
551
+ CursorFlow supports three universal authentication strategies that work with any web framework.
552
+
553
+ ##### **Method 1: Form Authentication (Most Common)**
554
+
555
+ For traditional username/password login forms.
556
+
557
+ **Configuration (`.cursorflow/config.json`):**
537
558
  ```json
538
559
  {
539
560
  "base_url": "http://localhost:3000",
540
561
  "auth": {
541
562
  "method": "form",
542
563
  "username": "test@example.com",
543
- "password": "testpass",
564
+ "password": "testpass123",
544
565
  "username_selector": "#email",
545
566
  "password_selector": "#password",
546
- "submit_selector": "#login-button",
547
- "session_storage": ".cursorflow/sessions/"
567
+ "submit_selector": "button[type='submit']",
568
+ "session_storage": ".cursorflow/sessions/",
569
+ "success_indicators": ["dashboard", "profile", "logout"],
570
+ "auth_check_selectors": [".user-menu", "#user-profile"]
548
571
  }
549
572
  }
550
573
  ```
551
574
 
552
- **Then use session save/restore:**
575
+ **Field Reference:**
576
+ - `method`: `"form"` - Indicates form-based authentication
577
+ - `username`: Your test user's username/email
578
+ - `password`: Your test user's password
579
+ - `username_selector`: CSS selector for username input field
580
+ - `password_selector`: CSS selector for password input field
581
+ - `submit_selector`: CSS selector for login button
582
+ - `session_storage`: Directory to store session files (default: `.cursorflow/sessions/`)
583
+ - `success_indicators`: Keywords that indicate successful auth (optional)
584
+ - `auth_check_selectors`: Elements that only appear when authenticated (optional)
585
+
586
+ **CLI Usage:**
553
587
  ```bash
554
588
  # Login once and save session
555
589
  cursorflow test --base-url http://localhost:3000 \
556
590
  --path /login \
557
591
  --save-session "authenticated"
558
- # AuthHandler logs in, saves cookies + localStorage + sessionStorage
559
592
 
560
- # Reuse saved session (skip login)
593
+ # Reuse saved session (no re-login needed)
561
594
  cursorflow test --base-url http://localhost:3000 \
562
595
  --path /dashboard \
563
596
  --use-session "authenticated"
564
- # AuthHandler restores saved state, already logged in
597
+ ```
598
+
599
+ ##### **Method 2: Cookie Authentication**
565
600
 
566
- # Manage sessions
601
+ For applications that use cookie-based auth (JWT in cookies, session cookies, etc.).
602
+
603
+ **Configuration:**
604
+ ```json
605
+ {
606
+ "base_url": "https://staging.example.com",
607
+ "auth": {
608
+ "method": "cookies",
609
+ "cookies": [
610
+ {
611
+ "name": "session_token",
612
+ "value": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
613
+ "domain": "staging.example.com",
614
+ "path": "/",
615
+ "httpOnly": true,
616
+ "secure": true
617
+ },
618
+ {
619
+ "name": "user_id",
620
+ "value": "12345",
621
+ "domain": "staging.example.com",
622
+ "path": "/"
623
+ }
624
+ ],
625
+ "session_storage": ".cursorflow/sessions/"
626
+ }
627
+ }
628
+ ```
629
+
630
+ **Cookie Format:**
631
+ - `name`: Cookie name
632
+ - `value`: Cookie value
633
+ - `domain`: Cookie domain (must match your base_url)
634
+ - `path`: Cookie path (default: "/")
635
+ - `httpOnly`: True for HTTP-only cookies
636
+ - `secure`: True for HTTPS-only cookies
637
+ - `sameSite`: "Strict", "Lax", or "None" (optional)
638
+
639
+ **Use Case:**
640
+ - Testing with long-lived JWT tokens
641
+ - Using cookies from browser DevTools
642
+ - Bypassing complex OAuth flows
643
+
644
+ ##### **Method 3: Header Authentication**
645
+
646
+ For API token or Bearer token authentication.
647
+
648
+ **Configuration:**
649
+ ```json
650
+ {
651
+ "base_url": "https://api.example.com",
652
+ "auth": {
653
+ "method": "headers",
654
+ "headers": {
655
+ "Authorization": "Bearer sk_test_51HqZ2RKr4...",
656
+ "X-API-Key": "your-api-key-here",
657
+ "X-User-ID": "12345"
658
+ },
659
+ "session_storage": ".cursorflow/sessions/"
660
+ }
661
+ }
662
+ ```
663
+
664
+ **Use Case:**
665
+ - API testing with Bearer tokens
666
+ - Custom authentication headers
667
+ - Service-to-service authentication
668
+
669
+ ---
670
+
671
+ #### **Session Management**
672
+
673
+ Session persistence allows you to authenticate once and reuse the session across multiple tests, saving time and reducing server load.
674
+
675
+ ##### **Saving Sessions**
676
+
677
+ ```bash
678
+ # Save session with custom name
679
+ cursorflow test --base-url http://localhost:3000 \
680
+ --path /login \
681
+ --save-session "admin-user"
682
+
683
+ # Session saved to: .cursorflow/sessions/admin-user_session.json
684
+ ```
685
+
686
+ **What gets saved:**
687
+ - All cookies (session cookies, JWT tokens, etc.)
688
+ - localStorage state
689
+ - sessionStorage state
690
+ - Timestamp and authentication method
691
+
692
+ ##### **Reusing Sessions**
693
+
694
+ ```bash
695
+ # Use saved session
696
+ cursorflow test --base-url http://localhost:3000 \
697
+ --path /protected-page \
698
+ --use-session "admin-user"
699
+
700
+ # If session is invalid, CursorFlow automatically:
701
+ # 1. Detects the session is expired
702
+ # 2. Deletes invalid session file
703
+ # 3. Performs fresh authentication
704
+ ```
705
+
706
+ ##### **Managing Sessions**
707
+
708
+ ```bash
709
+ # List all saved sessions
567
710
  cursorflow sessions list
568
- cursorflow sessions delete "name"
711
+
712
+ # Delete a specific session
713
+ cursorflow sessions delete "admin-user"
714
+
715
+ # Clear all sessions
716
+ cursorflow sessions clear
569
717
  ```
570
718
 
571
- **Authentication Methods:**
572
- - `form` - Username/password form submission
573
- - `cookies` - Pre-configured cookies
574
- - `headers` - HTTP header authentication (Bearer tokens, etc.)
719
+ ---
720
+
721
+ #### **Session Validation**
722
+
723
+ CursorFlow validates authentication using multiple strategies:
724
+
725
+ **1. Error Indicators** (checks for):
726
+ - `.error`, `.alert-danger`, `.login-error`
727
+ - Text containing: "error", "invalid", "failed", "incorrect"
728
+
729
+ **2. Success Indicators** (from config):
730
+ - Keywords in page content: "dashboard", "profile", "logout"
731
+ - Configured in `success_indicators` array
732
+
733
+ **3. URL Changes**:
734
+ - URL no longer contains: `/login`, `/signin`, `/auth`
735
+
736
+ **4. Auth-Specific Elements** (from config):
737
+ - Elements that only appear when authenticated
738
+ - Configured in `auth_check_selectors` array
739
+
740
+ **Example validation configuration:**
741
+ ```json
742
+ {
743
+ "auth": {
744
+ "method": "form",
745
+ "username": "test@example.com",
746
+ "password": "testpass",
747
+ "success_indicators": ["Welcome back", "My Account", "Sign Out"],
748
+ "auth_check_selectors": [".user-avatar", "#user-menu", ".logout-button"]
749
+ }
750
+ }
751
+ ```
752
+
753
+ ---
754
+
755
+ #### **Complete Authentication Workflows**
756
+
757
+ ##### **Workflow 1: Testing User Dashboard**
758
+
759
+ ```bash
760
+ # 1. Configure auth in .cursorflow/config.json (one-time setup)
761
+ cat > .cursorflow/config.json << 'EOF'
762
+ {
763
+ "base_url": "http://localhost:3000",
764
+ "auth": {
765
+ "method": "form",
766
+ "username": "test@example.com",
767
+ "password": "testpass",
768
+ "username_selector": "#email",
769
+ "password_selector": "#password",
770
+ "submit_selector": "button[type='submit']"
771
+ }
772
+ }
773
+ EOF
774
+
775
+ # 2. Login and save session
776
+ cursorflow test --base-url http://localhost:3000 \
777
+ --path /login \
778
+ --save-session "user"
779
+
780
+ # 3. Test protected pages (using saved session)
781
+ cursorflow test --base-url http://localhost:3000 \
782
+ --path /dashboard \
783
+ --use-session "user" \
784
+ --screenshot "dashboard"
785
+
786
+ cursorflow test --base-url http://localhost:3000 \
787
+ --path /settings \
788
+ --use-session "user" \
789
+ --screenshot "settings"
790
+ ```
791
+
792
+ ##### **Workflow 2: Testing Different User Roles**
793
+
794
+ ```json
795
+ {
796
+ "environments": {
797
+ "admin": {
798
+ "base_url": "http://localhost:3000",
799
+ "auth": {
800
+ "method": "form",
801
+ "username": "admin@example.com",
802
+ "password": "adminpass",
803
+ "username_selector": "#email",
804
+ "password_selector": "#password",
805
+ "submit_selector": "#login-button"
806
+ }
807
+ },
808
+ "user": {
809
+ "base_url": "http://localhost:3000",
810
+ "auth": {
811
+ "method": "form",
812
+ "username": "user@example.com",
813
+ "password": "userpass",
814
+ "username_selector": "#email",
815
+ "password_selector": "#password",
816
+ "submit_selector": "#login-button"
817
+ }
818
+ }
819
+ }
820
+ }
821
+ ```
822
+
823
+ ```bash
824
+ # Test admin panel
825
+ cursorflow test --base-url http://localhost:3000 \
826
+ --path /admin \
827
+ --save-session "admin" \
828
+ --config config.json --env admin
829
+
830
+ # Test user dashboard
831
+ cursorflow test --base-url http://localhost:3000 \
832
+ --path /dashboard \
833
+ --save-session "user" \
834
+ --config config.json --env user
835
+ ```
836
+
837
+ ##### **Workflow 3: Cookie-Based API Testing**
838
+
839
+ ```json
840
+ {
841
+ "base_url": "https://api.example.com",
842
+ "auth": {
843
+ "method": "cookies",
844
+ "cookies": [
845
+ {
846
+ "name": "jwt_token",
847
+ "value": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIn0...",
848
+ "domain": "api.example.com",
849
+ "path": "/",
850
+ "httpOnly": true,
851
+ "secure": true,
852
+ "sameSite": "Strict"
853
+ }
854
+ ]
855
+ }
856
+ }
857
+ ```
858
+
859
+ ```bash
860
+ # Test authenticated API endpoint
861
+ cursorflow test --base-url https://api.example.com \
862
+ --path /v1/user/profile \
863
+ --screenshot "api-response"
864
+ ```
865
+
866
+ ##### **Workflow 4: Header-Based Authentication**
867
+
868
+ ```json
869
+ {
870
+ "base_url": "https://api.example.com",
871
+ "auth": {
872
+ "method": "headers",
873
+ "headers": {
874
+ "Authorization": "Bearer your-api-token-here",
875
+ "X-API-Key": "your-api-key",
876
+ "X-Client-ID": "cursorflow-test"
877
+ }
878
+ }
879
+ }
880
+ ```
881
+
882
+ ```bash
883
+ # Test API with bearer token
884
+ cursorflow test --base-url https://api.example.com \
885
+ --path /v1/protected-resource \
886
+ --screenshot "protected-data"
887
+ ```
575
888
 
576
- **Without auth_config:** Session flags will be ignored (testing public pages doesn't need session persistence).
889
+ ---
890
+
891
+ #### **Python API Authentication**
892
+
893
+ **Form Authentication:**
894
+ ```python
895
+ from cursorflow import CursorFlow
896
+
897
+ flow = CursorFlow(
898
+ base_url="http://localhost:3000",
899
+ auth_config={
900
+ "method": "form",
901
+ "username": "test@example.com",
902
+ "password": "testpass",
903
+ "username_selector": "#email",
904
+ "password_selector": "#password",
905
+ "submit_selector": "#login-button",
906
+ "success_indicators": ["Dashboard", "Welcome"],
907
+ "auth_check_selectors": [".user-menu"]
908
+ }
909
+ )
910
+
911
+ # CursorFlow handles login automatically
912
+ results = await flow.execute_and_collect([
913
+ {"navigate": "/dashboard"},
914
+ {"screenshot": "authenticated-dashboard"}
915
+ ])
916
+ ```
917
+
918
+ **Session Reuse:**
919
+ ```python
920
+ # Save session
921
+ flow = CursorFlow(
922
+ base_url="http://localhost:3000",
923
+ auth_config={...}
924
+ )
925
+
926
+ results = await flow.execute_and_collect(
927
+ actions=[{"navigate": "/login"}],
928
+ session_options={"save_session": True, "session_name": "test-user"}
929
+ )
930
+
931
+ # Reuse session (much faster!)
932
+ results = await flow.execute_and_collect(
933
+ actions=[{"navigate": "/dashboard"}],
934
+ session_options={"reuse_session": True, "session_name": "test-user"}
935
+ )
936
+ ```
937
+
938
+ **Cookie Authentication:**
939
+ ```python
940
+ flow = CursorFlow(
941
+ base_url="https://staging.example.com",
942
+ auth_config={
943
+ "method": "cookies",
944
+ "cookies": [
945
+ {
946
+ "name": "session_id",
947
+ "value": "abc123xyz",
948
+ "domain": "staging.example.com",
949
+ "path": "/",
950
+ "httpOnly": True,
951
+ "secure": True
952
+ }
953
+ ]
954
+ }
955
+ )
956
+ ```
957
+
958
+ **Header Authentication:**
959
+ ```python
960
+ flow = CursorFlow(
961
+ base_url="https://api.example.com",
962
+ auth_config={
963
+ "method": "headers",
964
+ "headers": {
965
+ "Authorization": "Bearer your-token",
966
+ "X-API-Key": "your-key"
967
+ }
968
+ }
969
+ )
970
+ ```
971
+
972
+ ---
973
+
974
+ #### **Troubleshooting Authentication**
975
+
976
+ ##### **Common Issues**
977
+
978
+ **Problem: "Authentication failed"**
979
+
980
+ **Solution:**
981
+ 1. Verify selectors are correct:
982
+ ```bash
983
+ # Test without auth to inspect login form
984
+ cursorflow inspect --base-url http://localhost:3000 \
985
+ --path /login \
986
+ --selector "input[type='email']"
987
+ ```
988
+
989
+ 2. Check credentials are valid
990
+ 3. Verify success indicators:
991
+ ```json
992
+ {
993
+ "auth": {
994
+ "success_indicators": ["dashboard", "profile"], // Keywords after login
995
+ "auth_check_selectors": [".user-avatar"] // Elements only when logged in
996
+ }
997
+ }
998
+ ```
999
+
1000
+ **Problem: "Session not persisting"**
1001
+
1002
+ **Solution:**
1003
+ 1. Verify session directory exists and is writable:
1004
+ ```bash
1005
+ ls -la .cursorflow/sessions/
1006
+ ```
1007
+
1008
+ 2. Check session file was created:
1009
+ ```bash
1010
+ cat .cursorflow/sessions/authenticated_session.json
1011
+ ```
1012
+
1013
+ 3. Ensure cookies are being saved:
1014
+ ```json
1015
+ {
1016
+ "timestamp": 1234567890,
1017
+ "method": "form",
1018
+ "cookies": [...], // Should have cookies here
1019
+ "localStorage": {...},
1020
+ "sessionStorage": {...}
1021
+ }
1022
+ ```
1023
+
1024
+ **Problem: "Session expires immediately"**
1025
+
1026
+ **Solution:**
1027
+ - Check if application has aggressive session timeout
1028
+ - Use `fresh_session: True` to force new login:
1029
+ ```bash
1030
+ cursorflow test --use-session "user" --fresh-session
1031
+ ```
1032
+
1033
+ ##### **Debugging Authentication**
1034
+
1035
+ **Enable verbose logging:**
1036
+ ```bash
1037
+ # See detailed auth flow
1038
+ cursorflow test --base-url http://localhost:3000 \
1039
+ --path /login \
1040
+ --save-session "test" \
1041
+ --verbose
1042
+ ```
1043
+
1044
+ **Check what CursorFlow is doing:**
1045
+ ```
1046
+ 🔐 Performing fresh authentication...
1047
+ Filled username: #email
1048
+ Filled password: #password
1049
+ Clicked submit: button[type='submit']
1050
+ ✅ Form authentication successful
1051
+ 💾 Session saved: test
1052
+ ```
1053
+
1054
+ **Inspect saved session:**
1055
+ ```bash
1056
+ cat .cursorflow/sessions/test_session.json | python3 -m json.tool
1057
+ ```
1058
+
1059
+ ---
1060
+
1061
+ #### **Advanced Authentication Scenarios**
1062
+
1063
+ ##### **Multi-Step Authentication (2FA, OAuth)**
1064
+
1065
+ For complex auth flows, use explicit actions instead of auto-auth:
1066
+
1067
+ ```bash
1068
+ cursorflow test --base-url http://localhost:3000 --actions '[
1069
+ {"navigate": "/login"},
1070
+ {"fill": {"selector": "#email", "value": "test@example.com"}},
1071
+ {"fill": {"selector": "#password", "value": "testpass"}},
1072
+ {"click": "#login-button"},
1073
+ {"wait_for": "#otp-input"},
1074
+ {"fill": {"selector": "#otp-input", "value": "123456"}},
1075
+ {"click": "#verify-button"},
1076
+ {"wait_for": ".dashboard"},
1077
+ {"screenshot": "authenticated"}
1078
+ ]' --save-session "2fa-user"
1079
+ ```
1080
+
1081
+ ##### **Testing Multiple User Roles**
1082
+
1083
+ ```bash
1084
+ # Admin session
1085
+ cursorflow test --base-url http://localhost:3000 \
1086
+ --config admin-config.json \
1087
+ --path /admin \
1088
+ --save-session "admin"
1089
+
1090
+ # Regular user session
1091
+ cursorflow test --base-url http://localhost:3000 \
1092
+ --config user-config.json \
1093
+ --path /dashboard \
1094
+ --save-session "regular-user"
1095
+
1096
+ # Test admin-only features
1097
+ cursorflow test --use-session "admin" \
1098
+ --path /admin/users \
1099
+ --screenshot "admin-users"
1100
+
1101
+ # Test user features
1102
+ cursorflow test --use-session "regular-user" \
1103
+ --path /profile \
1104
+ --screenshot "user-profile"
1105
+ ```
1106
+
1107
+ ##### **Getting Cookies from Browser**
1108
+
1109
+ **From Chrome DevTools:**
1110
+ 1. Login to your app in Chrome
1111
+ 2. Open DevTools (F12) → Application → Cookies
1112
+ 3. Copy cookie values
1113
+ 4. Add to config:
1114
+
1115
+ ```json
1116
+ {
1117
+ "auth": {
1118
+ "method": "cookies",
1119
+ "cookies": [
1120
+ {
1121
+ "name": "session_id", // From DevTools
1122
+ "value": "copied-value-here", // From DevTools
1123
+ "domain": "yourapp.com",
1124
+ "path": "/"
1125
+ }
1126
+ ]
1127
+ }
1128
+ }
1129
+ ```
1130
+
1131
+ **From Network Tab:**
1132
+ 1. Login in browser
1133
+ 2. DevTools → Network → Find login request
1134
+ 3. Look at Response Headers for `Set-Cookie`
1135
+ 4. Copy cookie details to config
1136
+
1137
+ ##### **Environment-Specific Auth**
1138
+
1139
+ Different credentials for local/staging/production:
1140
+
1141
+ ```json
1142
+ {
1143
+ "environments": {
1144
+ "local": {
1145
+ "base_url": "http://localhost:3000",
1146
+ "auth": {
1147
+ "method": "form",
1148
+ "username": "dev@example.com",
1149
+ "password": "devpass"
1150
+ }
1151
+ },
1152
+ "staging": {
1153
+ "base_url": "https://staging.example.com",
1154
+ "auth": {
1155
+ "method": "form",
1156
+ "username": "staging@example.com",
1157
+ "password": "stagingpass"
1158
+ }
1159
+ },
1160
+ "production": {
1161
+ "base_url": "https://example.com",
1162
+ "auth": {
1163
+ "method": "cookies",
1164
+ "cookies": [{"name": "prod_token", "value": "..."}]
1165
+ }
1166
+ }
1167
+ }
1168
+ }
1169
+ ```
1170
+
1171
+ ```bash
1172
+ # Test on staging with staging credentials
1173
+ cursorflow test --config config.json \
1174
+ --env staging \
1175
+ --path /dashboard
1176
+ ```
1177
+
1178
+ ---
1179
+
1180
+ #### **Session Management Commands**
1181
+
1182
+ ```bash
1183
+ # List all saved sessions
1184
+ cursorflow sessions list
1185
+ # Output:
1186
+ # admin-user (saved: 2025-10-10 14:23:45)
1187
+ # regular-user (saved: 2025-10-10 14:25:12)
1188
+
1189
+ # Delete specific session
1190
+ cursorflow sessions delete "admin-user"
1191
+
1192
+ # Clear all sessions
1193
+ cursorflow sessions clear
1194
+
1195
+ # View session info
1196
+ cursorflow sessions info "admin-user"
1197
+ # Output:
1198
+ # Session: admin-user
1199
+ # Timestamp: 2025-10-10 14:23:45
1200
+ # Method: form
1201
+ # Cookies: 3
1202
+ # Local Storage: 5 items
1203
+ # Session Storage: 2 items
1204
+ ```
1205
+
1206
+ ---
1207
+
1208
+ #### **Security Considerations**
1209
+
1210
+ **Storing Credentials:**
1211
+ - Never commit `.cursorflow/config.json` with credentials to version control
1212
+ - Add to `.gitignore`:
1213
+ ```bash
1214
+ echo ".cursorflow/config.json" >> .gitignore
1215
+ echo ".cursorflow/sessions/" >> .gitignore
1216
+ ```
1217
+
1218
+ - Use environment variables for sensitive data:
1219
+ ```json
1220
+ {
1221
+ "auth": {
1222
+ "method": "form",
1223
+ "username": "${TEST_USER}",
1224
+ "password": "${TEST_PASSWORD}"
1225
+ }
1226
+ }
1227
+ ```
1228
+
1229
+ **Session Storage:**
1230
+ - Session files contain cookies and tokens - keep secure
1231
+ - Stored in `.cursorflow/sessions/` (gitignored by default)
1232
+ - Delete sessions when done: `cursorflow sessions clear`
1233
+
1234
+ **Best Practices:**
1235
+ - Use test accounts, not production accounts
1236
+ - Rotate test credentials regularly
1237
+ - Use short-lived tokens when possible
1238
+ - Clear sessions after testing
1239
+
1240
+ ---
1241
+
1242
+ #### **Without Authentication**
1243
+
1244
+ Testing public pages doesn't require auth_config:
1245
+
1246
+ ```bash
1247
+ # No auth needed for public pages
1248
+ cursorflow test --base-url https://example.com \
1249
+ --path /about \
1250
+ --screenshot "about-page"
1251
+
1252
+ # Session flags are ignored without auth_config
1253
+ cursorflow test --base-url https://example.com \
1254
+ --path /contact \
1255
+ --save-session "ignored" # Has no effect
1256
+ ```
577
1257
 
578
1258
  ### **Quick Commands**
579
1259
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "cursorflow"
7
- version = "2.7.6"
7
+ version = "2.7.7"
8
8
  description = "🔥 Complete page intelligence for AI-driven development with Hot Reload Intelligence - captures DOM, network, console, performance, HMR events, and comprehensive page analysis"
9
9
  authors = [
10
10
  {name = "GeekWarrior Development", email = "rbush@cooltheory.com"}
File without changes
File without changes
File without changes
File without changes
File without changes