Skip to content

Commit f2f7310

Browse files
authored
Merge pull request #44 from reach2jeyan/43-test-contents-not-appear-within-the-cells---024
Fixed bug test contents not wrapped within the cell
2 parents ded48c0 + 0dbb153 commit f2f7310

3 files changed

Lines changed: 49 additions & 28 deletions

File tree

Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,7 @@ RUN poetry lock
2222

2323
RUN poetry install --with dev
2424

25+
RUN poetry run playwright install --with-deps
26+
2527

2628

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "pytest-reporter-plus"
3-
version = "0.2.4"
3+
version = "0.2.5"
44
description = "Lightweight enhanced HTML reporter for Pytest"
55
readme = "README.md"
66
authors = ["Emjey", "Karan"]

pytest_reporter_plus/generate_html_report.py

Lines changed: 46 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -306,32 +306,23 @@ def generate_html_report(self):
306306
'style="background:#f39c12;color:white;padding:2px 6px;'
307307
'border-radius:3px;font-weight:bold;font-size:0.85em;">FLAKY</span>'
308308
)
309-
link_html = ""
310-
for url in test.get("links", []):
311-
link_html += (
312-
f'<a href="{url}" target="_blank" '
313-
f'style="background:#3498db;color:white;padding:2px 6px;'
314-
f'border-radius:3px;font-weight:bold;font-size:0.85em;'
315-
f'text-decoration:none;margin-right:6px;"> Link </a>'
316-
)
317-
318-
html += f'''
319-
320-
321309

322-
<div class="test test-card" data-name="{test['test']}" data-link="{','.join(test.get('links', []))}" data-markers="{marker_str}">
323-
<div class="header {status_class}" onclick="toggleDetails(this)">
324-
<span class="toggle"></span>
325-
326-
<span>
327-
<strong>{test["test"]}</strong> — {test["status"].upper()}
328-
</span>
329-
330-
<span class="nodeid-badge" style="display: flex; align-items: center; gap: 6px;">
331-
<code style="font-size: 0.6em; color: #555;">{test["nodeid"]}</code>
332-
<button class="copy-btn"
333-
onclick="event.stopPropagation(); copyToClipboard('{test["nodeid"]}')"
334-
title="Copy full test path"
310+
links = test.get("links", [])
311+
312+
if links:
313+
link_html = ""
314+
for url in links:
315+
link_html += (
316+
f'<a href="{url}" target="_blank" '
317+
f'style="background:#3498db;color:white;padding:2px 6px;'
318+
f'border-radius:3px;font-weight:bold;font-size:0.85em;'
319+
f'text-decoration:none;margin-right:6px;"> Link </a>'
320+
)
321+
else:
322+
link_html = """
323+
<button class="info-btn"
324+
title="You can tag your tests with markers such as pytest.mark.link. Other supported markers include testcase, jira, issue, and ticket."
325+
onclick="event.stopPropagation();"
335326
style="
336327
cursor: pointer;
337328
background: none;
@@ -340,16 +331,43 @@ def generate_html_report(self):
340331
padding: 0;
341332
line-height: 1;
342333
">
343-
📋
334+
ℹ️
344335
</button>
345-
</span>
336+
"""
337+
338+
html += f'''
339+
340+
<div class="test test-card" data-name="{test['test']}" data-link="{','.join(test.get('links', []))}" data-markers="{marker_str}">
341+
<div class="header {status_class}" onclick="toggleDetails(this)">
342+
<span class="toggle"></span>
343+
<span>
344+
<strong>{test["test"]}</strong> — {test["status"].upper()}
345+
</span>
346+
347+
<span class="nodeid-badge" style="display: flex; align-items: center; gap: 6px;">
348+
<code style="font-size: 0.6em; color: #555;">{test["nodeid"]}</code>
349+
<button class="copy-btn"
350+
onclick="event.stopPropagation(); copyToClipboard('{test["nodeid"]}')"
351+
title="Copy full test path"
352+
style="
353+
cursor: pointer;
354+
background: none;
355+
border: none;
356+
font-size: 1.2em;
357+
padding: 0;
358+
line-height: 1;
359+
">
360+
📋
361+
</button>
362+
</span>
346363
347364
<span class="worker-id" style="background: #ddd; border-radius: 3px; padding: 2px 5px; font-size: 0.85em; font-weight: bold;">{test["worker"]}</span>
348365
<span class="worker-id" style="background: #f39c12; color:white; border-radius: 3px; padding: 2px 5px; font-size: 0.85em; font-weight: bold;">{flaky_badge}</span>
349366
<span class="worker-id" style="background: #3498db; color:white; border-radius: 3px; padding: 2px 5px; font-size: 0.85em; font-weight: bold;">{link_html}</span>
350367
<span class="timestamp">⏱ {test.get("duration", 0):.2f}s</span>
351368
</div>
352369
370+
<div class="details">
353371
{error_html}
354372
{screenshot_html}
355373
{stdout_html}
@@ -387,5 +405,6 @@ def generate_html_report(self):
387405
with open(output_file, "w", encoding="utf-8") as f:
388406
f.write(html)
389407

408+
390409
if __name__ == "__main__":
391410
main()

0 commit comments

Comments
 (0)