@@ -12,12 +12,11 @@ import java.io.File
1212
1313class IntegrationTest {
1414
15- @Test
16- fun `test evaluate simple project success` () {
15+ fun prepareSimpleProject (): Project {
1716 val simpleProject = File (javaClass.getResource(" simple" ).file)
1817 val project = ProjectBuilder .builder().withProjectDir(simpleProject).build()
1918 project.plugins.apply (" com.android.application" )
20-
19+
2120 project.configure<AppExtension > {
2221 compileSdkVersion(27 )
2322 defaultConfig.apply {
@@ -27,6 +26,13 @@ class IntegrationTest {
2726 setTargetSdkVersion(27 )
2827 }
2928 }
29+ return project
30+ }
31+
32+
33+ @Test
34+ fun `test evaluate simple project success` () {
35+ val project = prepareSimpleProject()
3036 (project as ProjectInternal ).evaluate()
3137 }
3238
@@ -50,18 +56,8 @@ class IntegrationTest {
5056 @Test
5157 fun `run firebaseTestLabSetup install gcloud` () {
5258 val simpleProject = File (javaClass.getResource(" simple" ).file)
53- val project = ProjectBuilder .builder().withProjectDir(simpleProject).build()
54- project.plugins.apply (" com.android.application" )
55- project.plugins.apply (" firebase.test.lab" )
56- project.configure<AppExtension > {
57- compileSdkVersion(27 )
58- defaultConfig.also {
59- it.versionCode = 1
60- it.versionName = " 0.1"
61- it.setMinSdkVersion(27 )
62- it.setTargetSdkVersion(27 )
63- }
64- }
59+ val project = prepareSimpleProject()
60+ project.plugins.apply (" firebase.test.lab" )
6561 project.configure<FirebaseTestLabPluginExtension > {
6662 googleProjectId = " test"
6763 keyFile = File (simpleProject, " key.json" )
@@ -75,18 +71,8 @@ class IntegrationTest {
7571 @Test
7672 fun `ensure after evaluation tasks presented` () {
7773 val simpleProject = File (javaClass.getResource(" simple" ).file)
78- val project = ProjectBuilder .builder().withProjectDir(simpleProject).build()
79- project.plugins.apply (" com.android.application" )
80- project.plugins.apply (" firebase.test.lab" )
81- project.configure<AppExtension > {
82- compileSdkVersion(27 )
83- defaultConfig.also {
84- it.versionCode = 1
85- it.versionName = " 0.1"
86- it.setMinSdkVersion(27 )
87- it.setTargetSdkVersion(27 )
88- }
89- }
74+ val project = prepareSimpleProject()
75+ project.plugins.apply (" firebase.test.lab" )
9076 project.configure<FirebaseTestLabPluginExtension > {
9177 googleProjectId = " test"
9278 keyFile = File (simpleProject, " key.json" )
@@ -96,25 +82,36 @@ class IntegrationTest {
9682 }
9783 (project as ProjectInternal ).evaluate()
9884
99-
10085 assertTrue(project.getTasksByName(" firebaseTestLabExecuteDebugInstrumentation" , false ).isNotEmpty())
10186 assertTrue(project.getTasksByName(" firebaseTestLabExecuteDebugRobo" , false ).isNotEmpty())
10287 }
10388
89+ @Test
90+ fun `ensure after evaluation download tasks presented` () {
91+ val simpleProject = File (javaClass.getResource(" simple" ).file)
92+ val project = prepareSimpleProject()
93+ project.plugins.apply (" firebase.test.lab" )
94+ project.configure<FirebaseTestLabPluginExtension > {
95+ googleProjectId = " test"
96+ cloudBucketName = " test-bucket"
97+ cloudDirectoryName = " test-directory"
98+ keyFile = File (simpleProject, " key.json" )
99+ createDevice(" myDevice" ) {
100+ deviceIds = listOf (" Nexus6" )
101+ }
102+ }
103+ (project as ProjectInternal ).evaluate()
104+
105+ assertTrue(project.getTasksByName(" firebaseTestLabDownloadDebugInstrumentation" , false ).isNotEmpty())
106+ assertTrue(project.getTasksByName(" firebaseTestLabDownloadDebug" , false ).isNotEmpty())
107+ }
108+
104109 @Test
105110 fun `ensure tasks are created for abi splits with universal apk` () {
106111 val simpleProject = File (javaClass.getResource(" simple" ).file)
107- val project = ProjectBuilder .builder().withProjectDir(simpleProject).build()
108- project.plugins.apply (" com.android.application" )
112+ val project = prepareSimpleProject()
109113 project.plugins.apply (" firebase.test.lab" )
110114 project.configure<AppExtension > {
111- compileSdkVersion(27 )
112- defaultConfig.also {
113- it.versionCode = 1
114- it.versionName = " 0.1"
115- it.setMinSdkVersion(27 )
116- it.setTargetSdkVersion(27 )
117- }
118115 splits.also {
119116 it.abi.also {
120117 it.isEnable = true
@@ -143,17 +140,9 @@ class IntegrationTest {
143140 @Test
144141 fun `ensure tasks are created for abi splits without unversal apk` () {
145142 val simpleProject = File (javaClass.getResource(" simple" ).file)
146- val project = ProjectBuilder .builder().withProjectDir(simpleProject).build()
147- project.plugins.apply (" com.android.application" )
143+ val project = prepareSimpleProject()
148144 project.plugins.apply (" firebase.test.lab" )
149145 project.configure<AppExtension > {
150- compileSdkVersion(27 )
151- defaultConfig.also {
152- it.versionCode = 1
153- it.versionName = " 0.1"
154- it.setMinSdkVersion(27 )
155- it.setTargetSdkVersion(27 )
156- }
157146 splits.also {
158147 it.abi.also {
159148 it.isEnable = true
@@ -182,17 +171,9 @@ class IntegrationTest {
182171 @Test
183172 fun `ensure tasks are created for abi splits with filter` () {
184173 val simpleProject = File (javaClass.getResource(" simple" ).file)
185- val project = ProjectBuilder .builder().withProjectDir(simpleProject).build()
186- project.plugins.apply (" com.android.application" )
174+ val project = prepareSimpleProject()
187175 project.plugins.apply (" firebase.test.lab" )
188176 project.configure<AppExtension > {
189- compileSdkVersion(27 )
190- defaultConfig.also {
191- it.versionCode = 1
192- it.versionName = " 0.1"
193- it.setMinSdkVersion(27 )
194- it.setTargetSdkVersion(27 )
195- }
196177 splits.also {
197178 it.abi.also {
198179 it.isEnable = true
@@ -224,17 +205,9 @@ class IntegrationTest {
224205 @Test
225206 fun `ensure tasks are created for abi splits with filter all` () {
226207 val simpleProject = File (javaClass.getResource(" simple" ).file)
227- val project = ProjectBuilder .builder().withProjectDir(simpleProject).build()
228- project.plugins.apply (" com.android.application" )
208+ val project = prepareSimpleProject()
229209 project.plugins.apply (" firebase.test.lab" )
230210 project.configure<AppExtension > {
231- compileSdkVersion(27 )
232- defaultConfig.also {
233- it.versionCode = 1
234- it.versionName = " 0.1"
235- it.setMinSdkVersion(27 )
236- it.setTargetSdkVersion(27 )
237- }
238211 splits.also {
239212 it.abi.also {
240213 it.isEnable = true
@@ -264,18 +237,9 @@ class IntegrationTest {
264237 @Test
265238 fun `ensure tasks are created when abi split is disabled` () {
266239 val simpleProject = File (javaClass.getResource(" simple" ).file)
267- val project = ProjectBuilder .builder().withProjectDir(simpleProject).build()
268- project.plugins.apply (" com.android.application" )
240+ val project = prepareSimpleProject()
269241 project.plugins.apply (" firebase.test.lab" )
270- project.configure<AppExtension > {
271- compileSdkVersion(27 )
272- defaultConfig.also {
273- it.versionCode = 1
274- it.versionName = " 0.1"
275- it.setMinSdkVersion(27 )
276- it.setTargetSdkVersion(27 )
277- }
278- }
242+
279243 project.configure<FirebaseTestLabPluginExtension > {
280244 googleProjectId = " test"
281245 keyFile = File (simpleProject, " key.json" )
0 commit comments