Skip to content

Remove jodd-wot from fields tests#15965

Open
jamesfredley wants to merge 1 commit into
8.0.xfrom
chore/remove-jodd-wot
Open

Remove jodd-wot from fields tests#15965
jamesfredley wants to merge 1 commit into
8.0.xfrom
chore/remove-jodd-wot

Conversation

@jamesfredley

Copy link
Copy Markdown
Contributor

Summary

Removes the jodd-wot test dependency from grails-fields by replacing its only usage with direct Spock string assertions against the rendered field output.

Changes

Area Change
grails-fields tests Removed jodd.lagarto.dom.jerry.Jerry imports and helper usage in DefaultFieldTemplateSpec.
grails-fields dependencies Removed org.jodd:jodd-wot from test dependencies.
Root properties Removed the now-unused joddWotVersion property.

Verification

Check Result
`rg -n "jodd jodd-wot"`
./gradlew.bat :grails-fields:test --tests "grails.plugin.formfields.DefaultFieldTemplateSpec" Passed.
./gradlew.bat :grails-fields:test Passed.

Checklist

  • Searched for jodd-wot / jodd references.
  • Replaced test usage with plain Spock assertions.
  • Removed unused dependency/version wiring.
  • Verified affected module tests pass.

Replace the Jerry-based spec assertions with direct output checks and remove the unused jodd-wot test dependency wiring.

Assisted-by: opencode:gpt-5.5

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR removes the jodd-wot test dependency from the grails-fields module by replacing the prior DOM-parsing assertions in DefaultFieldTemplateSpec with direct string-based Spock assertions, and then cleaning up the related Gradle dependency and version property wiring.

Changes:

  • Refactored DefaultFieldTemplateSpec to drop Jerry/jerry usage and assert against rendered output strings.
  • Removed org.jodd:jodd-wot from grails-fields test dependencies.
  • Removed the now-unused joddWotVersion property from gradle.properties.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
grails-fields/src/test/groovy/grails/plugin/formfields/DefaultFieldTemplateSpec.groovy Removes Lagarto/Jerry usage and replaces DOM assertions with string assertions for default/invalid/required rendering.
grails-fields/build.gradle Drops the jodd-wot test dependency block (and its excludes).
gradle.properties Removes the unused joddWotVersion property.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +53 to +57
output.contains('<div class="fieldcontain">')

and:
def label = root.find('label')
label.text() == 'label'
label.attr('for') == 'property'

and:
label.next().is('input[name=property]')
}
and:
output.contains('<label class="" for="property">label</label>')
output.indexOf('<label class="" for="property">label</label>') < output.indexOf('<input name="property">')
given:
model.required = true
then:
output.contains('<div class="fieldcontain error">')
Comment on lines +79 to +82
output.contains('<div class="fieldcontain required">')

and:
output.contains('<span class="required-indicator">*</span>')
@codecov

codecov Bot commented Jul 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 49.6252%. Comparing base (c317eef) to head (19fc2a1).
⚠️ Report is 5 commits behind head on 8.0.x.

Additional details and impacted files

Impacted file tree graph

@@                Coverage Diff                 @@
##                8.0.x     #15965        +/-   ##
==================================================
+ Coverage     49.5558%   49.6252%   +0.0695%     
- Complexity      16930      16959        +29     
==================================================
  Files            1999       1999                
  Lines           93753      93791        +38     
  Branches        16419      16421         +2     
==================================================
+ Hits            46460      46544        +84     
+ Misses          40131      40078        -53     
- Partials         7162       7169         +7     

see 5 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@testlens-app

testlens-app Bot commented Jul 10, 2026

Copy link
Copy Markdown

🚨 TestLens detected 1 failed test 🚨

Here is what you can do:

  1. Inspect the test failures carefully.
  2. If you are convinced that some of the tests are flaky, you can mute them below.
  3. Finally, trigger a rerun by checking the rerun checkbox.

Test Summary

CI - Groovy Joint Validation Build / build_grails > :grails-test-examples-scaffolding:integrationTest

Test Runs Flakiness
UserControllerSpec > User list 3% 🟡

🏷️ Commit: 19fc2a1
▶️ Tests: 25074 executed
⚪️ Checks: 61/61 completed

Test Failures

UserControllerSpec > User list (:grails-test-examples-scaffolding:integrationTest in CI - Groovy Joint Validation Build / build_grails)
Condition failed with Exception:

at(UserListPage)
|  |
|  class com.example.pages.UserListPage
geb.waiting.WaitTimeoutException: condition did not pass in 30 seconds (failed with exception)
	at geb.waiting.Wait.waitFor(Wait.groovy:128)
	at geb.waiting.PotentiallyWaitingExecutor.execute(PotentiallyWaitingExecutor.groovy:31)
	at geb.Page.verifyThisPageAtOnly(Page.groovy:424)
	at geb.Page.getAtVerificationResult(Page.groovy:217)
	at geb.Page.verifyAt(Page.groovy:188)
	at geb.Browser.doAt(Browser.groovy:1208)
	at geb.Browser.at(Browser.groovy:381)
	at grails.plugin.geb.support.delegate.BrowserDelegate$Trait$Helper.at(BrowserDelegate.groovy:83)
	at com.example.UserControllerSpec.User list(UserControllerSpec.groovy:51)
Caused by: Assertion failed: 
 
title == pageTitle
|     |  |
|     |  'User List'
|     false
'Please sign in'
 
	at com.example.pages.UserListPage._clinit__closure1(UserListPage.groovy:28)
	at geb.waiting.Wait.waitFor(Wait.groovy:117)
	... 8 more

	at com.example.UserControllerSpec.User list(UserControllerSpec.groovy:51)
Caused by: geb.waiting.WaitTimeoutException: condition did not pass in 30 seconds (failed with exception)
	at geb.waiting.Wait.waitFor(Wait.groovy:128)
	at geb.waiting.PotentiallyWaitingExecutor.execute(PotentiallyWaitingExecutor.groovy:31)
	at geb.Page.verifyThisPageAtOnly(Page.groovy:424)
	at geb.Page.getAtVerificationResult(Page.groovy:217)
	at geb.Page.verifyAt(Page.groovy:188)
	at geb.Browser.doAt(Browser.groovy:1208)
	at geb.Browser.at(Browser.groovy:381)
	at grails.plugin.geb.support.delegate.BrowserDelegate$Trait$Helper.at(BrowserDelegate.groovy:83)
	... 1 more
Caused by: Assertion failed: 

title == pageTitle
|     |  |
|     |  'User List'
|     false
'Please sign in'

	at com.example.pages.UserListPage._clinit__closure1(UserListPage.groovy:28)
	at geb.waiting.Wait.waitFor(Wait.groovy:117)
	... 8 more

Muted Tests

Select tests to mute in this pull request:

  • UserControllerSpec > User list

Reuse successful test results:

  • ♻️ Only rerun the tests that failed or were muted before

Click the checkbox to trigger a rerun:

  • Rerun jobs

Learn more about TestLens at testlens.app.

@jdaugherty

Copy link
Copy Markdown
Contributor

I'm not a fan of the string comparisons - they're fragile and brittle. Why are we not using a standard html parser?

@jamesfredley

Copy link
Copy Markdown
Contributor Author

Fair point on the brittleness. Worth separating the goal from the assertion style:

The primary objective (pre-release review, Codebase 3 / hygiene quick-win) is to remove the jodd-wot dependency - jodd-wot 3.3.8 dates to 2012 and is effectively unmaintained, and it's a single testImplementation usage in grails-fields/build.gradle. Getting it off the dependency list is the win.

On how to replace the assertion, the review lists two options: "modern assertions" or "Jsoup or equivalent". The trade-off:

  • String assertions (current PR): removes jodd-wot with zero new dependencies, but is more brittle as you note.
  • Jsoup: robust HTML parsing, but re-adds a test dependency to replace the one we're removing.

I'm happy to switch these to Jsoup (org.jsoup:jsoup, testImplementation) if you'd rather have a real parser and consider the added test dep acceptable - that still achieves the jodd-wot removal, just trading one modern dep for one archived one. Which would you prefer: keep it dependency-free with tightened assertions, or move to Jsoup?

@jdaugherty

Copy link
Copy Markdown
Contributor

I'm happy with Jsoup, it's a parser that's well understood. I think we need to parse these values though, especially with some of the refactoring we've talked about. Otherwise, the tests are too brittle.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

3 participants