Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No way to click outside of a dialog #7

Closed
GoogleCodeExporter opened this issue Jun 29, 2015 · 6 comments
Closed

No way to click outside of a dialog #7

GoogleCodeExporter opened this issue Jun 29, 2015 · 6 comments

Comments

@GoogleCodeExporter
Copy link

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
Copy link
Author

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
Copy link
Author

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

  • Changed state: Accepted

@GoogleCodeExporter
Copy link
Author

Issue 16 has been merged into this issue.

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

@GoogleCodeExporter
Copy link
Author

Issue 20 has been merged into this issue.

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

@GoogleCodeExporter
Copy link
Author

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
Copy link
Author

fixed in 1.1

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

  • Changed state: Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant