I'm trying to use Allure-framework to generate a report for my Selenium WebDriver tests. I use JUnit framework and allure-maven-plugin with version 1.3.9 of Allure. I run tests with mvn test then generate the report using mvn site. I see generated report in target/site/allure-maven-plugin/ directory. When I open index.html page with Firefox it works normally. However when doing the same thing in Chrome or Safari I see nothing.
What's wrong? Am I missing something? My pom.xml file is located here.
This problem is related to default Webkit security settings which forbid doing Ajax requests on the local filesystem. You have at least two possible solutions:
- Serve index.html with some web-server like Nginx or Apache. This will emulate remote website and thus trick your browser. With Allure CLI 2.0+ this can be done using the following command:
$ allure report open
- Use --allow-file-access-from-files Chrome flag. See details in this question.
In Addition to the above answer using "--ignore-certifcate-errors" with chromeOptions might be helpfull.
DesiredCapabilities capabilities;
capabilities = DesiredCapabilities.chrome();
ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.addArguments("--ignore-certifcate-errors");
chromeOptions.addArguments("test-type");
capabilities.setCapability(ChromeOptions.CAPABILITY, chromeOptions);
WebDriver driver = new ChromeDriver(capabilities);
To use allure report in chrome, you have two options:
- Use
mvn allure:servetarget. It will generate the report and open a tab in Chrome (if default browser) - Generate the report using
mvn allure:reporttarget and serve the site your self, using any http server. if you have node you can usehttp-serverfor examplenpm install http-server -gand thenhttp-server target/site/allure-maven-plugin)
DO NOT use --allow-file-access-from-files flag, is it DANDEGEROUS
Allure 404 error:
- 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 :)
来源:https://stackoverflow.com/questions/23997449/allure-report-nothing-shown-in-chrome