Пример #1
0
        public void Enter()
        {
            var textBox = window.Get <TextBox>("textBox");

            textBox.Focus();
            AttachedKeyboard attachedKeyboard = window.Keyboard;

            attachedKeyboard.Enter("a");
            Assert.AreEqual("a", textBox.Text);
        }
Пример #2
0
        /// <summary>
        /// Navigating the menu by sending ALT and a number of keys
        /// </summary>
        /// <param name="keys">The combination of keys to send
        /// M is maintenance
        /// v is Service
        /// R is service routines these 3 brings you to the service routine menu, the last selects the test
        /// F is filter test
        /// N is noise test
        /// M is mirror/gain adjustment
        /// D is delay adjustment</param>
        private void SendKeysToMenu(string[] keys)
        {
            AttachedKeyboard keyboard = MainWindow.Keyboard;

            keyboard.PressSpecialKey(KeyboardInput.SpecialKeys.ALT);
            foreach (var key in keys)
            {
                keyboard.Enter(key);
            }
        }
        public void Enter()
        {
            SelectInputControls();
            var textBox = MainWindow.Get <TextBox>("TextBox");

            textBox.Focus();
            AttachedKeyboard attachedKeyboard = MainWindow.Keyboard;

            attachedKeyboard.Enter("a");
            Assert.Equal("a", textBox.Text);
        }
        public void TestMethod1()
        {
            Application app    = base.Application;
            Window      window = app.GetWindow(SearchCriteria.ByAutomationId("StartScreen"), InitializeOption.WithCache);

            Add_Level_Data();
            window.WaitWhileBusy();
            //click the cont button
            Button contBtn = window.Get <Button>(SearchCriteria.ByAutomationId("button2"));

            contBtn.Click();

            // get cont window
            Window cont = app.GetWindow(SearchCriteria.ByAutomationId("ContinueGame"), InitializeOption.WithCache);

            cont.WaitWhileBusy();

            IUIItem[] children1 = cont.GetMultiple(SearchCriteria.All);
            //get lvl 2 button
            Button lvl2Btn = (Button)children1[2];

            lvl2Btn.Click();
            // get game window
            Window game = app.GetWindow(SearchCriteria.ByAutomationId("Form2"), InitializeOption.WithCache);

            game.WaitWhileBusy(); //wait till lightening kills player

            AttachedKeyboard keyboard = game.Keyboard;

            keyboard.HoldKey(KeyboardInput.SpecialKeys.RIGHT); //die by black hole
            keyboard.LeaveKey(KeyboardInput.SpecialKeys.RIGHT);


            // put stuff here to win


            Window win = app.GetWindow(SearchCriteria.ByAutomationId("Level2Complete"), InitializeOption.WithCache);

            win.WaitWhileBusy();
            children1 = win.GetMultiple(SearchCriteria.All); //4-save 5-quit
            Button saveBtn = (Button)children1[4];

            saveBtn.Click();
            win.WaitWhileBusy();

            Button quitBtn = (Button)children1[5];

            quitBtn.Click();

            app.Close();
            app.Dispose();
        }
Пример #5
0
        public void TestMethod1()
        {
            Application app    = base.Application;
            Window      window = app.GetWindow(SearchCriteria.ByAutomationId("StartScreen"), InitializeOption.WithCache);

            Add_Level_Data();
            window.WaitWhileBusy();
            //click the cont button
            Button contBtn = window.Get <Button>(SearchCriteria.ByAutomationId("button2"));

            contBtn.Click();

            // get cont window
            Window cont = app.GetWindow(SearchCriteria.ByAutomationId("ContinueGame"), InitializeOption.WithCache);

            cont.WaitWhileBusy();

            IUIItem[] children1 = cont.GetMultiple(SearchCriteria.All);
            //get lvl 2 button
            Button lvl2Btn = (Button)children1[3];

            lvl2Btn.Click();
            // get game window
            Window game = app.GetWindow(SearchCriteria.ByAutomationId("Form3"), InitializeOption.NoCache);

            AttachedKeyboard keyboard = game.Keyboard;

            keyboard.PressSpecialKey(KeyboardInput.SpecialKeys.RIGHT);
            keyboard.HoldKey(KeyboardInput.SpecialKeys.SPACE);   // jump to cloud
            keyboard.LeaveKey(KeyboardInput.SpecialKeys.SPACE);
            game.ReloadIfCached();
            keyboard.PressSpecialKey(KeyboardInput.SpecialKeys.SPACE);
            keyboard.HoldKey(KeyboardInput.SpecialKeys.SPACE); // die by moon
            keyboard.LeaveKey(KeyboardInput.SpecialKeys.SPACE);

            Window lost = app.GetWindow(SearchCriteria.ByAutomationId("DeathBox3"), InitializeOption.WithCache);

            children1 = lost.GetMultiple(SearchCriteria.All); //3-cont 4-save

            Button saveBtn = (Button)children1[4];

            saveBtn.Click();

            contBtn = (Button)children1[3];
            contBtn.Click();

            game = app.GetWindow(SearchCriteria.ByAutomationId("Form3"), InitializeOption.NoCache);
            game.Close();
            app.Close();
            app.Dispose();
        }
Пример #6
0
        public void CopyTest()
        {
            AttachedKeyboard attachedKeyboard = Window.Keyboard;

            textBox.Text = "userText";
            attachedKeyboard.HoldKey(KeyboardInput.SpecialKeys.CONTROL);
            attachedKeyboard.Enter("ac");
            attachedKeyboard.LeaveKey(KeyboardInput.SpecialKeys.CONTROL);
            Thread.Sleep(100);

            //check the text is the same as that on the clipboard
            string clipbrdText = Clipboard.GetText();

            Assert.AreEqual(textBox.Text, clipbrdText, "Text on clipboard does not match expected");
        }
Пример #7
0
        public void TestMethod1()
        {
            Application app    = base.Application;
            Window      window = app.GetWindow(SearchCriteria.ByAutomationId("StartScreen"), InitializeOption.WithCache);

            Delete_LevelData();
            window.WaitWhileBusy();
            //click the cont button
            Button contBtn = window.Get <Button>(SearchCriteria.ByAutomationId("button2"));

            contBtn.Click();

            // get cont window
            Window cont = app.GetWindow(SearchCriteria.ByAutomationId("ContinueGame"), InitializeOption.WithCache);

            cont.WaitWhileBusy();

            IUIItem[] children1 = cont.GetMultiple(SearchCriteria.All);
            //get lvl 1 button
            Button lvl1Btn = (Button)children1[1];

            lvl1Btn.Click();
            // get game window
            Window game = app.GetWindow(SearchCriteria.ByAutomationId("Form1"), InitializeOption.WithCache);

            AttachedKeyboard keyboard = game.Keyboard;

            keyboard.HoldKey(KeyboardInput.SpecialKeys.RIGHT);  //die by black hole
            //keyboard.LeaveKey(KeyboardInput.SpecialKeys.RIGHT);

            Window lost = app.GetWindow(SearchCriteria.ByAutomationId("DeathBox"), InitializeOption.WithCache);

            keyboard.LeaveKey(KeyboardInput.SpecialKeys.RIGHT);
            lost.WaitWhileBusy();
            children1 = lost.GetMultiple(SearchCriteria.All); //35

            Button saveBtn = (Button)children1[4];

            saveBtn.Click();
            lost.WaitWhileBusy();

            Button quitBtn = (Button)children1[5];

            quitBtn.Click();

            app.Close();
            app.Dispose();
        }
Пример #8
0
        private static void SendKeysToMenu(string[] keys)
        {
            AttachedKeyboard keyboard = mainWindow.Keyboard;

            //Log("Sending ALT");
            keyboard.HoldKey(KeyboardInput.SpecialKeys.ALT);
            foreach (var key in keys)
            {
                //logger.Log($"Sending {key}");
                keyboard.Enter(key);
                Thread.Sleep(200);
            }

            keyboard.LeaveKey(KeyboardInput.SpecialKeys.ALT);
            Thread.Sleep(1000);
            //logger.Log($"{mainWindow.Title}");
        }
Пример #9
0
        void CopyTest()
        {
            var textBox = MainWindow.Get <TextBox>("TextBox");
            AttachedKeyboard attachedKeyboard = MainWindow.Keyboard;

            textBox.Text = "userText";
            attachedKeyboard.HoldKey(KeyboardInput.SpecialKeys.CONTROL);
            attachedKeyboard.Enter("ac");
            attachedKeyboard.LeaveKey(KeyboardInput.SpecialKeys.CONTROL);


            //check the text is the same as that on the clipboard
            Retry.For(() =>
            {
                string clipbrdText = Clipboard.GetText();
                Assert.Equal(textBox.Text, clipbrdText);
            }, TimeSpan.FromSeconds(5));
        }
