Inheritance: Clothing
 // Use this for initialization
 void Start()
 {
     // find the sensor in children
     if (!eye)
     {
         eye = gameObject.GetComponentInChildren<Eyes>();
     }
 }
Example #2
0
 /// <summary>
 /// Gets the currently active render texture for the given eye.
 /// </summary>
 /// <param name="eye">The eye.</param>
 /// <returns>the eye's scene texture</returns>
 public RenderTexture GetEyeSceneTexture(Eyes eye)
 {
     return(this.eyeTextures[this.currentEyeTextureIdx + ((int)eye)]);
 }
 public bool TryGetFeatureValue(InputFeatureUsage <Eyes> usage, out Eyes value)
 {
     return(m_inputDevice.TryGetFeatureValue(usage, out value));
 }
Example #4
0
 public DetectedBlinkEventArgs(Eyes eye, WinkState state, double timeStamp)
 {
     Eye       = eye;
     State     = state;
     TimeStamp = timeStamp;
 }
        public static void Main()
        {
            // Open a Chrome browser.
            var driver = new ChromeDriver();

            // Initialize the eyes SDK and set your private API key.
            var eyes = new Eyes();

            eyes.ApiKey = "Applitools_ApiKey";

            try
            {
                // Start the test and set the browser's viewport size to 800x600.
                eyes.Open(driver, "Hello World!", "My first Selenium C# test!", new Size(800, 600));

                // Navigate the browser to the "hello world!" web-site.
                driver.Url = "https://applitools.com/helloworld";

                // Visual checkpoint #1.
                eyes.CheckWindow("Hello!");

                //Click the "Click me!" button.
                driver.FindElement(By.TagName("button")).Click();

                //Visual checkpoint #2.
                eyes.CheckWindow("click!");

                // End visual testing. Validate visual correctness.
                Applitools.TestResults result = eyes.Close(false);

                //Link to batch result.
                Console.WriteLine(String.Format("This is the link for the Batch Result: {0}", result.Url));

                ApplitoolsTestResultsHandler.ApplitoolsTestResultsHandler testResultHandler = new ApplitoolsTestResultsHandler.ApplitoolsTestResultsHandler("Applitools_ViewKey", result);

                //Optional Setting this prefix will determine the structure of the repository for the downloaded
                testResultHandler.setPathPrefixStructure("TestName/AppName/viewport/hostingOS/hostingApp");

                // Download both the Baseline and the Current images to the folder specified in Path.
                testResultHandler.downloadImages("PathToDownloadImages");

                // Download the Current images to the folder specified in Path.
                testResultHandler.downloadCurrentImages("PathToDownloadImages");

                // Download the Baseline images to the folder specified in Path.
                testResultHandler.downloadBaselineImages("PathToDownloadImages");

                // Download Diffs to the folder specified in Path.
                testResultHandler.downloadDiffs("PathToDownloadImages");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }
            finally
            {
                // Close the browser.
                driver.Quit();

                // If the test was aborted before eyes.Close was called, ends the test as aborted.
                eyes.AbortIfNotClosed();
            }
        }
Example #6
0
        public void TestFullAgentId_1()
        {
            Eyes eyes = new Eyes();

            StringAssert.StartsWith("Eyes.LeanFT.DotNet/", eyes.FullAgentId);
        }
        public void TestVisualGridOptions()
        {
            // We want VG mode
            EyesRunner runner = new VisualGridRunner(10);
            Eyes       eyes   = new Eyes(runner);

            TestUtils.SetupLogging(eyes);
            eyes.visualGridEyes_.EyesConnectorFactory = new Mock.MockEyesConnectorFactory();

            Configuration config = eyes.GetConfiguration();

            config.AddBrowser(800, 600, BrowserType.CHROME);
            config.SetVisualGridOptions(new VisualGridOption("option1", "value1"), new VisualGridOption("option2", false));
            config.SetBatch(TestDataProvider.BatchInfo);
            eyes.SetConfiguration(config);

            MockEyesConnector mockEyesConnector;

            IWebDriver driver = SeleniumUtils.CreateChromeDriver();

            driver.Url = "https://applitools.github.io/demo/TestPages/DynamicResolution/desktop.html";
            try
            {
                // First check - global + fluent config
                mockEyesConnector = OpenEyesAndGetConnector_(eyes, config, driver);
                eyes.Check(Target.Window().VisualGridOptions(new VisualGridOption("option3", "value3"), new VisualGridOption("option4", 5)));
                eyes.Close();
                var expected1 = new Dictionary <string, object>()
                {
                    { "option1", "value1" }, { "option2", false }, { "option3", "value3" }, { "option4", 5 }
                };
                var actual1 = mockEyesConnector.LastRenderRequests[0].Options;
                CollectionAssert.AreEquivalent(expected1, actual1);


                // Second check - only global
                mockEyesConnector = OpenEyesAndGetConnector_(eyes, config, driver);
                eyes.CheckWindow();
                eyes.Close();
                var expected2 = new Dictionary <string, object>()
                {
                    { "option1", "value1" }, { "option2", false }
                };
                var actual2 = mockEyesConnector.LastRenderRequests[0].Options;
                CollectionAssert.AreEquivalent(expected2, actual2);

                // Third check - resetting
                mockEyesConnector = OpenEyesAndGetConnector_(eyes, config, driver);
                config            = eyes.GetConfiguration();
                config.SetVisualGridOptions(null);
                eyes.SetConfiguration(config);
                eyes.CheckWindow();
                eyes.Close();
                var actual3 = mockEyesConnector.LastRenderRequests[0].Options;
                Assert.IsNull(actual3);
                runner.GetAllTestResults();
            }
            finally
            {
                eyes.AbortIfNotClosed();
                driver.Close();
            }
        }
Example #8
0
 public Eyes(Eyes eyes)
     : base(eyes)
 {
     this.color = eyes.color;
 }
Example #9
0
 public MyMetricsPage(IWebDriver driver, Eyes eyes)
 {
     _driver = driver;
     _eyes   = eyes;
 }
Example #10
0
 public Brain(Actor actor, Eyes eyes = null)
 {
     this.actor = actor;
     this.eyes  = eyes;
 }
Example #11
0
 public override void RunCommand(TestResult tr, Bone val_bone = default, bool val_bool = false, Eyes val_eyes = default, float val_float = 0, Hand val_hand = default, InputTrackingState val_input_tracking_state = InputTrackingState.None, Quaternion val_quaternion = default, Vector2 val_vector2 = default, Vector3 val_vector3 = default)
 {
     h.rot = val_quaternion;
 }
Example #12
0
 /// <summary>
 /// Gets the currently active render texture's native ID for the given eye.
 /// </summary>
 /// <param name="eye">The eye.</param>
 /// <returns>the eye's gaze texture id</returns>
 public int GetEyeGazeTextureId(Eyes eye)
 {
     return(this.eyeTextureIds[this.currentEyeTextureIdx + (((int)eye * 2) + 1)]);
 }
Example #13
0
 public Skin(Beard beard, Hair hair, Hat hat, Body body, Tshirt tshirt, Pant pant, Gloves gloves, Eyes eyes)
 {
     this.beard = beard;
     this.hair = hair;
     this.hat = hat;
     this.body = body;
     this.tshirt = tshirt;
     this.pant = pant;
     this.gloves = gloves;
     this.eyes = eyes;
 }
Example #14
0
 // Constructeur
 public Skin()
 {
     this.beard = new Beard();
     this.hair = new Hair();
     this.hat = new Hat();
     this.body = new Body();
     this.tshirt = new Tshirt();
     this.pant = new Pant();
     this.gloves = new Gloves();
     this.eyes = new Eyes();
 }
Example #15
0
 /// <summary>
 /// Gets the currently active render texture's native ID for the given eye.
 /// </summary>
 /// <param name="eye">The eye.</param>
 /// <returns>the eye's scene texture id</returns>
 public int GetEyeSceneTextureId(Eyes eye)
 {
     return(this.eyeTextureIds[this.currentEyeTextureIdx + ((int)eye)]);
 }
Example #16
0
 public EditExercisePage(IWebDriver driver, Eyes eyes)
 {
     _driver = driver;
     _eyes   = eyes;
 }
