You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Cannot attach Selenide screenshot into allure 2.0 report #215
Here is the path to selenide screenshots:
.../myProject/build/reports/tests/pic.png
Here is the path to allure-results folder:
.../myProject/target/allure-results/....testsuite.xml
Can someone help me to fix the issue, or provide the correct way of implementation?
Conclusion:
I would like to have at the end - run the command "allure serve .../myProject/target/allure-results/"
and screenshots should be shown under my failed tests allure report section.
@dimencionrider
you can use the default as above which will include screenshots, or you can implement LogEventListener and pass the concrete implementation to SelenideLogger.addListener("foo", new concreteImpl());
allure will release soon i guess and make it simple to have the fluent capabilities. Here is an example I implemented my own listener to include screenshot, page source and a .json log file per threaded test
I recently faced similar issue with TestNG and could not resolve with SelenideLogger.addListener("AllureSelenide", new AllureSelenide().screenshots(true).savePageSource(true));
as my use case was to Take screenshots for successful cases .
Finally this worked for me (may not be the best solution ) but it may be helpful to someone who reach here via Search engine.
publicbyte[] captureScreenshot() throwsIOException {
// Generate a random filename using UUIDStringrandomFileName = "screenshot-" + UUID.randomUUID().toString();
Selenide.screenshot(randomFileName).getBytes(StandardCharsets.UTF_8);
Filescreenshot = Screenshots.getLastScreenshot();
returnscreenshot == null ? null : Files.toByteArray(screenshot);
}
Activity
baev commentedon Apr 6, 2018
Allure knows nothing about screenshots from Selenide, so you need to save screenshots using Allure API.
Also you can consider using Allure Selenide integration, that will do all the work for you https://docs.qameta.io/allure/#_selenide
dimencionrider commentedon Apr 6, 2018
Selenide listener does not work for me. It cannot download sources from maven repository.
import io.qameta.allure.selenide.AllureSelenide; - showing red colour in my IDEA
any other ways? or workarounds?
baev commentedon Apr 6, 2018
hm https://repo.maven.apache.org/maven2/io/qameta/allure/allure-selenide/2.6.0/
Have you added dependency? Try to invalidate caches for IDEA and restart
rosolko commentedon Apr 6, 2018
@baev @dimencionrider Just not that 2.6.0 version can't configure screenshots and savePageSource properties because that was added after release.
dimencionrider commentedon Apr 6, 2018
in my build.gradle file I have this dependency:
compile group: 'io.qameta.allure', name: 'allure-selenide', version: '2.0-BETA22'
here is screenshot of my method: https://prnt.sc/j1qc5e
I cannot import AllureSelenide()
rosolko commentedon Apr 6, 2018
@dimencionrider change version to 2.6.0
dimencionrider commentedon Apr 10, 2018
@baev @rosolko does not work with 2.6.0
janeberets commentedon Apr 30, 2018
@baev @rosolko Class AllureSelenide.java has not method 'screenshots' in tag 2.6.0. But in branch master - it has. Is it normal?
rosolko commentedon May 7, 2018
@janeberets It's weird. Because readme file updated with new features, but released the old one :(
rosolko commentedon Jun 7, 2018
@baev Can you please release 2.6.1 or 2.7.0 version with latest selenide ext version?
simple-elf commentedon Jun 24, 2018
@rosolko @dimencionrider @janeberets you can use 2.6.0 version. There is screenshots config value
trueby defaultsymonk commentedon Jul 9, 2018
@dimencionrider
you can use the default as above which will include screenshots, or you can implement
LogEventListenerand pass the concrete implementation to SelenideLogger.addListener("foo", new concreteImpl());allure will release soon i guess and make it simple to have the fluent capabilities. Here is an example I implemented my own listener to include screenshot, page source and a .json log file per threaded test
https://github.com/symonk/Selenide-TestNG-Allure2-Framework/blob/master/gui-tests/src/test/java/io.github.symonk/configurations/selenide/CustomListener.java
example:
new CustomListener().withPageSource(true).withScreenshot(true).withTestLog(true);simple-elf commentedon Jul 26, 2018
@dimencionrider @rosolko 2.7.0 released - https://github.com/allure-framework/allure-java/releases/tag/2.7.0
So now you can write like in docs https://docs.qameta.io/allure/#_selenide
Also you can disable standart selenide screenshoots by
Configuration.screenshots = falsebecause it will just dublicates files.@dimencionrider Do you have any other questions or problems? Can we close this issue?
baev commentedon Oct 18, 2018
thats looks like configuration issue. If you still having issues with that please asking a question in our community chat https://gitter.im/allure-framework/allure-core
amardeep2006 commentedon Oct 30, 2024
I recently faced similar issue with TestNG and could not resolve with
SelenideLogger.addListener("AllureSelenide", new AllureSelenide().screenshots(true).savePageSource(true));as my use case was to Take screenshots for successful cases .
Finally this worked for me (may not be the best solution ) but it may be helpful to someone who reach here via Search engine.
This Reference for Junit was helpful but did not solve for TestNG. https://github.com/selenide-examples/selenide-allure-junit/tree/main