Пример #10
0
        public static void OpenTargetPicture(string path, string picture)
        {
            List <Window> myWindows  = BaseView.Application.GetWindows();
            Window        openDialog = myWindows.First(n => n.Name == "Open");

            var addressElement = openDialog.Get <ToolStrip>(SearchCriteria.ByAutomationId("1001"));

            addressElement.Click();

            var adress = openDialog.Get <TextBox>(SearchCriteria.ByAutomationId("41477"));

            adress.Text = path;
            AttachedKeyboard keyboard = openDialog.Keyboard;

            keyboard.PressSpecialKey(KeyboardInput.SpecialKeys.RETURN);

            var fileName = openDialog.Get <TextBox>(SearchCriteria.ByControlType(ControlType.Edit).AndByText("File name:"));

            fileName.Text = picture;
            keyboard.PressSpecialKey(KeyboardInput.SpecialKeys.RETURN);
        }
Пример #11
0
 public static void PressSpecialKey(this AttachedKeyboard keyboard, KeyboardInput.SpecialKeys holdKey, KeyboardInput.SpecialKeys specialKey)
 {
     keyboard.HoldKey(holdKey);
     keyboard.PressSpecialKey(specialKey);
     keyboard.LeaveKey(holdKey);
 }
        public void TestMethod1()
        {
            Application app    = base.Application;
            Window      window = app.GetWindow(SearchCriteria.ByAutomationId("StartScreen"), InitializeOption.WithCache);

            Delete_LevelData();
            window.WaitWhileBusy();
            //click the cont button
            Button contBtn = window.Get <Button>(SearchCriteria.ByAutomationId("button2"));

            contBtn.Click();

            // get cont window
            Window cont = app.GetWindow(SearchCriteria.ByAutomationId("ContinueGame"), InitializeOption.WithCache);

            cont.WaitWhileBusy();

            IUIItem[] children1 = cont.GetMultiple(SearchCriteria.All);
            //get lvl 1 button
            Button lvl1Btn = (Button)children1[1];

            lvl1Btn.Click();
            // get game window
            Window game = app.GetWindow(SearchCriteria.ByAutomationId("Form1"), InitializeOption.NoCache);

            AttachedKeyboard keyboard = game.Keyboard;

            keyboard.PressSpecialKey(KeyboardInput.SpecialKeys.RIGHT); //winElem14.SendKeys(Keys.Right);
            keyboard.PressSpecialKey(KeyboardInput.SpecialKeys.SPACE); //winElem14.SendKeys(Keys.Space);
            keyboard.PressSpecialKey(KeyboardInput.SpecialKeys.SPACE); // winElem14.SendKeys(Keys.Space);
            keyboard.PressSpecialKey(KeyboardInput.SpecialKeys.RIGHT); //winElem14.SendKeys(Keys.Right);
            keyboard.PressSpecialKey(KeyboardInput.SpecialKeys.SPACE); //winElem14.SendKeys(Keys.Space);
            keyboard.PressSpecialKey(KeyboardInput.SpecialKeys.SPACE); // winElem14.SendKeys(Keys.Space);
            keyboard.PressSpecialKey(KeyboardInput.SpecialKeys.RIGHT); //winElem14.SendKeys(Keys.Right);
            keyboard.PressSpecialKey(KeyboardInput.SpecialKeys.SPACE); //winElem14.SendKeys(Keys.Space);
            keyboard.PressSpecialKey(KeyboardInput.SpecialKeys.SPACE); // winElem14.SendKeys(Keys.Space);
            keyboard.PressSpecialKey(KeyboardInput.SpecialKeys.RIGHT); //winElem14.SendKeys(Keys.Right);
            keyboard.PressSpecialKey(KeyboardInput.SpecialKeys.SPACE); //winElem14.SendKeys(Keys.Space);
            keyboard.PressSpecialKey(KeyboardInput.SpecialKeys.SPACE); // winElem14.SendKeys(Keys.Space);
            keyboard.PressSpecialKey(KeyboardInput.SpecialKeys.RIGHT); //winElem14.SendKeys(Keys.Right);
            keyboard.PressSpecialKey(KeyboardInput.SpecialKeys.RIGHT); //winElem14.SendKeys(Keys.Right);
            keyboard.PressSpecialKey(KeyboardInput.SpecialKeys.SPACE); //winElem14.SendKeys(Keys.Space);
            keyboard.PressSpecialKey(KeyboardInput.SpecialKeys.SPACE); // winElem14.SendKeys(Keys.Space);
            keyboard.PressSpecialKey(KeyboardInput.SpecialKeys.RIGHT); //winElem14.SendKeys(Keys.Right);
            keyboard.PressSpecialKey(KeyboardInput.SpecialKeys.LEFT);  //winElem14.SendKeys(Keys.Left);
            keyboard.PressSpecialKey(KeyboardInput.SpecialKeys.SPACE); //winElem14.SendKeys(Keys.Space);
            keyboard.PressSpecialKey(KeyboardInput.SpecialKeys.SPACE); // winElem14.SendKeys(Keys.Space);
            keyboard.PressSpecialKey(KeyboardInput.SpecialKeys.LEFT);  //winElem14.SendKeys(Keys.Left);
            keyboard.PressSpecialKey(KeyboardInput.SpecialKeys.SPACE); //winElem14.SendKeys(Keys.Space);
            keyboard.PressSpecialKey(KeyboardInput.SpecialKeys.SPACE); // winElem14.SendKeys(Keys.Space);
            keyboard.PressSpecialKey(KeyboardInput.SpecialKeys.LEFT);  //winElem14.SendKeys(Keys.Left);
            keyboard.PressSpecialKey(KeyboardInput.SpecialKeys.SPACE); //winElem14.SendKeys(Keys.Space);
            keyboard.PressSpecialKey(KeyboardInput.SpecialKeys.SPACE); // winElem14.SendKeys(Keys.Space);
            keyboard.PressSpecialKey(KeyboardInput.SpecialKeys.LEFT);  //winElem14.SendKeys(Keys.Left);
            keyboard.PressSpecialKey(KeyboardInput.SpecialKeys.SPACE); //winElem14.SendKeys(Keys.Space);
            keyboard.PressSpecialKey(KeyboardInput.SpecialKeys.SPACE); // winElem14.SendKeys(Keys.Space);
            keyboard.PressSpecialKey(KeyboardInput.SpecialKeys.LEFT);  //winElem14.SendKeys(Keys.Left);
            keyboard.PressSpecialKey(KeyboardInput.SpecialKeys.SPACE); //winElem14.SendKeys(Keys.Space);
            keyboard.PressSpecialKey(KeyboardInput.SpecialKeys.SPACE); // winElem14.SendKeys(Keys.Space);
            keyboard.PressSpecialKey(KeyboardInput.SpecialKeys.LEFT);  //winElem14.SendKeys(Keys.Left);
            keyboard.PressSpecialKey(KeyboardInput.SpecialKeys.SPACE); //winElem14.SendKeys(Keys.Space);
            keyboard.PressSpecialKey(KeyboardInput.SpecialKeys.SPACE); // winElem14.SendKeys(Keys.Space);
            keyboard.PressSpecialKey(KeyboardInput.SpecialKeys.LEFT);  //winElem14.SendKeys(Keys.Left);
            keyboard.PressSpecialKey(KeyboardInput.SpecialKeys.LEFT);  //winElem14.SendKeys(Keys.Left);
            keyboard.PressSpecialKey(KeyboardInput.SpecialKeys.RIGHT); //winElem14.SendKeys(Keys.Right);
            keyboard.PressSpecialKey(KeyboardInput.SpecialKeys.LEFT);  //winElem14.SendKeys(Keys.Left);
            keyboard.PressSpecialKey(KeyboardInput.SpecialKeys.LEFT);  //winElem14.SendKeys(Keys.Left);
            keyboard.PressSpecialKey(KeyboardInput.SpecialKeys.SPACE); //winElem14.SendKeys(Keys.Space);
            keyboard.PressSpecialKey(KeyboardInput.SpecialKeys.SPACE); // winElem14.SendKeys(Keys.Space);
            keyboard.PressSpecialKey(KeyboardInput.SpecialKeys.LEFT);  //winElem14.SendKeys(Keys.Left);


            Window win = app.GetWindow(SearchCriteria.ByAutomationId("LevelComplete"), InitializeOption.WithCache);

            win.WaitWhileBusy();
            children1 = win.GetMultiple(SearchCriteria.All); //345

            Button saveBtn = (Button)children1[4];

            saveBtn.Click();
            win.WaitWhileBusy();

            contBtn = (Button)children1[3];
            contBtn.Click();

            game = app.GetWindow(SearchCriteria.ByAutomationId("Form1"), InitializeOption.WithCache);
            game.Close();


            app.Close();
            app.Dispose();
        }