小编Nik*_*ddy的帖子

浓缩咖啡 - 无法使用浓缩咖啡执行按钮点击

我目前是自动化测试的新手,并使用 Android Studio 使用 Espresso 执行自动化测试,我正在尝试对登录屏幕执行自动化测试,我目前在执行特定按钮的单击时遇到问题。我尝试了多种方法按钮对我不起作用。我指的是下面的文档来实现,下面是我的示例代码和崩溃报告。

@RunWith(AndroidJUnit4.class)
@LargeTest
public class LoginTest {
    @Rule
    public ActivityTestRule<LoginActivity> mActivityRule =
            new ActivityTestRule<>(LoginActivity.class);
    @Test
    public void OnLoginButtonClick() throws InterruptedException {
        onView(ViewMatchers.withId(R.id.edtUserName)).perform(ViewActions.typeText("xxxxx"));
        onView(ViewMatchers.withId(R.id.edtPassword)).perform(ViewActions.typeText("xxxxxxx"));
        onView(ViewMatchers.withId(R.id.btnLogin)).perform(ViewActions.scrollTo(),ViewActions.click());
    }
}
Run Code Online (Sandbox Code Playgroud)

崩溃报告:

android.support.test.espresso.PerformException: Error performing 'scroll to' on view 'Animations or transitions are enabled on the target device.

with id: xxx.xxxx.xxx.xxxx:id/btnLogin'.
at android.support.test.espresso.PerformException$Builder.build(PerformException.java:83)
at android.support.test.espresso.base.DefaultFailureHandler.getUserFriendlyError(DefaultFailureHandler.java:80)
at android.support.test.espresso.base.DefaultFailureHandler.handle(DefaultFailureHandler.java:56)
at android.support.test.espresso.ViewInteraction.runSynchronouslyOnUiThread(ViewInteraction.java:184)
at android.support.test.espresso.ViewInteraction.doPerform(ViewInteraction.java:115)
at android.support.test.espresso.ViewInteraction.perform(ViewInteraction.java:87)
at com.msf.opx.LoginTest.OnLoginButtonClick(LoginTest.java:50)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
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 android.support.test.internal.statement.UiThreadStatement.evaluate(UiThreadStatement.java:55) …
Run Code Online (Sandbox Code Playgroud)

android unit-testing android-espresso

2
推荐指数
1
解决办法
3268
查看次数

从ListView android中删除重复项

我发布了我的代码,我无法从列表视图中删除重复的值?有人可以帮帮我吗?提前致谢!我在这里粘贴我的代码并且已经使用过了BaseAdapter.


@Override
            public void onCompleted(final List<Recommendable> result) {
                android.util.Log.w("suggestionview>>>>>", "suggestion"+ result.size());
                ((Activity) mContext).runOnUiThread(new Runnable() {
                    public void run() {
                        Iterator<Recommendable> itr = result.iterator();
                        while (itr.hasNext()) {
                            Recommendable element = itr.next();
                            suggestions.add(element);
                            android.util.Log.w("suggestionview", "Adding elements::>"+suggestions.add(element));
                        }
                        suggestionListView.setAdapter(new Suggestiondapter(mContext));
                        android.util.Log.w("suggestionview","suggestion adapter Values::>"+suggestionListView);
                    }
                });
Run Code Online (Sandbox Code Playgroud)

第二个代码

public class Suggestiondapter extends BaseAdapter {


    // private LayoutInflater mInflater = null;
    private Context mContext;

    public Suggestiondapter(Context mContext) {
        this.mContext=mContext;
        android.util.Log.w("Suggestion Adapter","vlues are comming.....");
    }

    @Override
    public int getCount() {
        android.util.Log.w("suugestion adapter","suggstion size::>"+suggestions.size());
        return suggestions.size(); …
Run Code Online (Sandbox Code Playgroud)

android listview duplicates

1
推荐指数
1
解决办法
8959
查看次数

自定义键盘重叠 EditText

目前我正在根据客户要求开发自定义键盘。除了一个问题之外,一切对我来说都很好。我将分步骤清楚地解释我的问题。

  1. 我的屏幕由底部的 2 个 EditText 组成。
  2. 当我单击 Edittext 时,键盘工作正常,我也可以输入值。
  3. 但我的问题是键盘与需要显示的编辑文本重叠。

带有编辑文本的屏幕截图:

使用 Edittext 的屏幕截图

键盘重叠编辑文本:

键盘重叠编辑文本

如果在清单中的某些情况下已经解决了

<activity android:windowSoftInputMode="adjustPan|adjustResize"> </activity> 
Run Code Online (Sandbox Code Playgroud)

Xml代码是

<?xml version="1.0" encoding="utf-8"?>
<Keyboard xmlns:android="http://schemas.android.com/apk/res/android"
    android:horizontalGap="0dp"
    android:keyHeight="50dp"
    android:keyTextSize="12sp"
    android:keyWidth="25%p"
    android:labelTextSize="12sp"
    android:verticalGap="0dp" >

    <Row>

        <Key
            android:codes="8"
            android:keyEdgeFlags="left"
            android:keyLabel="1" />

        <Key
            android:codes="9"
            android:keyLabel="2" />

        <Key
            android:codes="10"
            android:keyLabel="3" />

        <Key
            android:codes="69"
            android:keyEdgeFlags="right"
            android:keyLabel="-" />
    </Row>

    <Row>

        <Key
            android:codes="11"
            android:keyEdgeFlags="left"
            android:keyLabel="4" />

        <Key
            android:codes="12"
            android:keyLabel="5" />

        <Key
            android:codes="13"
            android:keyLabel="6" />

        <Key
            android:codes="56"
            android:keyEdgeFlags="right"
            android:keyLabel="." />
    </Row>

    <Row>

        <Key
            android:codes="14"
            android:keyEdgeFlags="left"
            android:keyLabel="7" />

        <Key
            android:codes="15"
            android:keyLabel="8" />

        <Key …
Run Code Online (Sandbox Code Playgroud)

keyboard android android-manifest

1
推荐指数
1
解决办法
947
查看次数

Android如果用户输入大写,它也应该是小写的

如果用户输入大写的字符,它也应该只用小写字母显示,Nikhilreddy

android-edittext

-2
推荐指数
1
解决办法
1377
查看次数