Example #17
0
        public void TestMapRunningTestsToRequiredBrowserWidth()
        {
            WebDriverProvider       webdriverProvider      = new WebDriverProvider();
            IServerConnectorFactory serverConnectorFactory = new MockServerConnectorFactory(webdriverProvider);
            ILogHandler             logHandler             = TestUtils.InitLogHandler();
            VisualGridRunner        runner = new VisualGridRunner(30, nameof(TestMapRunningTestsToRequiredBrowserWidth),
                                                                  serverConnectorFactory, logHandler);

            Eyes wrappingEyes = new Eyes(runner);

            Configuration configuration = wrappingEyes.GetConfiguration();

            configuration.AddBrowser(new DesktopBrowserInfo(1000, 500, BrowserType.CHROME));
            configuration.AddBrowser(new DesktopBrowserInfo(1000, 700, BrowserType.CHROME));
            configuration.AddBrowser(new DesktopBrowserInfo(700, 500, BrowserType.CHROME));
            wrappingEyes.SetConfiguration(configuration);

            VisualGridEyes eyes = wrappingEyes.visualGridEyes_;

            //doNothing().when(eyes).setViewportSize(ArgumentMatchers.< EyesSeleniumDriver > any());
            //eyes.ServerConnector(new MockServerConnector());

            //RemoteWebDriver driver = mock(RemoteWebDriver.class);
            //when(driver.getSessionId()).thenReturn(mock(SessionId.class));
            ChromeDriver driver = SeleniumUtils.CreateChromeDriver();

            webdriverProvider.SetDriver(driver);
            try
            {
                driver.Url = "data:text/html,<html><body><h1>Hello, world!</h1></body></html>";
                eyes.Open(driver, "app", "test", new Size(800, 800));

                Fluent.SeleniumCheckSettings          seleniumCheckSettings = Target.Window();
                Dictionary <int, List <RunningTest> > map = eyes.MapRunningTestsToRequiredBrowserWidth_(seleniumCheckSettings);
                CollectionAssert.IsEmpty(map);

                seleniumCheckSettings = Target.Window().LayoutBreakpointsEnabled(false);
                map = eyes.MapRunningTestsToRequiredBrowserWidth_(seleniumCheckSettings);
                CollectionAssert.IsEmpty(map);

                seleniumCheckSettings = Target.Window().LayoutBreakpointsEnabled(true);
                map = eyes.MapRunningTestsToRequiredBrowserWidth_(seleniumCheckSettings);
                CollectionAssert.AreEquivalent(new int[] { 700, 1000 }, map.Keys);
                Assert.AreEqual(1, map[700].Count);
                Assert.AreEqual(2, map[1000].Count);

                seleniumCheckSettings = Target.Window().LayoutBreakpoints(750, 1200);
                map = eyes.MapRunningTestsToRequiredBrowserWidth_(seleniumCheckSettings);
                CollectionAssert.AreEquivalent(new int[] { 749, 750 }, map.Keys);
                Assert.AreEqual(1, map[749].Count);
                Assert.AreEqual(2, map[750].Count);

                seleniumCheckSettings = Target.Window().LayoutBreakpoints(700);
                map = eyes.MapRunningTestsToRequiredBrowserWidth_(seleniumCheckSettings);
                CollectionAssert.AreEquivalent(new int[] { 700 }, map.Keys);
                Assert.AreEqual(3, map[700].Count);

                wrappingEyes.SetConfiguration(configuration.SetLayoutBreakpointsEnabled(false));
                seleniumCheckSettings = Target.Window();
                map = eyes.MapRunningTestsToRequiredBrowserWidth_(seleniumCheckSettings);
                CollectionAssert.IsEmpty(map);

                wrappingEyes.SetConfiguration(configuration.SetLayoutBreakpointsEnabled(true));
                seleniumCheckSettings = Target.Window();
                map = eyes.MapRunningTestsToRequiredBrowserWidth_(seleniumCheckSettings);
                CollectionAssert.AreEquivalent(new int[] { 700, 1000 }, map.Keys);
                Assert.AreEqual(1, map[700].Count);
                Assert.AreEqual(2, map[1000].Count);

                wrappingEyes.SetConfiguration(configuration.SetLayoutBreakpoints(750, 1200));
                seleniumCheckSettings = Target.Window();
                map = eyes.MapRunningTestsToRequiredBrowserWidth_(seleniumCheckSettings);
                CollectionAssert.AreEquivalent(new int[] { 749, 750 }, map.Keys);
                Assert.AreEqual(1, map[749].Count);
                Assert.AreEqual(2, map[750].Count);

                wrappingEyes.SetConfiguration(configuration.SetLayoutBreakpoints(750, 1200));
                seleniumCheckSettings = Target.Window().LayoutBreakpointsEnabled(true);
                map = eyes.MapRunningTestsToRequiredBrowserWidth_(seleniumCheckSettings);
                CollectionAssert.AreEquivalent(new int[] { 700, 1000 }, map.Keys);
                Assert.AreEqual(1, map[700].Count);
                Assert.AreEqual(2, map[1000].Count);

                wrappingEyes.SetConfiguration(configuration.SetLayoutBreakpoints(750, 1200));
                seleniumCheckSettings = Target.Window().LayoutBreakpoints(700);
                map = eyes.MapRunningTestsToRequiredBrowserWidth_(seleniumCheckSettings);
                CollectionAssert.AreEquivalent(new int[] { 700 }, map.Keys);
                Assert.AreEqual(3, map[700].Count);
            }
            finally
            {
                driver.Quit();
                runner.StopServiceRunner();
            }
        }
 public void IgnoreRegionUsingBy()
 {
     Eyes.Open(Driver, AppName, "IgnoreRegionUsingBy", Resolution1080P);
     //Ignoring an element with By
     Eyes.Check("IgnoreRegionUsingBy", Target.Window().Ignore(PriceLocator));
 }
        public static Eyes GetDeviceFeatureValueOrDefault(InputDevice device, InputFeatureUsage <Eyes> feature, Eyes defaultValue = default(Eyes))
        {
            Eyes value; if (device.TryGetFeatureValue(feature, out value))

            {
                return(value);
            }

            return(defaultValue);
        }
        public static void Setup(GameObject go, int lod)
        {
            string head   = "head";
            string eyeL   = "lefteye";
            string eyeR   = "righteye";
            string body   = "body";
            string blinkL = "^.*reyeclose.*$";
            string blinkR = "^.*leyeclose.*$";

            if (go)
            {
                Eyes eyes = go.GetComponent <Eyes>();
                if (eyes == null)
                {
                    eyes = go.AddComponent <Eyes>();
                }
                else
                {
                    DestroyImmediate(eyes);
                    eyes = go.AddComponent <Eyes>();
                }
                QueueProcessor qp = go.GetComponent <QueueProcessor>();
                if (qp == null)
                {
                    qp = go.AddComponent <QueueProcessor>();
                }

                // System Properties
                eyes.characterRoot  = go.transform;
                eyes.queueProcessor = qp;

                // Heads - Bone_Rotation
                eyes.BuildHeadTemplate(Eyes.HeadTemplates.Bone_Rotation_XY);
                eyes.heads[0].expData.controllerVars[0].bone = FindTransform(eyes.characterRoot, head);
                eyes.headTargetOffset.y = 0.052f;
                eyes.FixAllTransformAxes(ref eyes.heads, false);
                eyes.FixAllTransformAxes(ref eyes.heads, true);

                // Eyes - Bone_Rotation
                eyes.BuildEyeTemplate(Eyes.EyeTemplates.Bone_Rotation);
                eyes.eyes[0].expData.controllerVars[0].bone = FindTransform(eyes.characterRoot, eyeL);
                eyes.eyes[1].expData.controllerVars[0].bone = FindTransform(eyes.characterRoot, eyeR);
                eyes.FixAllTransformAxes(ref eyes.eyes, false);
                eyes.FixAllTransformAxes(ref eyes.eyes, true);

                // Eyelids - Bone_Rotation
                eyes.BuildEyelidTemplate(Eyes.EyelidTemplates.BlendShapes); // includes left/right eyelid
                eyes.SetEyelidShapeSelection(Eyes.EyelidSelection.Upper);
                float blinkMax = 1f;
                switch (lod)
                {
                case 0:         // Crowd
                    body = "^h_dds_.*crowd.*$";
                    break;

                case 1:             // low
                    body = "^h_dds_.*low.*$";
                    break;

                case 2:             // mid
                    body = "^h_dds_.*mid.*$";
                    break;

                case 3:             // high
                    body = "^h_dds_.*high.*$";
                    break;
                }
                // Left eyelid
                eyes.eyelids[0].referenceIdx = 0;
                eyes.eyelids[0].expData.controllerVars[0].smr        = FindTransform(eyes.characterRoot, body).GetComponent <SkinnedMeshRenderer>();
                eyes.eyelids[0].expData.controllerVars[0].blendIndex = FindBlendIdx(eyes.eyelids[0].expData.controllerVars[0].smr, blinkL);
                eyes.eyelids[0].expData.controllerVars[0].maxShape   = blinkMax;
                // Right eyelid
                eyes.eyelids[1].referenceIdx = 1;
                eyes.eyelids[1].expData.controllerVars[0].smr        = eyes.eyelids[0].expData.controllerVars[0].smr;
                eyes.eyelids[1].expData.controllerVars[0].blendIndex = FindBlendIdx(eyes.eyelids[1].expData.controllerVars[0].smr, blinkR);
                eyes.eyelids[1].expData.controllerVars[0].maxShape   = blinkMax;

                // Initialize the Eyes module
                eyes.Initialize();
            }
        }
        //[TestCase(true, "Test Sequence", "Test Sequence Name Env Var")]
        //[TestCase(true, "Test Sequence", null)]
        //[TestCase(true, null, "Test Sequence Name Env Var")]
        //[TestCase(true, null, null)]
        public void TestEyesConfiguration(bool useVisualGrid, string sequenceName, string sequenceNameEnvVar)
        {
            ILogHandler logHandler = TestUtils.InitLogHandler();
            EyesRunner  runner     = useVisualGrid ? (EyesRunner) new VisualGridRunner(10, logHandler) : new ClassicRunner(logHandler);
            Eyes        eyes       = new Eyes(runner);

            IWebDriver driver = SeleniumUtils.CreateChromeDriver();

            driver.Url = "https://applitools.github.io/demo/TestPages/FramesTestPage/";

            string originalBatchSequence = Environment.GetEnvironmentVariable("APPLITOOLS_BATCH_SEQUENCE");

            if (sequenceNameEnvVar != null)
            {
                Environment.SetEnvironmentVariable("APPLITOOLS_BATCH_SEQUENCE", sequenceNameEnvVar);
            }

            string effectiveSequenceName = sequenceName ?? sequenceNameEnvVar;

            BatchInfo batchInfo = new BatchInfo()
            {
                Id   = TestDataProvider.BatchInfo.Id + "_" + effectiveSequenceName,
                Name = TestDataProvider.BatchInfo.Name + "_" + effectiveSequenceName
            };

            if (sequenceName != null)
            {
                batchInfo.SequenceName = sequenceName;
            }

            if (sequenceNameEnvVar != null)
            {
                Environment.SetEnvironmentVariable("APPLITOOLS_BATCH_SEQUENCE", originalBatchSequence);
            }

            try
            {
                Assert.AreEqual(effectiveSequenceName, batchInfo.SequenceName, "SequenceName");

                Configuration conf     = new Configuration();
                string        testName = "Test - " + (useVisualGrid ? "Visual Grid" : "Selenium");
                conf.SetAppName("app").SetTestName(testName)
                .SetHostApp("someHostApp").SetHostOS("someHostOs")
                //.SetBaselineBranchName("baseline branch")
                //.SetBaselineEnvName("baseline env")
                .SetEnvironmentName("env name")
                .SetBatch(batchInfo);

                eyes.SetConfiguration(conf);
                eyes.Open(driver);

                eyes.MatchLevel = MatchLevel.Layout;
                eyes.Check(Target.Window());

                eyes.MatchLevel = MatchLevel.Content;
                eyes.Check(Target.Window());
            }
            finally
            {
                driver.Quit();
            }

            TestResults results = eyes.Close(false);

            Metadata.SessionResults sessionResults = TestUtils.GetSessionResults(eyes.ApiKey, results);

            Assert.NotNull(sessionResults, "SessionResults");

            Assert.AreEqual("someHostOs", sessionResults.Env.Os, "OS");
            Assert.AreEqual("someHostApp", sessionResults.Env.HostingApp, "Hosting App");

            Assert.AreEqual(batchInfo.SequenceName, sessionResults.StartInfo.BatchInfo.SequenceName, "Sequence Name");
            //Assert.AreEqual("baseline branch", sessionResults.BaselineBranchName);
            //Assert.AreEqual("baseline env", sessionResults.BaselineEnvId);

            Assert.NotNull(sessionResults.ActualAppOutput, "Actual App Output");
            Assert.AreEqual(2, sessionResults.ActualAppOutput.Length, "Actual App Output");
            Assert.AreEqual(MatchLevel.Layout2, sessionResults.ActualAppOutput[0].ImageMatchSettings.MatchLevel, "Actual App Output (Layout)");
            Assert.AreEqual(MatchLevel.Content, sessionResults.ActualAppOutput[1].ImageMatchSettings.MatchLevel, "Actual App Output (Content)");

            TestResultsSummary resultsSummary = runner.GetAllTestResults(false);

            eyes.Abort();
        }
 public void Open1080PBaseline()
 {
     //Start test in Applitools to compare to the baseline created by the parameters below.
     Eyes.Open(Driver, AppName, TestCaseName, Resolution1080P);
 }
