This is an automated email from the ASF dual-hosted git repository. sdelamo pushed a commit to branch use-relative-paths in repository https://gitbox.apache.org/repos/asf/groovy-geb.git
commit 4afdf5489599bb5b8994ee5a9f528a61b5744408 Author: Sergio del Amo <[email protected]> AuthorDate: Thu Feb 6 11:31:38 2025 +0100 use relative paths To enable us to host the website for example in https://groovy.apache.org/geb/ --- doc/site/src/test/groovy/geb/LinkCrawlSpec.groovy | 2 +- doc/site/src/test/groovy/geb/SiteSmokeSpec.groovy | 2 +- .../src/test/groovy/geb/crawl/NormalizeURL.java | 6 +- doc/site/templates/main.html | 67 +++++++++++----------- 4 files changed, 40 insertions(+), 37 deletions(-) diff --git a/doc/site/src/test/groovy/geb/LinkCrawlSpec.groovy b/doc/site/src/test/groovy/geb/LinkCrawlSpec.groovy index 4ee17c6d..cb813e43 100644 --- a/doc/site/src/test/groovy/geb/LinkCrawlSpec.groovy +++ b/doc/site/src/test/groovy/geb/LinkCrawlSpec.groovy @@ -37,7 +37,7 @@ class LinkCrawlSpec extends Specification { def allowBroken = ["https://travis-ci.org", "http://markmail.org", "https://circleci.com", "https://saucelabs.com", "https://wiki.saucelabs.com", "http://ldaley.com"] - String startingUrl = "http://localhost:${aut.port}" + String startingUrl = "http://localhost:${aut.port}/" Set<String> knowBadHosts = ["markmail.org", "ldaley.com"] as Set<String> def crawler = new Crawler(startingUrl, knowBadHosts) { boolean shouldUseHeadRequest(Link url) { diff --git a/doc/site/src/test/groovy/geb/SiteSmokeSpec.groovy b/doc/site/src/test/groovy/geb/SiteSmokeSpec.groovy index ac8fd450..3b1c9d0c 100644 --- a/doc/site/src/test/groovy/geb/SiteSmokeSpec.groovy +++ b/doc/site/src/test/groovy/geb/SiteSmokeSpec.groovy @@ -39,7 +39,7 @@ class SiteSmokeSpec extends GebSpec { EmbeddedServer app = ApplicationContext.run(EmbeddedServer) def setup() { - browser.baseUrl = "http://localhost:${app.port}".toString() + browser.baseUrl = "http://localhost:${app.port}/".toString() } def cleanupSpec() { diff --git a/doc/site/src/test/groovy/geb/crawl/NormalizeURL.java b/doc/site/src/test/groovy/geb/crawl/NormalizeURL.java index 7637baac..ec7399b5 100644 --- a/doc/site/src/test/groovy/geb/crawl/NormalizeURL.java +++ b/doc/site/src/test/groovy/geb/crawl/NormalizeURL.java @@ -34,9 +34,13 @@ public class NormalizeURL { private final static Logger LOGGER = LoggerFactory.getLogger(NormalizeURL.class); public static String normalize(final String taintedURL) throws MalformedURLException { + String fixedUrl = taintedURL; + if (fixedUrl.startsWith("./")) { + fixedUrl = fixedUrl.substring(1); + } final URL url; try { - url = new URI(taintedURL).normalize().toURL(); + url = new URI(fixedUrl).normalize().toURL(); } catch (URISyntaxException e) { throw new MalformedURLException(e.getMessage()); } diff --git a/doc/site/templates/main.html b/doc/site/templates/main.html index 3446a9e3..81e14e23 100644 --- a/doc/site/templates/main.html +++ b/doc/site/templates/main.html @@ -23,11 +23,10 @@ })(); </script> - <link rel="stylesheet" href="/css/semantic.min.css"> - <link rel="stylesheet" href="/css/base.css"> - - <link type="text/css" rel="stylesheet" href="/css/shCore.css" /> - <link type="text/css" rel="stylesheet" href="/css/shThemeEclipse.css" /> + <link rel="stylesheet" href="./css/semantic.min.css"> + <link rel="stylesheet" href="./css/base.css"> + <link type="text/css" rel="stylesheet" href="./css/shCore.css" /> + <link type="text/css" rel="stylesheet" href="./css/shThemeEclipse.css" /> <title>Geb - Very Groovy Browser Automation</title> </head> @@ -39,7 +38,7 @@ <a class="toc item"> <i class="sidebar icon"></i> </a> - <a class="active item" href="/">Home</a> + <a class="active item" href="./">Home</a> <a class="manuals item">Manual</a> <a class="apis item">API</a> <a class="mailing-lists item">Mailing Lists</a> @@ -51,23 +50,23 @@ <div id="apis-menu" class="ui horizontal secondary inverted hidden transition menu"> <div class="ui container"> - <a href="/manual/current/api/" class="item"> + <a href="./manual/current/api/" class="item"> <div class="ui green horizontal label">current</div> <%= current %> </a> - <% for (String v : old) { print "<a href=\"/manual/$v/api/\" class=\"item\">$v</a>" } %> - <% if (snapshot) print "<a href=\"/manual/snapshot/api/\" class=\"item\"><div class=\"ui yellow horizontal label\">snapshot</div>${snapshot}</a>" %> + <% for (String v : old) { print "<a href=\"./manual/$v/api/\" class=\"item\">$v</a>" } %> + <% if (snapshot) print "<a href=\"./manual/snapshot/api/\" class=\"item\"><div class=\"ui yellow horizontal label\">snapshot</div>${snapshot}</a>" %> </div> </div> <div id="manuals-menu" class="ui horizontal secondary inverted hidden transition menu"> <div class="ui container"> - <a href="/manual/current/" class="item"> + <a href="./manual/current/" class="item"> <div class="ui green horizontal label">current</div> <%= current %> </a> - <% for (String v : old) { print "<a href=\"/manual/$v/\" class=\"item\">$v</a>" } %> - <% if (snapshot) print "<a href=\"/manual/snapshot/\" class=\"item\"><div class=\"ui yellow horizontal label\">snapshot</div>${snapshot}</a>" %> + <% for (String v : old) { print "<a href=\"./manual/$v/\" class=\"item\">$v</a>" } %> + <% if (snapshot) print "<a href=\"./manual/snapshot/\" class=\"item\"><div class=\"ui yellow horizontal label\">snapshot</div>${snapshot}</a>" %> </div> </div> @@ -80,7 +79,7 @@ </div> <div class="ui inverted center aligned text container"> - <img class="logo-header" src="/images/logo.svg" alt="GEB" title='pronounced "Jeb"' /> + <img class="logo-header" src="./images/logo.svg" alt="GEB" title='pronounced "Jeb"' /> <div class="row"> <div class="ui four wide column"> @@ -133,11 +132,11 @@ <div class="sixteen wide column"> <div class="ui huge buttons"> - <a href="/manual/current/"> + <a href="./manual/current/"> <button class="ui blue button">Documentation</button> </a> <div class="or" data-text="+"></div> - <a href="/manual/current/api"> + <a href="./manual/current/api"> <button class="ui yellow button">API</button> </a> </div> @@ -155,14 +154,14 @@ the robustness of <a href="https://github.com/SeleniumHQ/selenium/wiki/PageObjects">Page Object</a> modelling and the expressiveness of the <a href="http://www.groovy-lang.org/">Groovy</a> language.</p> <p>It can be used for scripting, scraping and general automation — or equally as a functional/web/acceptance testing solution via integration with testing frameworks such as <a href="http://spockframework.org">Spock</a>, <a href="http://www.junit.org/">JUnit</a> & <a href="http://testng.org/">TestNG</a>.</p> - <p>The <a href="/manual/current/">Book of Geb</a> contains all the information you need to get started with Geb.</p> + <p>The <a href="./manual/current/">Book of Geb</a> contains all the information you need to get started with Geb.</p> <h2 class="ui header">What does it look like?</h2> <p>Here's what a simple Geb script to log into an admin section of a website might look like...</p> <p>This is what is known as the scripting style of Geb and it's great for quick automation.</p> - <a href="/manual/current/"> + <a href="./manual/current/"> <div class="ui huge primary button"> See the guide <i class="right chevron icon"></i> </div> @@ -205,7 +204,7 @@ Browser.drive { <div class="ui four cards"> <div class="card"> <div class="ui content quadruple spaced image"> - <img src="/images/firefox_512x512.png"> + <img src="./images/firefox_512x512.png"> </div> <div class="extra content"> <i class="check icon"></i> Supported @@ -219,7 +218,7 @@ Browser.drive { <div class="card"> <div class="ui content quadruple spaced image"> - <img src="/images/edge_512x512.png" class="content"> + <img src="./images/edge_512x512.png" class="content"> </div> <div class="extra content"> <i class="check icon"></i> Supported @@ -233,7 +232,7 @@ Browser.drive { <div class="card"> <div class="ui content quadruple spaced image"> - <img src="/images/chrome_512x512.png" class="content"> + <img src="./images/chrome_512x512.png" class="content"> </div> <div class="extra content"> <i class="check icon"></i> Supported @@ -247,7 +246,7 @@ Browser.drive { <div class="card"> <div class="ui content quadruple spaced image"> - <img src="/images/safari_512x512.png" class="content"> + <img src="./images/safari_512x512.png" class="content"> </div> <div class="extra content"> <i class="check icon"></i> Supported @@ -270,7 +269,7 @@ Browser.drive { <p>You can also use the headless, in process, Java browser emulator <a href="https://github.com/SeleniumHQ/selenium/wiki/HtmlUnitDriver">HTMLUnit with WebDriver</a>.</p> <div class="ui buttons"> - <a href="/manual/current/#driver-implementation-configuration" class="ui large right labeled orange icon button"> + <a href="./manual/current/#driver-implementation-configuration" class="ui large right labeled orange icon button"> <i class="browser icon"></i> Driver Configuration </a> @@ -285,7 +284,7 @@ Browser.drive { <h1 class="ui header">Navigating Content</h1> </div> <div class="eight wide column"> - <p>Geb takes inspiration from jQuery to provide a concise and effective way to get at content. This is called the <a href="/manual/current/#navigator" title="The Book Of Geb - Interacting with content">Navigator API</a>.</p> + <p>Geb takes inspiration from jQuery to provide a concise and effective way to get at content. This is called the <a href="./manual/current/#navigator" title="The Book Of Geb - Interacting with content">Navigator API</a>.</p> <p>The dollar function can be used anywhere to select content based on CSS selectors, attribute matchers and/or indexes.</p> </div> @@ -333,7 +332,7 @@ assert \$("form").name == "Geb" </div> <div class="sixteen wide center aligned column"> <div class="ui buttons"> - <a href="/manual/current/#navigator" class="ui large right labeled pink icon button"> + <a href="./manual/current/#navigator" class="ui large right labeled pink icon button"> Navigation <i class="location arrow icon"></i> </a> @@ -403,7 +402,7 @@ class DynamicPage extends Page { <div class="sixteen wide center aligned column"> <div class="ui buttons"> - <a href="/manual/current/#waiting" class="ui large labeled green icon button"> + <a href="./manual/current/#waiting" class="ui large labeled green icon button"> <i class="hourglass half icon"></i> Waiting </a> @@ -450,7 +449,7 @@ class LoginSpec extends GebSpec { <div class="ui center aligned text container"> <div class="ui buttons"> - <a href="/manual/current/#testing" class="ui large right labeled teal icon button"> + <a href="./manual/current/#testing" class="ui large right labeled teal icon button"> Testing <i class="lab icon"></i> </a> @@ -468,21 +467,21 @@ class LoginSpec extends GebSpec { <div class="eight wide right aligned column"> <a href="http://www.gradle.org/"> <div class="ui medium images"> - <img src="/images/gradle.png" class="offset-next"> + <img src="./images/gradle.png" class="offset-next"> </div> </a> </div> <div class="eight wide left aligned column"> <a href="http://maven.apache.org/"> <div class="ui medium images"> - <img src="/images/maven.png" class="offset-next"> + <img src="./images/maven.png" class="offset-next"> </div> </a> </div> <div class="sixteen wide center aligned column"> <div class="ui buttons"> - <a href="/manual/current/#build-integrations" class="ui large labeled yellow icon button"> + <a href="./manual/current/#build-integrations" class="ui large labeled yellow icon button"> Build Integrations <i class="puzzle icon"></i> </a> @@ -519,16 +518,16 @@ class LoginSpec extends GebSpec { </div> - <script src="/js/jquery.min.js"></script> - <script src="/js/semantic.min.js"></script> - <script language="javascript" src="/js/shCore.js"></script> - <script language="javascript" src="/js/shBrushGroovy.js"></script> + <script src="./js/jquery.min.js"></script> + <script src="./js/semantic.min.js"></script> + <script language="javascript" src="./js/shCore.js"></script> + <script language="javascript" src="./js/shBrushGroovy.js"></script> <script type="text/javascript" charset="utf-8"> SyntaxHighlighter.defaults['toolbar'] = false; SyntaxHighlighter.defaults['gutter'] = false; SyntaxHighlighter.all(); </script> - <script language="javascript" src="/js/base.js"></script> + <script language="javascript" src="./js/base.js"></script> <a href="https://github.com/geb/geb" class="github-corner" aria-label="View source on GitHub"><svg width="80" height="80" viewBox="0 0 250 250" style="fill:#fff; color:#151513; position: absolute; top: 0; border: 0; right: 0;" aria-hidden="true"><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path><path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101 [...]
