From 881e998fa361b6ca3fbedbeee91366bc4ca72ca5 Mon Sep 17 00:00:00 2001 From: Michael Yan Date: Thu, 4 Jan 2024 18:40:50 +0800 Subject: [PATCH] build integration test --- build.gradle | 32 ++++++++++++++++++++++++++++++++ gradle.properties | 6 ++++++ 2 files changed, 38 insertions(+) diff --git a/build.gradle b/build.gradle index 5b623a8..faacadd 100644 --- a/build.gradle +++ b/build.gradle @@ -58,6 +58,38 @@ dependencies { exclude module: 'slf4j-api' exclude module: 'asm' } + testImplementation "org.mockito:mockito-core" + testImplementation "org.grails.plugins:geb" + testImplementation "org.seleniumhq.selenium:selenium-chrome-driver:$seleniumVersion" + testImplementation "org.seleniumhq.selenium:selenium-firefox-driver:$seleniumVersion" + testImplementation "org.seleniumhq.selenium:selenium-safari-driver:$seleniumSafariDriverVersion" + testImplementation "org.seleniumhq.selenium:selenium-remote-driver:$seleniumVersion" + testImplementation "org.seleniumhq.selenium:selenium-api:$seleniumVersion" + testImplementation "org.seleniumhq.selenium:selenium-support:$seleniumVersion" + testImplementation "org.seleniumhq.selenium:selenium-htmlunit-driver:2.52.0" + testImplementation "net.sourceforge.htmlunit:htmlunit:2.18" +} + +apply from: rootProject.file('gradle/testVerbose.gradle') + +webdriverBinaries { + if (!System.getenv().containsKey('GITHUB_ACTIONS')) { + chromedriver "$chromeDriverVersion" + geckodriver "$geckodriverVersion" + } +} + +tasks.withType(Test) { + systemProperty "geb.env", System.getProperty('geb.env', 'chromeHeadless') + systemProperty "geb.build.reportsDir", reporting.file("geb/integrationTest") + + if (!System.getenv().containsKey('GITHUB_ACTIONS')) { + systemProperty 'webdriver.chrome.driver', System.getProperty('webdriver.chrome.driver') + systemProperty 'webdriver.gecko.driver', System.getProperty('webdriver.gecko.driver') + } else { + systemProperty 'webdriver.chrome.driver', "${System.getenv('CHROMEWEBDRIVER')}/chromedriver" + systemProperty 'webdriver.gecko.driver', "${System.getenv('GECKOWEBDRIVER')}/geckodriver" + } } groovydoc.doFirst { diff --git a/gradle.properties b/gradle.properties index 967ceaa..6f633e8 100644 --- a/gradle.properties +++ b/gradle.properties @@ -8,6 +8,12 @@ groovyVersion=3.0.11 cglibNodepVersion=3.2.9 joddWotVersion=3.3.8 servletApiVersion=4.0.1 +chromeDriverVersion=87.0.4280.20 +gebVersion=5.4.1 +geckodriverVersion=0.24.0 +seleniumSafariDriverVersion=3.14.0 +seleniumVersion=3.141.59 +webdriverBinariesVersion=2.6 asciidoc=true githubSlug=graceframework/grace-cache githubBranch=master