gwaredd / unium Goto Github PK
View Code? Open in Web Editor NEWAutomation for Unity games
License: MIT License
Automation for Unity games
License: MIT License
Is it possible to perform drag and drop ?what is command to achieve it?
Hi there,
First of all I want to say thank you for putting together this library. It is pretty well thought out and, for an initial, "experimental" version, it has been surprisingly stable!
I am in the process of writing a Javascript client wrapper for the HTTP API and ran into what appears to be either a documentation issue or a bug. When making a GET request to utils/scene/oijsfiojeoijioejfjoi
while running the tutorial scene, I get the following response:
{"loading":"ojieiofjeoijfe"}
Indeed, when looking at the logs, I see the following:
However, the PDF states that the endpoint should "Load a scene by name (e.g. /utils/scene/tutorial). If no name given then list all scenes."
Rather than fixing it directly, I think it would be great if the functionality was split into multiple endpoints, following a more RESTful model:
utils/scenes
- lists the available scenes in a JSON arrayutils/scenes/<name>
loads metadata about a scene. Returns a 404 if the scene does not existutils/scenes/<name>
loads the scene by name. Returns a 400 (bad request) if the scene is not available to load.Doing this split would separate functionality into explicit read/write calls and simplify the design of a client library. By leveraging HTTP semantics, it also would make the API more familiar to those with a web development background.
How does this sound to you? Do you have other ideas on how you'd like to see this work? I am happy to consume it whatever you decide. Thanks again!
This appears to be by design but the behaviour is not desired in my application. In the editor the Server uses IPAddress.Any, which lets me connect to the Unium instance on
However due to line 117 of UniumComponent.cs
, in a build, I can only connect to the unium instance at the IP detected by Util::GetIPAddress()
. Besides being hard to always look up the external IP, this creates problems when there are multiple network interfaces (for instance ethernet + wifi) and we need to use ethernet on the local subnet but it grabs the IP from the wifi connection instead.
I can fix this by commenting this out and leaving IPAddress.Any, but I think it might be better to leave it that way by default, or expose the choice as an option.
It is mentioned in the Unity Asset store: "It embeds a web server into debug builds of your project which provides an interface and a query language the enables you to remotely control your game. This means you can use your favourite testing frameworks to write automated tests."
Does it mean that you could integrate with e.g. Katalon?
Does unium support touch events?
I am using the latest master build using unity 2017 on ios device, it works on start, if I turn off the screen and resume the app, the connection is lost.
Any reason it is commented out?
I am planning to use this for test automation for devices and wanted to know if it works with .NET framework subset 2.0.
Example- http://localhost:13000/q/scene/HomeScaler/Canvas/Nav Bar
I cannot access the tree inside Nav Bar
Hello,
I may be wrong but I could not compile Unium under Unity 2018.3.4f1.
I have an an issue with ScreenCapture.CaptureScreenshot( filename ); l 136 in HandlerUtils.cs.
I have looked in the history of the file and also looked for a custom implementation of ScreenCapture class, but found nothing.
So I think you are using the ScreenCapture class from Unity. Now it seems located inside UnityEngine. I had the code compile by changing :
ScreenCapture.CaptureScreenshot(filename); to
UnityEngine.ScreenCapture.CaptureScreenshot(filename);
Regards,
Jerome.
Is it possible to control the button so that it is automatically clicked, and if so, how is it implemented?
This is not an issue in the code per se, but a question on good practice.
How do you manage the maintenance of the scripts that interact with your code through unium?
E.g. do you document that some code is made public in order to be accessible by Unium?
use new WWW( "file:///" + filepath ) instead of new WWW( filepath ) will fix the problem.
Updating Unium for Unity 2018 might require some refactoring. Ignoring errors in sample code, compile errors stem from the UnityEngine.Network
API being deprecated.
e.g. Assets/Unium/UniumComponent.cs(118,65): error CS0619: `UnityEngine.Network.player' is obsolete: `The legacy networking system has been removed in Unity 2018.2. Use Unity Multiplayer and NetworkIdentity instead.'
Does unium supports cloud testing?
Hi,
I really like the Unium framework of yours for UI testing and I wanna include it in my university projects. Now, I tried to import Unium via the package.json, which you added a couple of days ago. Works nearly okay, but you are missing a package.json.meta in your Packages-folder. So, when I import the Unium package, I get an error in Unity saying:
Read only asset Packages/com.gwaredd.unium/package.json has no meta file.
System.Reflection.MethodBase:Invoke(Object, Object[])
JetBrains.Rider.Unity.Editor.UnityUtils:SyncSolution()
JetBrains.Rider.Unity.Editor.PluginEntryPoint:SyncSolutionOnceCallBack()
UnityEditor.EditorApplication:Internal_CallUpdateFunctions()
Could you fix that for some later commits ? It's not super-urgent, but I'd really like to import your work in my projects and that needs to use the package method because of the CI pipeline.
Thanks a lot, Great work you did,
Christian
There is a full feature mobile game automation tool called airtest that use a opensource library called Poco. It has free IDE to create test script, however, it use tcp socket for communication.
http://airtest.netease.com/
I like unium as it use restful and websocket.
I've been trying to run the Unium Tutorial on my Android device but without success. I noticed that you had some Android-specific code in there so was wondering if you have any advice on troubleshooting the issue.
Here's my setup:
$curl http://10.9.105.223:8080/about
curl: (7) Failed to connect to 10.9.105.223 port 8080: Connection refused
I tried a couple things:
UniumComponent.StartServer()
overrides the Settings.Address
for non-editor apps. I changed it to always force the Address to IPAddress.Any
.(PS: Thanks for this awesome tool, it's exactly what we've been looking for! We think it's going to change how we approach testing. Planning on leaving a review on the asset store once we get this up and running!)
Thanks,
Saswat
Hi. Thanks for fantastic framework. One of my big wishes will be to run this on public device farms such as AWS Device Farm. Do you have any ideas how to approach implementation of this feature. As a programmer I can certainly contribute to code this feature. My first idea is that we can implement special appium driver to forward our messages via appium server.
In the tutorial scene, GQL Action triggering MoveTo method does not receive a proper response, which is the new values.
Unity 2017.4.x, .Net 2.0 Subset
class EventListener
eventInfo.AddEventHandler is not working on IL2CPP (e.g. iOS ), but work on Mono and Editor
I would like to make a interactive treeview ui for unity gameobject hierarchy on web browser. However, most of the javascript treeview ui supports hierarchy tree json instead of the flat json that returned by Unium GQL.
The following is hierarchy tree json example.
e.g. [ { "name": "Parent", "children": [ { "name": "Child1", "children": [] }, { "name": "Child2", "children": [ { "name": "Child2_1", "children": [] } ] } ] } ]
Hi,
Sorry if my question may sound silly or naive, I am a total novice in Unity.
I am able to interact with the app through http://localhost:8342 when I run it from Unity editor. However, if build the app and run the .exe file instead, I cannot access the unium web server.
Is there a way to enable the web server in the built apps?
/Sergey
Hi there @gwaredd ,
Im evaluating Unium and I have run into an issue.
I am able to click on game objects that have the Button component with gameObject.Button.onClick()
However, for game objects that ALSO have an EventTrigger, I am having some trouble. If I do gameObject.Button.onClick()
on a gameObject that also has an event trigger component. the click does not actually happen.
I am unsure how I can instead invoke the function in an Event Trigger?
if I do gameObject.EventTrigger
I get an appropriate response.
Ive tried things like gameObject.EventTrigger.onPointerDown()
but that isnt correct
Please see the screenshot of the game object properties, would really appreciate help on how to successfully click this gameObject -> https://imgur.com/a/XC9WuR6
Thanks!
The scene hierarchy tree has been obtained, but the format displayed on the web page is incorrect.
the format show on the webpage likes this:
"[{"name":"Sphere","tag":"Untagged","activeInHierarchy":true,"components":["Transform","MeshFilter","MeshRenderer","SphereCollider"],"children":["Cube","children":[],"Cube (1)","children":["Sphere (2)","children":["Cube","children":[],"Cube (1)","children":[]]]]}]"
The thing I try to do: doing an automation based on a certain requirement which in the game shown as an image.
Is it possible in Unium to get the sprite/image or its filename on an Image component using Unium?
Because the /scene
endpoint evaluates all root objects on all loaded scenes, it actually fails to catch objects that have set DontDestroyOnLoad in its net. These objects in a sense don't live in a scene. I am trying to think of a more elegant solution for this than iterating through FindObjectsOfTypeAll<Transform>()
, mapping to the root of the transform hierarchy, and taking only unique entries, but at the moment coming short. If there's a way to do this more efficiently that'd be ideal. Of course this might also be another reason to consider more specific endpoints in addition to /scene/
, so that you can have the old and efficient behaviour with /scene/
and more power/less efficiency when you need it.
I want to change the main camera or player rotation,but it does't work,with url:
http://localhost:8342/q/scene//Player.Transform.rotation={'x':0,'y':-86,'z':0}
I have been playing around to validate this tool. So far everything is working as intended. I have come across an issue trying to run a couple of tests on an iOS device. When I attempt to bind to events.debug it returns with 'Not Found'.
I have narrowed the line of code when an exception is being thrown to EventListener line 40 eventInfo.AddEventHandler( Target, Delegate );
.
The exception message is 'A null value was found where an object instance was required.'
The exact same code and bind call works in the Editor and on an Android device.
On mobile platforms the filename is appended to the persistent data path.
https://docs.unity3d.com/ScriptReference/Application.CaptureScreenshot.html
Application.CaptureScreenshot( filename ) should not contain full path for mobile device build.
I tested on unity5.6.x with il2cpp android build
when connect using websocket, it close the connection immediately.
12-16 12:12:17.267: I/Unity(1037): Listening on 172.16.247.102:8342
12-16 12:12:17.267: I/Unity(1037):
12-16 12:12:17.267: I/Unity(1037): (Filename: ./artifacts/generated/Android/runtime/DebugBindings.gen.cpp Line: 51)
12-16 12:12:17.267: I/Unity(1037): [unium][0] server listening on 172.16.247.102:8342
12-16 12:12:17.267: I/Unity(1037):
12-16 12:12:17.267: I/Unity(1037): (Filename: ./artifacts/generated/Android/runtime/DebugBindings.gen.cpp Line: 51)
12-16 12:12:17.297: D/Unity(1037): Sensor : Accelerometer ( 1) ; 0.009577 / 0.01s ; BMC150 Acceleration Sensor / Bosch Sensortec
12-16 12:12:17.317: D/Unity(1037): Choreographer available: Enabling VSYNC timing
12-16 12:12:17.337: D/Unity(1037): Setting up 1 worker threads for Enlighten.
12-16 12:12:17.337: D/Unity(1037): Thread -> id: ffffffffb841f3f8 -> priority: 1
12-16 12:12:17.337: D/Unity(1037): ANativeWindow: (720/1280) RequestedResolution: (0/0) EGLSurface: (720/1280)
12-16 12:12:23.747: I/Unity(1037): [0] OPEN /ws - 172.16.252.127:37437
12-16 12:12:23.747: I/Unity(1037):
12-16 12:12:23.747: I/Unity(1037): (Filename: ./artifacts/generated/Android/runtime/DebugBindings.gen.cpp Line: 51)
12-16 12:12:23.757: I/Unity(1037): [unium][1] [sock:0] connected - /ws
12-16 12:12:23.757: I/Unity(1037):
12-16 12:12:23.757: I/Unity(1037): (Filename: ./artifacts/generated/Android/runtime/DebugBindings.gen.cpp Line: 51)
12-16 12:12:23.767: I/Unity(1037): [ws:0] Opening websocket id:0
12-16 12:12:23.767: I/Unity(1037):
12-16 12:12:23.767: I/Unity(1037): (Filename: ./artifacts/generated/Android/runtime/DebugBindings.gen.cpp Line: 51)
12-16 12:12:24.787: E/Unity(1037): [ws:0] Fatal error - at System.Net.Sockets.NetworkStream.EndRead (IAsyncResult ar) [0x00000] in :0
12-16 12:12:24.787: E/Unity(1037): at gw.proto.http.WebSocket.OnRead (IAsyncResult asyncResult) [0x00000] in :0
12-16 12:12:24.787: E/Unity(1037): at System.Net.Sockets.Socket+SocketAsyncResult.Complete () [0x00000] in :0
12-16 12:12:24.787: E/Unity(1037):
12-16 12:12:24.787: E/Unity(1037): (Filename: ./artifacts/generated/Android/runtime/DebugBindings.gen.cpp Line: 51)
12-16 12:12:24.787: E/Unity(1037): [ws:0] Terminating connection - System.IO.IOException: EndRead failure ---> System.Net.Sockets.SocketException: Operation on non-blocking socket would block
12-16 12:12:24.787: E/Unity(1037): at System.Net.Sockets.Socket+SocketAsyncResult.CheckIfThrowDelayedException () [0x00000] in :0
12-16 12:12:24.787: E/Unity(1037): at System.Net.Sockets.Socket.EndReceive (IAsyncResult asyncResult, SocketError& errorCode) [0x00000] in :0
12-16 12:12:24.787: E/Unity(1037): at System.Net.Sockets.NetworkStream.EndRead (IAsyncResult ar) [0x00000] in :0
12-16 12:12:24.787: E/Unity(1037): at gw.proto.http.WebSocket.OnRead (IAsyncResult asyncResult) [0x00000] in :0
12-16 12:12:24.787: E/Unity(1037): at System.Net.Sockets.Socket+SocketAsyncResult.Complete () [0x00000] in :0
12-16 12:12:24.787: E/Unity(1037): --- End of inner exception stack trace ---
12-16 12:12:24.787: E/Unity(1037): at System.Net.Sockets.NetworkStream.EndRead (IAsyncResult ar) [0x00000] in :0
12-16 12:12:24.787: E/Unity(1037): at gw.proto.http.WebSocket.OnRead (IAsyncResult asyncResult) [0x00000] in :0
12-16 12:12:24.787: E/Unity(1037): at System.Net.Sockets.Socket+SocketAsyncResult.Complete () [0x00000] in <filename unk
12-16 12:12:24.787: I/Unity(1037): [ws:0] Connection closed
12-16 12:12:24.787: I/Unity(1037):
12-16 12:12:24.787: I/Unity(1037): (Filename: ./artifacts/generated/Android/runtime/DebugBindings.gen.cpp Line: 51)
12-16 12:12:24.787: I/Unity(1037): [unium][2] [sock:0] closed
I am trying to perform some click operations on a ios build. The same code works fine with Andriod but not with iOS. Does unium support ios?
I have used unium as a bridge between appium and app. I have also setup xcuitest driver.
I am able to install and launch the application but cannot perform operations in app.
I am trying to inspect the element the element using phone ip
Ex: 10.0.0.59:13000/q/scene/canvas/button
Browser cannot detect the element.
I am trying to add custom handlers without modifying Unium itself. Shouldn't the Unium class be public?
Or maybe have a way to expose the Unium.RoutesHTTP
instance in some way?
I'm trying to click a certain object on screen but when I get the RectTransform.position
they are in negative number. Then of course the /q/simulate.click
function doesn't work properly.
Upon closer inspection it seems all the objects have different alignments/anchor etc.
For some buttons I can use the Button.onClick.invoke()
but others I wasn't able to. Is there a way to get correct position on screen so that I can use /q/simulate.click
function?
http://localhost:8342/q/scene/GameObject1.TextMesh.text=Line%0ALine2
it will cut the %0ALine2 where %0A is '\n'
It can be fix by adding RegexOptions.Singleline in Path.cs
static Regex sMatchToken = new Regex(
@"(?[/.])" +
@"(?[^\[\]\./=\(]+)?" +
@"([(?[^\]]+)])?" +
@"(?(=|()(?.*))?"
, RegexOptions.Singleline
// enable regex compilation if using the full .net API compatibility (much faster!)
#if NET_2_0
| RegexOptions.Compiled
#endif
);
While it's possible to automate click button, is there a way to automate a "click" on toggle button?
There are statics that do not get properly reset when entering Editor Play Mode if Domain Reload is disabled, as described in https://docs.unity3d.com/Manual/DomainReloading.html
E.g. sLog does not get cleared.
Hey there, thanks for the great framework here! I'm having trouble trying to access a specific instance of an element in a browser when multiples appear on a page (with identical properties). Page 6 of the help document seems to indicate that square brackets can be used to filter a specific instance of a element (exact reference below), but adding the square brackets does not seem to filter out that instance. I've tried putting the brackets in various locations, but can't seem to isolate the instance.
How can I access a specific instance of an element? Or in the attached example here, what would I have to modify in that URL to get a single ["Indicator"] to appear on the page? Thanks for any help on this!
Find all the pickups and return the 3rd one from the list (0 based index naturally)
/q/scene/Game/Pickup[2]
is it possible to trigger an event?
Reproduction steps:
How to deny whether the interface switches after clicking the button, whether some UI elements are switched, hidden, modified attribute values, whether the object is destroyed, and whether the scene is loaded. Output test report (assertion) to text
I'm running the tutorial, and the RESTful interface works fine, but the steps that use websockets fail with the message
Error connecting to game - is it running?
Connection closed
Debugging the JS, I see
Firefox can’t establish a connection to the server at ws://localhost:8342/ws. tutorial.js:34:48624
This isn't surprising, since UNet is deprecated and Unity is changing their networking libraries. Is there a Websockets library that needs to be installed or enabled for this to work with newer versions of Unity?
And finally, this package is really cool. Thanks for creating and sharing it.
In my project, during a GQL query, objects being serialized can have child components/transforms can have null values.
This causes null exceptions in UnitySerialisers.cs (during the foreach loops).
It would be nice if the serializer could skip the null components and continue serializing.
I have downloaded the framework and added it to my application, able to interact with the application from browser using GQL, by following all the steps as you have mentioned in the README file.
But when I build an apk file and install it on android device, How do I interact with the application installed on device using GQL.
And I am able to launch that application installed on device through Appium. But I don't know how to interact with that launched application using this framework.
I am new to this unity and unium framework, please help me with this. Thanks in advance
In order to get the IP address of the android or ios device manually is not practical for fully automatic test.
If we can use adb forward tcp:8342 tcp:8342 (Android) or iproxy (iOS) , it will be easier.
However, unium websocket or http cannot support adb forward.
If you have a cloned GameObject with the name like "MyGO(Clone)" then when trying to just reference that by its path I get an error:
GQL::Query - failed to parse query, no attribute to set
Looking at the regex code it looks like it's taking the () brackets as an indication that it's an action (method invoke?) query when all I'm actually trying to do is get that GO's info.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.