问题描述
我一直在徒劳地尝试,每次我都走到了死胡同。
我正在尝试寻找一种方法,使用 cy.intercept
和 mockwebserver
在 cypress 中使用类似于 espresso
的 json 存根网络响应
这是我的代码
@Test
fun loginwithincorrectpassword(){
mockWebServer.enqueue(MockResponse().setBody("{\"success\":false,\"message\":\"Your emccail or password is incorrect. Use ‘Forgot Passddword’ option below to reset\",\"errorCode\":1019}"))
val intent = Intent()
activityRule.launchActivity(intent)
mainActivityTest.bypasspushnotification()
mainActivityTest.bypassWalkthrough()
onView(withId(R.id.login_pass_continue_btn)).perform(click())
onView(withText("Your email or password is incorrect. Use ‘Forgot Password’ option below to reset")).check(matches(isdisplayed()))
onView(withText("OK")).check(matches(isdisplayed())).perform(click())
onView(withId(R.id.login_pass_password_edt)).perform(clearText())
}
class Login {
val mainActivityTest = MainActivitytest()
val mockWebServer = MockWebServer()
@Before
@Throws(IOException::class,InterruptedException::class)
fun setup() {
mockWebServer.start(8080)
}
@Rule
@JvmField
var activityRule = ActivityTestRule<SplashActivity>(
SplashActivity::class.java,true,false
)
我不确定我是否朝着正确的方向前进,我参考了几种材料,但没有得到它有点愚蠢。需要帮助才能继续前进。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)