FAQ | This is a LIVE service | Changelog

Skip to content
Snippets Groups Projects

Chrome mobile

Merged Jason Allen requested to merge chrome-mobile into master
24 files
+ 338
80
Compare changes
  • Side-by-side
  • Inline
Files
24
package uk.ac.cam.automation.seleniumframework.allure;
import io.qameta.allure.Allure;
import io.qameta.allure.listener.StepLifecycleListener;
import io.qameta.allure.model.StepResult;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
import uk.ac.cam.automation.seleniumframework.driver.DriverManager;
import uk.ac.cam.automation.seleniumframework.properties.CommonProperties;
import uk.ac.cam.automation.seleniumframework.properties.PropertyLoader;
import uk.ac.cam.automation.seleniumframework.screenshots.ScreenshotTaker;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
public class AllureScreenshotPublisher implements StepLifecycleListener {
@Override
public void afterStepUpdate(StepResult result) {
if (PropertyLoader.getProperty(CommonProperties.SCREENSHOT_OFF) == null) {
byte[] screenShot = ((TakesScreenshot) DriverManager.getDriver()).getScreenshotAs(OutputType.BYTES);
Allure.getLifecycle().addAttachment(LocalDateTime.now().format(DateTimeFormatter.ofPattern("dd-MMM-yy_hh:mm:ss")), "image/png", "png", screenShot);
}
ScreenshotTaker.attachScreenshot();
}
}
\ No newline at end of file
Loading