-
Notifications
You must be signed in to change notification settings - Fork 51
/
build.gradle
195 lines (174 loc) · 6.81 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
import org.arquillian.spacelift.execution.Tasks
import org.arquillian.spacelift.gradle.*
import org.arquillian.spacelift.gradle.maven.*
import org.arquillian.spacelift.gradle.utils.*
import org.arquillian.spacelift.process.CommandBuilder
import org.arquillian.spacelift.process.impl.CommandTool
defaultTasks 'test'
apply plugin: 'spacelift'
ext {
defaultArquillianCoreVersion = ['1.1.4.Final', '1.1.5.Final', '1.1.6.Final', '1.1.7.Final', '1.1.8.Final',
'1.1.9.Final', '1.1.10.Final', '1.1.11.Final']
defaultBrowser = ['phantomjs']
defaultArquillianPhantomDriverCommit = '1.2.0.Final'
defaultArquillianPhantomDriverOrganization = 'qa'
// selenium server instance holder
seleniumVersion = '2.50.0'
iedriverVersion = '2.50.0'
phantomjsVersion = '2.1.1'
}
spacelift {
workspace = new File(project.rootDir, 'ws')
installationsDir = new File(project.rootDir, 'ws')
enableStaging = true
tools {
java {
command ([
linux: "java",
windows: "java.exe",
mac: "java",
solaris: "java"
])
}
mvn {
command {
def m2 = System.getenv("M2")
def m2_home = System.getenv("M2_HOME")
def mvnPath = null
if (m2 != null && !m2.isEmpty() && (new File(m2, 'mvn')).exists()) {
mvnPath = new File(new File(m2), 'mvn').getCanonicalPath()
} else if (m2_home != null && !m2_home.isEmpty() && (new File(m2_home, 'mvn')).exists()) {
mvnPath = new File(new File(m2_home), 'mvn').getCanonicalPath()
} else {
mvnPath = "mvn"
}
if(EnvironmentUtils.runsOnWindows()) {
mvnPath += '.bat'
}
return Tasks.prepare(CommandTool).command(new CommandBuilder(mvnPath))
}
}
}
profiles {
"default" {
enabledInstallations 'selenium', 'phantomjs', 'iedriver'
tests '*'
}
}
installations {
selenium {
product 'selenium'
version project.seleniumVersion
remoteUrl "http://selenium-release.storage.googleapis.com/${version.substring(0,4)}/selenium-server-standalone-${version}.jar"
autoExtract false
tools {
seleniumserver {
command {
GradleSpacelift.tools('java')
.parameters('-jar', "${selenium.home}/${selenium.fileName}")
}
}
}
}
phantomjs {
product 'phantomjs'
version project.phantomjsVersion
remoteUrl ([
linux: "https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-${version}-linux-x86_64.tar.bz2",
mac: "https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-${version}-macosx.zip",
windows: "https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-${version}-windows.zip",
])
home "phantomjs-${version}"
extractMapper { toDir(home).cutdirs() }
postActions {
// fix executable flags
project.ant.chmod(dir: "${home}", perm:"a+x", includes:"**/*phantomjs*")
}
}
iedriver {
product 'iedriver'
version project.iedriverVersion
remoteUrl "http://selenium-release.storage.googleapis.com/${version.substring(0,4)}/IEDriverServer_x64_${version}.zip"
home "iedriver-${version}"
extractMapper { toDir(home).cutdirs() }
}
// this installation can be used if there is a need to test against not yet release version of arquillian-phantom-driver
arquillianPhantomDriver {
product 'arquillianPhantomDriver'
version { project.arquillianPhantomDriverCommit }
remoteUrl { "https://github.com/${project.arquillianPhantomDriverOrganization}/arquillian-phantom-driver/archive/${version}.zip" }
home { "arquillian-phantom-driver-${version}" }
extractMapper { toDir(home).cutdirs() }
postActions {
Tasks.prepare(MavenExecutor).pom("${home.absolutePath}/pom.xml")
.goals('clean', 'install')
.execute().await()
}
}
}
tests {
arquillianCoreCompatibility {
def seleniumServer = null
dataProvider {
def browser = project.browser
project.arquillianCoreVersion.collectMany{arqVersion ->
browser.collect{ b->
[arqVersion, b]
}
}
}
beforeSuite {
def phantomjsPath = "${phantomjs.home}/bin/phantomjs"
if(EnvironmentUtils.runsOnWindows()) {
phantomjsPath += '.exe'
}
// start selenium server, we need it for tests
seleniumServer = GradleSpacelift.tools('seleniumserver')
.workingDir("${project.spacelift.workspace}")
.parameter("-Dphantomjs.binary.path=${phantomjsPath}")
.parameter("-Dwebdriver.ie.driver=${iedriver.home}/IEDriverServer.exe")
.interaction(GradleSpacelift.ECHO_OUTPUT)
.execute()
}
execute { arqVersion, browserType ->
// execute all tests in the extension
Tasks.prepare(MavenExecutor).pom("pom.xml")
// replace property version.arquillian.core with compatibility version
.property("version.arquillian.core=${arqVersion}")
.property("browser=${browserType}")
.goals('clean', 'verify').execute().await()
}
afterSuite {
// terminate selenium server
seleniumServer.terminate()
}
}
}
}
// build dependencies
buildscript {
repositories {
mavenCentral()
// you need this only if you plan to use SNAPSHOT version of this plugin
maven {
name 'jboss-staging-repository-group'
url 'https://repository.jboss.org/nexus/content/groups/staging'
}
}
dependencies {
classpath 'org.arquillian.spacelift.gradle:arquillian-spacelift-gradle:1.0.0-alpha-5'
}
}
// these elements are needed only if you are willing to use _testreport_ task
repositories {
mavenCentral()
}
configurations {
junitreport
}
dependencies {
junitreport 'org.apache.ant:ant-junit:1.9.4'
}
task wrapper(type: Wrapper) {
gradleVersion = '2.2'
}