public AltUnityObject WaitForElementWithText(string name, string text, string cameraName = "", double timeout = 20, double interval = 0.5)
    {
        double         time       = 0;
        AltUnityObject altElement = null;

        while (time < timeout)
        {
            try
            {
                altElement = FindElement(name, cameraName);
                if (altElement.GetText().Equals(text))
                {
                    break;
                }
                throw new System.Exception("Not the wanted text");
            }
            catch (System.Exception)
            {
                System.Threading.Thread.Sleep(System.Convert.ToInt32(interval * 1000));
                time += interval;
                UnityEngine.Debug.Log("Waiting for element " + name + " to have text " + text);
            }
        }
        if (altElement != null && altElement.GetText().Equals(text))
        {
            return(altElement);
        }
        throw new Assets.AltUnityTester.AltUnityDriver.WaitTimeOutException("Element with text: " + text + " not loaded after " + timeout + " seconds");
    }
Exemple #2
0
    public void TestCallMethodWithMultipleDefinitions()
    {
        AltUnityObject capsule = altUnityDriver.FindElement("Capsule");

        capsule.CallComponentMethod("Capsule", "Test", "2", "System.Int32");
        AltUnityObject capsuleInfo = altUnityDriver.FindElement("CapsuleInfo");

        Assert.AreEqual("6", capsuleInfo.GetText());
    }