Git Product home page Git Product logo

allure-single-html-file's Introduction

Allure single html file builder

Tool to build allure generated folder into a single html file

What it's doing?

After run by console command, or by call from python code, it:

  1. Reads contents of allure-generated folder
  2. Creates server.js file, which has all the data files inside and code to start fake XHR server
  3. 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
  4. Creates file complete.html with all files built-in in a single file

Attention! Update!

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!

Requirements

  • Python 3.6+
  • You need to have your allure report folder generated (allure generate './some/path/to/allure/generated/folder')

Installation

Install with pip

pip install allure-combine

or:

Install manually

  1. Clone repo
git clone [email protected]:MihanEntalpo/allure-single-html-file.git
cd allure-single-html-file
  1. Install requirements (actually there are only BeautifulSoup)
pip install -r ./requirements.txt
python setup.py install

Run as console script

If you have cloned repo, not installed module via pip, replace allure-combine with python ./allure_combine/combine.py in following commands:

  1. Create complete.html file inside the allure folder itself
allure-combine ./some/path/to/allure/generated/folder
  1. Create complete.html file inside specified folder:
allure-combine ./some/path/to/allure/generated/folder --dest /tmp
  1. 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
  1. 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
  1. 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

Import and use in python code

pip install allure-combine
from 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
)

TODO

  • 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

Ports to other languages:

allure-single-html-file's People

Contributors

mihanentalpo avatar kisscelia avatar vazhnov avatar m-rubin-itmegastar-com avatar brainlucker avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.