-
Notifications
You must be signed in to change notification settings - Fork 7
Methods
Note: if a setting is not set, it will take default value for each
-
static void Set(Settings setting, object value)
=> Set setting and its value, that will be used by Pupetry.Puppeteer:-
BaseUrl
=> base url of Puppetry.PuppetDriver endpoint that will be called by Puppetry.Puppeteer. Example: "http:\localhost" or "http:\127.0.0.1"; -
Port
=> port of Puppetry.PuppetDriver endpoint that will be combined with BaseUrl and called by Puppetry.Puppeteer. Example: "7111"; -
TimeoutMs
=> Default timeout in ms that will be used in Polling methods if custom timeout isn't provided; -
SessionTimeoutMs
=> Default timeout in ms that will be used in creating PuppetDriver's session; -
PollingStrategy
=> Strategy that will be used in polling methods. Can be Constant (will check result with constant step time in 500 ms) or Progressive (will check result with progressive step time: 100, 200, 400, 800 and so on);
-
-
void ReleaseSession()
=> Release current session to make usage Editor be available for next test; -
void ReleaseAllSessions()
=> Release all sessions, even from other threads. Useful in the end of run, or at the begging to be sure that all Editors will be available for next tests;
Note: methods of the class are available only if tests are executed in UnityEditor
-
public static void StartPlayMode()
=> Starts PlayMode in Editor; -
public static void StopPlayMode()
=> Stops PlayMode in Editor;
Note: methods of the class are available only if a Game is started. You can't use it in Edit Mode of the Editor.
Will receive PlayModeIsNotStartedException
exception if it was called in EditMode or PlayMode was not really started yet.
-
static void MakeScreenshot(string fileName, string folderName)
=> Make screenshot of a game and save it to Directory.GetCurrentDirectory() + folderName with name fileName.png. If folderName is not exist, than will create it; -
static void MakeScreenshot(string fullPath)
=> Make screenshot if a game and save it to path that declared. fullPath argument should contant full path + name of the screenshot with resolution (like *.png). The method won't create folder if it isn't exist, so you should create by yourself; -
void DeletePlayerPref(string key)
=> Delete PlayerPref by the key; -
void DeleteAllPlayerPrefs()
=> Delete All PlayerPrefs; -
float GetFloatPlayerPref(string key)
=> Get PlayerPref by the key with float value; -
int GetIntPlayerPref(string key)
=> Get PlayerPref by the key with int value; -
string GetStringPlayerPref(string key)
=> Get PlayerPref by the key with string value; -
void SetFloatPlayerPref(string key, float value)
=> Set PlayerPref with the key and float value; -
void SetIntPlayerPref(string key, int value)
=> Set PlayerPref with the key and int value; -
void SetStringPlayerPref(string key, string value)
=> Set PlayerPref with the key and string value; -
bool PlayerPrefHasKey(string key)
=> Check if PlayerPref with given key is exist;
Note: use this class to interact with some GameObject of the application
methods of the class are available only if a Game is started. You can't use it in Edit Mode of the Editor.
Will receive PlayModeIsNotStartedException
exception if it was called in EditMode or PlayMode was not really started yet, except while FindBy
** methods or initializing new
instant.
-
GameObject FindByUPath(string upath)
=> Sets Upath locator that will be used to find the GameObject and return its instance; -
GameObject FindByName(string root, string name)
=> Sets root element and name of the GameObject that will be used to find the GameObject. Root element should be active in hierarchy, otherwise that element wan't be found. The GameObject is descendant of the root element (not only direct child); -
GameObject FindByNameAndParent(string root, string name, string parent)
=> Sets root element, parent element and name of the GameObject. Unity will search for root element (should be active in hierarchy), then will search for parent name (could be active and inactive in hierarchy + parent is descendant) and finally will search for GameObject with given name (could be active and inactive in hierarchy + the gameObject is descendant of parent element); -
bool Exists
=> property that returns result if the GameObject is exist in the hierarchy; -
bool IsActiveInHierarchy
=> property that returns result if the GameObject is active in the hierarchy. NoSuchGameObjectException may be occurred if the gameObject is not existed. Need to be sure that the element is exist, before check if it is active in hierarchy; -
bool IsRendering
=> property that returns result if the GameObject is rendering (gameObject.GetComponent().isVisible). NoSuchGameObjectException may be occurred if the gameObject is not existed; -
bool IsOnScreen
=> property that returns result if the GameObject is on the screen (by coordinates) but is not guaranteed that any other gameObject is not overlap the GameObject. NoSuchGameObjectException may be occurred if the gameObject is not existed; -
bool IsGraphicClickable
=> property that returns result if the GameObject is clickable, checking Graphically (the gameObject is on the screen and Ui.Graphic.RayCast is hit the element first, so no other UI element is overlap the gameObject). NoSuchGameObjectException may be occurred if the gameObject is not existed; -
int Count
=> returns number of GameObjects with given locator, if any gameObject was found, Count would be 0; -
void Click()
=> emulates Click on first gameObject that was found by set locator; -
void SendKeys(string value)
=> sets value to Input of the GameObject (gameObject.GetComponent().text = value) that was found by set locator; -
void DragTo(GameObject toGameObject)
=> emulate Drag from center of the game object to toGameObject center; -
void DragTo(ScreenCoordinates toCoordinates)
=> emulate Drag from center of the game object to given screen coordinates; -
void Swipe(Constants.Directions direction)
=> emulate Swipe to selected direction (Up, Down, Left or Right) from center of the gameObject that was found by set locator; -
string GetComponent(string component)
=> returns json of given component. NoSuchGameObjectException may be occurred if the gameObject is not existed; -
ScreenCoordinates GetCoordinates()
=> returns 2d coordinates of the gameObject. NoSuchGameObjectException may be occurred if the gameObject is not existed; -
void Should(Condition condition, int timeoutMs)
=> Checks with set timeout a condition (like Should(Be.ActiveInHierarchy)). Will wait timeoutMs until given conditon is fulfilled or timeoutMs has expired; -
void Should(Condition condition)
=> calls void Should(Condition condition, int timeoutMs) and uses Configuration.TimeoutMs as set timeoutMs; -
void ShouldNot(Condition condition, int timeoutMs)
=> Checks with set timeout a condition is not fulfilled (like ShouldNot(Be.ActiveInHierarchy)). Will wait timeoutMs until given conditon is not fulfilled or timeoutMs has expired; -
void ShouldNot(Condition condition)
=> calls void ShouldNot(Condition condition, int timeoutMs) and uses Configuration.TimeoutMs as set timeoutMs;