Skip to content

Instantly share code, notes, and snippets.

@Sprajapati123
Created January 25, 2026 02:46
Show Gist options
  • Select an option

  • Save Sprajapati123/a69a2c31f70dea8d807775e31b31fb1c to your computer and use it in GitHub Desktop.

Select an option

Save Sprajapati123/a69a2c31f70dea8d807775e31b31fb1c to your computer and use it in GitHub Desktop.
package com.example.ai37c
import androidx.compose.ui.test.junit4.createAndroidComposeRule
import androidx.compose.ui.test.onNodeWithTag
import androidx.compose.ui.test.performClick
import androidx.compose.ui.test.performTextInput
import androidx.test.espresso.Espresso.onView
import androidx.test.ext.junit.runners.AndroidJUnit4
import org.junit.Before
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
import androidx.test.espresso.intent.Intents
import androidx.test.espresso.intent.matcher.IntentMatchers.hasComponent
import androidx.test.espresso.matcher.ViewMatchers.withText
import org.junit.After
@RunWith(AndroidJUnit4::class)
class LoginInstrumentedTest {
@get:Rule
val composeRule = createAndroidComposeRule<LoginActivity>()
@Before
fun setup() {
Intents.init()
}
@After
fun tearDown() {
Intents.release()
}
@Test
fun testSuccessfulLogin_navigatesToDashboard() {
// Enter email
// composeRule.onNodeWithTag("email")
// .performTextInput("ram@gmail.com")
//
// // Enter password
// composeRule.onNodeWithTag("password")
// .performTextInput("password")
// Click Login
composeRule.onNodeWithTag("register")
.performClick()
// Intents.intended(hasComponent(DashboardActivity::class.java.name))
Intents.intended(hasComponent(RegistrationActivity::class.java.name))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment