austgl / robotium

Automatically exported from code.google.com/p/robotium
0 stars 0 forks source link

junit.framework.AssertionFailedError: Button with index 2131230847 is not available! #252

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.solo = new Solo(getInstrumentation(), getActivity());
2.solo.clickOnButton(dk.lector.ao.mobile.R.id.productButton);
3.solo.assertCurrentActivity("ProductSearch", ProductSearchActivity.class);

What is the expected output? What do you see instead?
I expected an Activity launched.
but got the title of this isssue instead.

What version of the product are you using? On what operating system?
using 3.2.1 on ubuntu 11.10. with eclipse 

Please provide any additional information below.
My manifest does have the wiki manifest added, no change.
Here is my testclass:

package dk.lector.ao.mobile.test;

import android.test.ActivityInstrumentationTestCase2;

import com.jayway.android.robotium.solo.Solo;

import dk.lector.ao.mobile.AOinThePocket;
import dk.lector.ao.mobile.product.ProductSearchActivity;

public class TestAOinThePocket extends 
ActivityInstrumentationTestCase2<AOinThePocket> {

    private Solo solo;

    public TestAOinThePocket() {
        super("dk.lector.ao.mobile", AOinThePocket.class);
    }

    @Override
    protected void setUp() throws Exception {
        super.setUp();
        solo = new Solo(getInstrumentation(), getActivity());
        synchronized (solo) {
            solo.wait(2000);            
        }
    }

    public void testDisplayBlackBox() {

        solo.clickOnButton(dk.lector.ao.mobile.R.id.productButton);

        solo.assertCurrentActivity("ProductSearch", ProductSearchActivity.class);

    }

    @Override
    protected void tearDown() throws Exception {
        solo.finishOpenedActivities();
        super.tearDown();
    }

}

Original issue reported on code.google.com by Surhum...@gmail.com on 25 Apr 2012 at 9:53

GoogleCodeExporter commented 9 years ago
Nvm.
You have your own indexing.
I took the R.id index..

Original comment by Surhum...@gmail.com on 25 Apr 2012 at 11:55

GoogleCodeExporter commented 9 years ago
if you want to use resource ids, you can do something like: 

Button button = (Button) solo.getView(R.id) ;
clickOnView(buttton);

Original comment by renasr...@gmail.com on 25 Apr 2012 at 1:35

GoogleCodeExporter commented 9 years ago

Original comment by renasr...@gmail.com on 25 Apr 2012 at 1:35