adds filename of report as title to html body

This commit is contained in:
Joep Schuurkes 2018-03-25 10:37:53 +02:00 committed by Dave Hunt
parent 86d10ae466
commit abf8f15e4e
3 changed files with 17 additions and 0 deletions

View File

@ -414,6 +414,7 @@ class HTMLReport(object):
body = html.body(
html.script(raw(main_js)),
html.h1(os.path.basename(session.config.option.htmlpath)),
html.p('Report generated on {0} at {1} by'.format(
generated.strftime('%d-%b-%Y'),
generated.strftime('%H:%M:%S')),

View File

@ -4,6 +4,12 @@ body {
min-width: 1200px;
color: #999;
}
h1 {
font-size: 24px;
color: black;
}
h2 {
font-size: 16px;
color: black;

View File

@ -181,6 +181,16 @@ class TestHTML:
assert result.ret == 0
assert_results(html)
@pytest.mark.parametrize('path', ['', 'directory'])
def test_report_title(self, testdir, path):
testdir.makepyfile('def test_pass(): pass')
report_name = 'report.html'
path = os.path.join(path, report_name)
result, html = run(testdir, path)
assert result.ret == 0
report_title = "<h1>{0}</h1>".format(report_name)
assert report_title in html
def test_resources_inline_css(self, testdir):
testdir.makepyfile('def test_pass(): pass')
result, html = run(testdir, 'report.html', '--self-contained-html')