From 64395537821ea1574e6122194ab6a05083c211f4 Mon Sep 17 00:00:00 2001 From: Paul King Date: Sun, 15 Dec 2024 06:52:46 +1000 Subject: [PATCH] Improve IDE experience for snippets #221 --- doc/manual/manual.gradle | 3 ++ doc/manual/src/docs/asciidoc/010-intro.adoc | 28 ++++++----- doc/manual/src/docs/asciidoc/020-browser.adoc | 6 ++- doc/manual/src/docs/asciidoc/021-driver.adoc | 4 ++ .../src/docs/asciidoc/030-navigator.adoc | 49 ++++++++++--------- doc/manual/src/docs/asciidoc/040-pages.adoc | 11 +++-- doc/manual/src/docs/asciidoc/050-modules.adoc | 35 +++++++------ .../src/docs/asciidoc/060-configuration.adoc | 5 ++ .../asciidoc/070-implicit-assertions.adoc | 5 ++ .../src/docs/asciidoc/080-javascript.adoc | 24 +++++---- .../src/docs/asciidoc/081-downloading.adoc | 6 +++ doc/manual/src/docs/asciidoc/090-binding.adoc | 10 +++- .../src/docs/asciidoc/100-reporting.adoc | 6 +++ doc/manual/src/docs/asciidoc/110-testing.adoc | 6 +++ .../src/docs/asciidoc/111-cloud-browsers.adoc | 2 +- .../src/docs/asciidoc/130-ide-and-typing.adoc | 6 +++ 16 files changed, 141 insertions(+), 65 deletions(-) diff --git a/doc/manual/manual.gradle b/doc/manual/manual.gradle index 3423bd614..f54e29fdd 100644 --- a/doc/manual/manual.gradle +++ b/doc/manual/manual.gradle @@ -77,6 +77,9 @@ asciidoctorj { toc : 'left', encoding : 'utf-8', 'snippets-dir' : snippetsPath, + 'rb-snippets-dir' : snippetsPath, + 'cm-snippets-dir' : snippetsPath, + 'ct-snippets-dir' : snippetsPath, numbered : true, sectlinks : true, idprefix : '', diff --git a/doc/manual/src/docs/asciidoc/010-intro.adoc b/doc/manual/src/docs/asciidoc/010-intro.adoc index 0a84a71ff..31d5e2067 100644 --- a/doc/manual/src/docs/asciidoc/010-intro.adoc +++ b/doc/manual/src/docs/asciidoc/010-intro.adoc @@ -1,3 +1,7 @@ +ifndef::snippets-dir[] +:snippets-dir: ../../../../manual-snippets/src/test/groovy +:rb-snippets-dir: ../../../../manual-snippets/real-browser/src/test/groovy +endif::[] = Introduction Geb (pronounced "jeb" and originally a contraction of "Groovy web") is a developer focused tool for automating the interaction between web browsers and web content. @@ -6,7 +10,7 @@ inspection and traversal API (for finding and interacting with content). Geb was born out of a desire to make browser automation (originally for web testing) easier and more productive. It aims to be a *developer tool* in that it allows and encourages the using of programming and language constructs instead of creating a restricted environment. -It uses Groovy's dynamism to remove the noise and boiler plate code in order to focus on what's important — the content and interaction. +It uses Groovy's dynamism to remove the noise and boilerplate code in order to focus on what's important — the content and interaction. == The browser automation technology @@ -87,9 +91,9 @@ Here's an example of using Geb in an inline (i.e. no page objects or predefined [source,groovy] ---- -include::{snippets-dir}/intro/ScriptingSpec.groovy[tags=imports,indent=0] +include::{rb-snippets-dir}/intro/ScriptingSpec.groovy[tags=imports,indent=0] -include::{snippets-dir}/intro/ScriptingSpec.groovy[tags=inline,indent=0] +include::{rb-snippets-dir}/intro/ScriptingSpec.groovy[tags=inline,indent=0] ---- <1> Check that we are at Geb's homepage. <2> Click on the manual menu entry to open it. @@ -103,14 +107,14 @@ This time let us define our content up front using the Page Object pattern… [source,groovy] ---- -include::{snippets-dir}/intro/module/ManualsMenuModule.groovy[tags=imports,indent=0] -include::{snippets-dir}/intro/page/GebHomePage.groovy[tags=imports,indent=0] +include::{rb-snippets-dir}/intro/module/ManualsMenuModule.groovy[tags=imports,indent=0] +include::{rb-snippets-dir}/intro/page/GebHomePage.groovy[tags=imports,indent=0] -include::{snippets-dir}/intro/module/ManualsMenuModule.groovy[tags=class,indent=0] +include::{rb-snippets-dir}/intro/module/ManualsMenuModule.groovy[tags=class,indent=0] -include::{snippets-dir}/intro/page/GebHomePage.groovy[tags=class,indent=0] +include::{rb-snippets-dir}/intro/page/GebHomePage.groovy[tags=class,indent=0] -include::{snippets-dir}/intro/page/TheBookOfGebPage.groovy[tags=class,indent=0] +include::{rb-snippets-dir}/intro/page/TheBookOfGebPage.groovy[tags=class,indent=0] ---- <1> Modules are reusable fragments that can be used across pages. Here we are using a module to model a dropdown menu. <2> Content DSL. @@ -124,9 +128,9 @@ Now our script again, using the above defined content… [source,groovy] ---- -include::{snippets-dir}/intro/ScriptingSpec.groovy[tags=imports,indent=0] +include::{rb-snippets-dir}/intro/ScriptingSpec.groovy[tags=imports,indent=0] -include::{snippets-dir}/intro/ScriptingSpec.groovy[tags=using_page_objects,indent=0] +include::{rb-snippets-dir}/intro/ScriptingSpec.groovy[tags=using_page_objects,indent=0] ---- <1> Go to the url defined by `GebHomePage` and also verify it's “at checker”. @@ -140,9 +144,9 @@ Here is our Geb homepage case again, this time using Geb's {spock} integration [source,groovy] ---- -include::{snippets-dir}/intro/GebHomepageSpec.groovy[tags=imports,indent=0] +include::{rb-snippets-dir}/intro/GebHomepageSpec.groovy[tags=imports,indent=0] -include::{snippets-dir}/intro/GebHomepageSpec.groovy[tags=class,indent=0] +include::{rb-snippets-dir}/intro/GebHomepageSpec.groovy[tags=class,indent=0] ---- For more information on using Geb for web and functional testing, see the <>. diff --git a/doc/manual/src/docs/asciidoc/020-browser.adoc b/doc/manual/src/docs/asciidoc/020-browser.adoc index 0e48d1198..90c1be50a 100644 --- a/doc/manual/src/docs/asciidoc/020-browser.adoc +++ b/doc/manual/src/docs/asciidoc/020-browser.adoc @@ -1,3 +1,7 @@ +ifndef::snippets-dir[] +:snippets-dir: ../../../../manual-snippets/src/test/groovy +:rb-snippets-dir: ../../../../manual-snippets/real-browser/src/test/groovy +endif::[] [[browser]] = The `Browser` @@ -469,7 +473,7 @@ Both of them can be used to read and write values to the underlying storage as i [source,groovy,indent=0] ---- -include::{snippets-dir}/browser/WebStorageSpec.groovy[tag=write_and_read] +include::{rb-snippets-dir}/browser/WebStorageSpec.groovy[tag=write_and_read] ---- Both `localStorage` and `sessionStorage` properties are of `geb.webstorage.WebStorage` type - please refer to link:api/geb/webstorage/WebStorage.html[its javadoc] for information about other operations that are supported apart from reading and writing values. diff --git a/doc/manual/src/docs/asciidoc/021-driver.adoc b/doc/manual/src/docs/asciidoc/021-driver.adoc index e84297634..eb83b6f82 100644 --- a/doc/manual/src/docs/asciidoc/021-driver.adoc +++ b/doc/manual/src/docs/asciidoc/021-driver.adoc @@ -1,3 +1,7 @@ +ifndef::snippets-dir[] +:snippets-dir: ../../../../manual-snippets/src/test/groovy +:rb-snippets-dir: ../../../../manual-snippets/real-browser/src/test/groovy +endif::[] [[driver]] = The WebDriver implementation diff --git a/doc/manual/src/docs/asciidoc/030-navigator.adoc b/doc/manual/src/docs/asciidoc/030-navigator.adoc index 5afca346e..520db77d7 100644 --- a/doc/manual/src/docs/asciidoc/030-navigator.adoc +++ b/doc/manual/src/docs/asciidoc/030-navigator.adoc @@ -1,3 +1,8 @@ +ifndef::snippets-dir[] +:snippets-dir: ../../../../manual-snippets/src/test/groovy +:rb-snippets-dir: ../../../../manual-snippets/real-browser/src/test/groovy +:cm-snippets-dir: ../../../../../module/geb-core/src/main/groovy +endif::[] [[navigator]] = Interacting with content @@ -94,14 +99,14 @@ Let's consider a simple link:https://vuejs.org/[Vue.js] application which render [source,html] ---- -include::{snippets-dir}/navigator/DynamicModuleBaseSpec.groovy[tag=template,indent=0] +include::{rb-snippets-dir}/navigator/DynamicModuleBaseSpec.groovy[tag=template,indent=0] ---- …and the following javascript code… [source,groovy] ---- -include::{snippets-dir}/navigator/DynamicModuleBaseSpec.groovy[tag=vue_app,indent=0] +include::{rb-snippets-dir}/navigator/DynamicModuleBaseSpec.groovy[tag=vue_app,indent=0] ---- The important thing to note is that the `li` elements re re-rendered when they are reordered. @@ -110,40 +115,40 @@ Let's model each item in the list using the following module… [source,groovy] ---- -include::{snippets-dir}/navigator/DynamicModuleBaseSpec.groovy[tag=module,indent=0] +include::{rb-snippets-dir}/navigator/DynamicModuleBaseSpec.groovy[tag=module,indent=0] ---- Given the following content definition… [source,groovy] ---- -include::{snippets-dir}/navigator/DynamicModuleBaseSpec.groovy[tag=static_navigator,indent=0] +include::{rb-snippets-dir}/navigator/DynamicModuleBaseSpec.groovy[tag=static_navigator,indent=0] ---- The code below will fail with `StaleElementReferenceException`… [source,groovy] ---- -include::{snippets-dir}/navigator/DynamicModuleBaseSpec.groovy[tag=exception,indent=0] +include::{rb-snippets-dir}/navigator/DynamicModuleBaseSpec.groovy[tag=exception,indent=0] ---- If we change the base navigator of the list element module to be dynamic as in the following page class… [source,groovy] ---- -include::{snippets-dir}/navigator/DynamicModuleBaseSpec.groovy[tag=dynamic_navigator,indent=0] +include::{rb-snippets-dir}/navigator/DynamicModuleBaseSpec.groovy[tag=dynamic_navigator,indent=0] ---- Then the following will pass… [source,groovy] ---- -include::{snippets-dir}/navigator/DynamicModuleBaseSpec.groovy[tag=no_exception,indent=0] +include::{rb-snippets-dir}/navigator/DynamicModuleBaseSpec.groovy[tag=no_exception,indent=0] ---- [WARNING] ==== -While using dynamic navigators might seem like a way to completely avoid `{stale-element-reference-exception-api}` it is unfortunatelly not the case. +While using dynamic navigators might seem like a way to completely avoid `{stale-element-reference-exception-api}` it is unfortunately not the case. That's because operations which access elements of a dynamic `Navigator` are not atomic. For example, when calling `click()` on a dynamic `Navigator`, first a WebDriver protocol command will be executed to refresh the web elements which underpin that instance and then another command will be executed to click on the element that was found - if between the two commands the element is removed from the DOM the exception will still occur. While dynamic navigators make `StaleElementReferenceException` less likely, it's still far from impossible to get one when using them, especially in highly asynchronous applications with frequent DOM redraws. @@ -732,8 +737,8 @@ It is possible to send non-textual characters to content by using the WebDriver [source,groovy] ---- -include::{snippets-dir}/navigator/NonCharacterKeystrokesSpec.groovy[tag=import,indent=0] -include::{snippets-dir}/navigator/NonCharacterKeystrokesSpec.groovy[tag=keystrokes,indent=0] +include::{rb-snippets-dir}/navigator/NonCharacterKeystrokesSpec.groovy[tag=import,indent=0] +include::{rb-snippets-dir}/navigator/NonCharacterKeystrokesSpec.groovy[tag=keystrokes,indent=0] ---- Here we are sending a “control-c” to an input. @@ -1013,8 +1018,8 @@ Which an also be used for non-character keys… [source,groovy] ---- -include::{snippets-dir}/navigator/BackspaceSpec.groovy[tag=import,indent=0] -include::{snippets-dir}/navigator/BackspaceSpec.groovy[tag=backspace,indent=0] +include::{rb-snippets-dir}/navigator/BackspaceSpec.groovy[tag=import,indent=0] +include::{rb-snippets-dir}/navigator/BackspaceSpec.groovy[tag=backspace,indent=0] ---- [WARNING] @@ -1055,7 +1060,7 @@ It is possible to access the contained `WebElement` instances via the following [source,groovy] ---- -include::{snippets-dir}/geb/navigator/Navigator.groovy[tag=web_element_returning_methods,indent=0] +include::{cm-snippets-dir}/geb/navigator/Navigator.groovy[tag=web_element_returning_methods,indent=0] ---- By using the methods of the WebDriver `{actions-api}` class with `WebElement` instances, complex user gestures can be emulated. @@ -1063,21 +1068,21 @@ First you will need to create an `Actions` instance after obtaining the WebDrive [source,groovy] ---- -include::{snippets-dir}/navigator/InteractionsSpec.groovy[tag=actions_creation,indent=0] +include::{rb-snippets-dir}/navigator/InteractionsSpec.groovy[tag=actions_creation,indent=0] ---- Next, use methods of `Actions` to compose a series of UI actions, then call `build()` to create a concrete `Action`: [source,groovy] ---- -include::{snippets-dir}/navigator/InteractionsSpec.groovy[tag=action_definition,indent=0] +include::{rb-snippets-dir}/navigator/InteractionsSpec.groovy[tag=action_definition,indent=0] ---- Finally, call `perform()` to actually trigger the desired mouse or keyboard behavior: [source,groovy] ---- -include::{snippets-dir}/navigator/InteractionsSpec.groovy[tag=action_execution,indent=0] +include::{rb-snippets-dir}/navigator/InteractionsSpec.groovy[tag=action_execution,indent=0] ---- [[interact-closures]] @@ -1093,14 +1098,14 @@ This `interact()` call performs the same work as the calls in the < Page change is asynchronous, e.g. an ajax call is involved. [source,groovy] ---- -include::{snippets-dir}/pages/ToWaitOptionSpec.groovy[tag=to_wait,indent=0] +include::{rb-snippets-dir}/pages/ToWaitOptionSpec.groovy[tag=to_wait,indent=0] ---- See the <> for the semantics of the `waitFor()` method, that is used here internally. @@ -763,7 +768,7 @@ The `{page-api}` implementation of this method looks like this… [source,groovy] ---- -include::{snippets-dir}/geb/Page.groovy[tag=convert_to_path,indent=0] +include::{cm-snippets-dir}/geb/Page.groovy[tag=convert_to_path,indent=0] ---- You can either overwrite this catchall method to control path conversion for all invocations or provide an overloaded version for a specific type signature. diff --git a/doc/manual/src/docs/asciidoc/050-modules.adoc b/doc/manual/src/docs/asciidoc/050-modules.adoc index b260f40bb..583766acf 100644 --- a/doc/manual/src/docs/asciidoc/050-modules.adoc +++ b/doc/manual/src/docs/asciidoc/050-modules.adoc @@ -1,3 +1,8 @@ +ifndef::snippets-dir[] +:snippets-dir: ../../../../manual-snippets/src/test/groovy +:rb-snippets-dir: ../../../../manual-snippets/real-browser/src/test/groovy +:cm-snippets-dir: ../../../../../module/geb-core/src/main/groovy +endif::[] [[modules]] = Modules @@ -429,14 +434,14 @@ Given the html… [source,html] ---- -include::{snippets-dir}/modules/DateInputSnippetSpec.groovy[tag=html,indent=0] +include::{rb-snippets-dir}/modules/DateInputSnippetSpec.groovy[tag=html,indent=0] ---- It can be used this way… [source,groovy] ---- -include::{snippets-dir}/modules/DateInputSnippetSpec.groovy[tag=example,indent=0] +include::{rb-snippets-dir}/modules/DateInputSnippetSpec.groovy[tag=example,indent=0] ---- === `DateTimeLocalInput` @@ -447,14 +452,14 @@ Given the html… [source,html] ---- -include::{snippets-dir}/modules/DateTimeLocalInputSnippetSpec.groovy[tag=html,indent=0] +include::{rb-snippets-dir}/modules/DateTimeLocalInputSnippetSpec.groovy[tag=html,indent=0] ---- It can be used this way… [source,groovy] ---- -include::{snippets-dir}/modules/DateTimeLocalInputSnippetSpec.groovy[tag=example,indent=0] +include::{rb-snippets-dir}/modules/DateTimeLocalInputSnippetSpec.groovy[tag=example,indent=0] ---- === `TimeInput` @@ -465,21 +470,21 @@ Given the html… [source,html] ---- -include::{snippets-dir}/modules/TimeInputSnippetSpec.groovy[tag=html,indent=0] +include::{rb-snippets-dir}/modules/TimeInputSnippetSpec.groovy[tag=html,indent=0] ---- It can be used either with a `java.time.LocalTime` object… [source,groovy] ---- -include::{snippets-dir}/modules/TimeInputSnippetSpec.groovy[tag=example_time,indent=0] +include::{rb-snippets-dir}/modules/TimeInputSnippetSpec.groovy[tag=example_time,indent=0] ---- …or with a string… [source,groovy] ---- -include::{snippets-dir}/modules/TimeInputSnippetSpec.groovy[tag=example_string,indent=0] +include::{rb-snippets-dir}/modules/TimeInputSnippetSpec.groovy[tag=example_string,indent=0] ---- === `MonthInput` @@ -490,21 +495,21 @@ Given the html… [source,html] ---- -include::{snippets-dir}/modules/MonthInputSnippetSpec.groovy[tag=html,indent=0] +include::{rb-snippets-dir}/modules/MonthInputSnippetSpec.groovy[tag=html,indent=0] ---- It can be used either with a `java.time.YearMonth` object… [source,groovy] ---- -include::{snippets-dir}/modules/MonthInputSnippetSpec.groovy[tag=example_month,indent=0] +include::{rb-snippets-dir}/modules/MonthInputSnippetSpec.groovy[tag=example_month,indent=0] ---- …or with a string… [source,groovy] ---- -include::{snippets-dir}/modules/MonthInputSnippetSpec.groovy[tag=example_string,indent=0] +include::{rb-snippets-dir}/modules/MonthInputSnippetSpec.groovy[tag=example_string,indent=0] ---- === `WeekInput` @@ -515,21 +520,21 @@ Given the html… [source,html] ---- -include::{snippets-dir}/modules/WeekInputSnippetSpec.groovy[tag=html,indent=0] +include::{rb-snippets-dir}/modules/WeekInputSnippetSpec.groovy[tag=html,indent=0] ---- It can be used either with a `org.threeten.extra.YearWeek` object… [source,groovy] ---- -include::{snippets-dir}/modules/WeekInputSnippetSpec.groovy[tag=example_week,indent=0] +include::{rb-snippets-dir}/modules/WeekInputSnippetSpec.groovy[tag=example_week,indent=0] ---- …or with a string… [source,groovy] ---- -include::{snippets-dir}/modules/WeekInputSnippetSpec.groovy[tag=example_string,indent=0] +include::{rb-snippets-dir}/modules/WeekInputSnippetSpec.groovy[tag=example_string,indent=0] ---- === `EmailInput` @@ -594,14 +599,14 @@ Given the html… [source,html] ---- -include::{snippets-dir}/modules/RangeInputSnippetSpec.groovy[tag=html,indent=0] +include::{rb-snippets-dir}/modules/RangeInputSnippetSpec.groovy[tag=html,indent=0] ---- It can be used this way… [source,groovy] ---- -include::{snippets-dir}/modules/RangeInputSnippetSpec.groovy[tag=example,indent=0] +include::{rb-snippets-dir}/modules/RangeInputSnippetSpec.groovy[tag=example,indent=0] ---- === `UrlInput` diff --git a/doc/manual/src/docs/asciidoc/060-configuration.adoc b/doc/manual/src/docs/asciidoc/060-configuration.adoc index 52907e772..1bf8244f2 100644 --- a/doc/manual/src/docs/asciidoc/060-configuration.adoc +++ b/doc/manual/src/docs/asciidoc/060-configuration.adoc @@ -1,3 +1,8 @@ +ifndef::snippets-dir[] +:snippets-dir: ../../../../manual-snippets/src/test/groovy +:rb-snippets-dir: ../../../../manual-snippets/real-browser/src/test/groovy +:cm-snippets-dir: ../../../../../module/geb-core/src/main/groovy +endif::[] [[configuration]] = Configuration diff --git a/doc/manual/src/docs/asciidoc/070-implicit-assertions.adoc b/doc/manual/src/docs/asciidoc/070-implicit-assertions.adoc index e5ed6c6d4..09199f758 100644 --- a/doc/manual/src/docs/asciidoc/070-implicit-assertions.adoc +++ b/doc/manual/src/docs/asciidoc/070-implicit-assertions.adoc @@ -1,3 +1,8 @@ +ifndef::snippets-dir[] +:snippets-dir: ../../../../manual-snippets/src/test/groovy +:rb-snippets-dir: ../../../../manual-snippets/real-browser/src/test/groovy +:cm-snippets-dir: ../../../../../module/geb-core/src/main/groovy +endif::[] [[implicit-assertions]] = Implicit assertions diff --git a/doc/manual/src/docs/asciidoc/080-javascript.adoc b/doc/manual/src/docs/asciidoc/080-javascript.adoc index cc212cfa8..d9bc3c200 100644 --- a/doc/manual/src/docs/asciidoc/080-javascript.adoc +++ b/doc/manual/src/docs/asciidoc/080-javascript.adoc @@ -1,3 +1,9 @@ +ifndef::snippets-dir[] +:snippets-dir: ../../../../manual-snippets/src/test/groovy +:rb-snippets-dir: ../../../../manual-snippets/real-browser/src/test/groovy +:cm-snippets-dir: ../../../../../module/geb-core/src/main/groovy +:ct-snippets-dir: ../../../../../module/geb-core/src/test/groovy +endif::[] = Javascript, AJAX and dynamic pages This section discusses how to deal with some of the challenges in testing and/or automating modern web applications. @@ -242,7 +248,7 @@ Temporarily adding network latency during test development allows to shake off t This is how `setNetworkLatency()` method be used: [source,groovy] ---- -include::{snippets-dir}/geb/BrowserNetworkLatencySpec.groovy[tag=setNetworkLatency,indent=0] +include::{ct-snippets-dir}/geb/BrowserNetworkLatencySpec.groovy[tag=setNetworkLatency,indent=0] ---- [NOTE] @@ -279,7 +285,7 @@ There are three methods that deal with `alert()` dialogs: [source,groovy] ---- -include::{snippets-dir}/geb/js/AlertAndConfirmSupport.groovy[tag=alert,indent=0] +include::{cm-snippets-dir}/geb/js/AlertAndConfirmSupport.groovy[tag=alert,indent=0] ---- The first method, `withAlert()`, is used to verify actions that will produce an alert dialog. @@ -346,7 +352,7 @@ There are five methods that deal with `confirm()` dialogs: [source,groovy] ---- -include::{snippets-dir}/geb/js/AlertAndConfirmSupport.groovy[tag=confirm,indent=0] +include::{cm-snippets-dir}/geb/js/AlertAndConfirmSupport.groovy[tag=confirm,indent=0] ---- The first method, `withConfirm()` (and its ‘`ok`’ defaulted relative), is used to verify actions that will produce a confirm dialog. @@ -420,7 +426,7 @@ Consider the following page: [source,html] ---- -include::{snippets-dir}/javascript/JQuerySupportSpec.groovy[tag=html,indent=0] +include::{rb-snippets-dir}/javascript/JQuerySupportSpec.groovy[tag=html,indent=0] ---- We want to click the Geb link, but can't because it's hidden (WebDriver does not let you interact with hidden elements). @@ -440,7 +446,7 @@ Which we could invoke via Geb easy enough… [source,groovy] ---- -include::{snippets-dir}/javascript/JQuerySupportSpec.groovy[tag=using_javascript_executor,indent=0] +include::{rb-snippets-dir}/javascript/JQuerySupportSpec.groovy[tag=using_javascript_executor,indent=0] ---- That will work, but can be inconvenient as it duplicates content definitions in our Geb pages. @@ -449,19 +455,19 @@ Here is how we could call the `mouseover` jQuery function on an element from Geb [source,groovy] ---- -include::{snippets-dir}/javascript/JQuerySupportSpec.groovy[tag=using_adapter,indent=0] +include::{rb-snippets-dir}/javascript/JQuerySupportSpec.groovy[tag=using_adapter,indent=0] ---- To be clear, that is Groovy (not JavaScript code). It can be used with pages… [source,groovy] ---- -include::{snippets-dir}/javascript/JQuerySupportSpec.groovy[tag=page,indent=0] +include::{rb-snippets-dir}/javascript/JQuerySupportSpec.groovy[tag=page,indent=0] ---- [source,groovy] ---- -include::{snippets-dir}/javascript/JQuerySupportSpec.groovy[tag=on_content,indent=0] +include::{rb-snippets-dir}/javascript/JQuerySupportSpec.groovy[tag=on_content,indent=0] ---- The `jquery` property of a navigator is conceptually equivalent to a jQuery object for _all_ of the navigator's matched page elements. @@ -470,7 +476,7 @@ The methods can also take arguments… [source,groovy] ---- -include::{snippets-dir}/javascript/JQuerySupportSpec.groovy[tag=with_parameters,indent=0] +include::{rb-snippets-dir}/javascript/JQuerySupportSpec.groovy[tag=with_parameters,indent=0] ---- The same set of restricted types as allowed by WebDriver's `{javascript-executor-execute-script-api}` method are permitted here. diff --git a/doc/manual/src/docs/asciidoc/081-downloading.adoc b/doc/manual/src/docs/asciidoc/081-downloading.adoc index 5aea85933..3300e91a6 100644 --- a/doc/manual/src/docs/asciidoc/081-downloading.adoc +++ b/doc/manual/src/docs/asciidoc/081-downloading.adoc @@ -1,3 +1,9 @@ +ifndef::snippets-dir[] +:snippets-dir: ../../../../manual-snippets/src/test/groovy +:rb-snippets-dir: ../../../../manual-snippets/real-browser/src/test/groovy +:cm-snippets-dir: ../../../../../module/geb-core/src/main/groovy +:ct-snippets-dir: ../../../../../module/geb-core/src/test/groovy +endif::[] = Direct downloading Geb features an API that can be used to make direct HTTP requests from the application that is executing the Geb scripts or tests. diff --git a/doc/manual/src/docs/asciidoc/090-binding.adoc b/doc/manual/src/docs/asciidoc/090-binding.adoc index e7cfe9151..2c1d0f1e7 100644 --- a/doc/manual/src/docs/asciidoc/090-binding.adoc +++ b/doc/manual/src/docs/asciidoc/090-binding.adoc @@ -1,3 +1,9 @@ +ifndef::snippets-dir[] +:snippets-dir: ../../../../manual-snippets/src/test/groovy +:rb-snippets-dir: ../../../../manual-snippets/real-browser/src/test/groovy +:cm-snippets-dir: ../../../../../module/geb-core/src/main/groovy +:ct-snippets-dir: ../../../../../module/geb-core/src/test/groovy +endif::[] [[binding]] = Scripts and binding @@ -29,7 +35,7 @@ The following is an example script that will work if `BindingUpdater` is initial [source,groovy] ---- -include::{snippets-dir}/gebScript.groovy[tag=script,indent=0] +include::{snippets-dir}/../resources/gebScript.groovy[tag=script,indent=0] ---- In a managed binding, all of the methods/properties that you can usually call in the {drive-method-link}[`Browser.drive()`] method are available. @@ -64,5 +70,5 @@ The binding updater also updates the `page` property of the binding to be the br [source,groovy] ---- -include::{snippets-dir}/gebScriptUsingPages.groovy[tag=script,indent=0] +include::{snippets-dir}/../resources/gebScriptUsingPages.groovy[tag=script,indent=0] ---- \ No newline at end of file diff --git a/doc/manual/src/docs/asciidoc/100-reporting.adoc b/doc/manual/src/docs/asciidoc/100-reporting.adoc index 00451387c..33d2702ef 100644 --- a/doc/manual/src/docs/asciidoc/100-reporting.adoc +++ b/doc/manual/src/docs/asciidoc/100-reporting.adoc @@ -1,3 +1,9 @@ +ifndef::snippets-dir[] +:snippets-dir: ../../../../manual-snippets/src/test/groovy +:rb-snippets-dir: ../../../../manual-snippets/real-browser/src/test/groovy +:cm-snippets-dir: ../../../../../module/geb-core/src/main/groovy +:ct-snippets-dir: ../../../../../module/geb-core/src/test/groovy +endif::[] [[reporting]] = Reporting diff --git a/doc/manual/src/docs/asciidoc/110-testing.adoc b/doc/manual/src/docs/asciidoc/110-testing.adoc index 33ec45e3b..77bd693cf 100644 --- a/doc/manual/src/docs/asciidoc/110-testing.adoc +++ b/doc/manual/src/docs/asciidoc/110-testing.adoc @@ -1,3 +1,9 @@ +ifndef::snippets-dir[] +:snippets-dir: ../../../../manual-snippets/src/test/groovy +:rb-snippets-dir: ../../../../manual-snippets/real-browser/src/test/groovy +:cm-snippets-dir: ../../../../../module/geb-core/src/main/groovy +:ct-snippets-dir: ../../../../../module/geb-core/src/test/groovy +endif::[] [[testing]] = Testing diff --git a/doc/manual/src/docs/asciidoc/111-cloud-browsers.adoc b/doc/manual/src/docs/asciidoc/111-cloud-browsers.adoc index 039b89c7f..a8bfec286 100644 --- a/doc/manual/src/docs/asciidoc/111-cloud-browsers.adoc +++ b/doc/manual/src/docs/asciidoc/111-cloud-browsers.adoc @@ -277,7 +277,7 @@ Following is an example of using the geb-browserstack Gradle plugin. import geb.gradle.browserstack.BrowserStackAccount plugins { - id "org.gebish.browserstack" version "{geb-version}" <1> + id "org.gebish.browserstack" version "{geb-version}" //<1> } browserStack { diff --git a/doc/manual/src/docs/asciidoc/130-ide-and-typing.adoc b/doc/manual/src/docs/asciidoc/130-ide-and-typing.adoc index f04e8cfaa..5dd206d33 100644 --- a/doc/manual/src/docs/asciidoc/130-ide-and-typing.adoc +++ b/doc/manual/src/docs/asciidoc/130-ide-and-typing.adoc @@ -1,3 +1,9 @@ +ifndef::snippets-dir[] +:snippets-dir: ../../../../manual-snippets/src/test/groovy +:rb-snippets-dir: ../../../../manual-snippets/real-browser/src/test/groovy +:cm-snippets-dir: ../../../../../module/geb-core/src/main/groovy +:ct-snippets-dir: ../../../../../module/geb-core/src/test/groovy +endif::[] = IDE support Geb does not require any special plugins or configuration for use inside an IDE.