From 536b39625b5ba6a44ec449c11aa908565b9124a3 Mon Sep 17 00:00:00 2001 From: Mattias Reichel Date: Wed, 20 Dec 2023 08:44:13 +0100 Subject: [PATCH] Update readme (#45) * Change heading markup * Add maven central badge and push event param to CI badge * Fix links * Improve text and switch example driver as PhantomJS development has stopped. * Improve text --- README.md | 65 ++++++++++++++++++++++++++++++------------------------- 1 file changed, 36 insertions(+), 29 deletions(-) diff --git a/README.md b/README.md index 01c5998..9c92fb6 100644 --- a/README.md +++ b/README.md @@ -1,43 +1,50 @@ -Grails Geb Plugin -================= +# Grails Geb Plugin -[![Java CI](https://github.com/grails/geb/actions/workflows/gradle.yml/badge.svg)](https://github.com/grails/geb/actions/workflows/gradle.yml) +[![Maven Central](https://img.shields.io/maven-central/v/org.grails.plugins/geb.svg?label=Maven%20Central)](https://central.sonatype.com/artifact/org.grails.plugins/geb) +[![Java CI](https://github.com/grails/geb/actions/workflows/gradle.yml/badge.svg?event=push)](https://github.com/grails/geb/actions/workflows/gradle.yml) -Geb Functional Testing for GrailsĀ® framework +Geb Functional Testing for the GrailsĀ® framework. +This plugin provides the Geb dependencies and a `create-functional-test` command for generating Geb tests in a Grails app. -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) +For further reference please see the [Geb documentation](https://www.gebish.org). -Examples --------- +## Examples -If you are looking for examples check: +If you are looking for examples on how to write Geb tests, check: -[Geb/Grails example project](https://github.com/grails-samples/geb-example-grails) +[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. -or [Grails functional test suite](https://github.com/grails/grails3-functional-tests) where Geb tests are used extensively. +## Additional Drivers -Additional Drivers -================== +Grails comes with a set of pre-installed browser drivers. +To set up additional drivers you need to add the driver to your `build.gradle` for example: +```groovy +integrationTestRuntimeOnly "org.seleniumhq.selenium:selenium-edge-driver:$seleniumVersion" +``` -To setup additional drivers you need to add the driver to your `build.gradle` for example: +You also need to add it to the `GebConfig.groovy` file in the `src/test/resources/` directory. For example: +```groovy +/* + This is the Geb configuration file. - testRuntime 'com.github.detro:phantomjsdriver:1.2.0' - -Then you need to create a `GebConfig.groovy` file to your `src/test/resources/` directory. For example: + See: http://www.gebish.org/manual/current/#configuration +*/ - /* - This is the Geb configuration file. - - See: http://www.gebish.org/manual/current/#configuration - */ - import org.openqa.selenium.chrome.ChromeDriver - import org.openqa.selenium.firefox.FirefoxDriver - import org.openqa.selenium.phantomjs.PhantomJSDriver - - waiting { - timeout = 2 - } - driver = { new PhantomJSDriver() } +/* ... */ +import org.openqa.selenium.edge.EdgeDriver +environments { + + /* ... */ + + edge { + driver = { new EdgeDriver() } + } +} +``` +Now you can run your tests with the new driver by specifying the Geb environment: +```console +./gradlew integrationTest -Dgeb.env=edge +```