in allure pytest ~ read.
Opening local version of Allure report with Chrome

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 :
1. Install allure cli with brew install allure
2. Add pytest-allure-adaptor==1.7.7 dependency to requirements.txt
3. Add steps annotations to Page Object methods
4. Run tests with py.test --alluredir=reports command
5. As a result, i got JUnit XML report file that I could use for allure report generation
6. I managed to generate the report with allure generate report command. As an outcome, i was able to find allure-reports folder with index.html in it.
But, when I opened it, I got an empty report with 404 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 :
1. Open report in Firefox
2. Disable cross origin policy option in Chrome - very bad idea, since your chrome will become vulnerable to third party intrusion. Don't do it!.
3. 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.

comments powered by Disqus
comments powered by Disqus