Tag: espresso

如何使用Espresso访问外部网站上的元素

使用espresso,我们点击一​​个登录按钮,启动一个外部网站(Chrome自定义标签),您可以登录,然后重定向到我们的Android应用程序。 在浓咖啡中有一种方法可以: 1)validation正确的URL正在启动 2)访问网站上的元素,以便我可以输入登录信息并继续登录 当我尝试在Espresso Launch Navigator中查看它时,没有任何东西显示在页面上,如果我尝试记录,则不会在页面上输入任何东西。 这是我到目前为止(这是在Kotlin(不是Java)): 这里是显示的错误: 它启动我的应用程序,选择登录按钮,打开网站,但它不能访问的元素。 我也试过: 更新:这是使用Chrome自定义选项卡(不是Web视图),所以Espresso网站无法正常工作。

java.lang.NoClassDefFoundError:kotlin.jvm.internal.Intrinsics – newApplication

问题 我只是试图将自定义的AndroidJUnitRunner类从Java转换到Kotlin。 码 CustomTestRunner.java public class CustomTestRunner extends AndroidJUnitRunner { @Override public Application newApplication(ClassLoader cl, String className, Context context) throws IllegalAccessException, ClassNotFoundException, InstantiationException { return super.newApplication(cl, TestApp.class.getName(), context); } } CustomTestRunner.kt – (导致错误 – 请参阅下面的堆栈跟踪) class CustomTestRunner : AndroidJUnitRunner() { override fun newApplication(cl: ClassLoader, className: String, context: Context): Application { return super.newApplication(cl, TestApp::class.java.name, context) } […]

当imageuri作为额外的传递时,Espresso测试相机意图

我需要通过在意图额外提供的路径创建一个图像文件存根相机意图。 意式浓缩咖啡只能以活动结果回应。 我在哪里可以执行操作来创建文件在传递路径从意图额外。 代码启动相机 File destination = new File(Environment.getExternalStorageDirectory(), "app_name" + System.currentTimeMillis() + ".jpg"); imageUri = FileProvider.getUriForFile(getApplicationContext(),getApplicationContext()。getPackageName()+“.fileprovider”,destination); Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); intent.putExtra(MediaStore.EXTRA_OUTPUT,imageUri); startActivityForResult(intent,AppConstants.REQUEST_CODE_CAMERA); 代码测试中的stubbing意图 Instrumentation.ActivityResult result = new Instrumentation.ActivityResult(Activity.RESULT_OK, null); intending(hasAction(MediaStore.ACTION_IMAGE_CAPTURE)).respondWith(result);