aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/build.gradle19
-rw-r--r--app/src/androidTest/kotlin/com/pitchedapps/frost/activities/ImageActivityTest.kt33
-rw-r--r--build.gradle6
3 files changed, 31 insertions, 27 deletions
diff --git a/app/build.gradle b/app/build.gradle
index f0055048..197fe10f 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -309,15 +309,6 @@ dependencies {
}
-// Validates code and generates apk
-task createGithubReleaseApk(type: GradleBuild) {
- tasks = ['spotlessCheck',
- 'lintRelease',
- 'testReleaseUnitTest',
- 'connectedAndroidTest',
- 'assembleRelease']
-}
-
def kotlinResolutions = ['kotlin-reflect',
'kotlin-stdlib',
'kotlin-stdlib-jdk7',
@@ -335,4 +326,14 @@ configurations.all {
}
}
+// Validates code and generates apk
+// TODO order tasks; though technically it doesn't matter
+task createGithubReleaseApk {
+ dependsOn 'spotlessCheck'
+ dependsOn 'lintRelease'
+ dependsOn 'testReleaseUnitTest'
+ dependsOn 'connectedAndroidTest'
+ dependsOn 'assembleRelease'
+}
+
apply plugin: 'com.bugsnag.android.gradle' \ No newline at end of file
diff --git a/app/src/androidTest/kotlin/com/pitchedapps/frost/activities/ImageActivityTest.kt b/app/src/androidTest/kotlin/com/pitchedapps/frost/activities/ImageActivityTest.kt
index 5f1735f5..b582baf6 100644
--- a/app/src/androidTest/kotlin/com/pitchedapps/frost/activities/ImageActivityTest.kt
+++ b/app/src/androidTest/kotlin/com/pitchedapps/frost/activities/ImageActivityTest.kt
@@ -19,6 +19,7 @@ package com.pitchedapps.frost.activities
import android.content.Intent
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.rule.ActivityTestRule
+import ca.allanwang.kau.utils.isVisible
import com.pitchedapps.frost.FrostTestRule
import com.pitchedapps.frost.helper.getResource
import com.pitchedapps.frost.utils.ARG_COOKIE
@@ -44,6 +45,7 @@ import org.junit.rules.RuleChain
import org.junit.rules.TestRule
import org.junit.rules.Timeout
import org.junit.runner.RunWith
+import kotlin.test.assertNotNull
@RunWith(AndroidJUnit4::class)
class ImageActivityTest {
@@ -110,11 +112,13 @@ class ImageActivityTest {
mockServer.takeRequest()
with(activity.activity) {
assertEquals(1, mockServer.requestCount, "One http request expected")
- assertEquals(
- FabStates.DOWNLOAD,
- fabAction,
- "Image should be successful, image should be downloaded"
- )
+// assertEquals(
+// FabStates.DOWNLOAD,
+// fabAction,
+// "Image should be successful, image should be downloaded"
+// )
+ assertFalse(binding.error.isVisible, "Error should not be shown")
+ val tempFile = assertNotNull(tempFile, "Temp file not created")
assertTrue(tempFile.exists(), "Image should be located at temp file")
assertTrue(
System.currentTimeMillis() - tempFile.lastModified() < 2000L,
@@ -131,13 +135,15 @@ class ImageActivityTest {
mockServer.takeRequest()
with(activity.activity) {
assertEquals(1, mockServer.requestCount, "One http request expected")
- assertEquals(
- FabStates.ERROR,
- fabAction,
- "Text should not be a valid image format, error state expected"
- )
+ assertTrue(binding.error.isVisible, "Error should be shown")
+
+// assertEquals(
+// FabStates.ERROR,
+// fabAction,
+// "Text should not be a valid image format, error state expected"
+// )
assertEquals("Image format not supported", errorRef?.message, "Error message mismatch")
- assertFalse(tempFile.exists(), "Temp file should have been removed")
+ assertFalse(tempFile?.exists() == true, "Temp file should have been removed")
}
}
@@ -147,13 +153,14 @@ class ImageActivityTest {
mockServer.takeRequest()
with(activity.activity) {
assertEquals(1, mockServer.requestCount, "One http request expected")
- assertEquals(FabStates.ERROR, fabAction, "Error response code, error state expected")
+ assertTrue(binding.error.isVisible, "Error should be shown")
+// assertEquals(FabStates.ERROR, fabAction, "Error response code, error state expected")
assertEquals(
"Unsuccessful response for image: Error mock response",
errorRef?.message,
"Error message mismatch"
)
- assertFalse(tempFile.exists(), "Temp file should have been removed")
+ assertFalse(tempFile?.exists() == true, "Temp file should have been removed")
}
}
}
diff --git a/build.gradle b/build.gradle
index 2faeee34..8811522b 100644
--- a/build.gradle
+++ b/build.gradle
@@ -34,8 +34,4 @@ task generateChangelogMd() {
writer.write("\n* ${it}")
}
}
-}
-
-task fullRelease(type: GradleBuild) {
- tasks = ['clean', 'lintRelease', 'test', 'assembleRelease']
-}
+} \ No newline at end of file