JasonWongYH / android-test-kit

Automatically exported from code.google.com/p/android-test-kit
0 stars 0 forks source link

No way to click outside of a dialog #7

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create an app that contains

        AlertDialog.Builder builder = new AlertDialog.Builder(this);

        // Get the list of possible periods from game.
        final String[] names = new String[0];

        final int[] checkedItem = {0};

        // Set the dialog title
        builder.setTitle("")
                .setSingleChoiceItems(names, checkedItem[0],
                        new DialogInterface.OnClickListener() {
                            @Override
                            public void onClick(DialogInterface dialogInterface, int i) {
                                checkedItem[0] = i;
                            }
                        })
                .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int id) {
                    }
                })
                .setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int id) {
                    }
                })
                .setOnCancelListener(new DialogInterface.OnCancelListener() {
                    @Override
                    public void onCancel(DialogInterface dialogInterface) {
// This is what we want to test
                    }
                });
        AlertDialog dialog = builder.create();
        dialog.show();

2. Execute the app to have the dialog show.
3.  Try to write an espresso test case that clicks outside of the Dialog to 
have it be dismissed.
onView(withId(...)) and onView(withText(....)) that match outside of the dialog 
the view that brought up the dialog do not match.

What is the expected output? What do you see instead?

What version of the product are you using? On what operating system?

Please provide any additional information below.

Original issue reported on code.google.com by marcp...@gmail.com on 2 Nov 2013 at 10:58

GoogleCodeExporter commented 9 years ago
This is currently not possible due to lack of multi-window support.

Dialogs are rendered in separate windows. Espresso has heuristics that allow it 
to pick the top window because that is the most likely (and usually the only) 
one the user would interact with. This works well for the common case; however, 
there are cases when a user is able to interact with more than one window (like 
yours). We plan to add multi-window support to address this. Stay tuned.

Original comment by valera.z...@gmail.com on 5 Nov 2013 at 5:33

GoogleCodeExporter commented 9 years ago

Original comment by thoma...@google.com on 5 Nov 2013 at 7:54

GoogleCodeExporter commented 9 years ago
Issue 16 has been merged into this issue.

Original comment by vale...@google.com on 12 Nov 2013 at 6:25

GoogleCodeExporter commented 9 years ago
Issue 20 has been merged into this issue.

Original comment by vale...@google.com on 14 Nov 2013 at 6:10

GoogleCodeExporter commented 9 years ago
Yup, seeing the same issue here with AutoCompleteTextView like Issue 16:
        onView(withId(R.id.autoCompleteInput)).perform(typeText("South"));
        onView(withId(R.id.searchButton)).perform(click());

Original comment by brianlee...@gmail.com on 15 Nov 2013 at 11:43

GoogleCodeExporter commented 9 years ago
fixed in 1.1

Original comment by thoma...@google.com on 9 Jan 2014 at 12:30