Example #23
0
    /// <summary>
    /// Configures the camera.
    /// </summary>
    /// <param name="eye">The eye.</param>
    /// <returns>the camera relate to the eye</returns>
    private Camera ConfigureCamera(Eyes eye)
    {
        if (eye == Eyes.Center)
        {
            Camera centerEye = this.CenterEyeTransform.GetComponent <Camera>();

            // Clearing nothing to make sure the output image is not affected by this camera
            this.CenterEyeCamera.clearFlags = CameraClearFlags.Nothing;

            return(centerEye);
        }

        Transform anchor = eye == Eyes.Left ? this.LeftEyeTransform : this.RightEyeTransform;
        Camera    cam    = anchor.GetComponent <Camera>();

#if UNITY_ANDROID && !UNITY_EDITOR
        MiHMD.EyeParameter eyeDesc = VrManager.Instance.Hmd.GetEyeParameter(eye);

        cam.fieldOfView   = eyeDesc.Fov.y;
        cam.aspect        = eyeDesc.Resolution.x / eyeDesc.Resolution.y;
        cam.rect          = new Rect(0f, 0f, 1.0f, 1.0f);
        cam.targetTexture = VrManager.Instance.Hmd.GetEyeSceneTexture(eye);
        cam.hdr           = VrManager.Instance.IsHdrEnabled;

        // Enforce camera render order
        cam.depth = (eye == Eyes.Left) ?
                    (int)PluginEvents.LeftEyeEndFrame :
                    (int)PluginEvents.RightEyeEndFrame;

        // AA is documented to have no effect in deferred, but it causes black screens.
        if (cam.actualRenderingPath == RenderingPath.DeferredLighting)
        {
            QualitySettings.antiAliasing = 0;
        }
#elif UNITY_EDITOR || UNITY_STANDALONE_WIN
        cam.fieldOfView = 97.5f;
        if (eye == Eyes.Left)
        {
            cam.rect = new Rect(0.0f, 0.0f, 0.5f, 1.0f);
        }
        else
        {
            cam.rect = new Rect(0.5f, 0.0f, 0.5f, 1.0f);
        }

        cam.targetTexture = MiEmulation.Instance.StereoRT;
        cam.hdr           = VrManager.Instance.IsHdrEnabled;
        cam.depth         = 0;
        if (cam.actualRenderingPath == RenderingPath.DeferredLighting || cam.actualRenderingPath == RenderingPath.DeferredShading)
        {
            QualitySettings.antiAliasing = 0;
        }

        cam.enabled = true;
#endif

        // Gaze cursor render to a different texture.
#if UNITY_ANDROID && !UNITY_EDITOR
        Camera[] gazeGameras = new Camera[] { this.LeftEyeGazeCursorCamera, this.RightEyeGazeCursorCamera };
        Camera   gazeCamera  = gazeGameras[(int)eye];
        cam.cullingMask &= ~reticleLayerMask;
        if (gazeCamera)
        {
            gazeCamera.clearFlags       = CameraClearFlags.SolidColor;
            gazeCamera.backgroundColor  = Color.clear;
            gazeCamera.cullingMask      = reticleLayerMask;
            gazeCamera.orthographic     = cam.orthographic;
            gazeCamera.orthographicSize = cam.orthographicSize;
            gazeCamera.aspect           = cam.aspect;
            gazeCamera.fieldOfView      = cam.fieldOfView;
            gazeCamera.nearClipPlane    = cam.nearClipPlane;
            gazeCamera.farClipPlane     = cam.farClipPlane;
            gazeCamera.rect             = cam.rect;
            // make sure gazeCamera render before scene camera.
            gazeCamera.depth         = cam.depth - 1;
            gazeCamera.renderingPath = cam.renderingPath;
            gazeCamera.hdr           = cam.hdr;
            gazeCamera.targetTexture = VrManager.Instance.Hmd.GetEyeGazeTexture(eye);
        }
#endif

        return(cam);
    }
 public void TearDown(Eyes eyes)
 {
     eyes.Abort();
 }
        private void Run()
        {
            // Create a new webdriver
            IWebDriver webDriver = new ChromeDriver();

            // Navigate to the url we want to test
            webDriver.Url = "https:/demo.applitools.com";

            // ⭐️ Note to see visual bugs, run the test using the above URL for the 1st run.
            //but then change the above URL to https://demo.applitools.com/index_v2.html (for the 2nd run)

            // Create a runner with concurrency of 10
            VisualGridRunner runner = new VisualGridRunner(10);

            // Create Eyes object with the runner, meaning it'll be a Visual Grid eyes.
            Eyes eyes = new Eyes(runner);

            //Set the Applitools API KEY here or as an environment variable "APPLITOOLS_API_KEY"
            eyes.ApiKey = "APPLITOOLS_API_KEY";


            // Create configuration object
            Configuration conf = new Configuration();


            // Set test name
            conf.TestName = "C# VisualGrid demo";

            // Set app name
            conf.AppName = "Demo app";

            // Add browsers with different viewports
            conf.AddBrowser(800, 600, Configuration.BrowserType.CHROME);
            conf.AddBrowser(700, 500, Configuration.BrowserType.CHROME);
            conf.AddBrowser(1200, 800, Configuration.BrowserType.FIREFOX);
            conf.AddBrowser(1600, 1200, Configuration.BrowserType.FIREFOX);

            // Add iPhone 4 device emulation in Portraig mode
            EmulationInfo iphone4 = new EmulationInfo(EmulationInfo.DeviceNameEnum.iPhone_4, Applitools.VisualGrid.ScreenOrientation.Portrait);

            conf.AddDeviceEmulation(iphone4);



            // Set the configuration object to eyes
            eyes.Configuration = conf;

            // Call Open on eyes to initialize a test session
            eyes.Open(webDriver);

            // check the login page
            eyes.Check(Target.Window().Fully().WithName("Login page"));
            webDriver.FindElement(By.Id("log-in")).Click();

            // Check the app page
            eyes.Check(Target.Window().Fully().WithName("App page"));

            // Close the browser
            webDriver.Quit();

            //Wait and collect all test results
            TestResultSummary allTestResults = runner.GetAllTestResults();

            System.Console.WriteLine(allTestResults);
        }
