Bug 4693: Using a distinct file name for each screenshot to not override

existing images
This commit is contained in:
Steffen Schaefer
2018-07-30 15:31:21 +02:00
parent 44d0608eb3
commit b83a6db112
@@ -176,7 +176,7 @@ public abstract class AbstractSeleniumTest {
@Override
public void failed(Throwable cause, FrameworkMethod method) {
try {
captureScreenshot(UUID.randomUUID().toString());
captureScreenshots();
} catch (Exception exception) {
exception.printStackTrace();
}
@@ -249,10 +249,12 @@ public abstract class AbstractSeleniumTest {
* @throws IOException
* if an I/O error occurs.
*/
protected void captureScreenshot(String filename) {
protected void captureScreenshots() {
File screenshotFolder = this.environment.getScreenshotFolder();
if (screenshotFolder != null) {
this.environment.getWindowManager().forEachOpenedWindow(window -> {
final String filename = UUID.randomUUID().toString();
WebDriver driver = window.getWebDriver();
if (RemoteWebDriver.class.equals(driver.getClass())) {
driver = new Augmenter().augment(driver);