-
Notifications
You must be signed in to change notification settings - Fork 9
/
build.gradle
81 lines (65 loc) · 2.51 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
import org.apache.tools.ant.taskdefs.condition.Os
ext {
// The drivers we want to use
drivers = ["firefox", "chrome", "phantomJs"]
ext {
groovyVersion = '2.4.3'
gebVersion = '0.10.0'
seleniumVersion = '2.45.0'
chromeDriverVersion = '2.10'
phantomJsVersion = '1.9.7'
}
}
apply plugin: "groovy"
apply from: "gradle/idea.gradle"
apply from: "gradle/ci.gradle"
apply from: "gradle/osSpecificDownloads.gradle"
repositories {
jcenter()
}
dependencies {
// If using Spock, need to depend on geb-spock
testCompile "org.gebish:geb-spock:$gebVersion"
testCompile("org.spockframework:spock-core:1.0-groovy-2.4") {
exclude group: "org.codehaus.groovy"
}
testCompile "org.codehaus.groovy:groovy-all:$groovyVersion"
// If using JUnit, need to depend on geb-junit (3 or 4)
testCompile "org.gebish:geb-junit4:$gebVersion"
// Drivers
testCompile "org.seleniumhq.selenium:selenium-chrome-driver:$seleniumVersion"
testCompile "org.seleniumhq.selenium:selenium-firefox-driver:$seleniumVersion"
// TODO: This is patched version of phantomjsdriver with different maven coordinates
// Need to update to fixed official version when ready.
testCompile("com.codeborne:phantomjsdriver:1.2.1") {
// phantomjs driver pulls in a different selenium version
transitive = false
}
}
drivers.each { driver ->
task "${driver}Test"(type: Test) {
reports {
html.destination = reporting.file("$name/tests")
junitXml.destination = file("$buildDir/test-results/$name")
}
outputs.upToDateWhen { false } // Always run tests
systemProperty "geb.build.reportsDir", reporting.file("$name/geb")
systemProperty "geb.env", driver
// If you wanted to set the baseUrl in your build…
// systemProperty "geb.build.baseUrl", "http://myapp.com"
}
}
chromeTest {
dependsOn unzipChromeDriver
def chromedriverFilename = Os.isFamily(Os.FAMILY_WINDOWS) ? "chromedriver.exe" : "chromedriver"
systemProperty "webdriver.chrome.driver", new File(unzipChromeDriver.outputs.files.singleFile, chromedriverFilename).absolutePath
}
phantomJsTest {
dependsOn unzipPhantomJs
def phantomJsFilename = Os.isFamily(Os.FAMILY_WINDOWS) ? "phantomjs.exe" : "bin/phantomjs"
systemProperty "phantomjs.binary.path", new File(unzipPhantomJs.outputs.files.singleFile, phantomJsFilename).absolutePath
}
test {
dependsOn drivers.collect { tasks["${it}Test"] }
enabled = false
}