capydash 0.2.0 → 0.2.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '08b9f8d42cd5b408688aaffd4e8000a2f2514e1b7cababeaef8e6b5f22e6255b'
4
- data.tar.gz: fe000167bd555af57a386e7616a4a475b577881b8d8c7cd2cec996e81d5ce088
3
+ metadata.gz: bb913ca0b0dce3912a15dd5eb2f1fd2673671771ff34b485f4b1c5567240faa7
4
+ data.tar.gz: '0794e75f2f6d2d3c6e50cb0d49370c71d7f571c87a93519fc04947ff16c3c71b'
5
5
  SHA512:
6
- metadata.gz: 25087505b55812541a3be9184467174c205c4c6b8cc75bd6c0c74c5c9a8995cbcd19c1f1b160c5ebda02e4cf14a6adb26de2639bc1097724931182e4ff9bbf2b
7
- data.tar.gz: 16ebd46b3f89a641cd0260dbb2f08f7702b59ea89478568fbeb06e3f47e5e6a09dfdf501dd5cb528399d4dbed24417fd42c286dce391e625df9aff774168c4a0
6
+ metadata.gz: 153585a1af8f9ef4415a509a53c265f552bdfc496ae20409f38ce850e09624259211f53af41e13ad59bb4384936df2cdaeab3a83aab34e22dece0401fd1b4b57
7
+ data.tar.gz: 6079967d5cb84f6d3867a5d8ae6a996df16c8db45a800811e0c218a3d954a6615a86aea31fed07cdb2a92f0629a5d0c8e1a5eebecf0ac880af5ed4bc09307e77
data/README.md CHANGED
@@ -1,6 +1,14 @@
1
1
  # CapyDash
2
2
 
3
- A static HTML dashboard for Capybara tests that provides comprehensive test reporting with screenshots, step-by-step tracking, error reporting, and search capabilities. Perfect for debugging test failures and understanding test behavior.
3
+ A minimal static HTML report generator for RSpec system tests. CapyDash automatically generates a clean, readable test report after your RSpec suite finishes.
4
+
5
+ ## Features
6
+
7
+ - ✅ **Automatic report generation** - No configuration needed
8
+ - ✅ **RSpec system test support** - Works out of the box with `rspec-rails`
9
+ - ✅ **Clean HTML reports** - Simple, readable test results
10
+ - ✅ **Error details** - Full exception messages and backtraces
11
+ - ✅ **Zero configuration** - Just add the gem and run your tests
4
12
 
5
13
  ## Installation
6
14
 
@@ -8,237 +16,128 @@ Add to your Gemfile:
8
16
 
9
17
  ```ruby
10
18
  gem "capydash"
19
+ gem "rspec-rails"
11
20
  ```
12
21
 
13
- Or run:
22
+ Then run:
14
23
 
15
24
  ```bash
16
- bundle add capydash
17
- ```
18
-
19
- ## Quick Setup
20
-
21
- ### One-Command Installation
22
-
23
- After adding CapyDash to your Gemfile and running `bundle install`, simply run:
24
-
25
- ```bash
26
- bundle exec rails generate capydash:install
25
+ bundle install
27
26
  ```
28
27
 
