diff --git a/serenity-core/src/main/java/net/serenitybdd/core/pages/BuildWebElementFacade.java b/serenity-core/src/main/java/net/serenitybdd/core/pages/BuildWebElementFacade.java index 9642dcbe2a..93a1129656 100644 --- a/serenity-core/src/main/java/net/serenitybdd/core/pages/BuildWebElementFacade.java +++ b/serenity-core/src/main/java/net/serenitybdd/core/pages/BuildWebElementFacade.java @@ -40,16 +40,24 @@ public static T from(WebDriver driver, } public static T from(final WebDriver driver, - final By bySelector, - final long timeoutInMilliseconds, - final long waitForTimeoutInMilliseconds, - final String foundBy) { + final By bySelector, + final long timeoutInMilliseconds, + final long waitForTimeoutInMilliseconds, + final String foundBy) { + return (T) new WebElementFacadeImpl(driver, null, driver.findElement(bySelector), timeoutInMilliseconds, waitForTimeoutInMilliseconds, bySelector).foundBy(foundBy); +// WebElement resolvedElement = driver.findElement(bySelector); +// +// WebElementResolver.by(bySelector); +// +// return (resolvedElement instanceof WrapsElement) +// ? (T) new WrappedWebElementFacadeImpl(driver, null, resolvedElement, timeoutInMilliseconds, waitForTimeoutInMilliseconds).foundBy(foundBy) +// : (T) new WebElementFacadeImpl(driver, null, driver.findElement(bySelector), timeoutInMilliseconds, waitForTimeoutInMilliseconds, bySelector).foundBy(foundBy); } public static T from(final WebDriver driver, - final WebElement element, - final long timeout) { + final WebElement element, + final long timeout) { return (element instanceof WrapsElement) ? (T) new WrappedWebElementFacadeImpl(driver, null, element, timeout, timeout).foundBy(element.toString()) : (T) new WebElementFacadeImpl(driver, null, element, timeout, timeout).foundBy(element.toString()); @@ -57,7 +65,7 @@ public static T from(final WebDriver driver, public static T from(WebDriver driver, ElementLocator locator, WebElement element, long implicitTimeoutInMilliseconds, long waitForTimeoutInMilliseconds) { return (element instanceof WrapsElement) - ? (T) new WrappedWebElementFacadeImpl(driver, locator, element, implicitTimeoutInMilliseconds, waitForTimeoutInMilliseconds) - : (T) new WebElementFacadeImpl(driver, locator, element, implicitTimeoutInMilliseconds, waitForTimeoutInMilliseconds); + ? (T) new WrappedWebElementFacadeImpl(driver, locator, element, implicitTimeoutInMilliseconds, waitForTimeoutInMilliseconds) + : (T) new WebElementFacadeImpl(driver, locator, element, implicitTimeoutInMilliseconds, waitForTimeoutInMilliseconds); } } \ No newline at end of file diff --git a/serenity-core/src/main/java/net/serenitybdd/core/pages/WebElementResolverByLocator.java b/serenity-core/src/main/java/net/serenitybdd/core/pages/WebElementResolverByLocator.java index f22d061ef0..f97d05d248 100644 --- a/serenity-core/src/main/java/net/serenitybdd/core/pages/WebElementResolverByLocator.java +++ b/serenity-core/src/main/java/net/serenitybdd/core/pages/WebElementResolverByLocator.java @@ -8,13 +8,20 @@ public class WebElementResolverByLocator extends WebElementResolver { private final By bySelector; + private final long implicitTimeoutInMilliseconds; - public WebElementResolverByLocator(By bySelector) { + public WebElementResolverByLocator(By bySelector, long implicitTimeoutInMilliseconds) { this.bySelector = bySelector; + this.implicitTimeoutInMilliseconds = implicitTimeoutInMilliseconds; + } + + public WebElementResolverByLocator(By bySelector) { + this(bySelector, 0L); } @Override public WebElement resolveForDriver(WebDriver driver) { + return driver.findElement(bySelector); } diff --git a/serenity-core/src/main/java/net/serenitybdd/core/photography/PhotoSession.java b/serenity-core/src/main/java/net/serenitybdd/core/photography/PhotoSession.java index 4018a25f9b..aa4410db56 100644 --- a/serenity-core/src/main/java/net/serenitybdd/core/photography/PhotoSession.java +++ b/serenity-core/src/main/java/net/serenitybdd/core/photography/PhotoSession.java @@ -60,7 +60,7 @@ public ScreenshotPhoto takeScreenshot() { byte[] screenshotData = null; - if (WebDriverFactory.isAlive(driver) && driver instanceof TakesScreenshot) { + if (WebDriverFactory.isAlive(driver) && unproxied(driver) instanceof TakesScreenshot) { try { PageSnapshot snapshot = Shutterbug.shootPage(unproxied(driver), scrollStrategy, 500); screenshotData = asByteArray(snapshot.getImage()); diff --git a/serenity-model/src/main/java/net/thucydides/core/ThucydidesSystemProperty.java b/serenity-model/src/main/java/net/thucydides/core/ThucydidesSystemProperty.java index 9f4b4d634f..a23a248669 100644 --- a/serenity-model/src/main/java/net/thucydides/core/ThucydidesSystemProperty.java +++ b/serenity-model/src/main/java/net/thucydides/core/ThucydidesSystemProperty.java @@ -1021,6 +1021,11 @@ public enum ThucydidesSystemProperty { */ DELETE_HISTORY_DIRECTORY, + /** + * Generate a CSV report for each test result (true by default) + */ + SERENITY_GENERATE_CSV_REPORTS, + /** * Add extra columns to the CSV output, obtained from tag values. */ @@ -1601,7 +1606,6 @@ public Boolean booleanFrom(EnvironmentVariables environmentVariables, Boolean de if (environmentVariables == null) { return defaultValue; } Optional newPropertyValue = optionalPropertyValueDefinedIn(environmentVariables); -// = Optional.ofNullable(environmentVariables.getProperty(withSerenityPrefix(getPropertyName()))); if (isDefined(newPropertyValue)) { return Boolean.valueOf(newPropertyValue.get().trim()); diff --git a/serenity-model/src/main/java/net/thucydides/core/logging/ConsoleLoggingListener.java b/serenity-model/src/main/java/net/thucydides/core/logging/ConsoleLoggingListener.java index 545f56c256..775880eb03 100644 --- a/serenity-model/src/main/java/net/thucydides/core/logging/ConsoleLoggingListener.java +++ b/serenity-model/src/main/java/net/thucydides/core/logging/ConsoleLoggingListener.java @@ -50,7 +50,6 @@ public class ConsoleLoggingListener implements StepListener { " Documentation at https://wakaleo.gitbooks.io/the-serenity-book/content/ \n" + " Join the Serenity Community on Gitter: https://gitter.im/serenity-bdd/serenity-core \n" + " Serenity BDD Support and Training at http://serenity-bdd.info/#/trainingandsupport \n" + - " Learn Serenity BDD online at https://www.serenitydojo.net \n" + "-------------------------------------------------------------------------------------\n"; public static final String SERENITY_SMALL_BANNER = @@ -62,7 +61,6 @@ public class ConsoleLoggingListener implements StepListener { " Documentation at https://wakaleo.gitbooks.io/the-serenity-book/content/ \n" + " Join the Serenity Community on Gitter: https://gitter.im/serenity-bdd/serenity-core \n" + " Serenity BDD Support and Training at http://serenity-bdd.info/#/trainingandsupport \n" + - " Learn Serenity BDD online at https://www.serenitydojo.net \n" + "-------------------------------------------------------------------------------------\n"; // MAIN BANNERS diff --git a/serenity-reports/src/main/java/net/thucydides/core/reports/html/AggregateReportingTask.java b/serenity-reports/src/main/java/net/thucydides/core/reports/html/AggregateReportingTask.java index 3f37dbfca5..2ad1d7cfb0 100644 --- a/serenity-reports/src/main/java/net/thucydides/core/reports/html/AggregateReportingTask.java +++ b/serenity-reports/src/main/java/net/thucydides/core/reports/html/AggregateReportingTask.java @@ -10,6 +10,7 @@ import java.io.IOException; import java.util.Map; +import static net.thucydides.core.ThucydidesSystemProperty.SERENITY_GENERATE_CSV_REPORTS; import static net.thucydides.core.reports.html.ReportNameProvider.NO_CONTEXT; public class AggregateReportingTask extends BaseReportingTask implements ReportingTask { @@ -40,12 +41,19 @@ public void generateReports() throws IOException { Map context = freemarker.getBuildContext(testOutcomes, defaultNameProvider, true); context.put("report", ReportProperties.forAggregateResultsReport()); - context.put("csvReport", "results.csv"); generateReportPage(context, HOME_PAGE_TEMPLATE_PATH, "index.html"); generateReportPage(context, BUILD_INFO_TEMPLATE_PATH, "build-info.html"); - generateCSVReportFor(testOutcomes, "results.csv"); + + if (csvReportsAreActivated()) { + context.put("csvReport", "results.csv"); + generateCSVReportFor(testOutcomes, "results.csv"); + } LOGGER.debug("Aggregate reports generated in {} ms ", stopwatch.stop()); } + + private boolean csvReportsAreActivated() { + return SERENITY_GENERATE_CSV_REPORTS.booleanFrom(environmentVariables, true); + } } diff --git a/serenity-screenplay-webdriver/src/test/java/net/serenitybdd/screenplay/webtests/integration/WhenSeveralActorsBrowsesTheWebWithDifferentBrowsers.java b/serenity-screenplay-webdriver/src/test/java/net/serenitybdd/screenplay/webtests/integration/WhenSeveralActorsBrowsesTheWebWithDifferentBrowsers.java index 7a7384eb2b..8e197f6899 100644 --- a/serenity-screenplay-webdriver/src/test/java/net/serenitybdd/screenplay/webtests/integration/WhenSeveralActorsBrowsesTheWebWithDifferentBrowsers.java +++ b/serenity-screenplay-webdriver/src/test/java/net/serenitybdd/screenplay/webtests/integration/WhenSeveralActorsBrowsesTheWebWithDifferentBrowsers.java @@ -62,7 +62,6 @@ public void multipleUsersCanUseDifferentBrowsers() { then(jill).should(seeThat(herProfile, hasProperty("name", equalTo("Jill")))); and(jill).should(seeThat(herProfile, hasProperty("country", equalTo("France")))); - } @@ -98,8 +97,8 @@ public void multipleUsersCanUseDifferentBrowsersInDifferentOrders() { then(jill).should(seeThat(herProfile, hasProperty("name", equalTo("Jill")))); and(jill).should(seeThat(herProfile, hasProperty("country", equalTo("France")))); - } + @Steps OpenTheApplication openedTheApplication;