|
1 |
| -Grails Geb Plugin |
2 |
| -================= |
| 1 | +# Grails Geb Plugin |
3 | 2 |
|
4 |
| -[](https://github.com/grails/geb/actions/workflows/gradle.yml) |
| 3 | +[](https://central.sonatype.com/artifact/org.grails.plugins/geb) |
| 4 | +[](https://github.com/grails/geb/actions/workflows/gradle.yml) |
5 | 5 |
|
6 |
| -Geb Functional Testing for Grails® framework |
| 6 | +Geb Functional Testing for the Grails® framework. |
7 | 7 |
|
| 8 | +This plugin provides the Geb dependencies and a `create-functional-test` command for generating Geb tests in a Grails app. |
8 | 9 |
|
9 |
| -This plugin just provides the Geb dependencies and a `create-functional-test` command for generating Geb tests in a Grails app. For further reference please see the [Geb documentation](http://www.gebish.org) |
| 10 | +For further reference please see the [Geb documentation](https://www.gebish.org). |
10 | 11 |
|
11 |
| -Examples |
12 |
| --------- |
| 12 | +## Examples |
13 | 13 |
|
14 |
| -If you are looking for examples check: |
| 14 | +If you are looking for examples on how to write Geb tests, check: |
15 | 15 |
|
16 |
| -[Geb/Grails example project](https://github.com/grails-samples/geb-example-grails) |
| 16 | +[Geb/Grails example project](https://github.com/grails-samples/geb-example-grails) or [Grails functional test suite](https://github.com/grails/grails-functional-tests) where Geb tests are used extensively. |
17 | 17 |
|
18 |
| -or [Grails functional test suite](https://github.com/grails/grails3-functional-tests) where Geb tests are used extensively. |
| 18 | +## Additional Drivers |
19 | 19 |
|
20 |
| -Additional Drivers |
21 |
| -================== |
| 20 | +Grails comes with a set of pre-installed browser drivers. |
| 21 | +To set up additional drivers you need to add the driver to your `build.gradle` for example: |
| 22 | +```groovy |
| 23 | +integrationTestRuntimeOnly "org.seleniumhq.selenium:selenium-edge-driver:$seleniumVersion" |
| 24 | +``` |
22 | 25 |
|
23 |
| -To setup additional drivers you need to add the driver to your `build.gradle` for example: |
| 26 | +You also need to add it to the `GebConfig.groovy` file in the `src/test/resources/` directory. For example: |
| 27 | +```groovy |
| 28 | +/* |
| 29 | + This is the Geb configuration file. |
24 | 30 |
|
25 |
| - testRuntime 'com.github.detro:phantomjsdriver:1.2.0' |
26 |
| - |
27 |
| -Then you need to create a `GebConfig.groovy` file to your `src/test/resources/` directory. For example: |
| 31 | + See: http://www.gebish.org/manual/current/#configuration |
| 32 | +*/ |
28 | 33 |
|
29 |
| - /* |
30 |
| - This is the Geb configuration file. |
31 |
| - |
32 |
| - See: http://www.gebish.org/manual/current/#configuration |
33 |
| - */ |
34 |
| - import org.openqa.selenium.chrome.ChromeDriver |
35 |
| - import org.openqa.selenium.firefox.FirefoxDriver |
36 |
| - import org.openqa.selenium.phantomjs.PhantomJSDriver |
37 |
| - |
38 |
| - waiting { |
39 |
| - timeout = 2 |
40 |
| - } |
41 |
| - driver = { new PhantomJSDriver() } |
| 34 | +/* ... */ |
| 35 | +import org.openqa.selenium.edge.EdgeDriver |
42 | 36 |
|
| 37 | +environments { |
| 38 | + |
| 39 | + /* ... */ |
| 40 | + |
| 41 | + edge { |
| 42 | + driver = { new EdgeDriver() } |
| 43 | + } |
| 44 | +} |
| 45 | +``` |
43 | 46 |
|
| 47 | +Now you can run your tests with the new driver by specifying the Geb environment: |
| 48 | +```console |
| 49 | +./gradlew integrationTest -Dgeb.env=edge |
| 50 | +``` |
0 commit comments