Example #26
0
        public void TestConfig_ForceFullPageScreenshot_Selenium()
        {
            Eyes eyes = new Eyes();

            DoTestConfig_ForceFullPageScreenshot_(eyes);
        }
Example #27
0
 public override void ReadEyeParameters(Eyes eye, float near, float far, ref Vector3 cameraPosition, ref Matrix cameraRotation, bool ignoreHeadRotation, bool ignoreHeadPosition, out Matrix view, out Matrix projection)
 {
     throw new System.NotImplementedException();
 }
Example #28
0
        public void TestConfig_MatchLevel_Selenium()
        {
            Eyes eyes = new Eyes();

            DoTestConfig_MatchLevel_(eyes);
        }
Example #29
0
 /// <summary>
 /// Gets the resolution and field of view for the given eye.
 /// </summary>
 /// <param name="eye">The eye.</param>
 /// <returns>the eye parameter</returns>
 public EyeParameter GetEyeParameter(Eyes eye)
 {
     return(this.eyeParameters[(int)eye]);
 }
        internal static void InitEyes(bool useVisualGrid, out IWebDriver driver, out EyesRunner runner, out Eyes eyes, [CallerMemberName] string testName = null)
        {
            driver = CreateChromeDriver();
            if (useVisualGrid)
            {
                testName += "_VG";
                VisualGridRunner visualGridRunner = new VisualGridRunner(10);
                //visualGridRunner.DebugResourceWriter = new FileDebugResourceWriter(logPath);
                runner = visualGridRunner;
            }
            else
            {
                runner = new ClassicRunner();
            }

            string logPath = TestUtils.InitLogPath(testName);

            eyes = new Eyes(runner);
            eyes.SetLogHandler(TestUtils.InitLogHandler(testName, logPath));
            eyes.Batch = TestDataProvider.BatchInfo;
        }
