File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ HTML report for the test results.
1212 :alt: PyPI
1313.. image :: https://img.shields.io/conda/vn/conda-forge/pytest-html.svg
1414 :target: https://anaconda.org/conda-forge/pytest-html
15- :alt: Conda Forge
15+ :alt: Conda Forge
1616.. image :: https://img.shields.io/travis/pytest-dev/pytest-html.svg
1717 :target: https://travis-ci.org/pytest-dev/pytest-html/
1818 :alt: Travis
@@ -240,6 +240,14 @@ additional HTML and log output with a notice that the log is empty:
240240 del data[:]
241241 data.append(html.div(' No log output captured.' , class_ = ' empty log' ))
242242
243+ Display options
244+ ---------------
245+
246+ By default, all rows in the **Results ** table will be expanded except those that have :code: `Passed `.
247+
248+ This behavior can be customized with a query parameter: :code: `?collapsed=Passed,XFailed,Skipped `.
249+
250+
243251Screenshots
244252-----------
245253
Original file line number Diff line number Diff line change @@ -78,9 +78,10 @@ function add_collapse() {
7878
7979 // Add show/hide link to each result
8080 find_all ( '.col-result' ) . forEach ( function ( elem ) {
81+ var collapsed = get_query_parameter ( 'collapsed' ) || 'Passed' ;
8182 var extras = elem . parentNode . nextElementSibling ;
8283 var expandcollapse = document . createElement ( "span" ) ;
83- if ( elem . innerHTML === 'Passed' ) {
84+ if ( collapsed . includes ( elem . innerHTML ) ) {
8485 extras . classList . add ( "collapsed" ) ;
8586 expandcollapse . classList . add ( "expander" ) ;
8687 } else {
@@ -98,6 +99,11 @@ function add_collapse() {
9899 } )
99100}
100101
102+ function get_query_parameter ( name ) {
103+ var match = RegExp ( '[?&]' + name + '=([^&]*)' ) . exec ( window . location . search ) ;
104+ return match && decodeURIComponent ( match [ 1 ] . replace ( / \+ / g, ' ' ) ) ;
105+ }
106+
101107function init ( ) {
102108 reset_sort_headers ( ) ;
103109
You can’t perform that action at this time.
0 commit comments