Fix unit tests (although BeanValidator tests still fail intermittently) This involved upgrading Selenium from 3.7.1 to 3.12.0 and webdrivermanager from 2.0.0 to 2.2.4, and reverting some of Jochen's AppFolderTests.groovy changes from Nov 2017.
Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/d50d22c7 Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/d50d22c7 Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/d50d22c7 Branch: refs/heads/master Commit: d50d22c726b991c44fc507f7f4f6cfe7f213de7e Parents: daf3cee Author: Bob Harner <[email protected]> Authored: Sat Aug 4 22:27:57 2018 -0400 Committer: Bob Harner <[email protected]> Committed: Sat Aug 4 22:27:57 2018 -0400 ---------------------------------------------------------------------- build.gradle | 2 +- .../integration/appfolder/AppFolderTests.groovy | 8 ++++---- .../tapestry5/integration/app1/components/Border.tml | 2 +- tapestry-test/build.gradle | 2 +- .../org/apache/tapestry5/test/SeleniumTestCase.java | 15 ++++++++++----- tapestry-webresources/build.gradle | 2 +- 6 files changed, 18 insertions(+), 13 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/d50d22c7/build.gradle ---------------------------------------------------------------------- diff --git a/build.gradle b/build.gradle index 215e7af..a19d0d5 100755 --- a/build.gradle +++ b/build.gradle @@ -17,7 +17,7 @@ project.ext.versions = [ hibernate: "5.1.0.Final", slf4j: "1.7.25", geb: "2.0", - selenium: "3.7.1" + selenium: "3.12.0" ] ext.continuousIntegrationBuild = Boolean.getBoolean("ci") http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/d50d22c7/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/appfolder/AppFolderTests.groovy ---------------------------------------------------------------------- diff --git a/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/appfolder/AppFolderTests.groovy b/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/appfolder/AppFolderTests.groovy index 4a3c996..0ee69ba 100644 --- a/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/appfolder/AppFolderTests.groovy +++ b/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/appfolder/AppFolderTests.groovy @@ -15,7 +15,7 @@ class AppFolderTests extends GroovyTapestryCoreTestCase @Test void page_navigation() { - openLinks "t5app/ " + openLinks "t5app/" assertTitle "Index Page" @@ -31,7 +31,7 @@ class AppFolderTests extends GroovyTapestryCoreTestCase @Test void component_event_request() { - openLinks "t5app/ ", "show index page alert" + openLinks "t5app/", "show index page alert" assertTextPresent "index page alert" } @@ -39,7 +39,7 @@ class AppFolderTests extends GroovyTapestryCoreTestCase @Test void static_pages() { - openLinks "static.html " + openLinks "static.html" assertTitle "Static File" @@ -51,7 +51,7 @@ class AppFolderTests extends GroovyTapestryCoreTestCase @Test void asset_access() { - openLinks "t5app/ " + openLinks "t5app/" // Ony one image on page String assetURL = getAttribute("//img/@src") http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/d50d22c7/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/components/Border.tml ---------------------------------------------------------------------- diff --git a/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/components/Border.tml b/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/components/Border.tml index 36c8b00..007f7a0 100644 --- a/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/components/Border.tml +++ b/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/components/Border.tml @@ -3,7 +3,7 @@ <head> <title>Tapestry Integration Test Application</title> </head> -<body data-floating-console="enabled"> +<body data-floating-console="invisible"> <div class="navbar navbar-inverse navbar-static-top" role="navigation"> <div class="container"> http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/d50d22c7/tapestry-test/build.gradle ---------------------------------------------------------------------- diff --git a/tapestry-test/build.gradle b/tapestry-test/build.gradle index 8753084..41ef97f 100644 --- a/tapestry-test/build.gradle +++ b/tapestry-test/build.gradle @@ -5,7 +5,7 @@ dependencies { compile project(":tapestry-test-data") compile project(":tapestry-runner") - compile ("io.github.bonigarcia:webdrivermanager:2.0.0") + compile ("io.github.bonigarcia:webdrivermanager:2.2.4") compile "org.seleniumhq.selenium:selenium-leg-rc:${versions.selenium}", { exclude group: "org.seleniumhq.selenium", module: "jetty-repacked" http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/d50d22c7/tapestry-test/src/main/java/org/apache/tapestry5/test/SeleniumTestCase.java ---------------------------------------------------------------------- diff --git a/tapestry-test/src/main/java/org/apache/tapestry5/test/SeleniumTestCase.java b/tapestry-test/src/main/java/org/apache/tapestry5/test/SeleniumTestCase.java index a1fba91..34806f8 100644 --- a/tapestry-test/src/main/java/org/apache/tapestry5/test/SeleniumTestCase.java +++ b/tapestry-test/src/main/java/org/apache/tapestry5/test/SeleniumTestCase.java @@ -37,6 +37,8 @@ import org.testng.ITestContext; import org.testng.annotations.*; import org.testng.xml.XmlTest; +import io.github.bonigarcia.wdm.FirefoxDriverManager; + import java.io.File; import java.lang.reflect.Method; import java.util.concurrent.TimeUnit; @@ -207,11 +209,11 @@ public abstract class SeleniumTestCase extends Assert implements Selenium final Runnable stopWebServer = launchWebServer(container, webAppFolder, contextPath, port, sslPort); - // FirefoxDriverManager.getInstance().setup(); + FirefoxDriverManager.getInstance().setup(); File ffProfileTemplate = new File(TapestryRunnerConstants.MODULE_BASE_DIR, "src/test/conf/ff_profile_template"); DesiredCapabilities desiredCapabilities = DesiredCapabilities.firefox(); - desiredCapabilities.setCapability(FirefoxDriver.MARIONETTE, false); + desiredCapabilities.setCapability(FirefoxDriver.MARIONETTE, true); FirefoxOptions options = new FirefoxOptions(desiredCapabilities); @@ -260,7 +262,9 @@ public abstract class SeleniumTestCase extends Assert implements Selenium try { - webDriver.quit(); + if (webDriver != null) { // is sometimes null... but why? + webDriver.quit(); + } } catch (RuntimeException e) { LOGGER.error("Webdriver shutdown failure.", e); @@ -563,7 +567,9 @@ public abstract class SeleniumTestCase extends Assert implements Selenium { WebElement element = webDriver.findElement(convertLocator(locator)); scrollIntoView(element); - element.click(); + JavascriptExecutor executor = (JavascriptExecutor)webDriver; + executor.executeScript("arguments[0].click();", element); +// element.click(); // failing as of Aug 2018 } @Override @@ -1801,7 +1807,6 @@ public abstract class SeleniumTestCase extends Assert implements Selenium protected static By convertLocator(String locator) { - By by; if (locator.startsWith("link=")) { return By.linkText(locator.substring(5)); http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/d50d22c7/tapestry-webresources/build.gradle ---------------------------------------------------------------------- diff --git a/tapestry-webresources/build.gradle b/tapestry-webresources/build.gradle index 775cdde..7c9eb63 100644 --- a/tapestry-webresources/build.gradle +++ b/tapestry-webresources/build.gradle @@ -16,7 +16,7 @@ dependencies { testCompile "org.seleniumhq.selenium:selenium-server:${versions.selenium}", { exclude group: "org.eclipse.jetty" } - testCompile ("io.github.bonigarcia:webdrivermanager:1.7.2") + testCompile ("io.github.bonigarcia:webdrivermanager:2.2.4") }
