Skip to content

Commit f55ccbe

Browse files
wip
Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
1 parent 22ea632 commit f55ccbe

3 files changed

Lines changed: 29 additions & 12 deletions

File tree

app/src/androidTest/java/com/owncloud/android/ui/fragment/FileDetailFragmentStaticServerIT.kt

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,10 @@ class FileDetailFragmentStaticServerIT : AbstractIT() {
7979
var activity: TestActivity? = null
8080
scenario.onActivity { sut ->
8181
activity = sut
82-
val fragment = ImageDetailFragment.newInstance(oCFile, user).apply {
83-
hideMap()
84-
}
82+
val fragment = ImageDetailFragment.newInstance(oCFile, user)
8583
sut.addFragment(fragment)
8684
sut.supportFragmentManager.executePendingTransactions()
85+
fragment.hideMap()
8786
}
8887

8988
val screenShotName = createName(testClassName + "_" + "showFileDetailDetailsFragment", "")
@@ -155,7 +154,11 @@ class FileDetailFragmentStaticServerIT : AbstractIT() {
155154
val fragment = FileDetailFragment.newInstance(oCFile, user, 0)
156155
sut.addFragment(fragment)
157156
sut.supportFragmentManager.executePendingTransactions()
158-
fragment.fileDetailActivitiesFragment.populateList(activities as List<Any>?, true)
157+
}
158+
159+
scenario.onActivity { sut ->
160+
(sut.fragment as FileDetailFragment)
161+
.fileDetailActivitiesFragment.populateList(activities as List<Any>?, true)
159162
}
160163

161164
val screenShotName = createName(testClassName + "_" + "showDetailsActivities", "")
@@ -171,10 +174,14 @@ class FileDetailFragmentStaticServerIT : AbstractIT() {
171174
var activity: TestActivity? = null
172175
scenario.onActivity { sut ->
173176
activity = sut
174-
val fragment = FileDetailFragment.newInstance(oCFile, user, 0)
177+
val fragment = FileDetailFragment.newInstance(oCFile, user, 1)
175178
sut.addFragment(fragment)
176179
activity.supportFragmentManager.executePendingTransactions()
177-
fragment.fileDetailActivitiesFragment.populateList(emptyList(), true)
180+
}
181+
182+
scenario.onActivity { sut ->
183+
(sut.fragment as FileDetailFragment)
184+
.fileDetailActivitiesFragment.populateList(emptyList(), true)
178185
}
179186

180187
val screenShotName = createName(testClassName + "_" + "showDetailsActivitiesNone", "")
@@ -193,6 +200,10 @@ class FileDetailFragmentStaticServerIT : AbstractIT() {
193200
val fragment = FileDetailFragment.newInstance(oCFile, user, 0)
194201
sut.addFragment(fragment)
195202
sut.supportFragmentManager.executePendingTransactions()
203+
}
204+
205+
scenario.onActivity { sut ->
206+
val fragment = sut.fragment as FileDetailFragment
196207
fragment.fileDetailActivitiesFragment.disableLoadingActivities()
197208
fragment.fileDetailActivitiesFragment.setErrorContent(
198209
targetContext.resources.getString(R.string.file_detail_activity_error)

app/src/androidTest/java/com/owncloud/android/ui/fragment/FileDetailSharingFragmentIT.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,15 +83,15 @@ class FileDetailSharingFragmentIT : AbstractIT() {
8383
@Test
8484
@ScreenshotTest
8585
fun listSharesFileNone() {
86-
show(file)
86+
show(file, "listSharesFileNone")
8787
}
8888

8989
@Test
9090
@ScreenshotTest
9191
fun listSharesFileResharingNotAllowed() {
9292
file.permissions = ""
9393

94-
show(file)
94+
show(file, "listSharesFileResharingNotAllowed")
9595
}
9696

9797
@Test
@@ -139,7 +139,7 @@ class FileDetailSharingFragmentIT : AbstractIT() {
139139
}
140140
}
141141

142-
show(file)
142+
show(file, "listSharesDownloadLimit")
143143
}
144144
}
145145

@@ -256,11 +256,11 @@ class FileDetailSharingFragmentIT : AbstractIT() {
256256
}
257257
}
258258

259-
show(file)
259+
show(file, "listSharesFileAllShareTypes")
260260
}
261261
}
262262

263-
private fun show(file: OCFile) {
263+
private fun show(file: OCFile, testName: String) {
264264
launchActivity<TestActivity>().use { scenario ->
265265
var activity: TestActivity? = null
266266
scenario.onActivity { sut ->
@@ -269,7 +269,7 @@ class FileDetailSharingFragmentIT : AbstractIT() {
269269
sut.addFragment(fragment)
270270
}
271271

272-
val screenShotName = createName(testClassName + "_" + "show", "")
272+
val screenShotName = createName(testClassName + "_" + testName, "")
273273
onView(isRoot()).check(matches(isDisplayed()))
274274
screenshotViaName(activity, screenShotName)
275275
}

app/src/androidTest/java/com/owncloud/android/ui/fragment/OCFileListFragmentStaticServerIT.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ import com.owncloud.android.utils.MimeType
3636
import com.owncloud.android.utils.ScreenshotTest
3737
import org.hamcrest.Matchers.allOf
3838
import org.hamcrest.Matchers.not
39+
import org.junit.After
3940
import org.junit.Assert
4041
import org.junit.Before
4142
import org.junit.Rule
@@ -53,6 +54,11 @@ class OCFileListFragmentStaticServerIT : AbstractIT() {
5354
Intents.init()
5455
}
5556

57+
@After
58+
fun releaseIntentRecording() {
59+
Intents.release()
60+
}
61+
5662
@Test
5763
@ScreenshotTest
5864
@Suppress("MagicNumber")

0 commit comments

Comments
 (0)