@@ -720,191 +720,34 @@ HTML Reporter Plugin for CodeceptJS
720
720
721
721
Generates comprehensive HTML reports showing:
722
722
723
- - **Interactive Test Results**: Click-to-expand test details with comprehensive information
724
- - **Step-by-Step Details**: Shows individual test steps with proper method names (e.g., ` I .seeFile ()` , ` I .amInPath ()` ), status indicators, and timing
725
- - **BDD/Gherkin Support**: Full support for Gherkin feature files with proper scenario formatting, step keywords, and feature information
726
- - **Test Statistics**: Visual cards displaying totals, passed, failed, and pending test counts with interactive pie chart
727
- - **Error Information**: Clean, formatted error messages for failed tests with ANSI color code stripping
728
- - **Artifacts Support**: Display screenshots and other test artifacts with modal viewing capability
729
- - **Responsive Design**: Mobile-friendly layout that works across all screen sizes
730
- - **Professional Styling**: Modern, clean interface with color-coded status indicators
731
- - **Enhanced Features**:
732
- - **Metadata Display**: Shows test metadata, options, and custom properties
733
- - **Tags Support**: Display and filter by test tags (@smoke, @critical, etc.)
734
- - **Retry Tracking**: Shows retry attempts and final test status
735
- - **Test Notes**: Display test notes and comments
736
- - **Interactive Filters**: Filter tests by status, feature, tags, retry status, and test type (BDD vs Regular)
737
- - **Test History**: Track test results across multiple runs with visual charts
738
- - **Stats Export**: Export test statistics in JSON format for integration with external tools (Grafana, etc.)
739
- - **Worker Support**: Compatible with run-workers and run-multiple commands
723
+ - Test statistics
724
+ - Feature/Scenario details
725
+ - Individual step results
726
+ - Test artifacts (screenshots, etc.)
740
727
741
728
## Configuration
742
729
743
730
` ` ` js
744
731
" plugins" : {
745
732
" htmlReporter" : {
746
733
" enabled" : true ,
747
- " output" : " ./output" , // Directory for the report
748
- " reportFileName" : " report.html" , // Name of the HTML file
749
- " includeArtifacts" : true , // Include screenshots/artifacts
750
- " showSteps" : true , // Show individual test steps
751
- " showSkipped" : true , // Show skipped tests
752
- " showMetadata" : true , // Show test metadata and options
753
- " showTags" : true , // Show test tags
754
- " showRetries" : true , // Show retry information
755
- " exportStats" : false , // Export stats to JSON file
756
- " exportStatsPath" : " ./stats.json" , // Path for stats export
757
- " keepHistory" : false , // Track test history
758
- " historyPath" : " ./test-history.json" , // Path for history file
759
- " maxHistoryEntries" : 50 // Max history entries to keep
734
+ " output" : " ./output" ,
735
+ " reportFileName" : " report.html" ,
736
+ " includeArtifacts" : true ,
737
+ " showSteps" : true ,
738
+ " showSkipped" : true ,
739
+ " showMetadata" : true ,
740
+ " showTags" : true ,
741
+ " showRetries" : true ,
742
+ " exportStats" : false ,
743
+ " exportStatsPath" : " ./stats.json" ,
744
+ " keepHistory" : false ,
745
+ " historyPath" : " ./test-history.json" ,
746
+ " maxHistoryEntries" : 50
760
747
}
761
748
}
762
749
` ` `
763
750
764
- ### Usage
765
-
766
- Run tests normally and the HTML report will be automatically generated:
767
-
768
- ` ` ` bash
769
- npx codeceptjs run
770
- ` ` `
771
-
772
- The generated HTML report includes:
773
-
774
- - **Filter Controls**: Interactive filtering by status, feature, tags, and retry status
775
- - **Test History Chart**: Visual representation of test results over time (when history is enabled)
776
- - **Detailed Test Information**: Expandable sections showing steps, hooks, metadata, and artifacts
777
- - **Export Integration**: JSON stats export for external analysis tools
778
-
779
- ### Screenshots
780
-
781
- #### Main Dashboard
782
-
783
- 
784
- _Interactive dashboard with test statistics, pie chart visualization, and comprehensive filtering options_
785
-
786
- #### Test Details View
787
-
788
- 
789
- _Expandable test details showing step-by-step execution with timing, status indicators, and comprehensive test information_
790
-
791
- #### Advanced Filtering
792
-
793
- 
794
- _Real-time filtering capabilities allowing users to filter by status, features, tags, retry status, and test type_
795
-
796
- #### BDD/Gherkin Support
797
-
798
- 
799
- _Comprehensive BDD/Gherkin support with feature information, scenario formatting, proper step keywords (Given, When, Then, And), hooks, and visual indicators_
800
-
801
- ### Stats Export for Grafana Integration
802
-
803
- Enable stats export to integrate with monitoring tools:
804
-
805
- ` ` ` js
806
- " htmlReporter" : {
807
- " enabled" : true ,
808
- " exportStats" : true ,
809
- " exportStatsPath" : " ./test-stats.json"
810
- }
811
- ` ` `
812
-
813
- The exported JSON contains structured data perfect for Grafana dashboards:
814
-
815
- - Test execution metrics
816
- - Pass/fail rates over time
817
- - Individual test performance data
818
- - Retry statistics
819
- - Test metadata for grouping and filtering
820
-
821
- ### History Tracking
822
-
823
- Track test trends across multiple runs:
824
-
825
- ` ` ` js
826
- " htmlReporter" : {
827
- " enabled" : true ,
828
- " keepHistory" : true ,
829
- " historyPath" : " ./test-history.json" ,
830
- " maxHistoryEntries" : 100
831
- }
832
- ` ` `
833
-
834
- History tracking provides:
835
-
836
- - Test result trends over time
837
- - Performance regression detection
838
- - Visual charts in the HTML report
839
- - JSON data for external analysis
840
-
841
- ### BDD/Gherkin Support
842
-
843
- The HTML reporter provides comprehensive support for BDD/Gherkin feature files with enhanced formatting and visualization:
844
-
845
- #### Key BDD Features
846
-
847
- - **Automatic Detection**: Automatically detects BDD/Gherkin tests based on ` .feature ` files and Gherkin syntax
848
- - **Scenario Formatting**: Displays scenarios with proper "Scenario:" prefix and visual distinction from regular tests
849
- - **Feature Information**: Shows complete feature details including name, description, and file path
850
- - **Gherkin Steps**: Displays steps with proper keywords (Given, When, Then, And) in a BDD-friendly format
851
- - **BDD Badge**: Visual indicator distinguishing Gherkin tests from regular CodeceptJS tests
852
- - **Feature Tags**: Supports both feature-level and scenario-level tags with proper inheritance
853
- - **Test Type Filtering**: Filter reports to show only BDD tests, only regular tests, or both
854
-
855
- #### BDD Configuration
856
-
857
- No special configuration required - BDD support is automatically enabled when using Gherkin feature files:
858
-
859
- ` ` ` js
860
- // codecept.conf.js
861
- exports .config = {
862
- gherkin: {
863
- features: ' ./features/*.feature' ,
864
- steps: ' ./step_definitions/*.js' ,
865
- },
866
- plugins: {
867
- htmlReporter: {
868
- enabled: true ,
869
- output: ' ./output' ,
870
- reportFileName: ' report.html' ,
871
- },
872
- },
873
- }
874
- ` ` `
875
-
876
- #### BDD Report Features
877
-
878
- **Feature Display:**
879
-
880
- - Feature name and description prominently displayed
881
- - Feature-level tags shown with purple styling
882
- - File path information for traceability
883
- - Language support for internationalized Gherkin
884
-
885
- **Scenario Formatting:**
886
-
887
- - Clear "Scenario:" prefix for test titles
888
- - "Feature:" prefix for feature grouping
889
- - Purple "Gherkin" badge for easy identification
890
- - Visual left border styling for BDD tests
891
-
892
- **Step Visualization:**
893
-
894
- - Proper Gherkin keywords: Given, When, Then, And
895
- - Step text displayed with original Gherkin formatting
896
- - Execution timing for each step
897
- - Status indicators (pass/fail) for individual steps
898
- - Support for data tables and docstrings in step comments
899
-
900
- **Enhanced Filtering:**
901
-
902
- - Test Type filter to show BDD-only or regular tests
903
- - All existing filters (tags, status, feature) work with BDD tests
904
- - Combined filtering for complex test selection
905
-
906
- The BDD support seamlessly integrates with all existing HTML reporter features including retry tracking, history, stats export, and artifact display.
907
-
908
751
### Parameters
909
752
910
753
- ` config`  
0 commit comments