This is an automated email from the ASF dual-hosted git repository.
jonnybot pushed a commit to branch task/properly-run-driver-config-spec
in repository https://gitbox.apache.org/repos/asf/groovy-geb.git
The following commit(s) were added to
refs/heads/task/properly-run-driver-config-spec by this push:
new 24acf531 WIP - get sample configs from files
24acf531 is described below
commit 24acf531783c2d5373a8b99b83b546fc47d76017
Author: Jonny Carter <[email protected]>
AuthorDate: Mon Dec 23 12:01:16 2024 -0600
WIP - get sample configs from files
---
.../groovy/configuration/DriverConfigSpec.groovy | 20 +++-----------------
.../resources/basicFirefoxDriverConfigScript.groovy | 6 ++++++
doc/manual/src/docs/asciidoc/060-configuration.adoc | 4 ++--
3 files changed, 11 insertions(+), 19 deletions(-)
diff --git
a/doc/manual-snippets/src/test/groovy/configuration/DriverConfigSpec.groovy
b/doc/manual-snippets/src/test/groovy/configuration/DriverConfigSpec.groovy
index 1711428e..986414be 100644
--- a/doc/manual-snippets/src/test/groovy/configuration/DriverConfigSpec.groovy
+++ b/doc/manual-snippets/src/test/groovy/configuration/DriverConfigSpec.groovy
@@ -18,8 +18,8 @@
*/
package configuration
+import geb.ConfigurationLoader
import geb.driver.CachingDriverFactory
-import geb.fixture.HeadlessTestSupport
import geb.test.StandaloneWebDriverServer
import org.openqa.selenium.firefox.FirefoxDriver
import org.openqa.selenium.htmlunit.HtmlUnitDriver
@@ -41,22 +41,8 @@ class DriverConfigSpec extends Specification implements
InlineConfigurationLoade
def "configuring driver using closure"() {
when:
- // lang=groovy
- configScript """
- import org.openqa.selenium.firefox.FirefoxOptions
- // tag::configuring_driver[]
- // tag::configuring_driver-a[]
- import org.openqa.selenium.firefox.FirefoxDriver
-
- driver = {
- new FirefoxDriver()
- // end::configuring_driver-a[]
- ${HeadlessTestSupport.headless ? /new FirefoxDriver(new
FirefoxOptions().addArguments('--headless'))/ : ''}
- // tag::configuring_driver-b[]
- }
- // end::configuring_driver-b[]
- // end::configuring_driver[]
- """
+ def config = new ConfigurationLoader(null, null, new
GroovyClassLoader(DriverConfigSpec.classLoader))
+ .getConf('/basicFirefoxDriverConfigScript.groovy')
then:
config.driver instanceof FirefoxDriver
diff --git
a/doc/manual-snippets/src/test/resources/basicFirefoxDriverConfigScript.groovy
b/doc/manual-snippets/src/test/resources/basicFirefoxDriverConfigScript.groovy
new file mode 100644
index 00000000..92eff5a7
--- /dev/null
+++
b/doc/manual-snippets/src/test/resources/basicFirefoxDriverConfigScript.groovy
@@ -0,0 +1,6 @@
+import org.openqa.selenium.firefox.FirefoxDriver
+
+System.out.println "IM UN UR SCRIPT"
+println 'CONFIGURIN UR GEBS'
+
+driver = { new FirefoxDriver() }
diff --git a/doc/manual/src/docs/asciidoc/060-configuration.adoc
b/doc/manual/src/docs/asciidoc/060-configuration.adoc
index 1bf8244f..1123a1cf 100644
--- a/doc/manual/src/docs/asciidoc/060-configuration.adoc
+++ b/doc/manual/src/docs/asciidoc/060-configuration.adoc
@@ -87,7 +87,7 @@ In the config script it can be a closure that when invoked
with no arguments ret
[source,groovy]
----
-include::{snippets-dir}/configuration/DriverConfigSpec.groovy[tag=configuring_driver,indent=0]
+include::doc/manual-snippets/src/test/resources/basicFirefoxDriverConfigScript.groovy
----
This is the preferred mechanism, as it allows the most control over the
drivers creation and configuration.
@@ -429,4 +429,4 @@
include::{snippets-dir}/configuration/FunctionalSpec.groovy[tag=runtime_override
====
Bear in mind that since Geb 6.0, one `Configuration` instance is shared
between all of the tests.
To avoid configuration runtime overrides bleeding from one test to another,
you will have to revert any overrides after the test, like it is done in
`cleanup()` of the above example.
-====
\ No newline at end of file
+====