Example #31
0
 /// <summary>
 /// Gets the currently shared depth buffer for the given eye.
 /// </summary>
 /// <param name="eye">The eye.</param>
 /// <returns>the eye's depth texture</returns>
 public RenderBuffer GetEyeSceneTextureDepthBuffer(Eyes eye)
 {
     return(this.eyeTextures[((int)eye)].depthBuffer);
 }
 public bool TryGetFeatureValue(InputFeatureUsage <Eyes> usage, out Eyes value)
 {
     value = new Eyes();
     return(false);
 }
Example #33
0
 public override void RunCommand(TestResult tr, Bone val_bone = default, bool val_bool = false, Eyes val_eyes = default, float val_float = 0, Hand val_hand = default, InputTrackingState val_input_tracking_state = InputTrackingState.None, Quaternion val_quaternion = default, Vector2 val_vector2 = default, Vector3 val_vector3 = default)
 {
     if (tr == TestResult.TRUE && !pressed)
     {
         Debug.Log("VR Input 1 detected");
         gm.RH_Grip = true;
         pressed    = true;
     }
     else
     {
         gm.RH_Grip = false;
     }
     if (tr == TestResult.FALSE)
     {
         pressed = false;
     }
 }
Example #34
0
 public TestObjects(IWebDriver webDriver, VisualGridRunner runner, Eyes eyes)
 {
     WebDriver = webDriver;
     Runner    = runner;
     Eyes      = eyes;
 }
