Skip to content

Commit

Permalink
Merge pull request #80 from jdaugherty/5.0.x
Browse files Browse the repository at this point in the history
feature #79 - recording support
  • Loading branch information
jdaugherty authored Nov 25, 2024
2 parents c459b49 + a2eff1b commit 8824159
Show file tree
Hide file tree
Showing 88 changed files with 43,075 additions and 90 deletions.
1 change: 1 addition & 0 deletions .sdkmanrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
java=17.0.12-librca
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,35 @@ This requires a [compatible container runtime](https://java.testcontainers.org/s
If you choose to use the `ContainerGebSpec` class, as long as you have a compatible container runtime installed, you don't need to do anything else.
Just run `./gradlew integrationTest` and a container will be started and configured to start a browser that can access your application under test.

#### Custom Host Configuration

The annotation `ContainerGebConfiguration` exists to customize the connection the container will use to access the application under test. The annotation is not required and `ContainerGebSpec` will use the default values in this annotation if it's not present.

#### Recording

By default, no test recording will be performed. Various system properties exist to change the recording behavior. To set them, you can set them in your `build.gradle` file like so:

tasks.withType(Test) {
useJUnitPlatform()
systemProperty 'grails.geb.recording.mode', 'RECORD_ALL'
}

* `grails.geb.recording.mode`
* purpose: which tests to record
* possible values: `SKIP`, `RECORD_ALL`, or `RECORD_FAILING`
* defaults to `SKIP`


* `grails.geb.recording.directory`
* purpose: the directory to save the recordings relative to the project directory
* defaults to `build/recordings`


* `grails.geb.recording.format`
* purpose: sets the format of the recording
* possible values are `FLV` or `MP4`
* defaults to `MP4`

### GebSpec

If you choose to extend `GebSpec`, you will need to have a [Selenium WebDriver](https://www.selenium.dev/documentation/webdriver/browsers/) installed that matches a browser you have installed on your system.
Expand Down
5 changes: 3 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ grailsPublish {
graemerocher: 'Graeme Rocher',
puneetbehl: 'Puneet Behl',
sbglasius: 'Søren Berg Glasius',
matrei: 'Mattias Reichel'
matrei: 'Mattias Reichel',
jdaugherty: 'James Daugherty',
]
}

Expand All @@ -84,4 +85,4 @@ tasks.withType(Test).configureEach {
tasks.named('bootJar') { enabled = false }
tasks.named('bootRun') { enabled = false }
tasks.named('bootTestRun') { enabled = false }
tasks.named('findMainClass') { enabled = false }
tasks.named('findMainClass') { enabled = false }
42 changes: 42 additions & 0 deletions spock-container-test-app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
### Gradle ###
.gradle
build/
!gradle/wrapper/gradle-wrapper.jar
!**/src/main/**/build/
!**/src/test/**/build/

### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
bin/
!**/src/main/**/bin/
!**/src/test/**/bin/

### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
out/
!**/src/main/**/out/
!**/src/test/**/out/

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/

### VS Code ###
.vscode/

### Other ###
Thumbs.db
.DS_Store
target/
60 changes: 60 additions & 0 deletions spock-container-test-app/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
plugins {
id "groovy"
id "org.grails.grails-web"
id "org.grails.grails-gsp"
id "war"
id "idea"
id "com.bertramlabs.asset-pipeline" version "5.0.1"
id "eclipse"
}

group = "org.demo.spock"

repositories {
mavenCentral()
maven { url "https://repo.grails.org/grails/core/" }
maven { url "https://repository.apache.org/content/repositories/snapshots"}
}

dependencies {
profile("org.grails.profiles:web")
implementation("org.grails:grails-core")
implementation("org.grails:grails-logging")
implementation("org.grails:grails-plugin-databinding")
implementation("org.grails:grails-plugin-i18n")
implementation("org.grails:grails-plugin-interceptors")
implementation("org.grails:grails-plugin-rest")
implementation("org.grails:grails-plugin-services")
implementation("org.grails:grails-plugin-url-mappings")
implementation("org.grails:grails-web-boot")
implementation("org.grails.plugins:gsp")
implementation("org.grails.plugins:hibernate5")
implementation("org.grails.plugins:scaffolding")
implementation("org.sitemesh:grails-plugin-sitemesh3:7.0.0-SNAPSHOT")
implementation("org.springframework.boot:spring-boot-autoconfigure")
implementation("org.springframework.boot:spring-boot-starter")
implementation("org.springframework.boot:spring-boot-starter-actuator")
implementation("org.springframework.boot:spring-boot-starter-logging")
implementation("org.springframework.boot:spring-boot-starter-tomcat")
implementation("org.springframework.boot:spring-boot-starter-validation")
console("org.grails:grails-console")
runtimeOnly("com.bertramlabs.plugins:asset-pipeline-grails")
runtimeOnly("com.h2database:h2")
runtimeOnly("org.apache.tomcat:tomcat-jdbc")
runtimeOnly("org.fusesource.jansi:jansi")
integrationTestImplementation testFixtures(project(':geb'))
testImplementation("org.grails:grails-gorm-testing-support")
testImplementation("org.grails:grails-web-testing-support")
testImplementation("org.spockframework:spock-core")
}

compileJava.options.release = 17

tasks.withType(Test) {
useJUnitPlatform()
systemProperty 'grails.geb.recording.mode', 'RECORD_ALL'
}
assets {
minifyJs = true
minifyCss = true
}
10 changes: 10 additions & 0 deletions spock-container-test-app/buildSrc/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
repositories {
mavenCentral()
maven { url "https://repo.grails.org/grails/core/" }
maven { url "https://repository.apache.org/content/repositories/snapshots"}
}
dependencies {
implementation platform("org.grails:grails-bom:7.0.0-SNAPSHOT")
implementation("org.grails:grails-gradle-plugin:7.0.0-SNAPSHOT")
implementation("org.grails.plugins:hibernate5:9.0.0-SNAPSHOT")
}
7 changes: 7 additions & 0 deletions spock-container-test-app/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
grailsVersion=7.0.0-SNAPSHOT
grailsGradlePluginVersion=7.0.0-SNAPSHOT
version=0.1
org.gradle.caching=true
org.gradle.daemon=true
org.gradle.parallel=true
org.gradle.jvmargs=-Dfile.encoding=UTF-8 -Xmx1024M
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 8824159

Please sign in to comment.