Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gradle 8 updates #2669

Merged
merged 9 commits into from
Apr 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
245 changes: 125 additions & 120 deletions app/build.gradle

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions app/instrumentation-tests/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="${applicationId}">
xmlns:tools="http://schemas.android.com/tools">

<uses-sdk tools:overrideLibrary="android_libs.ub_uiautomator"/>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@ import androidx.test.espresso.assertion.ViewAssertions.matches
import androidx.test.espresso.contrib.RecyclerViewActions
import androidx.test.espresso.intent.Intents.intended
import androidx.test.espresso.intent.Intents.intending
import androidx.test.espresso.matcher.ViewMatchers.*
import androidx.test.espresso.matcher.ViewMatchers.hasDescendant
import androidx.test.espresso.matcher.ViewMatchers.isChecked
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
import androidx.test.espresso.matcher.ViewMatchers.withClassName
import androidx.test.espresso.matcher.ViewMatchers.withId
import androidx.test.espresso.matcher.ViewMatchers.withText
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.LargeTest
import org.commcare.annotations.BrowserstackTests
Expand All @@ -26,7 +31,7 @@ import org.junit.runner.RunWith
@RunWith(AndroidJUnit4::class)
@LargeTest
@BrowserstackTests
class AppPreferenceSettingsTest: BaseTest() {
class AppPreferenceSettingsTest : BaseTest() {

companion object {
const val CCZ_NAME = "settings_sheet_tests.ccz"
Expand All @@ -44,13 +49,13 @@ class AppPreferenceSettingsTest: BaseTest() {
val settingName = "Fuzzy Search Matches"
InstrumentationUtility.openOptionsMenu()
onView(withText("Settings"))
.perform(click())
.perform(click())
selectSetting(settingName)

onView(withText("Enabled"))
.check(matches(isDisplayed()))
.check(matches(isDisplayed()))
onView(withText("Disabled"))
.check(matches(isDisplayed()))
.check(matches(isDisplayed()))

// Check enabled is selected by default
matchSelectedPreference("Enabled")
Expand All @@ -68,15 +73,15 @@ class AppPreferenceSettingsTest: BaseTest() {
val settingName = "Auto Update Frequency"
InstrumentationUtility.openOptionsMenu()
onView(withText("Settings"))
.perform(click())
.perform(click())
selectSetting(settingName)

onView(withText("Never"))
.check(matches(isDisplayed()))
.check(matches(isDisplayed()))
onView(withText("Daily"))
.check(matches(isDisplayed()))
.check(matches(isDisplayed()))
onView(withText("Weekly"))
.check(matches(isDisplayed()))
.check(matches(isDisplayed()))

// Change setting and check their persistence
changePreferenceAndCheckPersistence("Daily", settingName)
Expand All @@ -91,7 +96,7 @@ class AppPreferenceSettingsTest: BaseTest() {
InstrumentationUtility.login("settings.test.3", "123")
InstrumentationUtility.openOptionsMenu()
onView(withText("Settings"))
.perform(click())
.perform(click())
selectSetting("Set Print Template")

//Create a dummy file selection intent
Expand All @@ -102,34 +107,34 @@ class AppPreferenceSettingsTest: BaseTest() {

// Click on file fetch
onView(withId(R.id.filefetch))
.perform(click())
.perform(click())

// Confirm that the file selection intent was called.
intended(expectedIntent)
}

private fun selectSetting(text: String) {
onView(withText("CommCare > Settings"))
.check(matches(isDisplayed()))
onView(withId(R.id.recycler_view))
.perform(RecyclerViewActions.scrollTo<RecyclerView.ViewHolder>(
hasDescendant(withText(text))
.check(matches(isDisplayed()))
onView(withId(androidx.preference.R.id.recycler_view))
.perform(RecyclerViewActions.scrollTo<RecyclerView.ViewHolder>(
hasDescendant(withText(text))
))
onView(withText(text))
.perform(click())
.perform(click())
}

private fun cancelSettingChangeDialog() {
onView(withText("CANCEL"))
.perform(click())
.perform(click())
onView(withText("CommCare > Settings"))
.check(matches(isDisplayed()))
.check(matches(isDisplayed()))
}

private fun changePreferenceAndCheckPersistence(newPref: String, setting: String) {
// Change to new preference
onView(withText(newPref))
.perform(click())
.perform(click())

//Rotate and check the selection persists.
InstrumentationUtility.rotateLeft()
Expand All @@ -142,8 +147,8 @@ class AppPreferenceSettingsTest: BaseTest() {

private fun matchSelectedPreference(value: String) {
onView(allOf(
withClassName(endsWith("AppCompatCheckedTextView")),
withText(value)
withClassName(endsWith("AppCompatCheckedTextView")),
withText(value)
)).check(matches(isChecked()))
}

Expand Down
Loading
Loading