how to navigate to settings in android emulator using robotium? - robotium

I am a newbie for Robotium and till then I managed to learn a lot by directly writing test cases for public websites and sorted out several issues from answers in stackoverflow. now, I seemed to hit the wall at this (probably)trivial problem.
I would like to navigate to 'Settings' icon which is inside 'Apps' menu of the android emulator using some sort of 'robotium-solo' method.
This is my failed attempt:
solo.sendKey(KeyEvent.KEYCODE_HOME);
//solo.clickOnImageButton(2); // no success!
//solo.clickOnActionBarItem(2); // no success!
solo.clickOnText("Settings");
solo.clickOnText("Music");
I checked for any KEYCODE_var for home screen 'app' icon but couldn't find one.
There is no useful log message in DDMS to figure out the starting activity when clicked/tapped on that button.s
Please guide me whether my approach is any good and help me with an answer. Thanks.

you can check with getCurrentViews() and have the list of views displayed before clicking the menu button and after clicking the menu button.By comparing them you can get the view of the new views displayed (i.e. settings button).
After getting the view,you can go with solo.clickOnView(ViewNameObtained);
This will solve your problem for sure.

As far as I know, navigating to settings is not possible with robotium. Even if you would be able to go there you cannot perform any other action as Settings are not port of your application. Android Instrumentation allows performing actions only within one package and robotium is only wrapper for that, so it's not able to click outside your application as well.
You can use UI Automator for that.

Related

How do I make my react-native(built using Expo) app such that it can't exit?

I need to develop an app that works like the default app which can't be exited by pressing the home or back buttons or using the status bar. I need to disable them. How do I do so?
I'm not exactly sure where to look at and have been struggling to find documentation. Could someone help me

Proper way to close dialogs in Flutter tests

Flutter's WidgetTester has a pageBack() method for popping the route stack. When I open a page as a fullscreen dialog using MaterialPageRoute's fullscreenDialog property, the pageBack() method does not work ("One back button expected on screen"). I can't find an alternative method for the job.
What is the standard way to cancel/close a dialog in a Flutter test?
I am able to close the dialog as follows:
await tester.tap(find.byIcon(Icons.close));
But then I could have instead done a pageBack() as follows:
await tester.tap(find.byIcon(Icons.arrow_back));
Why have the pageBack() method but no equivalent for closing a dialog?
I have not yet written my Cupertino UI yet. Will that test need to look for a different icon?
See also a similar problem I had with selecting the overflow menu.
UPDATE: Maybe pageBack() emulates pressing the system back button, not the back arrow? In that case, there would be no need to emulate the behavior on iOS, and I would have to find the back button by icon to emulate pressing it, anyway.
You can have a dialog that contains a button with a text 'X', which pops the dialog.
This button, you can find with
await tester.tap(find.text('X'));
and don't forget to pump to go through with the tap
await tester.pumpAndSettle();
Have a look at the full code sample the flutter team is using to test dialogs: source code
I think finding by Icons.close seems reasonable. I did similarly in my app. Another option could be assuming the x,y of the button in the navigation bar and just tapping at that location on the screen.
I faced a similar problem earlier and I found the following solution that worked fine for my case.
Navigator.of(context, rootNavigator: true).pop('dialog')
Or you can write like,
Navigator.of(context).pop();
Navigator.pop(context);
You can check the brief documentation on Flutter Navigation and Routing here.
Hope, this would work. Have a great day.

Changing Taskbar menu icon in nodewebkit app dynamically

I am working on a nodewebkit app. Looking for a functionality where in I can change task-bar icon of app to notify users, similar to what Skype does when a new message is received by user.
Is there any way it can be done in Nodewebkit?
Initially I tried changing window.icon in package.json file, but then I came to know that it is used only once, i.e. on app load. So that did not work.
Anything else I can try?
Thanks in advance
Window.requestAttention(Boolean attention) is what I was looking for.
It worked for me.
Thanks to Dhiraj, It gave me an additional feature for icon.

How to use AssistiveTouch UI in iOS

I'm now developing an app on iOS. With some reason, I want to use AssistiveTouch UI in my app. For example, there will display a button in my app like AssistiveTouch, if anyone press this button, four buttons will appear like AssistiveTouch, if anyone press one of there four buttons again, some action i set before will excuse.
Does apple support api about this? Or Is there any source code available?
You would have to reimplement this from scratch. There is no public API for either accessing the existing Assistive Touch feature (it has to be turned on by the user in the settings) or for creating a similar UI.

Is it possible to enable or disable VoiceOver within an iOS app?

I would like to be able to turn VoiceOver on or off within my iOS app. The reason for this is I am trying to help a person with disabilities which render her unable to read messages (hence the need for VoiceOver), and who is also unable to triple click the home-button due to motor coordination problems. The way to the setting through Settings>General>Accessibility>VoiceOver>VoiceOver>Flipswitch is far too long and complicated.
Is it possible, without jailbreaking the device, to change this setting in an app? The app doesn't need to make it to the App Store, if that helps.
Alternatively, is it easy to do this with a jailbroken device?
Another approach may be to simulate the triple-click on the home-button that automatically turns on VoiceOver. Is there any way to do this?
Get the app aHomeIcon.
Open the app and tap URL.
Insert the url: prefs:root=General&path=ACCESSIBILITY
Tap 'Done'.
Insert a name to be shown below the icon.
Tap the export button at the bottom of the page. Safari opens.
Add a bookmark and select 'to home-screen'.
Now you can tap that icon and you are redirected to the accessibility part of the settings app.
See this link for reference.