summaryrefslogtreecommitdiffstats
path: root/uitest/build.xml
blob: 02b97fb3a06ddfed4c70d664823bf380afdefd07 (plain)
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
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
<?xml version="1.0"?>

<project name="vaadin-uitest" basedir="." default="publish-local" xmlns:ivy="antlib:org.apache.ivy.ant">
    <description>
        Provides a uitest WAR containing Vaadin UI tests
    </description>
    <include file="../common.xml" as="common" />
    <include file="../build.xml" as="vaadin" />

    <!-- global properties -->
    <property name="module.name" value="vaadin-uitest" />
    <property name="uitest.dir" location="${vaadin.basedir}/uitest" />
    <property name="result.dir" value="result" />
    <property name="theme.result.dir" value="${result.dir}/VAADIN/themes" />
    <property name="result.war" location="${result.dir}/lib/${module.name}-${vaadin.version}.war" />

    <path id="classpath.compile.custom">
    </path>

    <target name="dependencies">
        <!-- This is copied from common.xml to be able to add server.test.source
            to the source path -->

        <ivy:resolve log="download-only" resolveid="common" conf="build, build-provided" />
        <ivy:cachepath pathid="classpath.compile.dependencies" conf="build, build-provided" />
    </target>

    <target name="compile" description="Compiles the module" depends="dependencies">

        <fail unless="module.name" message="No module name given" />
        <property name="result.dir" location="result" />
        <property name="src" location="${result.dir}/../src" />
        <property name="classes" location="${result.dir}/classes" />
        <property name="server.test.sources" location="${result.dir}/../../server/tests/src" />
        <mkdir dir="${classes}" />

        <!-- TODO: Get rid of this -->
        <javac destdir="${classes}" source="${vaadin.java.version}" target="${vaadin.java.version}" debug="true" encoding="UTF-8" includeantruntime="false">
            <src path="${server.test.sources}" />
            <include name="com/vaadin/tests/data/bean/**" />
            <include name="com/vaadin/tests/VaadinClasses.java" />
            <include name="com/vaadin/data/util/sqlcontainer/SQLTestsConstants.java" />
            <classpath refid="classpath.compile.dependencies" />
            <classpath refid="classpath.compile.custom" />
        </javac>

        <javac destdir="${classes}" source="${vaadin.java.version}" target="${vaadin.java.version}" debug="true" encoding="UTF-8" includeantruntime="false">
            <src path="${src}" />
            <classpath location="${classes}" />
            <classpath refid="classpath.compile.dependencies" />
            <classpath refid="classpath.compile.custom" />
        </javac>
    </target>

    <target name="testing-widgetset" depends="dependencies,compile">
        <property name="module" value="com.vaadin.tests.widgetset.TestingWidgetSet" />
        <property name="style" value="OBF" />
        <property name="localWorkers" value="6" />
        <property name="extraParams" value="" />
        <property name="module.output.dir" location="${result.dir}/VAADIN/widgetsets" />
        <property name="work.dir" location="${result.dir}/work" />

        <mkdir dir="${module.output.dir}" />

        <echo>Compiling ${module} to ${module.output.dir}</echo>

        <!-- compile the module -->
        <java classname="com.google.gwt.dev.Compiler" classpathref="classpath.compile.dependencies" failonerror="yes" fork="yes" maxmemory="512m">
            <classpath location="src" />
            <classpath location="${classes}" />
            <arg value="-workDir" />
            <arg value="${work.dir}" />
            <arg value="-logLevel" />
            <arg value="TRACE" />
            <arg value="-war" />
            <arg value="${module.output.dir}" />
            <arg value="-style" />
            <arg value="${style}" />

            <arg value="-localWorkers" />
            <arg value="${localWorkers}" />
            <arg value="-strict" />
            <arg line="${extraParams}" />
            <arg value="${module}" />

            <sysproperty key="vFailIfNotSerializable" value="true" />

            <jvmarg value="-Xss8M" />
            <jvmarg value="-XX:MaxPermSize=256M" />
            <jvmarg value="-Djava.awt.headless=true" />
        </java>

    </target>

    <target name="war" depends="dependencies, compile, compile-test-themes, testing-widgetset">
        <property name="result.dir" location="result" />
        <property name="classes" location="${result.dir}/classes" />
        <property name="WebContent.dir" location="${vaadin.basedir}/WebContent" />
        <property name="deps.dir" location="${result.dir}/deps" />
        <property name="src" location="${result.dir}/../src" />

        <ivy:resolve log="download-only" resolveid="common" conf="build" />
        <ivy:cachepath pathid="classpath.runtime.dependencies" conf="build" />

        <delete dir="${deps.dir}" />
        <mkdir dir="${deps.dir}" />

        <copy todir="${deps.dir}" flatten="true">
            <path refid="classpath.runtime.dependencies" />
        </copy>

        <delete>
            <!-- Avoid including some potentially conflicting jars in the war -->
            <fileset dir="${deps.dir}" includes="jetty-*.jar" />
            <fileset dir="${deps.dir}" includes="servlet-api-*.jar" />
        </delete>

        <!-- Ensure filtered webcontent files are available -->
        <antcall target="common.filter.webcontent" />

        <war destfile="${result.war}" duplicate="fail" index="true">
            <fileset refid="common.files.for.all.jars" />
            <fileset dir="${result.dir}">
                <include name="VAADIN/widgetsets/**/*" />
                <include name="VAADIN/themes/tests-valo*/**" />
            </fileset>
            <fileset dir="${WebContent.dir}">
                <include name="statictestfiles/**" />
                <include name="VAADIN/themes/tests-*/**" />
                <!-- Scss themes compiled and included above -->
                <exclude name="VAADIN/themes/tests-valo*/**" />
                <include name="VAADIN/themes/reindeer-tests/**" />
                <include name="VAADIN/jquery.atmosphere.js" />
                <include name="WEB-INF/*.xml" />
                <include name="WEB-INF/web.xml.2.4" />
            </fileset>
            <classes dir="${classes}" />
            <classes dir="${src}" />
            <lib dir="${deps.dir}" />
        </war>

    </target>

    <target name="publish-local" depends="war">
        <antcall target="common.publish-local">
            <param name="conf" value="build" />
        </antcall>
    </target>

    <target name="clean">
        <antcall target="common.clean" />
    </target>
    <target name="checkstyle">
        <echo>Checkstyle is disabled for uitest for now</echo>
    </target>
    <target name="test" depends="checkstyle">
    </target>

    <target name="test-testbench" depends="clean-testbench-errors" description="Run all TestBench based tests, including server tests">
        <parallel>
            <daemons>
                <!-- Start server -->
                <ant antfile="${uitest.dir}/vaadin-server.xml" inheritall="true" inheritrefs="true" target="deploy-and-start" />
            </daemons>
            <sequential>
                <!-- Server tests -->

                <!-- Sleep before running integration tests so testbench 2
                        tests have time to compile and start -->
                <sleep minutes="4" />
                <ant antfile="${uitest.dir}/integration_tests.xml" target="integration-test-all" inheritall="false" inheritrefs="false">
                    <property name="demo.war" value="${war.file}" />
                </ant>
            </sequential>
            <sequential>
                <!-- Wait for server to start -->
                <ant antfile="${uitest.dir}/vaadin-server.xml" target="wait-for-startup" />

                <!-- Run all different kinds of TestBench tests in parallel -->
                <parallel>

                    <!-- Legacy TestBench 2 tests -->
                    <sequential>
                        <ant antfile="${uitest.dir}/test.xml" target="tb2-tests" />
                        <echo message="TestBench 2 tests complete" />
                    </sequential>

                    <!-- TestBench 3 tests -->
                    <sequential>
                        <ant antfile="${uitest.dir}/tb3test.xml" target="run-all-tb3-tests" inheritall="true" />
                        <echo message="TestBench 3 tests complete" />
                    </sequential>
                </parallel>
            </sequential>
        </parallel>
    </target>

    <target name="test-server" depends="clean-testbench-errors">
        <property name="war.file" location="${vaadin.basedir}/result/artifacts/${vaadin.version}/vaadin-uitest/vaadin-uitest-${vaadin.version}.war" />
        <parallel>
            <daemons>
                <ant antfile="${uitest.dir}/vaadin-server.xml" inheritall="true" inheritrefs="true" target="deploy-and-start" />
            </daemons>
            <sequential>
                <ant antfile="${uitest.dir}/integration_tests.xml" target="integration-test-all" inheritall="false" inheritrefs="false">
                    <property name="demo.war" value="${war.file}" />
                </ant>
            </sequential>
        </parallel>
    </target>

    <target name="test-tb2" depends="clean-testbench-errors">
        <property name="war.file" location="${vaadin.basedir}/result/artifacts/${vaadin.version}/vaadin-uitest/vaadin-uitest-${vaadin.version}.war" />
        <parallel>
            <daemons>
                <ant antfile="${uitest.dir}/vaadin-server.xml" inheritall="true" inheritrefs="true" target="deploy-and-start" />
            </daemons>
            <sequential>
                <ant antfile="${uitest.dir}/vaadin-server.xml" target="wait-for-startup" />
                <ant antfile="${uitest.dir}/test.xml" target="tb2-tests" />
            </sequential>
        </parallel>
    </target>

    <target name="test-tb3" depends="clean-testbench-errors">
        <property name="war.file" location="${vaadin.basedir}/result/artifacts/${vaadin.version}/vaadin-uitest/vaadin-uitest-${vaadin.version}.war" />
        <parallel>
            <daemons>
                <ant antfile="${uitest.dir}/vaadin-server.xml" inheritall="true" inheritrefs="true" target="deploy-and-start" />
            </daemons>
            <sequential>
                <ant antfile="${uitest.dir}/vaadin-server.xml" target="wait-for-startup" />
                <ant antfile="${uitest.dir}/tb3test.xml" target="run-all-tb3-tests" inheritall="true" />
            </sequential>
        </parallel>
    </target>

    <target name="clean-testbench-errors">
        <fail unless="com.vaadin.testbench.screenshot.directory" message="Define screenshot directory using -Dcom.vaadin.testbench.screenshot.directory" />
        <mkdir dir="${com.vaadin.testbench.screenshot.directory}/errors" />
        <delete>
            <fileset dir="${com.vaadin.testbench.screenshot.directory}/errors">
                <include name="*" />
            </fileset>
        </delete>
    </target>

    <target name="compile-test-themes">
        <antcall target="compile-theme">
            <param name="theme" value="tests-valo" />
        </antcall>
        <antcall target="compile-theme">
            <param name="theme" value="tests-valo-dark" />
        </antcall>
        <antcall target="compile-theme">
            <param name="theme" value="tests-valo-metro" />
        </antcall>
        <antcall target="compile-theme">
            <param name="theme" value="tests-valo-flat" />
        </antcall>
        <antcall target="compile-theme">
            <param name="theme" value="tests-valo-flatdark" />
        </antcall>
        <antcall target="compile-theme">
            <param name="theme" value="tests-valo-facebook" />
        </antcall>
        <antcall target="compile-theme">
            <param name="theme" value="tests-valo-blueprint" />
        </antcall>
        <antcall target="compile-theme">
          <param name="theme" value="tests-valo-light" />
        </antcall>

    </target>
    <target name="compile-theme" depends="copy-theme">
        <fail unless="theme" message="You must give the theme name to compile in the 'theme' parameter" />

        <ivy:resolve log="download-only" resolveid="common" conf="compile-theme" />
        <ivy:cachepath pathid="classpath.compile.theme" conf="compile-theme" />
        <ivy:cachepath pathid="classpath.runtime.theme" conf="build" />

        <echo>Compiling ${theme}</echo>
        <mkdir dir="${theme.result.dir}" />

        <!-- compile the theme -->
        <java classname="com.vaadin.buildhelpers.CompileTheme" classpathref="classpath.compile.theme" failonerror="yes" fork="yes" maxmemory="512m">
            <arg value="--theme" />
            <arg value="${theme}" />
            <arg value="--theme-folder" />
            <arg value="${theme.result.dir}" />
            <arg value="--version" />
            <arg value="${vaadin.version}" />
            <jvmarg value="-Xss8M" />
            <jvmarg value="-XX:MaxPermSize=256M" />
            <jvmarg value="-Djava.awt.headless=true" />
        </java>

    </target>

    <target name="copy-theme">
        <fail unless="theme" message="You must give the theme name to copy n the 'theme' parameter" />
        <property name="theme.source.dir" location="../WebContent/VAADIN/themes" />

        <copy todir="${theme.result.dir}">
            <fileset dir="${theme.source.dir}">
                <include name="${theme}/**/*.scss" />
            </fileset>
            <filterset refid="filter-vaadin.version" />
        </copy>
        <copy todir="${theme.result.dir}">
            <fileset dir="${theme.source.dir}">
                <exclude name="${theme}/**/*.scss" />
            </fileset>
        </copy>
    </target>


</project>