Simulate Mouseclick-Events on a jailbroken device via cycript - ios

I'm interested in the iOS-Tweak "MouseSupport" Source Code (Repo) from Matthias Ringwald. Does anybody know how to use it?
I would like to simulate Mouseclick-Events while being hooked up at SpringBoard (via cycript)
(a goal would be for example to click programmatically on buttons or just simulate a click at a specific point via coordinates).
Thx

Regarding your goals; take a look at cocoawithlove.com or check out the Private Framework Header repo by masbogs on Github.

Related

How to automate mac app using Xcode?

I try to add UI test cases to our existing mac application. I already tried UI test cases for iOS, which includes the following steps
I choosed Appium instead of Apple's UIAutomator, because I want to maintain the same flow for our Android apps too.
To proceed the automation, I need to set Labels/Values/Identifiers to the elements. So that they can be accessible. We used drawRect method in most parts, so I followed this post to make drawed components accessible.
I can set/read elements in iOS. What I did is, whenever I draw an element, I simply created an UIAccessibilityElement and added in the corresponding view.
Now, I'm trying to write UI tests for our mac application. As Appium does not have support to the mac application, I considered to use Apple's XCTest UI recording/playback to automate my mac application.
Here is the steps that I took:
NSAccessibility is the class that provides accessibility to the mac application
With XCTest, If I knew a particular elements (say a button) identifier/label, I can proceed with automated tap action
Unlike UIAccessibility, NSAccessibility is a role based object. That is, we need to mention which type of accessibility element that we are going to define.
To start the automation process, I took my mac applications left panel, which has five buttons aligned vertically in it
I set identifiers to those buttons. Then I opened Accessibility Inspector and opened my mac app. The values are properly set.
Then I tried to use record option in XCTest. When tapping the button, crashes the app with the error
"Recorder Service Error: Left Mouse Down: Failed to find matching
element".
I posted about it here.
Questions:
Can someone suggest me the right path to automate mac application? Am I going in the right way?
I googled a lot to see a working sample code about how to implement NSAccessibility. But I can not found anything. Can someone share any useful links/samples?
All I need is, to get elements by identifier/label. Accessibility Inspector shows the right value where as XCTest can not read the identifiers. Did anyone face this issue?
Thanks in Advance

uploading firmware to particle io's photon

I am receiving an "Error 1" when using particle io relay - I am using the same exact firmware found here: https://github.com/spark/relayshield. What do I need to change?
1_Blink_a_Relay.cpp:2:37: fatal error: RelayShield/RelayShield.h: No such file or directory
#include "RelayShield/RelayShield.h"
It looks like your code can't find the library you're trying to import. Often (and especially when adapting Arduino code for Particle), the folder name for a library needs to be removed. Try #include "RelayShield.h instead.
If that doesn't work, please provide a little more information, such as your development environment. (Are you using Particle's web-based IDE? Did you import the library from there?)
Cheers!
If you are using the web ide, the one at build.particle.io, then you have to include the library. You have to go to the fifth item on the left menu bar, after flash, compile, save, and code. It should say library, and looks like a bookmark. Click on that. It will pop out a view. Scroll down until you see the Community Library search bar. And search for RelayShield. It will show you the "RELAYSHIELD", which currently is used by 520 people (or something like that). Click on that, and it will open the library. Scroll down on the left side (the one that pops up) until you see the button "Include in App". Click on that, and select your app. After you click on that, it will bring up your app. Then scroll down on that popped out view, until you see "Add to this App". Just click on this button, and then it will include that library in your project.
For Particle Dev on Desktop, it is a lot harder. If you are using Particle Dev, please reply, and I will give you the solution for that. It is very hard to manage libraries with Particle Dev. However, if you want to use the Serial Monitor while using the Particle Build on the internet, what you can do is that you do the regular serial commands on the Particle Build (build.particle.io), and open the Serial monitor on Particle Dev after also connecting to your Particle photon

How do I take screenshots of my UI with Xcode 7 during UI Testing?

