This repository has been archived by the owner on Dec 6, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
81 lines (64 loc) · 2.48 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.8'
gebVersion = '1.1.1'
seleniumVersion = '2.53.0'
chromeDriverVersion = '2.24'
phantomJsVersion = '2.1.1'
}
}
apply plugin: "groovy"
apply from: "gradle/idea.gradle"
apply from: "gradle/osSpecificDownloads.gradle"
repositories {
mavenCentral()
}
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"
// using a custom version of phantomjs driver for now as the original one does not support WebDriver > 2.43.1
testCompile("com.codeborne:phantomjsdriver:1.3.0") {
// 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
}
apply from: "gradle/ci.gradle"