Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/pytest_html/nextgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,10 @@ def pytest_sessionfinish(self, session):
self._report.data["runningState"] = "Finished"
self._generate_report()

@pytest.hookimpl(trylast=True)
def pytest_terminal_summary(self, terminalreporter):
terminalreporter.write_sep("-", f"Generated html report: file://{self._report_path}")

Comment on lines +209 to +212
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This adds an output to the console that is available in the legacy report.

@pytest.hookimpl(trylast=True)
def pytest_collection_finish(self, session):
self._report.data["collectedItems"] = len(session.items)
Expand Down
2 changes: 1 addition & 1 deletion src/pytest_html/resources/index.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
</template>
<template id="template_results-table__head--empty">
<tr id="not-found-message">
<th colspan="4">No results found. Try to check the filters</th>
<th colspan="4">No results found. Check the filters.</th>
</tr>
</template>
<!-- END TEMPLATES -->
Expand Down
18 changes: 10 additions & 8 deletions src/pytest_html/scripts/dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,20 +82,22 @@ const dom = {

const media = []
extras?.forEach(({ name, format_type, content }) => {
const extraLink = aTag.content.cloneNode(true)
const extraLinkItem = extraLink.querySelector('a')

extraLinkItem.href = content
extraLinkItem.className = `col-links__extra ${format_type}`
extraLinkItem.innerText = name
resultBody.querySelector('.col-links').appendChild(extraLinkItem)
if (['json', 'text', 'url'].includes(format_type)) {
const extraLink = aTag.content.cloneNode(true)
const extraLinkItem = extraLink.querySelector('a')

extraLinkItem.href = content
extraLinkItem.className = `col-links__extra ${format_type}`
extraLinkItem.innerText = name
resultBody.querySelector('.col-links').appendChild(extraLinkItem)
}

if (['image', 'video'].includes(format_type)) {
media.push({ path: content, name, format_type })
}

if (format_type === 'html') {
resultBody.querySelector('.extraHTML').insertAdjacentHTML('beforeend', `<div>${content}</div>`)
resultBody.querySelector('.extraHTML').insertAdjacentHTML('beforeend', `<div>${content}</div>`)
}
})
mediaViewer.setUp(resultBody, media)
Expand Down