grails / grails-core

The Grails Web Application Framework
http://grails.org
Apache License 2.0
2.78k stars 951 forks source link

Newly generated project should run tests with Apple M1 processors without exception #12497

Open kurb70 opened 2 years ago

kurb70 commented 2 years ago

Expected Behavior

The project created by the "grails create-app" command should not cause the error "Execution failed for task ':configureChromeDriverBinary'." when running tests (gradle check) under Apple M1. .

Actual Behaviour

When trying to run tests with gradle check the following message appears

Execution failed for task ':configureChromeDriverBinary'.
> com.github.erdi.gradle.webdriver.repository.UnsupportedArchitectureException: UNKNOWN

Steps To Reproduce

  1. Create Grails App wit Web profile
  2. Start App (no problem)
  3. Start ./gradlew check -> FAILURE: Build failed with an exception. -> com.github.erdi.gradle.webdriver.repository.UnsupportedArchitectureException

Environment Information

Example Application

No response

Version

5.1.7

rainboyan commented 2 years ago

@kurb70 you should use WebDriver binaries Gradle plugin v2.7, this version support macOS ARM64 architecture. But the default drivers repository-3.0.json file is no longer maintained, you can add the drivers which support Apple M1 by yourself.

Please reference here: https://github.com/rainboyan/grails-geb-test-driver-demo

buildscript {
    repositories {
        maven { url "https://repo.grails.org/grails/core" }
    }
    dependencies {
        classpath "org.grails:grails-gradle-plugin:$grailsGradlePluginVersion"
        // (1)
        classpath "gradle.plugin.com.github.erdi.webdriver-binaries:webdriver-binaries-gradle-plugin:2.7"
    }
}

...

webdriverBinaries {
    driverUrlsConfiguration = resources.text.fromFile('repository-3.0.json') // (2)
    if (!System.getenv().containsKey('GITHUB_ACTIONS')) {
        chromedriver {
            version = '101.0.4951.41'
            //architecture = 'ARM64'
            fallbackTo32Bit = true
        }
        geckodriver {
            version = '0.31.0'
        }
    }
}

Put the repository-3.0.json in your app root,

{
    "drivers": [
        {
            "name": "chromedriver",
            "platform": "mac",
            "bit": "arm64",
            "version": "101.0.4951.41",
            "url": "https://chromedriver.storage.googleapis.com/101.0.4951.41/chromedriver_mac64_m1.zip"
        },
        {
            "name": "geckodriver",
            "platform": "mac",
            "bit": "arm64",
            "version": "0.31.0",
            "url": "https://github.com/mozilla/geckodriver/releases/download/v0.31.0/geckodriver-v0.31.0-macos-aarch64.tar.gz"
        },
   ]

}