Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loading of assets fails when running integration tests with Grails 6.2.2 #13937

Open
martinfrancois opened this issue Dec 21, 2024 · 0 comments

Comments

@martinfrancois
Copy link
Contributor

martinfrancois commented Dec 21, 2024

Expected Behavior

When running integration tests with a fresh Grails 6.2.2 project built using Grails Forge, there should be no warnings in the console when the website is opened and all assets (like jquery etc.) are loaded.

The last known version where this worked as expected was Grails 6.1.1.

Actual Behaviour

When running integration tests with a fresh Grails 6.2.2 project built using Grails Forge, there when the website is opened, the following warnings are logged to the browser's console:

Loading failed for the <script> with source “http://localhost:64114/assets/jquery-3.5.1.min.js?compile=false”. [localhost:64114:184:81](http://localhost:64114/)
Loading failed for the <script> with source “http://localhost:64114/assets/popper.min.js?compile=false”. [localhost:64114:185:75](http://localhost:64114/)
Loading failed for the <script> with source “http://localhost:64114/assets/bootstrap.js?compile=false”. [localhost:64114:186:74](http://localhost:64114/)
Loading failed for the <script> with source “http://localhost:64114/assets/application.js?compile=false”. [localhost:64114:187:76](http://localhost:64114/)

Also, any JavaScript code included in the assets is NOT executed.

Steps To Reproduce

Reproduction Steps

  1. Locally check out minimal reproducible example
  2. Execute in a terminal window: ./gradlew clean -Dgeb.env=firefox integrationTest
  3. As soon as the Firefox browser window opens, open the browser's console
  4. The warnings Loading failed for the <script> with source... appear

Workaround

  1. Cancel test execution in the terminal window
  2. Execute in a terminal window: ./gradlew bootRun
  3. Open the URL in the browser (can be any browser, even in an incognito window)
  4. No warnings appear in the console.
  5. Cancel bootRun in the terminal window
  6. Execute in a terminal window: ./gradlew -Dgeb.env=firefox integrationTest (without clean!)
  7. As soon as the Firefox browser window opens, open the browser's console
  8. No warnings are visible.

Step 3 (opening the URL in the browser) is essential, when going through the steps of the workaround WITHOUT opening the URL in the browser, the warnings still appear.

When running ./gradlew clean -Dgeb.env=firefox integrationTest (with clean) the bug is reproducible again.

How the provided minimal reproducible example was created

  1. Go to https://start.grails.org/ (Grails Forge)
  2. Choose the following:
    • Application Type: Web Application
    • Java Version: 17
    • Grails Version: 6.2.2
    • GORM Implementation: Gorm Hibernate5
    • Embedded Servlet: Spring Boot Starter Tomcat
    • Test Framework: Spock
  3. Generate the project, and open the ZIP in an IDE
  4. In src/integration-test/groovy/com/example/DemoSpec.groovy, add Thread.sleep(500000) after the line go '/' (this ensures the browser stays open long enough to check the console)
  5. In build.gradle, change geckodriver '0.33.0' to geckodriver '0.35.0' to be able to run the tests using the latest Firefox version

Environment Information

  • Operating System: macOS 14.6.1 (23G93)
  • JDK: 17
  • Firefox 133.0.3 (aarch64)

Example Application

https://github.com/martinfrancois/grails-622-bug-repro

Version

6.2.2

@martinfrancois martinfrancois changed the title Assets are not compiled when running integration tests with Grails 6.2.2 Loading of assets fails when running integration tests with Grails 6.2.2 Dec 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant