This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@RunWith(AndroidJUnit4::class) | |
class OnDeviceTest { | |
@get:Rule val rule = ActivityTestRule(NoteListActivity::class.java) | |
@Test fun clickingOnTitle_shouldLaunchEditAction() { | |
onView(withId(R.id.button)).perform(click()) | |
intended(hasAction(equalTo("android.intent.action.EDIT"))) | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@RunWith(AndroidJUnit4.class) | |
public class InstrumentedUnitTest { | |
private final String prefName = "TEST_PREF"; | |
@Test | |
public void test_sharedPref(){ | |
Context mContext = InstrumentationRegistry.getContext(); | |
SharedPreferences mSharedPreferences = mContext.getSharedPreferences(prefName,Context.MODE_PRIVATE); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void greeterSaysHello() { | |
onView(withId(R.id.name_field)).perform(typeText("Steve")); | |
onView(withId(R.id.greet_button)).perform(click()); | |
onView(withText("Hello Steve!")).check(matches(isDisplayed())); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Busca objeto que representa o device e vai para Home do smartphone | |
mDevice = UiDevice.getInstance(getInstrumentation()); | |
mDevice.pressHome(); | |
// Busca um componente clicável através do seu content description. | |
// Nesse caso o botão que aciona o launcher do smartphone. | |
UiObject allAppsButton = mDevice.findObject(new UiSelector().description("Apps")); | |
// Executa um click no botão anterior para carregar o launcher. | |
allAppsButton.clickAndWaitForNewWindow(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CarTest { | |
private lateinit var car: Car | |
@Before | |
fun setUp() { | |
car = Car() | |
} | |
@Test |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import androidx.test.core.app.ApplicationProvider | |
@RunWith(AndroidJUnit4::class) | |
class DatabaseTest { | |
private lateinit var database: MainDatabase | |
@Before | |
fun setUp() { | |
val context = ApplicationProvider.getApplicationContext<Context>() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@RunWith(AndroidJUnit4::class) | |
class ChangeTextBehaviorTest { | |
@get:Rule | |
var activityRule: ActivityTestRule<MainActivity> = ActivityTestRule(MainActivity::class.java) | |
@Test | |
fun changeText_sameActivity() { | |
onView(withId(R.id.editTextUserInput)).perform(typeText("Espresso"), closeSoftKeyboard()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
adb shell settings put global window_animation_scale 0 | |
adb shell settings put global transition_animation_scale 0 | |
adb shell settings put global animator_duration_scale 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
make disable-animations |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lint: | |
./gradlew lintCheckErrors --info | |
run-unit-tests: | |
./gradlew test | |
run-instrumented-tests: clear-app-data disable-animations | |
./gradlew connectedAndroidTest | |
run-all-tests: run-unit-tests build-install-app run-instrumented-tests |
OlderNewer