sassernetsky / robotium

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

waitForActivity return false on robotium 5.2.1 #648

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.launch one activity
2.do some action
3.waitForActivity return false

What is the expected output? What do you see instead?
waitForActivity return true if another activity shows on screen.

What version of the product are you using? On what operating system?
robotium 5.2.1,android 4.4

Please provide any additional information below.

protected void setUp() throws Exception {
        super.setUp();
        Intent i = new Intent();
        i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        setActivityIntent(i);
        solo = new Solo(getInstrumentation());
        getActivity();
    }
public void testCapture() {
            //solo.assertCurrentActivity("current activity is not CameraActivity", CameraActivity.class);

            Activity act=solo.getCurrentActivity();
            assertTrue(act.getClass().getName().equals("com.android.camera.CameraActivity")); 

            int id=act.getResources().getIdentifier("shutter_button", "id", act.getPackageName());//通过String的id获取int的id
            ImageView shutterButton=(ImageView)act.findViewById(id);//获取View
            solo.sleep(1000);   
            solo.clickOnView(shutterButton);
            solo.sleep(1000);
            //assertTrue(PhotoEditor.class.getName().equals("com.android.s3dgallery3d.photoeditor.PhotoEditor")); 
            //ActivityMonitor imageActivityMonitor = this.getInstrumentation().addMonitor(PhotoEditor.class.getName(), null, false);
            solo.clickOnView(shutterButton);
            solo.sleep(1000);

            solo.waitForActivity(PhotoEditor.class.getName(),3000);
            solo.assertCurrentActivity("Failure to start PhotoEditorActivity", PhotoEditor.class);
}
PhotoEditor and CameraActivity in the same process, i can find it in 
androidmanifest.xml
manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.superd.camera3d"
<activity
            android:name="com.android.camera.CameraActivity"
            android:clearTaskOnLaunch="true"
<activity android:name="com.android.s3dgallery3d.photoeditor.PhotoEditor"

Original issue reported on code.google.com by lina_b...@163.com on 4 Jan 2015 at 10:27

GoogleCodeExporter commented 9 years ago
Thanks for reporting this. Would it be possible for you to share an app that 
exhibits this issue? You can email it to renasreda@gmail.com

Original comment by renasr...@gmail.com on 4 Jan 2015 at 12:40

GoogleCodeExporter commented 9 years ago
I have sent the app to your gmail box,please help to check,many thanks.

Original comment by lina_b...@163.com on 5 Jan 2015 at 1:38

GoogleCodeExporter commented 9 years ago
Hi renas��

I found the root cause, in manifest.xml file of app source code,
<activity
            android:name="com.android.camera.CameraActivity"
            android:clearTaskOnLaunch="true"
            android:configChanges="orientation|screenSize|keyboardHidden"
            android:icon="@mipmap/ic_launcher_camera"
            >
 <activity android:name="com.android.s3dgallery3d.photoeditor.PhotoEditor"
                android:label="@string/app_name"
                android:process=":edit">

So,they are in the different process.
Do you have resolved this type of problem ?
Many thanks.

Br,
Na

At 2015-01-04 20:41:02, robotium@googlecode.com wrote: >Updates: > Owner: 
renasr...@gmail.com > >Comment #1 on issue 648 by renasr...@gmail.com: 
waitForActivity return >false on robotium 5.2.1 
>https://code.google.com/p/robotium/issues/detail?id=648 > >Thanks for 
reporting this. Would it be possible for you to share an app >that exhibits 
this issue? You can email it to renasreda@gmail.com > >-- >You received this 
message because you starred the issue. >You may adjust your notification 
preferences at: >https://code.google.com/hosting/settings > >Reply to this 
email to add a comment.

Original comment by lina_b...@163.com on 5 Jan 2015 at 9:40

GoogleCodeExporter commented 9 years ago
Robotium uses instrumentation which only supports one process. Unfortunately 
there is no way around this. 

Original comment by renasr...@gmail.com on 5 Jan 2015 at 9:41