Fix problem of intermittent Selenium link conversion to absolute URLs
authorBob Harner <bobharner@gmail.com>
Sun, 4 Nov 2018 16:54:35 +0000 (11:54 -0500)
committerBob Harner <bobharner@gmail.com>
Sun, 4 Nov 2018 17:16:02 +0000 (12:16 -0500)
tapestry-core/src/test/groovy/org/apache/tapestry5/integration/appfolder/AppFolderTests.groovy

index c2baaab..a0c192d 100644 (file)
@@ -56,10 +56,12 @@ class AppFolderTests extends GroovyTapestryCoreTestCase
         // there's only one image on page
         String assetURL = getAttribute("//img/@src")
 
-        // Selenium now adds unwanted port & host
-        String urlPath = new URL(assetURL).getPath();
+        // Selenium now (sometimes?) adds unwanted port & host
+        if (assetURL.startsWith("http")) {
+            assetURL = new URL(assetURL).getPath()
+        }
 
-        assert urlPath.startsWith("/t5app/assets/")
+        assert assetURL.startsWith("/t5app/assets/")
 
         assertDownloadedAsset urlPath, "src/test/appfolder/images/t5-logo.png"
     }