3 / 3 / 2
Регистрация: 07.07.2012
Сообщений: 116
|
||||||
1 | ||||||
Espresso RecyclerViewActions click уничтожает activity10.10.2021, 19:37. Показов 834. Ответов 0
Доброго. Хочу начать использовать Espresso для тестирования. Взял пример кода из документации (https://developer.android.com/... esso/lists).
Но проблема с RecyclerViewActions. После события клика активность просто переходит в DESTROYED. Без ошибки.
Код
Testing started at 18:47 ... 10/10 18:47:39: Launching 'MainActivityTest' on 4 WVGA (Nexus S) API 30. Install successfully finished in 1 s 408 ms. Running tests $ adb shell am instrument -w -m -e debug true -e class 'ui.MainActivityTest' com.example.motivationmanager.test/androidx.test.runner.AndroidJUnitRunner Connecting to com.example.motivationmanager.test Waiting for application to start debug server Waiting for application to come online: com.example.motivationmanager.test | com.example.motivationmanager Connecting to com.example.motivationmanager.test Waiting for application to start debug server Connecting to com.example.motivationmanager Waiting for application to start debug server Connected to process 9973 on device 'emulator-5556'. Connecting to com.example.motivationmanager.test Waiting for application to start debug server Connecting to com.example.motivationmanager Connected to the target VM, address: 'localhost:50308', transport: 'socket' Capturing and displaying logcat messages from application. This behavior can be disabled in the "Logcat output" section of the "Debugger" settings page. I/tivationmanage: Not late-enabling -Xcheck:jni (already on) I/tivationmanage: Unquickening 12 vdex files! W/tivationmanage: Unexpected CPU variant for X86 using defaults: x86 I/tivationmanage: The ClassLoaderContext is a special shared library. I/chatty: uid=10153(com.example.motivationmanager) identical 1 line I/tivationmanage: The ClassLoaderContext is a special shared library. D/ApplicationLoaders: Returning zygote-cached class loader: /system/framework/android.test.base.jar D/ApplicationLoaders: Returning zygote-cached class loader: /system/framework/android.test.base.jar I/tivationmanage: The ClassLoaderContext is a special shared library. D/ApplicationLoaders: Returning zygote-cached class loader: /system/framework/android.test.base.jar Returning zygote-cached class loader: /system/framework/android.test.base.jar I/tivationmanage: The ClassLoaderContext is a special shared library. I/chatty: uid=10153(com.example.motivationmanager) identical 2 lines I/tivationmanage: The ClassLoaderContext is a special shared library. W/tivationmanage: Accessing hidden method Landroid/app/Instrumentation;->execStartActivity(Landroid/content/Context;Landroid/os/IBinder;Landroid/os/IBinder;Landroid/app/Activity;Landroid/content/Intent;ILandroid/os/Bundle;)Landroid/app/Instrumentation$ActivityResult; (greylist, linking, allowed) Accessing hidden method Landroid/app/Instrumentation;->execStartActivity(Landroid/content/Context;Landroid/os/IBinder;Landroid/os/IBinder;Ljava/lang/String;Landroid/content/Intent;ILandroid/os/Bundle;)Landroid/app/Instrumentation$ActivityResult; (greylist, linking, allowed) D/NetworkSecurityConfig: No Network Security Config specified, using platform default D/NetworkSecurityConfig: No Network Security Config specified, using platform default I/MultiDex: VM with version 2.1.0 has multidex support Installing application VM has multidex support, MultiDex support library is disabled. I/MonitoringInstr: Instrumentation started! I/AndroidJUnitRunner: Waiting for debugger to connect... I/System.out: Sending WAIT chunk I/System.out: Debugger has connected waiting for debugger to settle... I/System.out: waiting for debugger to settle... I/chatty: uid=10153(com.example.motivationmanager) identical 3 lines I/System.out: waiting for debugger to settle... I/System.out: waiting for debugger to settle... I/System.out: debugger has settled (1300) I/AndroidJUnitRunner: Debugger connected. V/TestEventClient: No service name argument was given (testDiscoveryService, testRunEventService or orchestratorService) I/MonitoringInstr: No JSBridge. D/InfraTrack: Tracking disabled due to lack of internet permissions I/UsageTrackerFacilitator: Usage tracking disabled D/TestExecutor: Adding listener androidx.test.internal.runner.listener.LogRunListener D/TestExecutor: Adding listener androidx.test.internal.runner.listener.InstrumentationResultPrinter Adding listener androidx.test.internal.runner.listener.ActivityFinisherRunListener I/TestRunner: run started: 1 tests I/TestRunner: started: recyclerViewTest(ui.MainActivityTest) Started running tests W/Settings: Setting always_finish_activities has moved from android.provider.Settings.System to android.provider.Settings.Global, returning read-only value. D/libEGL: loaded /vendor/lib/egl/libEGL_emulation.so D/libEGL: loaded /vendor/lib/egl/libGLESv1_CM_emulation.so D/libEGL: loaded /vendor/lib/egl/libGLESv2_emulation.so D/LifecycleMonitor: Lifecycle status change: ui.MainActivity@197a684 in: PRE_ON_CREATE V/ActivityScenario: Activity lifecycle changed event received but ignored because the reported transition was not ON_CREATE while the last known transition was PRE_ON_CREATE W/tivationmanage: Accessing hidden method Landroid/view/View;->computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z (greylist, reflection, allowed) W/tivationmanage: Accessing hidden method Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V (greylist, reflection, allowed) D/LifecycleMonitor: Lifecycle status change: ui.MainActivity@197a684 in: CREATED V/ActivityScenario: Update currentActivityStage to CREATED, currentActivity=ui.MainActivity@197a684 D/LifecycleMonitor: Lifecycle status change: ui.MainActivity@197a684 in: STARTED V/ActivityScenario: Update currentActivityStage to STARTED, currentActivity=ui.MainActivity@197a684 D/LifecycleMonitor: Lifecycle status change: ui.MainActivity@197a684 in: RESUMED V/ActivityScenario: Update currentActivityStage to RESUMED, currentActivity=ui.MainActivity@197a684 D/HostConnection: HostConnection::get() New Host Connection established 0xf6c223d0, tid 10012 D/HostConnection: HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_native_sync_v3 ANDROID_EMU_native_sync_v4 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem ANDROID_EMU_host_composition_v1 ANDROID_EMU_host_composition_v2 ANDROID_EMU_vulkan ANDROID_EMU_deferred_vulkan_commands ANDROID_EMU_vulkan_null_optional_strings ANDROID_EMU_vulkan_create_resources_with_requirements ANDROID_EMU_YUV_Cache ANDROID_EMU_async_unmap_buffer ANDROID_EMU_vulkan_ignored_handles ANDROID_EMU_has_shared_slots_host_memory_allocator ANDROID_EMU_vulkan_free_memory_sync ANDROID_EMU_vulkan_shader_float16_int8 ANDROID_EMU_vulkan_async_queue_submit ANDROID_EMU_sync_buffer_data GL_OES_EGL_image_external_essl3 GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_host_side_tracing ANDROID_EMU_async_frame_commands ANDROID_EMU_gles_max_version_3_0 W/OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without... D/EGL_emulation: eglCreateContext: 0xf6c22590: maj 3 min 0 rcv 3 D/EGL_emulation: eglMakeCurrent: 0xf6c22590: ver 3 0 (tinfo 0xc54bac70) (first time) I/Gralloc4: mapper 4.x is not supported D/HostConnection: createUnique: call HostConnection::get() New Host Connection established 0xf6c22050, tid 10012 D/goldfish-address-space: allocate: Ask for block of size 0x100 allocate: ioctl allocate returned offset 0x3fbffe000 size 0x2000 D/HostConnection: HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_native_sync_v3 ANDROID_EMU_native_sync_v4 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem ANDROID_EMU_host_composition_v1 ANDROID_EMU_host_composition_v2 ANDROID_EMU_vulkan ANDROID_EMU_deferred_vulkan_commands ANDROID_EMU_vulkan_null_optional_strings ANDROID_EMU_vulkan_create_resources_with_requirements ANDROID_EMU_YUV_Cache ANDROID_EMU_async_unmap_buffer ANDROID_EMU_vulkan_ignored_handles ANDROID_EMU_has_shared_slots_host_memory_allocator ANDROID_EMU_vulkan_free_memory_sync ANDROID_EMU_vulkan_shader_float16_int8 ANDROID_EMU_vulkan_async_queue_submit ANDROID_EMU_sync_buffer_data GL_OES_EGL_image_external_essl3 GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_host_side_tracing ANDROID_EMU_async_frame_commands ANDROID_EMU_gles_max_version_3_0 D/EventInjectionStrategy: Creating injection strategy with input manager. W/tivationmanage: Accessing hidden method Landroid/hardware/input/InputManager;->getInstance()Landroid/hardware/input/InputManager; (greylist, reflection, allowed) W/tivationmanage: Accessing hidden method Landroid/hardware/input/InputManager;->injectInputEvent(Landroid/view/InputEvent;I)Z (greylist, reflection, allowed) Accessing hidden field Landroid/hardware/input/InputManager;->INJECT_INPUT_EVENT_MODE_WAIT_FOR_FINISH:I (greylist, reflection, allowed) W/tivationmanage: Accessing hidden method Landroid/os/MessageQueue;->next()Landroid/os/Message; (greylist, reflection, allowed) Accessing hidden field Landroid/os/MessageQueue;->mMessages:Landroid/os/Message; (greylist, reflection, allowed) Accessing hidden method Landroid/os/Message;->recycleUnchecked()V (greylist, reflection, allowed) W/tivationmanage: Accessing hidden method Landroid/view/WindowManagerGlobal;->getInstance()Landroid/view/WindowManagerGlobal; (greylist, reflection, allowed) Accessing hidden field Landroid/view/WindowManagerGlobal;->mViews:Ljava/util/ArrayList; (greylist, reflection, allowed) Accessing hidden field Landroid/view/WindowManagerGlobal;->mParams:Ljava/util/ArrayList; (greylist, reflection, allowed) I/ViewInteraction: Performing 'scroll RecyclerView to position: 0' action on view view.getId() is <2131296529/com.example.motivationmanager:id/tasks_progress_recyclerview> W/tivationmanage: Accessing hidden method Landroid/view/ViewConfiguration;->getDoubleTapMinTime()I (greylist, reflection, allowed) I/ViewInteraction: Performing 'actionOnItemAtPosition performing ViewAction: single click on item at position: 0' action on view view.getId() is <2131296529/com.example.motivationmanager:id/tasks_progress_recyclerview> D/LifecycleMonitor: Lifecycle status change: ui.MainActivity@197a684 in: PAUSED V/ActivityScenario: Update currentActivityStage to PAUSED, currentActivity=ui.MainActivity@197a684 D/LifecycleMonitor: Lifecycle status change: ui.MainActivity@197a684 in: STOPPED V/ActivityScenario: Update currentActivityStage to STOPPED, currentActivity=ui.MainActivity@197a684 D/LifecycleMonitor: Lifecycle status change: ui.MainActivity@197a684 in: DESTROYED V/ActivityScenario: Update currentActivityStage to DESTROYED, currentActivity=null W/RootViewPicker: No activities found - waiting: 10ms for one to appear. W/RootViewPicker: No activities found - waiting: 50ms for one to appear. W/RootViewPicker: No activities found - waiting: 150ms for one to appear. W/RootViewPicker: No activities found - waiting: 250ms for one to appear. E/TestRunner: failed: recyclerViewTest(ui.MainActivityTest) ----- begin exception ----- E/TestRunner: androidx.test.espresso.NoActivityResumedException: No activities found. Did you forget to launch the activity by calling getActivity() or startActivitySync or similar? at dalvik.system.VMStack.getThreadStackTrace(Native Method) at java.lang.Thread.getStackTrace(Thread.java:1736) at androidx.test.espresso.base.DefaultFailureHandler.getUserFriendlyError(DefaultFailureHandler.java:12) at androidx.test.espresso.base.DefaultFailureHandler.handle(DefaultFailureHandler.java:7) at androidx.test.espresso.ViewInteraction.waitForAndHandleInteractionResults(ViewInteraction.java:8) at androidx.test.espresso.ViewInteraction.desugaredPerform(ViewInteraction.java:11) at androidx.test.espresso.ViewInteraction.perform(ViewInteraction.java:4) at ui.MainActivityTest.recyclerViewTest(MainActivityTest.java:58) at java.lang.reflect.Method.invoke(Native Method) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:48) at org.junit.rules.RunRules.evaluate(RunRules.java:20) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.junit.runners.Suite.runChild(Suite.java:128) at org.junit.runners.Suite.runChild(Suite.java:27) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.junit.runner.JUnitCore.run(JUnitCore.java:137) at org.junit.runner.JUnitCore.run(JUnitCore.java:115) at androidx.test.internal.runner.TestExecutor.execute(TestExecutor.java:56) at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:444) at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2205) ----- end exception ----- I/TestRunner: finished: recyclerViewTest(ui.MainActivityTest) androidx.test.espresso.NoActivityResumedException: No activities found. Did you forget to launch the activity by calling getActivity() or startActivitySync or similar? at dalvik.system.VMStack.getThreadStackTrace(Native Method) at java.lang.Thread.getStackTrace(Thread.java:1736) at androidx.test.espresso.base.DefaultFailureHandler.getUserFriendlyError(DefaultFailureHandler.java:12) at androidx.test.espresso.base.DefaultFailureHandler.handle(DefaultFailureHandler.java:7) at androidx.test.espresso.ViewInteraction.waitForAndHandleInteractionResults(ViewInteraction.java:8) at androidx.test.espresso.ViewInteraction.desugaredPerform(ViewInteraction.java:11) at androidx.test.espresso.ViewInteraction.perform(ViewInteraction.java:4) at ui.MainActivityTest.recyclerViewTest(MainActivityTest.java:58) I/TestRunner: run finished: 1 tests, 1 failed, 0 ignored Tests ran to completion. I/MonitoringInstr: waitForActivitiesToComplete() took: 0ms Disconnected from the target VM, address: 'localhost:50308', transport: 'socket' Как вообще клик уничтожает активность? Как исправить? Никакой ошибки (если не делать никаких действий после того как он уничтожил актвити) нет. В recyclerview 3 эллемента. По рекомендации отключил анимацию https://developer.android.com/... esso/setup. Версия espresso 3.4.0 Все перепробыал 0 идей.
0
|
10.10.2021, 19:37 | |
Ответы с готовыми решениями:
0
если .click один - одна функция, .click еще раз и другая Как изменить кнопку на втором Activity с первого Activity в Android Studio? При открытие activity одного приложения предлагает открыть activity другого Как в Android Studio изменять объект одного Activity из другого Activity? Приложение зависает, если свернуть и развернуть Activity или перейти на другую Activity |
10.10.2021, 19:37 | |
10.10.2021, 19:37 | |
Помогаю со студенческими работами здесь
1
Изменение layout-элементов одного activity из другого activity Как из одного Activity перенести фотку в другое Activity? Android - Передача данных с одного Activity на другое Activity Не обновляется текстовое поле текущего Activity при выборе другого элемента в RadioButton предыдущего Activity Espresso Искать еще темы с ответами Или воспользуйтесь поиском по форуму: |