Ejemplo n.º 1
0
        public void AutoMoveMousePointerToTopLeft()
        {
            BrowsersToTestWith.ForEach(manager =>
            {
                // GIVEN
                manager.CloseBrowser();

                var notTopLeftPoint = new Point(50, 50);
                Cursor.Position     = notTopLeftPoint;

                // This test won't work if mousepointer isn't moved
                // Happens if system is locked or remote desktop with no UI
                if (Cursor.Position != notTopLeftPoint)
                {
                    return;
                }


                // WHEN not moving the mousepointer to top left
                // when creating a new browser instance
                Settings.AutoMoveMousePointerToTopLeft = false;
                using (manager.CreateBrowser(TestPageUri))
                {
                    // THEN cursor should still be on 50,50
                    Assert.That(Cursor.Position, Is.EqualTo(notTopLeftPoint));
                }

                // WHEN we set to the mousepointer to top left
                // when creating a new browser instance
                Settings.AutoMoveMousePointerToTopLeft = true;
                using (manager.CreateBrowser(TestPageUri))
                {
                    // THEN cursor should be on 0,0
                    Assert.That(Cursor.Position, Is.EqualTo(new Point(0, 0)));
                }
            });
        }