android - Testing SharedPreference pop-up -
i have settings activity in used sharedpreference set simple options application. have edittextpreference , listpreference. want test when select option in listpreference or when enter text in edittextpreference sharedpreference set correctly. problem have can click on listpreference , pop-up 5 options show up. cannot figure out way select 1 of option. tried this:
onview(withtext(r.string.list_color_selection_title)).perform(click()); onview(withtext("yellow")).inroot(isplatformpopup()).perform(click()); sharedpreferences defaultsharedpreferences preferencemanager.getdefaultsharedpreferences(mcontext); string defaultemailvalue = defaultsharedpreferences.getstring("list_color", "null"); assertequals("yellow",defaultemailvalue);
this doesn't work. have find people doing kind of thing:
onview(viewmatchers.withcontentdescription("somedescription")) .inroot(rootmatchers.isplatformpopup()) .perform(viewactions.click());
it doesn't work either. don't know how find contentdescription of options. if use text "yellow" doesn't work.
thank help!
wiki
Comments
Post a Comment