public class LithoViewTestHelper
extends java.lang.Object
LithoView
that is relevant during end to end tests.
In order for the data to be collected, ComponentsConfiguration.isEndToEndTestRun
must be
enabled.Modifier and Type | Class and Description |
---|---|
static class |
LithoViewTestHelper.InternalNodeRef
Holds an opaque reference to an
LithoNode without giving the holder any access to it. |
Constructor and Description |
---|
LithoViewTestHelper() |
Modifier and Type | Method and Description |
---|---|
static TestItem |
findTestItem(LithoView lithoView,
java.lang.String testKey) |
static java.util.Deque<TestItem> |
findTestItems(LithoView lithoView,
java.lang.String testKey)
|
static LithoViewTestHelper.InternalNodeRef |
getRootLayoutRef(LithoView view)
Obtain a reference to a LithoView's internal layout root, if present.
|
static java.lang.String |
rootInstanceToString(DebugComponent root,
boolean embedded,
int startingDepth)
Provides a nested string representation of a DebugComponent and its nested components for
debugging.
|
static void |
setRootLayoutRef(LithoView view,
LithoViewTestHelper.InternalNodeRef rootLayoutNode)
Restore a previously saved root layout reference.
|
static java.lang.String |
toDebugString(LithoView lithoView) |
static java.lang.String |
viewToString(LithoView view) |
static java.lang.String |
viewToString(LithoView view,
boolean embedded)
Provide a nested string representation of a LithoView and its nested components for debugging
purposes.
|
static java.lang.String |
viewToStringForE2E(View view,
int depth,
boolean withProps) |
static java.lang.String |
viewToStringForE2E(View view,
int depth,
boolean withProps,
DebugComponentDescriptionHelper.ExtraDescription extraDescription)
Provide a nested string representation of a LithoView and its nested components for E2E testing
purposes.
|
public static TestItem findTestItem(LithoView lithoView, java.lang.String testKey)
lithoView
- The component view the component is mounted to.testKey
- The unique identifier the component was constructed with.java.lang.UnsupportedOperationException
- If the e2e flag is not enabled in the configuration.Note: If there is more than one element mounted under the given key,
the last one to render will be returned.
public static java.util.Deque<TestItem> findTestItems(LithoView lithoView, java.lang.String testKey)
TestItem
given a LithoView
based on the test key it was assigned during
construction.
Example use:
{@code final LithoView lithoView = ComponentTestHelper.mountComponent( mContext, new InlineLayoutSpec() {
lithoView
- The component view the component is mounted to.testKey
- The unique identifier the component was constructed with.java.lang.UnsupportedOperationException
- If the e2e flag is not enabled in the configuration.public static java.lang.String viewToString(LithoView view)
public static java.lang.String viewToStringForE2E(View view, int depth, boolean withProps)
public static java.lang.String viewToStringForE2E(View view, int depth, boolean withProps, DebugComponentDescriptionHelper.ExtraDescription extraDescription)
depth
- the offset to set on the litho nodeswithProps
- if to dump extra propertiespublic static java.lang.String viewToString(LithoView view, boolean embedded)
view
- A Litho view with mounted components.embedded
- if the call is embedded in "adb dumpsys activity"public static java.lang.String rootInstanceToString(DebugComponent root, boolean embedded, int startingDepth)
root
- A root DebugComponentembedded
- if the call is embedded in "adb dumpsys activity"startingDepth
- the starting depth of the true for printing components (normally defaults
to 0)public static java.lang.String toDebugString(LithoView lithoView)
public static LithoViewTestHelper.InternalNodeRef getRootLayoutRef(LithoView view)
public static void setRootLayoutRef(LithoView view, LithoViewTestHelper.InternalNodeRef rootLayoutNode)
getRootLayoutRef(LithoView)