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
2 changes: 1 addition & 1 deletion tests/e2e-test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Installing Playwright Pytest from Virtual Environment

Run test cases

- To run test cases from your 'tests' folder : "pytest --html=report.html --self-contained-html"
- To run test cases from e2e-test: "pytest --html=report.html --self-contained-html"

Create .env file in project root level with web app url and client credentials

Expand Down
1 change: 1 addition & 0 deletions tests/e2e-test/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ python-dotenv
pytest-check
pytest-html
py
beautifulsoup4
29 changes: 28 additions & 1 deletion tests/e2e-test/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
from py.xml import html # type: ignore
import io
import logging
from bs4 import BeautifulSoup
import atexit


@pytest.fixture(scope="session")
Expand Down Expand Up @@ -83,4 +85,29 @@ def pytest_collection_modifyitems(items):
if hasattr(item, 'callspec'):
prompt = item.callspec.params.get("prompt")
if prompt:
item._nodeid = prompt # This controls how the test name appears in the report
item._nodeid = prompt # This controls how the test name appears in the report

def rename_duration_column():
report_path = os.path.abspath("report.html") # or your report filename
if not os.path.exists(report_path):
print("Report file not found, skipping column rename.")
return

with open(report_path, 'r', encoding='utf-8') as f:
soup = BeautifulSoup(f, 'html.parser')

# Find and rename the header
headers = soup.select('table#results-table thead th')
for th in headers:
if th.text.strip() == 'Duration':
th.string = 'Execution Time'
#print("Renamed 'Duration' to 'Execution Time'")
break
else:
print("'Duration' column not found in report.")

with open(report_path, 'w', encoding='utf-8') as f:
f.write(str(soup))

# Register this function to run after everything is done
atexit.register(rename_duration_column)