Tool to build allure generated folder into a single html file
After run by console command, or by call from python code, it:
- Reads contents of allure-generated folder
- Creates server.js file, which has all the data files inside and code to start fake XHR server
- Patches index.html file, so it's using server.js and sinon-9.2.4.js (Taken from here), and could be run in any browser without --allow-file-access-from-files parameter of chrome browser
- Creates file complete.html with all files built-in in a single file
According to this merged pull request allure-framework/allure2#2072 Allure itself now has command line argument --single-file that make it produce report as a single html file.
As for now it's not described in official allure docs, but anyway it should make this package (allure-combine) useless.
I'm encorage you to use Allure --single-file functionality, as it should work much better that my combiner!
- Python 3.6+
- You need to have your allure report folder generated (
allure generate './some/path/to/allure/generated/folder')
pip install allure-combineor:
- Clone repo
git clone git@github.com:MihanEntalpo/allure-single-html-file.git
cd allure-single-html-file- Install requirements (actually there are only BeautifulSoup)
pip install -r ./requirements.txt
python setup.py installIf you have cloned repo, not installed module via pip, replace allure-combine with python ./allure_combine/combine.py in following commands:
- Create complete.html file inside the allure folder itself
allure-combine ./some/path/to/allure/generated/folder- Create complete.html file inside specified folder:
allure-combine ./some/path/to/allure/generated/folder --dest /tmp- Ensure that specified dest folder exists (create if not)
allure-combine ./some/path/to/allure/generated/folder --dest /tmp/allure-2022-05-05_12-20-01/result --auto-create-folders- Remove sinon.js and server.js from allure folder after complete.html is generated:
allure-combine ./some/path/to/allure/generated/folder --remove-temp-files- If html/json files what should be utf-8 is has broken encoding, ignore errors:
allure-combine ./some/path/to/allure/generated/folder --ignore-utf8-errors- If the text content of generated HTML presents formatting issues, try this option:
allure-combine ./some/path/to/allure/generated/folder --disable-tags-escapingpip install allure-combinefrom allure_combine import combine_allure
# 1) Create complete.html in allure-generated folder
combine_allure("./some/path/to/allure/generated/folder")
# 2) Create complete.html in specified folder
combine_allure("./some/path/to/allure/generated/folder", dest_folder="/tmp")
# 3) Make sure that dest folder exists, create if not
combine_allure(
"./some/path/to/allure/generated/folder",
dest_folder="/tmp/allure-2022-05-05_12-20-01/result",
auto_create_folders=True
)
# 4) Remove sinon.js and server.js from allure folder after complete.html is generated:
combine_allure(
"./some/path/to/allure/generated/folder",
remove_temp_files=True
)
# 5) If html/json files what should be utf-8 is has broken encoding, ignore errors:
combine_allure(
"./some/path/to/allure/generated/folder",
ignore_utf8_errors=True
)
# 6) If the text content of generated HTML presents formatting issues, try this option:
combine_allure(
"./some/path/to/allure/generated/folder",
disable_tags_escaping=True
)
The repository contains Docker-based integration tests in integration_tests/ that validate allure-combine CLI flows (including --dest, --auto-create-folders, --remove-temp-files, --ignore-utf8-errors, and --disable-tags-escaping).
Run full integration flow (requires Docker): build image, run tests, generate complete.html for each CLI variant, and validate every generated HTML in headless Chromium via Playwright.
./run_integration_tests.shOptional environment variables:
IMAGE_TAG=my-allure-itests:dev ./run_integration_tests.sh
ARTIFACTS_DIR=./tmp/allure-itests ./run_integration_tests.sh
RUN_PLAYWRIGHT_VALIDATION=0 ./run_integration_tests.sh
PLAYWRIGHT_IMAGE=mcr.microsoft.com/playwright:v1.56.1-noble ./run_integration_tests.sh
PLAYWRIGHT_VERSION=1.56.1 ./run_integration_tests.shValidate an existing HTML report directly with Playwright:
./validate_html_with_playwright.sh ./integration_tests/artifacts/complete.htmlBy default, generated reports are stored under integration_tests/artifacts/ and variants under integration_tests/artifacts/variants/.
- Functionality to open image or video in new browser tab doesn't work yet.
- Need functionality to return combined file as a string, not saving it to a file directly
- Functionality to not change source files at all, work in a read-only filesystem