Example #35
0
 private void CreateBodyParts()
 {
     Ears = new Ears(this);
     Face = new Face(this);
     Eyes = new Eyes(this);
     Leg = new Leg(this);
 }
Example #36
0
    // Method
    public void Randomize()
    {
        List<Eyes> eyes = new List<Eyes>();
        foreach (Eyes e in Clothing.Eyes)
            eyes.Add(e);
        this.eyes = eyes[Random.Range(0, eyes.Count - 1)];

        List<Gloves> gloves = new List<Gloves>();
        foreach (Gloves g in Clothing.Gloves)
            gloves.Add(g);
        this.gloves = gloves[Random.Range(0, gloves.Count - 1)];

        List<Pant> pant = new List<Pant>();
        foreach (Pant p in Clothing.Pants)
            pant.Add(p);
        this.pant = pant[Random.Range(0, pant.Count - 1)];

        List<Tshirt> tshirt = new List<Tshirt>();
        foreach (Tshirt t in Clothing.Tshirts)
            tshirt.Add(t);
        this.tshirt = tshirt[Random.Range(0, tshirt.Count - 1)];

        List<Body> body = new List<Body>();
        foreach (Body b in Clothing.Bodies)
            body.Add(b);
        this.body = body[Random.Range(0, body.Count - 1)];

        List<Hair> hair = new List<Hair>();
        foreach (Hair h in Clothing.Hairs)
            hair.Add(h);
        this.hair = hair[Random.Range(0, hair.Count - 1)];

        if (this.hair.GetTypeHair == Hair.TypeHair.Crete)
            this.hat = Hat.NoneHat;
        else
        {
            List<Hat> hat = new List<Hat>();
            foreach (Hat h in Clothing.Hats)
                hat.Add(h);
            this.hat = hat[Random.Range(0, hat.Count - 1)];
        }

        List<Beard> beard = new List<Beard>();
        foreach (Beard b in Clothing.Beards)
            beard.Add(b);
        this.beard = beard[Random.Range(0, beard.Count - 1)];
    }