Opening local version of Allure report with Chrome
Recently I was trying to integrate Allure report with some Webdriver tests I was writing with py.test. I did everything like it was said in the documentation :
- Install allure cli with
brew install allure
- Add
pytest-allure-adaptor==1.7.7
dependency torequirements.txt
- Add steps annotations to Page Object methods
- Run tests with
py.test --alluredir=reports
command - As a result, i got JUnit XML report file that I could use for allure report generation
- I managed to generate the report with
allure generate report
command. As an outcome, i was able to findallure-reports
folder withindex.html
in it.
But, when I opened it, I got an empty report with404 Not Found
error message.
With allure serve report
command I was able to see test results just fine. But for some reason, I couldn't browse local report in Chrome. So I asked for help. With quick help from Artem Eroshenko we managed to figure out that the problem was in Chrome Same origin policy enabled option. Indeed, when I opened local report in Chrome and went to Developer console, I was able to see the error :
XMLHttpRequest cannot load file:///var/folders/t6/bwm48vv112n2vn943c825t980000gp/T/7567737615297653314/allure-report/data/widgets.json. Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.
So, how to fix it? Well, you have couple choices :
- Open report in Firefox
- Disable cross origin policy option in Chrome - very bad idea, since your chrome will become vulnerable to third party intrusion.
Don't do it!
. - You can use
allure serve allure-report
command - it will spin up small web server, that will serve your report and you can view it in your favorite Chrome browser :)
Allure team made a really good job with their report tool and I hope with this tip you won't encounter problems as I did.