public IEnumerator CheckObjectDisabledFailCases() { yield return(null); var testObject = UITestUtils.FindAnyGameObject <TestObject>(); testObject.gameObject.SetActive(true); try { Check.IsDisabled <TestObject>(); Assert.Fail(); } catch (AssertionException ex) { if (!ex.Message.EndsWith("enabled")) { throw ex; } } try { Check.IsDisabled("container"); Assert.Fail(); } catch (AssertionException ex) { if (!ex.Message.EndsWith("enabled")) { throw ex; } } try { Check.IsDisabled <TestObject>("container"); Assert.Fail(); } catch (AssertionException ex) { if (!ex.Message.EndsWith("enabled")) { throw ex; } } try { Check.IsDisabled(testObject.gameObject); Assert.Fail(); } catch (AssertionException ex) { if (!ex.Message.EndsWith("enabled")) { throw ex; } } }
public IEnumerator CheckForToggleOffFailCases() { yield return(null); var testToggle = UITestUtils.FindAnyGameObject <Toggle>(); try { testToggle.isOn = true; Check.Toggle("container/Toggle", false); Assert.Fail(); } catch (AssertionException ex) { if (!ex.Message.EndsWith("but expected is Off")) { throw ex; } } Object.DestroyImmediate(testToggle); try { Check.Toggle("container/Toggle", false); Assert.Fail(); } catch (AssertionException ex) { if (!ex.Message.EndsWith("has no Toggle component.")) { throw ex; } } }
public IEnumerator FindObjectByPixelsFail() { yield return(null); var obj = UITestUtils.FindObjectByPixels(20, 20); Assert.IsNull(obj); }
public IEnumerator FindObjectByPixels() { yield return(null); var obj = UITestUtils.FindObjectByPixels(630.0f, 325.0f); Assert.IsNotNull(obj); Assert.AreEqual(obj.name, "Image"); }
public IEnumerator ClickOnObject() { yield return(null); Interact.ClickPixels(512, 41); var openedWindow = UITestUtils.FindAnyGameObject("Window"); Assert.IsTrue(openedWindow.activeInHierarchy); }
public IEnumerator CheckObjectDontExists() { yield return(null); var testObject = UITestUtils.FindAnyGameObject <TestObject>().gameObject; Object.DestroyImmediate(testObject); Check.DoesNotExist("container"); Check.DoesNotExist <TestObject>(); Check.DoesNotExist <TestObject>("container"); }
public IEnumerator CheckForToggle() { yield return(null); var testToggle = UITestUtils.FindAnyGameObject <Toggle>(); testToggle.isOn = true; Check.Toggle("container/Toggle", true); testToggle.isOn = false; Check.Toggle("container/Toggle", false); }
public IEnumerator WaitForButtonAccesible() { var exceptionMessage = "Exception: Operation timed out: Wait failed, reason: ButtonAccessible UnityEngine.GameObject"; PermittedErrors.Add(exceptionMessage); var waiter = AsyncWait.StartWaitingForLog(exceptionMessage, LogType.Exception); var button = UITestUtils.FindAnyGameObject("container"); yield return(Wait.ButtonAccessible(button)); yield return(waiter); }
public IEnumerator WaitForObjectDestractionByInstance() { var objectInstance = UITestUtils.FindAnyGameObject <TestObject>().gameObject; var exceptionMessage = "Exception: Operation timed out: Wait failed, reason: WaitForDestroy UnityEngine.GameObject"; PermittedErrors.Add(exceptionMessage); var waiter = AsyncWait.StartWaitingForLog(exceptionMessage, LogType.Exception); yield return(Wait.ObjectDestroyed(objectInstance)); yield return(waiter); }
public IEnumerator DragByPath() { Vector2 to = new Vector2(934, 0); var handle = UITestUtils.FindAnyGameObject("Handle"); yield return(Interact.DragPixels("container/Slider/Handle Slide Area/Handle", to)); var center = UITestUtils.CenterPointOfObject(handle.transform as RectTransform); Assert.AreEqual(center.x, 934, 0.1f); Assert.AreEqual(center.y, 526, 0.1f); }
public IEnumerator DragByCoords() { Vector2 from = new Vector2(45, 526); Vector2 to = new Vector2(934, 0); yield return(Interact.DragPixels(from, to)); var handle = UITestUtils.FindAnyGameObject("Handle"); var center = UITestUtils.CenterPointOfObject(handle.transform as RectTransform); Assert.AreEqual(center.x, 934, 0.1f); Assert.AreEqual(center.y, 526, 0.1f); }
public IEnumerator WaitForObjectDisabled() { //get manual reference to the object var objectInstance = UITestUtils.FindAnyGameObject <TestObject>(); //manually disable object objectInstance.gameObject.SetActive(false); //check for disabled yield return(Wait.ObjectDisabled("container")); //check for disabled yield return(Wait.ObjectDisabled <TestObject>()); }
public IEnumerator WaitForObjectEnabled() { //get manual reference to the object var objectInstance = UITestUtils.FindAnyGameObject <TestObject>(); //manually enable object objectInstance.gameObject.SetActive(true); //check for enabled by component type yield return(Wait.ObjectEnabled <TestObject>()); //check for enabled by path in hierarchy yield return(Wait.ObjectEnabled("container")); }
public IEnumerator WaitForObjectByComponentAndName() { var testObject = UITestUtils.FindAnyGameObject <TestObject>().gameObject; Object.DestroyImmediate(testObject); var exceptionMessage = "Exception: Operation timed out: Wait failed, reason: WaitForObject<PlayQ.UITestTools.Tests.TestObject>"; PermittedErrors.Add(exceptionMessage); var waiter = AsyncWait.StartWaitingForLog(exceptionMessage, LogType.Exception); yield return(Wait.ObjectInstantiated <TestObject>("container")); yield return(waiter); }
public IEnumerator WaitForObjectEnabledByComponent() { var exceptionMessage = "Exception: Operation timed out: Wait failed, reason: WaitObjectEnabled<PlayQ.UITestTools.Tests.TestObject>"; PermittedErrors.Add(exceptionMessage); var waiter = AsyncWait.StartWaitingForLog(exceptionMessage, LogType.Exception); var testObject = UITestUtils.FindAnyGameObject <TestObject>().gameObject; testObject.SetActive(false); //check for enabled by component type yield return(Wait.ObjectEnabled <TestObject>()); yield return(waiter); }
public IEnumerator WaitForObjectEnabledByName() { var exceptionMessage = "Exception: Operation timed out: Wait failed, reason: WaitObjectEnabled path: container"; PermittedErrors.Add(exceptionMessage); var waiter = AsyncWait.StartWaitingForLog(exceptionMessage, LogType.Exception); var testObject = UITestUtils.FindAnyGameObject <TestObject>().gameObject; testObject.SetActive(false); //check for enabled by path in hierarchy yield return(Wait.ObjectEnabled("container")); yield return(waiter); }
public IEnumerator WaitForObjectDestraction() { //manually search for object in scene var objectInstance = UITestUtils.FindAnyGameObject <TestObject>().gameObject; Object.Destroy(objectInstance); //wait during interval for destraction of object with component "ObjectThatWillBeDestroyedInSecond" yield return(Wait.ObjectDestroyed <TestObject>()); //wait during interval for object destraction by object name "Object_that_will_be_destroyed_in_second" yield return(Wait.ObjectDestroyed("container")); //wait during interval for object destraction by object instance yield return(Wait.ObjectDestroyed(objectInstance)); }
public IEnumerator CheckObjectExistsFailCases() { yield return(null); var testObject = UITestUtils.FindAnyGameObject <TestObject>(); Object.DestroyImmediate(testObject.gameObject); try { Check.IsExists("container"); Assert.Fail(); } catch (AssertionException ex) { if (!ex.Message.EndsWith("not exist.")) { throw ex; } } try { Check.IsExists <TestObject>(); Assert.Fail(); } catch (AssertionException ex) { if (!ex.Message.EndsWith("not exist.")) { throw ex; } } try { Check.IsExists <TestObject>("container"); Assert.Fail(); } catch (AssertionException ex) { if (!ex.Message.EndsWith("not exist.")) { throw ex; } } }
public IEnumerator CheckObjectDisabled() { yield return(null); var testObject = UITestUtils.FindAnyGameObject <TestObject>(); testObject.gameObject.SetActive(false); //ensure object disabled by component Check.IsDisabled <TestObject>(); //ensure object disabled by path in hierarchy Check.IsDisabled("container"); //ensure object disabled by path in hierarchy and component type Check.IsDisabled <TestObject>("container"); //ensure object disbaled by object instance Check.IsDisabled(testObject.gameObject); }
public IEnumerator CheckObjectEnabled() { yield return(null); //get manual reference to the object var testObject = UITestUtils.FindAnyGameObject <TestObject>(); testObject.gameObject.SetActive(true); //ensure object enabled by component Check.IsEnabled <TestObject>(); //ensure object enabled by path in hierarchy Check.IsEnabled("container"); //ensure object enabled by path in hierarchy and component type Check.IsEnabled <TestObject>("container"); //ensure object enabled by object instance Check.IsEnabled(testObject.gameObject); }
public IEnumerator WaitForButtonAccesible() { var button = UITestUtils.FindAnyGameObject("container/Button"); yield return(Wait.ButtonAccessible(button)); }
public IEnumerator CheckTextEquals() { yield return(null); var testText = UITestUtils.FindAnyGameObject <Text>(); testText.text = "text"; Check.TextEquals("container/Text", "text"); Check.TextNotEquals("container/Text", "random text"); try { Check.TextEquals("container/Text", "random text"); Assert.Fail(); } catch (AssertionException ex) { if (!ex.Message.EndsWith("text dont't match")) { throw ex; } } try { Check.TextEquals("container", "text"); Assert.Fail(); } catch (AssertionException ex) { if (!ex.Message.EndsWith("no Text attached")) { throw ex; } } try { Check.TextNotEquals("container/Text", "text"); Assert.Fail(); } catch (AssertionException ex) { if (!ex.Message.EndsWith("text matches but must not")) { throw ex; } } try { Check.TextNotEquals("container", "text"); Assert.Fail(); } catch (AssertionException ex) { if (!ex.Message.EndsWith("no Text attached")) { throw ex; } } }