diff --git a/sentinel/src/androidTest/AndroidManifest.xml b/sentinel/src/androidTest/AndroidManifest.xml index 9c93c8ed..2af11a87 100644 --- a/sentinel/src/androidTest/AndroidManifest.xml +++ b/sentinel/src/androidTest/AndroidManifest.xml @@ -6,12 +6,12 @@ + android:theme="@style/Sentinel.Theme"/> diff --git a/sentinel/src/androidTest/kotlin/com/infinum/sentinel/SentinelTests.kt b/sentinel/src/androidTest/kotlin/com/infinum/sentinel/SentinelTests.kt index b78e8819..4b216d9d 100644 --- a/sentinel/src/androidTest/kotlin/com/infinum/sentinel/SentinelTests.kt +++ b/sentinel/src/androidTest/kotlin/com/infinum/sentinel/SentinelTests.kt @@ -79,17 +79,16 @@ internal class SentinelTests { fun sentinel_show() { Sentinel.show() - intended(hasComponent(ComponentName(context, SentinelActivity::class.java)), times(2)) + intended(hasComponent(ComponentName(context, SentinelActivity::class.java)), times(1)) } -// @Test -// @SmallTest -// @RequiresDevice -// fun sentinel_showDevice() { -// val instance = Sentinel.watch(context) -// -// instance.show() -// -// intended(hasComponent(ComponentName(context, SentinelActivity::class.java)), times(1)) -// } + @Test + @SmallTest + fun sentinel_showDevice() { + val instance = Sentinel.watch() + + instance.show() + + intended(hasComponent(ComponentName(context, SentinelActivity::class.java)), times(1)) + } } diff --git a/sentinel/src/androidTest/kotlin/com/infinum/sentinel/data/sources/raw/collectors/ApplicationCollectorTests.kt b/sentinel/src/androidTest/kotlin/com/infinum/sentinel/data/sources/raw/collectors/ApplicationCollectorTests.kt index abe7455d..8fb255a9 100644 --- a/sentinel/src/androidTest/kotlin/com/infinum/sentinel/data/sources/raw/collectors/ApplicationCollectorTests.kt +++ b/sentinel/src/androidTest/kotlin/com/infinum/sentinel/data/sources/raw/collectors/ApplicationCollectorTests.kt @@ -12,11 +12,9 @@ import org.junit.Assert.assertEquals import org.junit.Assert.assertNotNull import org.junit.Assert.assertTrue import org.junit.BeforeClass -import org.junit.Ignore import org.junit.Test import org.junit.runner.RunWith -@Ignore("This test is ignored because it's failing on CI") @RunWith(AndroidJUnit4::class) internal class ApplicationCollectorTests { diff --git a/sentinel/src/androidTest/kotlin/com/infinum/sentinel/data/sources/raw/collectors/DeviceCollectorDeviceTests.kt b/sentinel/src/androidTest/kotlin/com/infinum/sentinel/data/sources/raw/collectors/DeviceCollectorDeviceTests.kt index c6627115..80920b87 100644 --- a/sentinel/src/androidTest/kotlin/com/infinum/sentinel/data/sources/raw/collectors/DeviceCollectorDeviceTests.kt +++ b/sentinel/src/androidTest/kotlin/com/infinum/sentinel/data/sources/raw/collectors/DeviceCollectorDeviceTests.kt @@ -10,12 +10,10 @@ import com.infinum.sentinel.ui.SentinelTestApplication import org.junit.Assert.assertEquals import org.junit.Assert.assertFalse import org.junit.BeforeClass -import org.junit.Ignore import org.junit.Test import org.junit.runner.RunWith import org.robolectric.util.ReflectionHelpers -@Ignore("This test is ignored because it's failing on CI") @RunWith(AndroidJUnit4::class) internal class DeviceCollectorDeviceTests { diff --git a/sentinel/src/androidTest/kotlin/com/infinum/sentinel/data/sources/raw/collectors/DeviceCollectorEmulatorTests.kt b/sentinel/src/androidTest/kotlin/com/infinum/sentinel/data/sources/raw/collectors/DeviceCollectorEmulatorTests.kt index 8535f54a..e7998f9a 100644 --- a/sentinel/src/androidTest/kotlin/com/infinum/sentinel/data/sources/raw/collectors/DeviceCollectorEmulatorTests.kt +++ b/sentinel/src/androidTest/kotlin/com/infinum/sentinel/data/sources/raw/collectors/DeviceCollectorEmulatorTests.kt @@ -10,12 +10,10 @@ import com.infinum.sentinel.ui.SentinelTestApplication import org.junit.Assert.assertEquals import org.junit.Assert.assertTrue import org.junit.BeforeClass -import org.junit.Ignore import org.junit.Test import org.junit.runner.RunWith import org.robolectric.util.ReflectionHelpers -@Ignore("This test is ignored because it's failing on CI") @RunWith(AndroidJUnit4::class) internal class DeviceCollectorEmulatorTests { diff --git a/sentinel/src/androidTest/kotlin/com/infinum/sentinel/data/sources/raw/collectors/PermissionsCollectorTests.kt b/sentinel/src/androidTest/kotlin/com/infinum/sentinel/data/sources/raw/collectors/PermissionsCollectorTests.kt index 1004c678..6220efce 100644 --- a/sentinel/src/androidTest/kotlin/com/infinum/sentinel/data/sources/raw/collectors/PermissionsCollectorTests.kt +++ b/sentinel/src/androidTest/kotlin/com/infinum/sentinel/data/sources/raw/collectors/PermissionsCollectorTests.kt @@ -8,17 +8,23 @@ import com.infinum.sentinel.ui.SentinelTestApplication import org.junit.Assert.assertEquals import org.junit.Assert.assertTrue import org.junit.BeforeClass -import org.junit.Ignore import org.junit.Test import org.junit.runner.RunWith -@Ignore("This test is ignored because it's failing on CI") @RunWith(AndroidJUnit4::class) internal class PermissionsCollectorTests { companion object { - private val APPENDED_PERMISSIONS = mapOf(Manifest.permission.REORDER_TASKS to true) + private val APPENDED_PERMISSIONS = mapOf( + Manifest.permission.REORDER_TASKS to true, + Manifest.permission.POST_NOTIFICATIONS to false, + Manifest.permission.WAKE_LOCK to true, + Manifest.permission.ACCESS_NETWORK_STATE to true, + Manifest.permission.RECEIVE_BOOT_COMPLETED to true, + Manifest.permission.FOREGROUND_SERVICE to true, + "com.infinum.sentinel.test.DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION" to true + ) lateinit var actualPermissions: Map @@ -40,13 +46,15 @@ internal class PermissionsCollectorTests { fun permissions_notDeclared() { assertTrue(actualPermissions.isNotEmpty()) assertEquals(APPENDED_PERMISSIONS.size, actualPermissions.size) - assertEquals( - APPENDED_PERMISSIONS.containsKey(Manifest.permission.REORDER_TASKS), - actualPermissions.containsKey(Manifest.permission.REORDER_TASKS) - ) - assertEquals( - APPENDED_PERMISSIONS[Manifest.permission.REORDER_TASKS], - actualPermissions[Manifest.permission.REORDER_TASKS] - ) + APPENDED_PERMISSIONS.forEach { (permission, expectedStatus) -> + assertEquals( + APPENDED_PERMISSIONS.containsKey(permission), + actualPermissions.containsKey(permission) + ) + assertEquals( + expectedStatus, + actualPermissions[permission] + ) + } } } diff --git a/sentinel/src/androidTest/kotlin/com/infinum/sentinel/data/sources/raw/collectors/PreferencesCollectorTests.kt b/sentinel/src/androidTest/kotlin/com/infinum/sentinel/data/sources/raw/collectors/PreferencesCollectorTests.kt index 70d452da..3e5b793c 100644 --- a/sentinel/src/androidTest/kotlin/com/infinum/sentinel/data/sources/raw/collectors/PreferencesCollectorTests.kt +++ b/sentinel/src/androidTest/kotlin/com/infinum/sentinel/data/sources/raw/collectors/PreferencesCollectorTests.kt @@ -15,12 +15,10 @@ import org.junit.Assert.assertNotNull import org.junit.Assert.assertTrue import org.junit.Before import org.junit.BeforeClass -import org.junit.Ignore import org.junit.Test import org.junit.runner.RunWith import org.robolectric.annotation.Config -@Ignore("This test is ignored because it's failing on CI") @RunWith(AndroidJUnit4::class) internal class PreferencesCollectorTests { diff --git a/sentinel/src/androidTest/kotlin/com/infinum/sentinel/data/sources/raw/collectors/ToolsCollectorTests.kt b/sentinel/src/androidTest/kotlin/com/infinum/sentinel/data/sources/raw/collectors/ToolsCollectorTests.kt index 5d116bc2..bf4d13d7 100644 --- a/sentinel/src/androidTest/kotlin/com/infinum/sentinel/data/sources/raw/collectors/ToolsCollectorTests.kt +++ b/sentinel/src/androidTest/kotlin/com/infinum/sentinel/data/sources/raw/collectors/ToolsCollectorTests.kt @@ -2,17 +2,15 @@ package com.infinum.sentinel.data.sources.raw.collectors import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest -import com.infinum.sentinel.ui.tools.AppInfoTool +import com.infinum.sentinel.Sentinel import com.infinum.sentinel.ui.tools.DummyTool import com.infinum.sentinel.ui.tools.NoNameTool import org.junit.Assert.assertEquals import org.junit.Assert.assertTrue import org.junit.BeforeClass -import org.junit.Ignore import org.junit.Test import org.junit.runner.RunWith -@Ignore("This test is ignored because it's failing on CI") @RunWith(AndroidJUnit4::class) internal class ToolsCollectorTests { @@ -33,12 +31,12 @@ internal class ToolsCollectorTests { @SmallTest fun tools_AreEmpty() { val collector = ToolsCollector(setOf()) - val expectedTools = setOf(AppInfoTool()) + val expectedTools = setOf() val actualTools = collector() assertEquals(expectedTools.size, actualTools.size) - assertTrue(actualTools.isNotEmpty()) + assertTrue(actualTools.isEmpty()) assertEquals(expectedTools, actualTools) } @@ -46,7 +44,7 @@ internal class ToolsCollectorTests { @SmallTest fun tools_AreUnique() { val collector = ToolsCollector(setOf(dummyTool, dummyTool)) - val expectedTools = setOf(dummyTool, AppInfoTool()) + val expectedTools = setOf(dummyTool) val actualTools = collector() @@ -59,7 +57,7 @@ internal class ToolsCollectorTests { @SmallTest fun tools_AreValid() { val collector = ToolsCollector(setOf(dummyTool, noNameTool)) - val expectedTools = setOf(dummyTool, AppInfoTool()) + val expectedTools = setOf(dummyTool) val actualTools = collector() diff --git a/sentinel/src/androidTest/kotlin/com/infinum/sentinel/data/sources/raw/formatters/HtmlStringBuilderTests.kt b/sentinel/src/androidTest/kotlin/com/infinum/sentinel/data/sources/raw/formatters/HtmlStringBuilderTests.kt index e0c3e7d9..00a3a0b2 100644 --- a/sentinel/src/androidTest/kotlin/com/infinum/sentinel/data/sources/raw/formatters/HtmlStringBuilderTests.kt +++ b/sentinel/src/androidTest/kotlin/com/infinum/sentinel/data/sources/raw/formatters/HtmlStringBuilderTests.kt @@ -18,12 +18,10 @@ import org.junit.Assert.assertNotNull import org.junit.Assert.assertTrue import org.junit.Before import org.junit.BeforeClass -import org.junit.Ignore import org.junit.Test import org.junit.runner.RunWith import org.robolectric.util.ReflectionHelpers -@Ignore("This test is ignored because it's failing on CI") @RunWith(AndroidJUnit4::class) internal class HtmlStringBuilderTests { @@ -123,6 +121,33 @@ internal class HtmlStringBuilderTests { ?.use { it.readText() } .orEmpty() + private fun checkDeviceSpecificFields(html: String): String { + val fields = listOf( + "screen_width", + "screen_height", + "screen_size", + "screen_density", + "font_scale" + ) + + val fieldPatterns = fields.map { field -> + field to Regex("""
$field:\s*[^<]*
""") + } + + var updatedHtml = html + + fieldPatterns.forEach { (field, pattern) -> + val matchResult = pattern.find(updatedHtml) + if (matchResult == null) { + throw AssertionError("Field $field is missing in the device object") + } else { + updatedHtml = updatedHtml.replace(matchResult.value, """
$field:
""") + } + } + + return updatedHtml + } + @Before fun preferences_deleteDir() { val prefsDirectory = @@ -144,7 +169,8 @@ internal class HtmlStringBuilderTests { assertNotNull(actualData) assertTrue(actualData.isNotBlank()) - assertEquals(EXPECTED_DATA_NO_PREFERENCES, actualData) + val cleanedUpData = checkDeviceSpecificFields(actualData) + assertEquals(EXPECTED_DATA_NO_PREFERENCES, cleanedUpData) } @Test @@ -167,6 +193,7 @@ internal class HtmlStringBuilderTests { assertNotNull(actualData) assertTrue(actualData.isNotBlank()) - assertEquals(EXPECTED_DATA, actualData) + val cleanedUpData = checkDeviceSpecificFields(actualData) + assertEquals(EXPECTED_DATA, cleanedUpData) } } diff --git a/sentinel/src/androidTest/kotlin/com/infinum/sentinel/data/sources/raw/formatters/JsonStringBuilderTests.kt b/sentinel/src/androidTest/kotlin/com/infinum/sentinel/data/sources/raw/formatters/JsonStringBuilderTests.kt index 4b848599..108a962e 100644 --- a/sentinel/src/androidTest/kotlin/com/infinum/sentinel/data/sources/raw/formatters/JsonStringBuilderTests.kt +++ b/sentinel/src/androidTest/kotlin/com/infinum/sentinel/data/sources/raw/formatters/JsonStringBuilderTests.kt @@ -13,17 +13,16 @@ import com.infinum.sentinel.data.sources.raw.collectors.PreferencesCollector import com.infinum.sentinel.domain.collectors.Collectors import com.infinum.sentinel.ui.SentinelTestApplication import java.io.File +import org.json.JSONObject import org.junit.Assert.assertEquals import org.junit.Assert.assertNotNull import org.junit.Assert.assertTrue import org.junit.Before import org.junit.BeforeClass -import org.junit.Ignore import org.junit.Test import org.junit.runner.RunWith import org.robolectric.util.ReflectionHelpers -@Ignore("This test is ignored because it's failing on CI") @RunWith(AndroidJUnit4::class) internal class JsonStringBuilderTests { @@ -136,6 +135,27 @@ internal class JsonStringBuilderTests { assertTrue(success) } + private fun checkDeviceSpecificFields(json: JSONObject): JSONObject { + val device = json.optJSONObject("device") ?: throw AssertionError("Device object is missing") + + val fields = listOf( + "screen_width", + "screen_height", + "screen_size", + "screen_density", + "font_scale" + ) + + fields.forEach { field -> + if (!device.has(field)) { + throw AssertionError("Field $field is missing in the device object") + } + device.put(field, "") + } + + return json + } + @Test @SmallTest fun formatter_hasDataWithoutPreferences() { @@ -147,7 +167,8 @@ internal class JsonStringBuilderTests { assertNotNull(actualData) assertTrue(actualData.isNotBlank()) - assertEquals(EXPECTED_DATA_NO_PREFERENCES, actualData) + val cleanedUpData = checkDeviceSpecificFields(JSONObject(actualData)) + assertEquals(EXPECTED_DATA_NO_PREFERENCES, cleanedUpData.toString()) } @Test @@ -171,6 +192,8 @@ internal class JsonStringBuilderTests { assertNotNull(actualData) assertTrue(actualData.isNotBlank()) - assertEquals(EXPECTED_DATA, actualData) + assertTrue(actualData.isNotBlank()) + val cleanedUpData = checkDeviceSpecificFields(JSONObject(actualData)) + assertEquals(EXPECTED_DATA, cleanedUpData.toString()) } } diff --git a/sentinel/src/androidTest/kotlin/com/infinum/sentinel/data/sources/raw/formatters/MarkdownStringBuilderTests.kt b/sentinel/src/androidTest/kotlin/com/infinum/sentinel/data/sources/raw/formatters/MarkdownStringBuilderTests.kt index edcf1b2c..2bcc2959 100644 --- a/sentinel/src/androidTest/kotlin/com/infinum/sentinel/data/sources/raw/formatters/MarkdownStringBuilderTests.kt +++ b/sentinel/src/androidTest/kotlin/com/infinum/sentinel/data/sources/raw/formatters/MarkdownStringBuilderTests.kt @@ -18,12 +18,10 @@ import org.junit.Assert.assertNotNull import org.junit.Assert.assertTrue import org.junit.Before import org.junit.BeforeClass -import org.junit.Ignore import org.junit.Test import org.junit.runner.RunWith import org.robolectric.util.ReflectionHelpers -@Ignore("This test is ignored because it's failing on CI") @RunWith(AndroidJUnit4::class) internal class MarkdownStringBuilderTests { @@ -123,6 +121,33 @@ internal class MarkdownStringBuilderTests { ?.use { it.readText() } .orEmpty() + private fun checkDeviceSpecificFields(markdown: String): String { + val fields = listOf( + "_screen_width_", + "_screen_height_", + "_screen_size_", + "_screen_density_", + "_font_scale_" + ) + + val fieldPatterns = fields.map { field -> + field to Regex("""$field:\s*.*""") + } + + var updatedMarkdown = markdown + + fieldPatterns.forEach { (field, pattern) -> + val matchResult = pattern.find(updatedMarkdown) + if (matchResult == null) { + throw AssertionError("Field $field is missing in the device object") + } else { + updatedMarkdown = updatedMarkdown.replace(matchResult.value, """$field: """) + } + } + + return updatedMarkdown + } + @Before fun preferences_deleteDir() { val prefsDirectory = @@ -144,7 +169,8 @@ internal class MarkdownStringBuilderTests { assertNotNull(actualData) assertTrue(actualData.isNotBlank()) - assertEquals(EXPECTED_DATA_NO_PREFERENCES, actualData) + val cleanedUpData = checkDeviceSpecificFields(actualData) + assertEquals(EXPECTED_DATA_NO_PREFERENCES, cleanedUpData) } @Test @@ -167,6 +193,7 @@ internal class MarkdownStringBuilderTests { assertNotNull(actualData) assertTrue(actualData.isNotBlank()) - assertEquals(EXPECTED_DATA, actualData) + val cleanedUpData = checkDeviceSpecificFields(actualData) + assertEquals(EXPECTED_DATA, cleanedUpData) } } diff --git a/sentinel/src/androidTest/kotlin/com/infinum/sentinel/data/sources/raw/formatters/PlainStringBuilderTests.kt b/sentinel/src/androidTest/kotlin/com/infinum/sentinel/data/sources/raw/formatters/PlainStringBuilderTests.kt index 4a9d9c00..a755a4fd 100644 --- a/sentinel/src/androidTest/kotlin/com/infinum/sentinel/data/sources/raw/formatters/PlainStringBuilderTests.kt +++ b/sentinel/src/androidTest/kotlin/com/infinum/sentinel/data/sources/raw/formatters/PlainStringBuilderTests.kt @@ -19,12 +19,10 @@ import org.junit.Assert.assertNotNull import org.junit.Assert.assertTrue import org.junit.Before import org.junit.BeforeClass -import org.junit.Ignore import org.junit.Test import org.junit.runner.RunWith import org.robolectric.util.ReflectionHelpers -@Ignore("This test is ignored because it's failing on CI") @RunWith(AndroidJUnit4::class) internal class PlainStringBuilderTests { @@ -124,6 +122,33 @@ internal class PlainStringBuilderTests { ?.use { it.readText() } .orEmpty() + private fun checkDeviceSpecificFields(text: String): String { + val fields = listOf( + "screen_width", + "screen_height", + "screen_size", + "screen_density", + "font_scale" + ) + + val fieldPatterns = fields.map { field -> + field to Regex("""$field:\s*.*""") + } + + var updatedText = text + + fieldPatterns.forEach { (field, pattern) -> + val matchResult = pattern.find(updatedText) + if (matchResult == null) { + throw AssertionError("Field $field is missing in the device object") + } else { + updatedText = updatedText.replace(matchResult.value, """$field:""") + } + } + + return updatedText + } + @Before fun preferences_deleteDir_Before() { val prefsDirectory = @@ -153,9 +178,11 @@ internal class PlainStringBuilderTests { val actualData = stringBuilder() .replace(Regex("\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}"), "yyyy-MM-dd HH:mm:ss") + .replace(Regex("(installer:)\\s"), "$1") assertNotNull(actualData) assertTrue(actualData.isNotBlank()) - assertEquals(EXPECTED_DATA_NO_PREFERENCES, actualData) + val cleanedUpData = checkDeviceSpecificFields(actualData) + assertEquals(EXPECTED_DATA_NO_PREFERENCES, cleanedUpData) } @Test @@ -175,9 +202,11 @@ internal class PlainStringBuilderTests { val actualData = stringBuilder() .replace(Regex("\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}"), "yyyy-MM-dd HH:mm:ss") + .replace(Regex("(installer:)\\s"), "$1") assertNotNull(actualData) assertTrue(actualData.isNotBlank()) - assertEquals(EXPECTED_DATA, actualData) + val cleanedUpData = checkDeviceSpecificFields(actualData) + assertEquals(EXPECTED_DATA, cleanedUpData) } } diff --git a/sentinel/src/androidTest/kotlin/com/infinum/sentinel/data/sources/raw/formatters/XmlStringBuilderTests.kt b/sentinel/src/androidTest/kotlin/com/infinum/sentinel/data/sources/raw/formatters/XmlStringBuilderTests.kt index 8256d112..32512eea 100644 --- a/sentinel/src/androidTest/kotlin/com/infinum/sentinel/data/sources/raw/formatters/XmlStringBuilderTests.kt +++ b/sentinel/src/androidTest/kotlin/com/infinum/sentinel/data/sources/raw/formatters/XmlStringBuilderTests.kt @@ -18,12 +18,10 @@ import org.junit.Assert.assertNotNull import org.junit.Assert.assertTrue import org.junit.Before import org.junit.BeforeClass -import org.junit.Ignore import org.junit.Test import org.junit.runner.RunWith import org.robolectric.util.ReflectionHelpers -@Ignore("This test is ignored because it's failing on CI") @RunWith(AndroidJUnit4::class) internal class XmlStringBuilderTests { @@ -125,6 +123,33 @@ internal class XmlStringBuilderTests { .orEmpty() .replace(Regex("\\s"), "") + private fun checkDeviceSpecificFields(text: String): String { + val fields = listOf( + "screen_width", + "screen_height", + "screen_size", + "screen_density", + "font_scale" + ) + + val fieldPatterns = fields.map { field -> + field to Regex(""".*?""") + } + + var updatedText = text + + fieldPatterns.forEach { (field, pattern) -> + val matchResult = pattern.find(updatedText) + if (matchResult == null) { + throw AssertionError("Field <$field> is missing in the device object") + } else { + updatedText = updatedText.replace(matchResult.value, "") + } + } + + return updatedText + } + @Before fun preferences_deleteDir() { val prefsDirectory = @@ -147,7 +172,8 @@ internal class XmlStringBuilderTests { assertNotNull(actualData) assertTrue(actualData.isNotBlank()) - assertEquals(EXPECTED_DATA_NO_PREFERENCES, actualData) + val cleanedUpData = checkDeviceSpecificFields(actualData) + assertEquals(EXPECTED_DATA_NO_PREFERENCES, cleanedUpData) } @Test @@ -171,6 +197,7 @@ internal class XmlStringBuilderTests { assertNotNull(actualData) assertTrue(actualData.isNotBlank()) - assertEquals(EXPECTED_DATA, actualData) + val cleanedUpData = checkDeviceSpecificFields(actualData) + assertEquals(EXPECTED_DATA, cleanedUpData) } } diff --git a/sentinel/src/androidTest/kotlin/com/infinum/sentinel/ui/SentinelFragmentTests.kt b/sentinel/src/androidTest/kotlin/com/infinum/sentinel/ui/SentinelFragmentTests.kt index 802aa991..c50efb2f 100644 --- a/sentinel/src/androidTest/kotlin/com/infinum/sentinel/ui/SentinelFragmentTests.kt +++ b/sentinel/src/androidTest/kotlin/com/infinum/sentinel/ui/SentinelFragmentTests.kt @@ -3,9 +3,10 @@ package com.infinum.sentinel.ui import android.content.Context import android.content.Intent import android.view.View -import androidx.appcompat.widget.ActionMenuView +import androidx.appcompat.widget.AppCompatImageButton import androidx.arch.core.executor.testing.InstantTaskExecutorRule import androidx.fragment.app.testing.launchFragmentInContainer +import androidx.test.core.app.ActivityScenario import androidx.test.core.app.ApplicationProvider import androidx.test.espresso.Espresso.onView import androidx.test.espresso.UiController @@ -14,33 +15,33 @@ import androidx.test.espresso.action.ViewActions.click import androidx.test.espresso.assertion.ViewAssertions.matches import androidx.test.espresso.intent.Intents import androidx.test.espresso.intent.matcher.IntentMatchers.hasAction +import androidx.test.espresso.intent.matcher.IntentMatchers.hasComponent import androidx.test.espresso.matcher.ViewMatchers +import androidx.test.espresso.matcher.ViewMatchers.isAssignableFrom +import androidx.test.espresso.matcher.ViewMatchers.isDescendantOfA import androidx.test.espresso.matcher.ViewMatchers.isDisplayed +import androidx.test.espresso.matcher.ViewMatchers.withContentDescription import androidx.test.espresso.matcher.ViewMatchers.withId import androidx.test.espresso.matcher.ViewMatchers.withParent import androidx.test.espresso.matcher.ViewMatchers.withText import androidx.test.ext.junit.runners.AndroidJUnit4 -import com.google.android.material.appbar.MaterialToolbar import com.infinum.sentinel.R import com.infinum.sentinel.ui.main.SentinelFragment import com.infinum.sentinel.ui.main.application.ApplicationFragment +import com.infinum.sentinel.ui.main.device.DeviceFragment import com.infinum.sentinel.ui.main.permissions.PermissionsFragment import com.infinum.sentinel.ui.main.preferences.PreferencesFragment import com.infinum.sentinel.ui.main.tools.ToolsFragment -import kotlinx.coroutines.MainScope -import kotlinx.coroutines.launch +import com.infinum.sentinel.ui.settings.SettingsActivity +import com.infinum.sentinel.ui.settings.SettingsFragment import org.hamcrest.Matcher import org.hamcrest.Matchers.allOf -import org.hamcrest.Matchers.instanceOf import org.junit.Assert.assertNotNull -import org.junit.Before import org.junit.BeforeClass -import org.junit.Ignore import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith -@Ignore("This test is ignored because it's failing on CI") @RunWith(AndroidJUnit4::class) public class SentinelFragmentTests { @@ -58,17 +59,10 @@ public class SentinelFragmentTests { @get:Rule public val instantTaskExecutorRule: InstantTaskExecutorRule = InstantTaskExecutorRule() - @Before - public fun setupGraph() { - MainScope().launch { - } - } - @Test public fun sentinelFragment_show() { - val scenario = launchFragmentInContainer( - themeResId = R.style.Sentinel_Theme_Dialog - ) + val scenario = launchFragmentInContainer(themeResId = R.style.Sentinel_Theme_Dialog) + scenario.onFragment { val childFragment = it.childFragmentManager.findFragmentByTag(ToolsFragment.TAG) assertNotNull(childFragment) @@ -82,108 +76,81 @@ public class SentinelFragmentTests { onView(withId(R.id.share)).check(matches(isDisplayed())) } - // TODO: Fix this flaky test - // @Test - // fun sentinelFragment_showChild_Settings() { - // val scenario = - // launchFragmentInContainer(themeResId = R.style.Sentinel_Theme_BottomSheet) - // - // onView(withId(R.id.sentinelTitle)).check(matches(withText(R.string.sentinel_name))) - // onView(withId(R.id.applicationIconView)).check(matches(isDisplayed())) - // onView(withId(R.id.fab)).check(matches(isDisplayed())) - // onView(withId(R.id.bottomAppBar)).check(matches(isDisplayed())) - // onView(withId(R.id.fragmentContainer)).check(matches(isDisplayed())) - // onView(withId(R.id.toolbar)).check(matches(isDisplayed())) - // - // onView(withId(R.id.settings)).check(matches(isDisplayed())) - // - // onView( - // allOf( - // withId(R.id.settings), - // withParent(instanceOf(ActionMenuView::class.java)) - // ) - // ).perform(click()) - // - // onView(withId(R.id.toolbar)).check(matches(isDisplayed())) - // onView(withText(R.string.sentinel_settings)).check(matches(withParent(withId(R.id.toolbar)))) - // - // scenario.onFragment { - // val childFragment = it.childFragmentManager.findFragmentByTag(SettingsFragment.TAG) - // - // assertNotNull(childFragment) - // } - // } - - // @Test - // fun sentinelFragment_showChild_Device() { - // val scenario = - // launchFragmentInContainer(themeResId = R.style.Sentinel_Theme_BottomSheet) - // - // onView(withId(R.id.sentinelTitle)).check(matches(withText(R.string.sentinel_name))) - // onView(withId(R.id.applicationIconView)).check(matches(isDisplayed())) - // onView(withId(R.id.fab)).check(matches(isDisplayed())) - // onView(withId(R.id.bottomAppBar)).check(matches(isDisplayed())) - // onView(withId(R.id.fragmentContainer)).check(matches(isDisplayed())) - // onView(withId(R.id.toolbar)).check(matches(isDisplayed())) - // - // onView( - // allOf( - // withId(R.id.device), - // withParent(instanceOf(ActionMenuView::class.java)) - // ) - // ).perform(click()) - // - // onView(withId(R.id.toolbar)).check(matches(isDisplayed())) - // onView( - // allOf( - // withText(R.string.sentinel_device), - // withParent(instanceOf(MaterialToolbar::class.java)) - // ) - // ).check(matches(withParent(withId(R.id.toolbar)))) - // - // scenario.onFragment { - // val childFragment = it.childFragmentManager.findFragmentByTag(DeviceFragment.TAG) - // - // assertNotNull(childFragment) - // } - // } - @Test - public fun sentinelFragment_showChild_Application() { - val scenario = launchFragmentInContainer( - themeResId = R.style.Sentinel_Theme_Dialog - ) + public fun sentinelFragment_launches_SettingsActivity() { + launchFragmentInContainer(themeResId = R.style.Sentinel_Theme_Dialog) + + Intents.init() onView(withId(R.id.applicationIconView)).check(matches(isDisplayed())) onView(withId(R.id.fab)).check(matches(isDisplayed())) onView(withId(R.id.bottomNavigation)).check(matches(isDisplayed())) onView(withId(R.id.fragmentContainer)).check(matches(isDisplayed())) onView(withId(R.id.toolbar)).check(matches(isDisplayed())) + // find navigationIcon + onView( + allOf( + withContentDescription(R.string.sentinel_settings), + isAssignableFrom(AppCompatImageButton::class.java) + ) + ).check(matches(isDisplayed())) + // click navigationIcon onView( allOf( - withId(R.id.application), - withParent(instanceOf(ActionMenuView::class.java)) + withContentDescription(R.string.sentinel_settings), + isAssignableFrom(AppCompatImageButton::class.java) ) ).perform(click()) + Intents.intended(hasComponent(SettingsActivity::class.java.name)) + Intents.release() + } + + @Test + public fun settingsActivity_showSettingsFragment() { + val scenario = ActivityScenario.launch(SettingsActivity::class.java) + + scenario.onActivity { + val childFragment = it.supportFragmentManager.findFragmentByTag(SettingsFragment.TAG) + + assertNotNull(childFragment) + } + onView(withId(R.id.toolbar)).check(matches(isDisplayed())) + onView(withText(R.string.sentinel_settings)).check(matches(withParent(withId(R.id.toolbar)))) + onView(withId(R.id.triggersLayout)).check(matches(isDisplayed())) + onView(withId(R.id.formatGroup)).check(matches(isDisplayed())) + onView(withId(R.id.bundleMonitorLayout)).check(matches(isDisplayed())) + } + + @Test + public fun sentinelFragment_showChild_Device() { + val scenario = launchFragmentInContainer(themeResId = R.style.Sentinel_Theme_Dialog) + + onView(withId(R.id.applicationIconView)).check(matches(isDisplayed())) + onView(withId(R.id.fab)).check(matches(isDisplayed())) + onView(withId(R.id.bottomNavigation)).check(matches(isDisplayed())) + onView(withId(R.id.fragmentContainer)).check(matches(isDisplayed())) + onView(withId(R.id.toolbar)).check(matches(isDisplayed())) + onView( allOf( - withText(R.string.sentinel_application), - withParent(instanceOf(MaterialToolbar::class.java)) + withId(R.id.device), + isDescendantOfA(withId(R.id.bottomNavigation)) ) - ).check(matches(withParent(withId(R.id.toolbar)))) + ).perform(click()) scenario.onFragment { - val childFragment = it.childFragmentManager.findFragmentByTag(ApplicationFragment.TAG) + val childFragment = it.childFragmentManager.findFragmentByTag(DeviceFragment.TAG) assertNotNull(childFragment) } + onView(withId(R.id.toolbar)).check(matches(isDisplayed())) } @Test - public fun sentinelFragment_showChild_Permissions() { + public fun sentinelFragment_showChild_Application() { val scenario = launchFragmentInContainer( themeResId = R.style.Sentinel_Theme_Dialog ) @@ -193,27 +160,47 @@ public class SentinelFragmentTests { onView(withId(R.id.bottomNavigation)).check(matches(isDisplayed())) onView(withId(R.id.fragmentContainer)).check(matches(isDisplayed())) onView(withId(R.id.toolbar)).check(matches(isDisplayed())) + onView(withId(R.id.share)).check(matches(isDisplayed())) onView( allOf( - withId(R.id.permissions), - withParent(instanceOf(ActionMenuView::class.java)) + withId(R.id.application), + isDescendantOfA(withId(R.id.bottomNavigation)) ) ).perform(click()) + scenario.onFragment { + val childFragment = it.childFragmentManager.findFragmentByTag(ApplicationFragment.TAG) + + assertNotNull(childFragment) + } + } + + @Test + public fun sentinelFragment_showChild_Permissions() { + val scenario = launchFragmentInContainer( + themeResId = R.style.Sentinel_Theme_Dialog + ) + + onView(withId(R.id.applicationIconView)).check(matches(isDisplayed())) + onView(withId(R.id.fab)).check(matches(isDisplayed())) + onView(withId(R.id.bottomNavigation)).check(matches(isDisplayed())) + onView(withId(R.id.fragmentContainer)).check(matches(isDisplayed())) onView(withId(R.id.toolbar)).check(matches(isDisplayed())) + onView( allOf( - withText(R.string.sentinel_permissions), - withParent(instanceOf(MaterialToolbar::class.java)) + withId(R.id.permissions), + isDescendantOfA(withId(R.id.bottomNavigation)) ) - ).check(matches(withParent(withId(R.id.toolbar)))) + ).perform(click()) scenario.onFragment { val childFragment = it.childFragmentManager.findFragmentByTag(PermissionsFragment.TAG) assertNotNull(childFragment) } + onView(withId(R.id.toolbar)).check(matches(isDisplayed())) } @Test @@ -231,23 +218,16 @@ public class SentinelFragmentTests { onView( allOf( withId(R.id.preferences), - withParent(instanceOf(ActionMenuView::class.java)) + isDescendantOfA(withId(R.id.bottomNavigation)) ) ).perform(lenientClick()) - onView(withId(R.id.toolbar)).check(matches(isDisplayed())) - onView( - allOf( - withText(R.string.sentinel_preferences), - withParent(instanceOf(MaterialToolbar::class.java)) - ) - ).check(matches(withParent(withId(R.id.toolbar)))) - scenario.onFragment { val childFragment = it.childFragmentManager.findFragmentByTag(PreferencesFragment.TAG) assertNotNull(childFragment) } + onView(withId(R.id.toolbar)).check(matches(isDisplayed())) } @Test @@ -268,19 +248,12 @@ public class SentinelFragmentTests { ) ).perform(click()) - onView(withId(R.id.toolbar)).check(matches(isDisplayed())) - onView( - allOf( - withText(R.string.sentinel_tools), - withParent(instanceOf(MaterialToolbar::class.java)) - ) - ).check(matches(withParent(withId(R.id.toolbar)))) - scenario.onFragment { val childFragment = it.childFragmentManager.findFragmentByTag(ToolsFragment.TAG) assertNotNull(childFragment) } + onView(withId(R.id.toolbar)).check(matches(isDisplayed())) } @Test diff --git a/sentinel/src/androidTest/resources/expected_html.html b/sentinel/src/androidTest/resources/expected_html.html index 70b421b2..ca6727e0 100644 --- a/sentinel/src/androidTest/resources/expected_html.html +++ b/sentinel/src/androidTest/resources/expected_html.html @@ -6,16 +6,23 @@

application

first_install: yyyy-MM-dd HH:mm:ss
last_update: yyyy-MM-dd HH:mm:ss
min_sdk: 21
-
target_sdk: 29
+
target_sdk: 34
package_name: com.infinum.sentinel.test
process_name: com.infinum.sentinel.test
task_affinity: com.infinum.sentinel.test
locale_language: en
locale_country: US
+
installer:

permissions

    +
  • android.permission.POST_NOTIFICATIONS: false
  • +
  • android.permission.WAKE_LOCK: true
  • +
  • android.permission.ACCESS_NETWORK_STATE: true
  • +
  • android.permission.RECEIVE_BOOT_COMPLETED: true
  • +
  • android.permission.FOREGROUND_SERVICE: true
  • android.permission.REORDER_TASKS: true
  • +
  • com.infinum.sentinel.test.DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION: true

device

@@ -31,6 +38,14 @@

device

sdk: 29
security_patch: 2019-09-05
emulator: true
+
automatic_time: true
+
automatic_timezone: true
+
rooted: false
+
screen_width:
+
screen_height:
+
screen_size:
+
screen_density:
+
font_scale:

preferences

com.infinum.sentinel.test_preferences

diff --git a/sentinel/src/androidTest/resources/expected_html_no_preferences.html b/sentinel/src/androidTest/resources/expected_html_no_preferences.html index df34067c..e89ea163 100644 --- a/sentinel/src/androidTest/resources/expected_html_no_preferences.html +++ b/sentinel/src/androidTest/resources/expected_html_no_preferences.html @@ -6,16 +6,23 @@

application

first_install: yyyy-MM-dd HH:mm:ss
last_update: yyyy-MM-dd HH:mm:ss
min_sdk: 21
-
target_sdk: 29
+
target_sdk: 34
package_name: com.infinum.sentinel.test
process_name: com.infinum.sentinel.test
task_affinity: com.infinum.sentinel.test
locale_language: en
locale_country: US
+
installer:

permissions

    +
  • android.permission.POST_NOTIFICATIONS: false
  • +
  • android.permission.WAKE_LOCK: true
  • +
  • android.permission.ACCESS_NETWORK_STATE: true
  • +
  • android.permission.RECEIVE_BOOT_COMPLETED: true
  • +
  • android.permission.FOREGROUND_SERVICE: true
  • android.permission.REORDER_TASKS: true
  • +
  • com.infinum.sentinel.test.DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION: true

device

@@ -31,6 +38,14 @@

device

sdk: 29
security_patch: 2019-09-05
emulator: true
+
automatic_time: true
+
automatic_timezone: true
+
rooted: false
+
screen_width:
+
screen_height:
+
screen_size:
+
screen_density:
+
font_scale:

preferences

diff --git a/sentinel/src/androidTest/resources/expected_json.json b/sentinel/src/androidTest/resources/expected_json.json index 54443eec..c7eb8f9f 100644 --- a/sentinel/src/androidTest/resources/expected_json.json +++ b/sentinel/src/androidTest/resources/expected_json.json @@ -5,17 +5,42 @@ "first_install": "yyyy-MM-dd HH:mm:ss", "last_update": "yyyy-MM-dd HH:mm:ss", "min_sdk": "21", - "target_sdk": "29", + "target_sdk": "34", "package_name": "com.infinum.sentinel.test", "process_name": "com.infinum.sentinel.test", "task_affinity": "com.infinum.sentinel.test", "locale_language": "en", - "locale_country": "US" + "locale_country": "US", + "installer": "" }, "permissions": [ + { + "name": "android.permission.POST_NOTIFICATIONS", + "status": "false" + }, + { + "name": "android.permission.WAKE_LOCK", + "status": "true" + }, + { + "name": "android.permission.ACCESS_NETWORK_STATE", + "status": "true" + }, + { + "name": "android.permission.RECEIVE_BOOT_COMPLETED", + "status": "true" + }, + { + "name": "android.permission.FOREGROUND_SERVICE", + "status": "true" + }, { "name": "android.permission.REORDER_TASKS", "status": "true" + }, + { + "name": "com.infinum.sentinel.test.DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION", + "status": "true" } ], "device": { @@ -30,7 +55,15 @@ "release": "10", "sdk": "29", "security_patch": "2019-09-05", - "emulator": true + "emulator": true, + "automatic_time": true, + "automatic_timezone": true, + "rooted": false, + "screen_width": "", + "screen_height": "", + "screen_size": "", + "screen_density": "", + "font_scale": "" }, "preferences": [ { diff --git a/sentinel/src/androidTest/resources/expected_json_no_preferences.json b/sentinel/src/androidTest/resources/expected_json_no_preferences.json index 82b1fdb7..3e7c41b8 100644 --- a/sentinel/src/androidTest/resources/expected_json_no_preferences.json +++ b/sentinel/src/androidTest/resources/expected_json_no_preferences.json @@ -5,17 +5,42 @@ "first_install": "yyyy-MM-dd HH:mm:ss", "last_update": "yyyy-MM-dd HH:mm:ss", "min_sdk": "21", - "target_sdk": "29", + "target_sdk": "34", "package_name": "com.infinum.sentinel.test", "process_name": "com.infinum.sentinel.test", "task_affinity": "com.infinum.sentinel.test", "locale_language": "en", - "locale_country": "US" + "locale_country": "US", + "installer": "" }, "permissions": [ + { + "name": "android.permission.POST_NOTIFICATIONS", + "status": "false" + }, + { + "name": "android.permission.WAKE_LOCK", + "status": "true" + }, + { + "name": "android.permission.ACCESS_NETWORK_STATE", + "status": "true" + }, + { + "name": "android.permission.RECEIVE_BOOT_COMPLETED", + "status": "true" + }, + { + "name": "android.permission.FOREGROUND_SERVICE", + "status": "true" + }, { "name": "android.permission.REORDER_TASKS", "status": "true" + }, + { + "name": "com.infinum.sentinel.test.DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION", + "status": "true" } ], "device": { @@ -30,7 +55,15 @@ "release": "10", "sdk": "29", "security_patch": "2019-09-05", - "emulator": true + "emulator": true, + "automatic_time": true, + "automatic_timezone": true, + "rooted": false, + "screen_width": "", + "screen_height": "", + "screen_size": "", + "screen_density": "", + "font_scale": "" }, "preferences": [] } \ No newline at end of file diff --git a/sentinel/src/androidTest/resources/expected_markdown.md b/sentinel/src/androidTest/resources/expected_markdown.md index e607cfdb..d6879df0 100644 --- a/sentinel/src/androidTest/resources/expected_markdown.md +++ b/sentinel/src/androidTest/resources/expected_markdown.md @@ -4,15 +4,22 @@ _version_name_: 1.0.0 _first_install_: yyyy-MM-dd HH:mm:ss _last_update_: yyyy-MM-dd HH:mm:ss _min_sdk_: 21 -_target_sdk_: 29 +_target_sdk_: 34 _package_name_: com.infinum.sentinel.test _process_name_: com.infinum.sentinel.test _task_affinity_: com.infinum.sentinel.test _locale_language_: en _locale_country_: US +_installer_: # permissions +- _android.permission.POST_NOTIFICATIONS_: false +- _android.permission.WAKE_LOCK_: true +- _android.permission.ACCESS_NETWORK_STATE_: true +- _android.permission.RECEIVE_BOOT_COMPLETED_: true +- _android.permission.FOREGROUND_SERVICE_: true - _android.permission.REORDER_TASKS_: true +- _com.infinum.sentinel.test.DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION_: true # device _manufacturer_: Google @@ -27,6 +34,14 @@ _release_: 10 _sdk_: 29 _security_patch_: 2019-09-05 _emulator_: true +_automatic_time_: true +_automatic_timezone_: true +_rooted_: false +_screen_width_: +_screen_height_: +_screen_size_: +_screen_density_: +_font_scale_: # preferences ## com.infinum.sentinel.test_preferences diff --git a/sentinel/src/androidTest/resources/expected_markdown_no_preferences.md b/sentinel/src/androidTest/resources/expected_markdown_no_preferences.md index 69c6a729..2e086b8d 100644 --- a/sentinel/src/androidTest/resources/expected_markdown_no_preferences.md +++ b/sentinel/src/androidTest/resources/expected_markdown_no_preferences.md @@ -4,15 +4,22 @@ _version_name_: 1.0.0 _first_install_: yyyy-MM-dd HH:mm:ss _last_update_: yyyy-MM-dd HH:mm:ss _min_sdk_: 21 -_target_sdk_: 29 +_target_sdk_: 34 _package_name_: com.infinum.sentinel.test _process_name_: com.infinum.sentinel.test _task_affinity_: com.infinum.sentinel.test _locale_language_: en _locale_country_: US +_installer_: # permissions +- _android.permission.POST_NOTIFICATIONS_: false +- _android.permission.WAKE_LOCK_: true +- _android.permission.ACCESS_NETWORK_STATE_: true +- _android.permission.RECEIVE_BOOT_COMPLETED_: true +- _android.permission.FOREGROUND_SERVICE_: true - _android.permission.REORDER_TASKS_: true +- _com.infinum.sentinel.test.DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION_: true # device _manufacturer_: Google @@ -27,6 +34,14 @@ _release_: 10 _sdk_: 29 _security_patch_: 2019-09-05 _emulator_: true +_automatic_time_: true +_automatic_timezone_: true +_rooted_: false +_screen_width_: +_screen_height_: +_screen_size_: +_screen_density_: +_font_scale_: # preferences diff --git a/sentinel/src/androidTest/resources/expected_plain.txt b/sentinel/src/androidTest/resources/expected_plain.txt index 687d05f3..5b7455a9 100644 --- a/sentinel/src/androidTest/resources/expected_plain.txt +++ b/sentinel/src/androidTest/resources/expected_plain.txt @@ -5,17 +5,24 @@ version_name: 1.0.0 first_install: yyyy-MM-dd HH:mm:ss last_update: yyyy-MM-dd HH:mm:ss min_sdk: 21 -target_sdk: 29 +target_sdk: 34 package_name: com.infinum.sentinel.test process_name: com.infinum.sentinel.test task_affinity: com.infinum.sentinel.test locale_language: en locale_country: US +installer: PERMISSIONS ----------- +android.permission.POST_NOTIFICATIONS: false +android.permission.WAKE_LOCK: true +android.permission.ACCESS_NETWORK_STATE: true +android.permission.RECEIVE_BOOT_COMPLETED: true +android.permission.FOREGROUND_SERVICE: true android.permission.REORDER_TASKS: true +com.infinum.sentinel.test.DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION: true DEVICE @@ -32,6 +39,14 @@ release: 10 sdk: 29 security_patch: 2019-09-05 emulator: true +automatic_time: true +automatic_timezone: true +rooted: false +screen_width: +screen_height: +screen_size: +screen_density: +font_scale: PREFERENCES diff --git a/sentinel/src/androidTest/resources/expected_plain_no_preferences.txt b/sentinel/src/androidTest/resources/expected_plain_no_preferences.txt index dbc2f382..251b8dff 100644 --- a/sentinel/src/androidTest/resources/expected_plain_no_preferences.txt +++ b/sentinel/src/androidTest/resources/expected_plain_no_preferences.txt @@ -5,17 +5,24 @@ version_name: 1.0.0 first_install: yyyy-MM-dd HH:mm:ss last_update: yyyy-MM-dd HH:mm:ss min_sdk: 21 -target_sdk: 29 +target_sdk: 34 package_name: com.infinum.sentinel.test process_name: com.infinum.sentinel.test task_affinity: com.infinum.sentinel.test locale_language: en locale_country: US +installer: PERMISSIONS ----------- +android.permission.POST_NOTIFICATIONS: false +android.permission.WAKE_LOCK: true +android.permission.ACCESS_NETWORK_STATE: true +android.permission.RECEIVE_BOOT_COMPLETED: true +android.permission.FOREGROUND_SERVICE: true android.permission.REORDER_TASKS: true +com.infinum.sentinel.test.DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION: true DEVICE @@ -32,6 +39,14 @@ release: 10 sdk: 29 security_patch: 2019-09-05 emulator: true +automatic_time: true +automatic_timezone: true +rooted: false +screen_width: +screen_height: +screen_size: +screen_density: +font_scale: PREFERENCES diff --git a/sentinel/src/androidTest/resources/expected_xml.xml b/sentinel/src/androidTest/resources/expected_xml.xml index 74cb459f..1a87e9e5 100644 --- a/sentinel/src/androidTest/resources/expected_xml.xml +++ b/sentinel/src/androidTest/resources/expected_xml.xml @@ -1 +1,65 @@ -1000001.0.0yyyy-MM-dd HH:mm:ssyyyy-MM-dd HH:mm:ss2129com.infinum.sentinel.testcom.infinum.sentinel.testcom.infinum.sentinel.testenUSGoogleAndroid SDK built for x86QSR1.190920.001unknowngeneric_x86goldfish_x86x86REL10292019-09-05true \ No newline at end of file + + + + 100000 + + 1.0.0 + yyyy-MM-dd + HH:mm:ss + + yyyy-MM-dd HH:mm:ss + 21 + 34 + + com.infinum.sentinel.test + com.infinum.sentinel + .test + + com.infinum.sentinel.test + en + + US + + + + + + + + + + + + + Google + Android SDK built for x86 + QSR1.190920.001 + unknown + generic_x86 + goldfish_x86 + x86 + REL + 10 + 29 + 2019-09-05 + true + true + true + false + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sentinel/src/androidTest/resources/expected_xml_no_preferences.xml b/sentinel/src/androidTest/resources/expected_xml_no_preferences.xml index 2d0e8d63..08462ad1 100644 --- a/sentinel/src/androidTest/resources/expected_xml_no_preferences.xml +++ b/sentinel/src/androidTest/resources/expected_xml_no_preferences.xml @@ -1 +1,56 @@ -1000001.0.0yyyy-MM-dd HH:mm:ssyyyy-MM-dd HH:mm:ss2129com.infinum.sentinel.testcom.infinum.sentinel.testcom.infinum.sentinel.testenUSGoogleAndroid SDK built for x86QSR1.190920.001unknowngeneric_x86goldfish_x86x86REL10292019-09-05true \ No newline at end of file + + + + 100000 + + 1.0.0 + yyyy-MM-dd + HH:mm:ss + + yyyy-MM-dd HH:mm:ss + 21 + 34 + + com.infinum.sentinel.test + com.infinum.sentinel + .test + + com.infinum.sentinel.test + en + + US + + + + + + + + + + + + + Google + Android SDK built for x86 + QSR1.190920.001 + unknown + generic_x86 + goldfish_x86 + x86 + REL + 10 + 29 + 2019-09-05 + true + true + true + false + + + + + + + + \ No newline at end of file diff --git a/sentinel/src/main/AndroidManifest.xml b/sentinel/src/main/AndroidManifest.xml index 61a51446..22738cc9 100644 --- a/sentinel/src/main/AndroidManifest.xml +++ b/sentinel/src/main/AndroidManifest.xml @@ -10,7 +10,7 @@ () { diff --git a/tool-timber/src/main/kotlin/com/infinum/sentinel/ui/shared/LogFileResolver.kt b/tool-timber/src/main/kotlin/com/infinum/sentinel/ui/shared/LogFileResolver.kt index 80144b5d..a8d84a5c 100644 --- a/tool-timber/src/main/kotlin/com/infinum/sentinel/ui/shared/LogFileResolver.kt +++ b/tool-timber/src/main/kotlin/com/infinum/sentinel/ui/shared/LogFileResolver.kt @@ -14,7 +14,7 @@ internal class LogFileResolver( private const val LOG_EXTENSION = ".log" } - private val parent = File("${context.filesDir.absolutePath}${LOGS_DIRECTORY}") + private val parent = File("${context.filesDir.absolutePath}$LOGS_DIRECTORY") fun logsDir() = parent