So I downloaded the beta of XCode 7 and I've created some UI tests, but I can't find the functionality of how to take screenshots of my app/UI during the test.
Can someone please help?
UI Testing in Xcode automatically takes screenshots of your app after every step.
Simply go to one of the tests that has already ran (Report Navigator > choose a Test), then start expanding your tests. When you hover your mouse over the steps, you will see eye icons near each step that has a screenshot.
Here's an example... in this case, notice the eye icon at the end of the gray row. If I were to tap on it, I would see a screenshot of the app right when the button in my app was tapped (since the step is Tap the "Button" Button).
If you want to generate screenshots, you can also use snapshot, which describes how to trigger screenshots in UI tests: https://github.com/fastlane/fastlane/tree/master/snapshot#how-does-it-work
It basically rotates the device to .Unknown (Source), which triggers a snapshot without actually modifying your app's state.
Comparing the output with the generated plist file enables you to even properly name the screenshot
Facebook's ios-snapshot-test-case and KIF both run as Unit Tests, and therefore are in the same process as the app. As such, they can directly access views and use something like renderView: or snapshotViewAfterScreenUpdates. Xcode UI Testing runs in a separate process, and therefore cannot directly access the views.
UI Automation, Apple's now-deprecated Javascript UI testing library, had a function calledcaptureScreenWithName.
Unfortunately, the new Xcode UI Testing lacks any similar function in its testing library, which to me seems like a glaring omission and I encourage you to submit a Radar for it, as taking screenshots is fundamental to perceptual difference tests (which it sounds like you're trying to do). I hope (and expect) that able will address this deficiency in later Xcode updates.
In the meantime, there are more creative approaches to taking screenshots. See this stack overflow response for a workaround involving taking the screenshot in the app itself and then sending it to the test process.
I' ve created a tool that saves the tests last n screenshots and generates the JUnit tests results report, parsing TestSummaries plist file from test logs. https://github.com/nacuteodor/ProcessTestSummaries
Maybe, that helps you.
Facebook's FBSnapshotTestCase can be alternative solution:
https://github.com/facebook/ios-snapshot-test-case

how to identify path for android using appium

This is for iOS to find all the elements:
driver.findElementsByXPath("//UIAApplication[1]/UIAWindow[1]/UIACollectionView[1]/UIACollectionCell");
I need the similar path for android, I tried:
driver.findElementsByXPath("//android.view.View[1]/android.widget.GridView[1]")
But it's not working. Please help
Please post the log from Appium console, so that we will be able to find out the exact issue.
From :
//android.view.View[1]/android.widget.GridView[1]
It seems there are multiple GridViews are available on that particular screen. Please try to put some constraints.
e.g
//android.view.View[#id='Id_of_the_View']/android.widget.GridView[#something here too]
If you are on a native application, just use the inspector or hierarchy viewer to get the Xpath but I would advise you use driver.findElement(s)ById to get specific elements. Hope this helps.
If you could give a bit more detail maybe I could help.
If you are using Eclipse as editor, then you can open an emulator where you have the app installed, then open DDMS perspective from Eclipse.
Go into your app at the view you want to inspect, and then click the button Dump View Hierarchy for UI Automator in the DDMS perspective.
This will give you a snapshot and you can hover over elements and find their properties.

Creating an iOS library or framework using libgdx (roboVM)

Is it possible to create an iOS library or framework using libgdx (RoboVM) that can be imported into Xcode?
Background:
One of my colleagues has created a 3D visualisation app as a libgdx project for android and windows desktop. It can be compiled to run on iOS using RoboVM. However, I would like to wrap extra native user interface elements around it using Xcode. I know its possible to build the user interface programmatically via RoboVM but I would be keen to investigate if its possible to bring the existing work into Xcode. I don't need to edit the 3D visualisation component but add extra GUI elements around the 3D Vis window. I thought compiling the libgdx (RoboVM) code to a framework or library might be a solution that could be imported?!
Yes you can do it.
All you need to create a method, say initRoboVM(), This will be called by your code when you want to initialize libgdx. You'll need to pass the app path in, which you can hardcode when you're testing.
initRoboVM() will need some modifications, namely it should not call your Java app's main method, well, at least, that's what well behaving libraries should not do IMO. It should also not call rvmShutdown.
You can get further information from here
Thanks :)
I asked the RoboVM team directly. Their answer: It's not a native function, but it certainly can be done.
The complete message...
Hi,
Sorry for the late reply. This use case is not something we're going
to do now. It is possible though if you're prepared to do some
patching of RoboVM. Search the RoboVM Google Group and you should find
others who have managed to get this working.
We get this request every know and then so we will add support for
this eventually.
Regards, Niklas

Resources