title: How do i make all rows of pytest-html single html report result file default to a collapsed state?
body: <p>I use the pytest runner to get the output of results from my automated test frameworks (Selenium and RestAPI tests). I use the pytest-html plugin to generate a single page html result file at the end of the test. I initiate the test run with the following command (from an active VirtEnv session).</p>
  
  <p><code>python -m pytest -v --html="api_name_test.html" --self-contained-html</code></p>
  
  <p>(it's a little more complicated in that I use a powershell script to run this and provide a datetime stamped result file name and email the file when it's finished but it's essentially the above command)</p>
  
  <p>When the reports are generated and I open this report html I find that all the non passing tests are expanded. I want to make it so all rows are collapsed by default (Failed, XFailed, Error etc..).</p>
  
  <p><a href="https://i.stack.imgur.com/baz0e.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/baz0e.png" alt="html result with some files expanded"></a></p>
  
  <p>My project contains a conftest.py file at the diretory root and a pytest.ini file where I specify the directory for the test scripts</p>
  
  <p>In the conftest.py file in my simplest projects, I have one optional hook to obtain the target url of the tests and put that in the report summary:</p>
  
  <pre><code>import pytest
  from py._xmlgen import html
  import os
  import rootdir_ref
  import simplejson
  
  @pytest.mark.optionalhook
  def pytest_html_results_summary(prefix):
      theRootDir = os.path.dirname(rootdir_ref.__file__)
      credentials_path = os.path.join(theRootDir, 'TestDataFiles', 'API_Credentials.txt')
      target_url = simplejson.load(open(credentials_path)).get('base_url')
      prefix.extend([html.p("Testing against URL: " + target_url)])
  </code></pre>
  
  <p>The Github page mentions that a display query can be used to collapse rows with various results, but it doesn't mention where this information is entered.
  <a href="https://github.com/pytest-dev/pytest-html" rel="nofollow noreferrer">https://github.com/pytest-dev/pytest-html</a></p>
  
  <p>"By default, all rows in the Results table will be expanded except those that have Passed. This behavior can be customized with a query parameter: ?collapsed=Passed,XFailed,Skipped"</p>
  
  <p>Currently I'm unsure if the <code>?collapsed=...</code> line goes in the command line, or the conftest as a hook, or do I need to edit the default style.css or main.js  that comes with the pytest-html plugin? (Also i'm not familiar with css and only know a small amount of html). I'm assuming it goes in the conftest.py file as a hook but don't really understand how to apply it.</p>