pytest-dev / pytest-dev/pytest-html

pytest-html does not escape HTML in testId (v4.2.0)

Open
#1,024 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
779
Forks
260
PR merge metrics
No merged PRs in 30d

Description

Hello,

I created a parametrize test where testId contains the following text:

<span style="font-weight: bold; color: red; font-size: 2em;">text</span>

pytest-html generated the next report:

Image

Is it an expected behaviour?

Test code:

import pytest        
@pytest.mark.parametrize(
    "data",
    [
        '<span style="font-weight: bold; color: red; font-size: 2em;">text</span>',
    ],
)
def test_unescape(data): print("ha-ha")

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the supplied parametrized Python test and inspecting the generated pytest-html report. The issue names no repository file or test to begin with, so trace how the testId is inserted into the report. Done means the report consistently renders the testId as literal text rather than interpreting its HTML markup.

Written by the indexing model from the issue text.

Assessment

Tech stack
html, python
Domain
testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.