29
- This will automatically:
30
- - ✅ Create the CapyDash initializer
31
- - ✅ Update your test helper with all necessary hooks
32
- - ✅ Add rake tasks for report generation
33
- - ✅ Works with parallel testing out of the box
34
-
35
- ### Manual Setup (Alternative)
36
-
37
- If you prefer to set up CapyDash manually, see the [Manual Setup Guide](#manual-setup) below.
38
-
39
28
  ## Usage
40
29
 
41
- ### Run Tests with CapyDash
42
-
43
- Run your tests normally - CapyDash will automatically instrument them:
30
+ That's it! CapyDash automatically hooks into RSpec when it detects it. Just run your tests:
44
31
 
45
32
  ```bash
46
- bundle exec rails test
33
+ bundle exec rspec
47
34
  ```
48
35
 
49
- ### Generate Test Report
50
-
51
- After running your Capybara tests, generate a static HTML report:
36
+ After your test suite completes, CapyDash will automatically generate a report at:
52
37
 
53
- ```bash
54
- bundle exec rake capydash:report
55
38
  ```
56
-
57
- This will create a `capydash_report/index.html` file with:
58
- - Test steps in chronological order
59
- - Embedded screenshots for each step
60
- - Click-to-open/close functionality for screenshots
61
- - Typeahead search across test names, step text, and pass/fail status
62
- - Summary statistics
63
-
64
- ### View Report in Browser
65
-
66
- **Option 1: Open directly in browser**
67
- ```bash
68
- open capydash_report/index.html
39
+ capydash_report/index.html
69
40
  ```
70
41
 
71
- **Option 2: Use the built-in server**
72
- ```bash
73
- bundle exec rake capydash:server
74
- ```
75
-
76
- Then open `http://localhost:4000` in your browser.
77
-
78
- ## Troubleshooting
79
-
80
- ### Common Issues
81
-
82
- 1. **"No test data found"**: Make sure you've added the test helper configuration and are running actual Capybara tests (not just unit tests).
83
-
84
- 2. **"log shifting failed" error**: This is a Rails logger issue, not related to CapyDash. It's harmless but you can fix it by updating your Rails version.
42
+ Open it in your browser to view the results.
85
43
 
86
- 3. **Screenshots not working**: Make sure you're using a driver that supports screenshots (like Selenium, not rack_test).
44
+ ## Example Test
87
45
 
88
- 4. **Tests not appearing in report**: Ensure your tests are using Capybara methods like `visit`, `click_button`, `fill_in`, etc.
89
-
90
- 5. **"No test data found"**: Make sure you're running system tests that use Capybara methods. CapyDash works with parallel testing by default.
91
-
92
- ### Example Test
93
-
94
- Here's an example test that will work with CapyDash:
46
+ Here's an example RSpec system test:
95
47
 
96
48
  ```ruby
97
- require 'test_helper'
98
-
99
- class HomepageTest < ActionDispatch::IntegrationTest
100
- include Capybara::DSL
49
+ require 'rails_helper'
101
50
 
102
- test "homepage loads with correct content" do
51
+ RSpec.describe "Homepage", type: :system do
52
+ it "displays the welcome message" do
103
53
  visit "/"
104
- assert_text "Welcome"
54
+ expect(page).to have_content("Welcome")
55
+ end
105
56
 
57
+ it "allows user to submit a form" do
58
+ visit "/"
106
59
  fill_in "Your name", with: "Alice"
107
60
  click_button "Greet"
108
- assert_text "Hello, Alice!"
61
+ expect(page).to have_content("Hello, Alice!")
109
62
  end
110
63
  end
111
64
  ```
112
65
 
113
- ## Manual Setup
114
-
115
- If you prefer to set up CapyDash manually instead of using the generator:
116
-
117
- ### Step 1: Create CapyDash Initializer
66
+ ## Report Features
118
67
 
119
- Create `config/initializers/capydash.rb` in your Rails project:
68
+ The generated report includes:
120
69
 
121
- ```ruby
122
- require 'capydash'
70
+ - **Summary statistics** - Total, passed, and failed test counts
71
+ - **Test grouping** - Tests organized by spec file
72
+ - **Expandable test details** - Click to view error messages
73
+ - **Error information** - Full exception messages and backtraces
74
+ - **Clean design** - Simple, readable HTML layout
123
75
 
124
- # Configure CapyDash
125
- CapyDash.configure do |config|
126
- config.port = 4000
127
- config.screenshot_path = "tmp/capydash_screenshots"
128
- end
76
+ ## Requirements
129
77
 
130
- # Subscribe to events for test data collection
131
- CapyDash::EventEmitter.subscribe do |event|
132
- # Collect test data for report generation
133
- CapyDash::TestDataAggregator.handle_event(event)
134
- end
135
- ```
78
+ - Ruby 2.7+
79
+ - RSpec 3.0+
80
+ - Rails 6.0+ (for system tests)
136
81
 
137
- ### Step 2: Update Test Helper
82
+ ## How It Works
138
83
 
139
- In your `test/test_helper.rb`, add the following:
84
+ 1. CapyDash automatically detects when RSpec is present
85
+ 2. Hooks into RSpec's `before(:suite)`, `after(:each)`, and `after(:suite)` callbacks
86
+ 3. Collects test results in memory during the test run
87
+ 4. Generates a static HTML report after all tests complete
88
+ 5. Saves the report to `capydash_report/index.html`
140
89
 
141
- ```ruby
142
- require 'capydash'
143
-
144
- # Start test run data collection
145
- CapyDash::TestDataCollector.start_test_run
90
+ ## Troubleshooting
146
91
 
147
- # Hook into test execution to set current test name and manage test runs
148
- module CapyDash
149
- module TestHooks
150
- def run(&block)
151
- # Set the current test name for CapyDash
152
- CapyDash.current_test = self.name
92
+ ### Report not generated
153
93
 
154
- # Start test run data collection if not already started
155
- CapyDash::TestDataAggregator.start_test_run unless CapyDash::TestDataAggregator.instance_variable_get(:@current_run)
94
+ - Make sure you're running RSpec tests (not Minitest)
95
+ - Ensure `rspec-rails` is in your Gemfile
96
+ - Check that tests actually ran (no early exits)
156
97
 
157
- super
158
- end
159
- end
160
- end
98
+ ### Tests not appearing in report
161
99
 
162
- # Apply the hook to the test case
163
- class ActiveSupport::TestCase
164
- prepend CapyDash::TestHooks
165
- end
100
+ - Verify you're using RSpec system tests (`type: :system`)
101
+ - Make sure the test suite completed (not interrupted)
166
102
 
167
- # Hook to finish test run when all tests are done
168
- Minitest.after_run do
169
- CapyDash::TestDataCollector.finish_test_run
170
- CapyDash::TestDataAggregator.finish_test_run
171
- end
172
- ```
103
+ ### Report shows old results
173
104
 
174
- ### Step 3: Add Rake Tasks
105
+ - Delete the `capydash_report` directory and run tests again
106
+ - The report is regenerated on each test run
175
107
 
176
- Create `lib/tasks/capydash.rake` in your Rails project:
108
+ ## Development
177
109
 
178
- ```ruby
179
- namespace :capydash do
180
- desc "Generate static HTML test report"
181
- task :report => :environment do
182
- CapyDash::ReportGenerator.generate_report
183
- end
110
+ ### Running Tests
184
111
 
185
- desc "Start local server to view static HTML report"
186
- task :server => :environment do
187
- CapyDash::DashboardServer.start
188
- end
189
- end
112
+ ```bash
113
+ # In a Rails app with RSpec
114
+ bundle exec rspec
190
115
  ```
191
116
 
192
- ### Step 4: Configure System Tests (Optional)
117
+ ### Building the Gem
193
118
 
194
- If you're using system tests, make sure your `test/application_system_test_case.rb` uses a driver that supports screenshots:
195
-
196
- ```ruby
197
- require "test_helper"
198
-
199
- class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
200
- driven_by :selenium, using: :headless_chrome, screen_size: [ 800, 600 ]
201
- end
119
+ ```bash
120
+ gem build capydash.gemspec
202
121
  ```
203
122
 
204
- ## Development
205
-
206
- ### Testing with Dummy App
207
-
208
- The project includes a dummy Rails app for testing. To run it:
123
+ ### Publishing
209
124
 
210
125
  ```bash
211
- cd spec/dummy_app
212
- bundle install
213
- bundle exec rails test
126
+ gem push capydash-0.2.0.gem
214
127
  ```
215
128
 
216
- ### Development Setup
129
+ ## License
217
130
 
218
- 1. Clone the repository
219
- 2. Install dependencies: `bundle install`
220
- 3. Run the dummy app tests to verify everything works
221
- 4. Make your changes
222
- 5. Test with the dummy app
131
+ MIT
223
132
 
224
133
  ## Contributing
225
134
 
226
135
  1. Fork the repository
227
136
  2. Create a feature branch
228
137
  3. Make your changes
229
- 4. Test with the dummy app
138
+ 4. Test with RSpec
230
139
  5. Submit a pull request
231
140
 
232
- ## Publishing
233
-
234
- Build the gem:
235
-
236
- ```bash
237
- gem build capydash.gemspec
238
- ```
239
-
240
- Push to RubyGems:
141
+ ---
241
142
 
242
- ```bash
243
- gem push capydash-0.1.0.gem
244
- ```
143
+ **Note:** CapyDash is a minimal MVP focused solely on RSpec system test reporting. It does not support Minitest, configuration DSLs, local servers, or screenshots. For a simple, zero-configuration test reporting solution, CapyDash is perfect.
data/capydash.gemspec CHANGED
@@ -3,31 +3,25 @@ require_relative "lib/capydash/version"
3
3
 
4
4
  Gem::Specification.new do |spec|
5
5
  spec.name = "capydash"
6
- spec.version = Capydash::VERSION
6
+ spec.version = CapyDash::VERSION
7
7
  spec.authors = ["Damon Clark"]
8
8
  spec.email = ["dclark312@gmail.com"]
9
9
 
10
- spec.summary = "Real-time Capybara test dashboard"
11
- spec.description = "CapyDash instruments Capybara tests and streams test steps, screenshots, and DOM snapshots to a live dashboard."
10
+ spec.summary = "Minimal static HTML report generator for RSpec system tests"
11
+ spec.description = "CapyDash automatically generates clean, readable HTML test reports after your RSpec suite finishes. Zero configuration required."
12
12
  spec.homepage = "https://github.com/damonclark/capydash"
13
13
  spec.license = "MIT"
14
14
 
15
15
  # Specify which files should be added to the gem when it is released.
16
- spec.files = Dir["lib/**/*", "bin/*", "README.md", "LICENSE*", "*.gemspec"]
16
+ spec.files = Dir["lib/**/*", "README.md", "LICENSE*", "*.gemspec"]
17
17
  spec.require_paths = ["lib"]
18
18
 
19
- # Add generator support
20
- spec.add_runtime_dependency "railties", ">= 5.0"
21
-
22
19
  # Dependencies
23
- spec.add_runtime_dependency "capybara", ">= 3.0"
24
- spec.add_runtime_dependency "faye-websocket"
25
- spec.add_runtime_dependency "eventmachine"
26
- spec.add_runtime_dependency "em-websocket"
20
+ spec.add_runtime_dependency "rspec", ">= 3.0"
27
21
 
28
22
  # Development dependencies
29
- spec.add_development_dependency "rspec", "~> 3.0"
30
- spec.add_development_dependency "rails", "~> 8.0"
23
+ spec.add_development_dependency "rspec-rails", "~> 6.0"
24
+ spec.add_development_dependency "rails", ">= 6.0"
31
25
 
32
26
  spec.metadata["allowed_push_host"] = "https://rubygems.org"
33
27
  end