Exemplo n.º 1
0
        public void ListItemInComboBoxWithoutTextAvailableInitiallyTest()
        {
            if (Framework != WindowsFramework.Wpf)
            {
                Assert.Ignore();
            }

            // Restart the application and reinitialize
            Restart();
            ComboBoxUnderTest = MainWindow.Get <ComboBox>(SearchCriteria.ByAutomationId("AComboBox"));

            try
            {
                CoreAppXmlConfiguration.Instance.ComboBoxItemsPopulatedWithoutDropDownOpen = false;
                Assert.That(ComboBoxUnderTest.Items, Has.Count.EqualTo(0));
            }
            finally
            {
                CoreAppXmlConfiguration.Instance.ComboBoxItemsPopulatedWithoutDropDownOpen = true;
            }
        }
Exemplo n.º 2
0
        public MarkpadDocument SaveAs(string path)
        {
            var directoryName = Path.GetDirectoryName(path);

            if (!Directory.Exists(directoryName))
            {
                Directory.CreateDirectory(directoryName);
            }

            ParentScreen.WhiteWindow.Get <Button>("ShowSave").Click();
            ParentScreen.WhiteWindow.Get <Button>("SaveAsDocument").Click();

            var modalWindow = ParentScreen.WhiteWindow.ModalWindow("Save As");

            modalWindow.Get <TextBox>(SearchCriteria.ByAutomationId("1001")).Text = path;
            modalWindow.Get <Button>(SearchCriteria.ByAutomationId("1")).Click();

            ParentScreen.WaitWhileBusy();

            return(this);
        }
Exemplo n.º 3
0
        /// <summary>
        /// method to Perform Addition of two numbers and validate the result
        /// </summary>
        private static void PerformSummationOnCalculator(UIItemContainer mainWindow)
        {
            mainWindow.Get <Button>(SearchCriteria.ByText("1")).Click();
            mainWindow.Get <Button>(SearchCriteria.ByText("2")).Click();
            mainWindow.Get <Button>(SearchCriteria.ByText("3")).Click();
            mainWindow.Get <Button>(SearchCriteria.ByText("4")).Click();
            mainWindow.Get <Button>(SearchCriteria.ByText("Add")).Click();
            mainWindow.Get <Button>(SearchCriteria.ByText("5")).Click();
            mainWindow.Get <Button>(SearchCriteria.ByText("6")).Click();
            mainWindow.Get <Button>(SearchCriteria.ByText("7")).Click();
            mainWindow.Get <Button>(SearchCriteria.ByText("8")).Click();
            //Button with text as +(for sum)
            //Read button to get the result
            mainWindow.Get <Button>(SearchCriteria.ByText("Equals")).Click();

            //Get the result
            var    resultLable = mainWindow.Get <Label>(SearchCriteria.ByAutomationId("150"));
            string result      = resultLable.Text;

            Assert.Equal("6912", result);
        }
Exemplo n.º 4
0
        public void TestMethod()
        {
            var num1 = Helper.GetInstance().MainCalc.Get <Button>(SearchCriteria.ByText("5"));

            num1.Click();
            var op = Helper.GetInstance().MainCalc.Get <Button>(SearchCriteria.ByText("+"));

            op.Click();
            var num2 = Helper.GetInstance().MainCalc.Get <Button>(SearchCriteria.ByText("6"));

            num2.Click();
            var equals = Helper.GetInstance().MainCalc.Get <Button>(SearchCriteria.ByText("="));

            equals.Click();

            Thread.Sleep(3000);

            var result = Helper.GetInstance().MainCalc.Get <Label>(SearchCriteria.ByAutomationId("150"));

            Assert.AreEqual(result.Text, "11");
        }
Exemplo n.º 5
0
        public List <ContactData> GetContactList()
        {
            List <ContactData> list = new List <ContactData>();

            Table tContacts = manager.mainWND.Get <Table>(SearchCriteria.ByAutomationId("uxAddressGrid"));

            if (tContacts.Rows.Count != 0)
            {
                tContacts.Rows.First();
                foreach (TableRow record in tContacts.Rows)
                {
                    list.Add(new ContactData()
                    {
                        FirstName = record.Cells[0].Value.ToString(),
                        LastName  = record.Cells[1].Value.ToString()
                    });
                }
            }

            return(list);
        }
Exemplo n.º 6
0
        public StandardWorkingArea(IUIItemContainer mainFrame)
        {
            var calcFrame = mainFrame.Get <Panel>(SearchCriteria.ByClassName("CalcFrame"));

            Button0     = new Button(calcFrame, SearchCriteria.ByAutomationId("130"), "0");
            Button1     = new Button(calcFrame, SearchCriteria.ByAutomationId("131"), "1");
            Button2     = new Button(calcFrame, SearchCriteria.ByAutomationId("132"), "2");
            Button3     = new Button(calcFrame, SearchCriteria.ByAutomationId("133"), "3");
            Button4     = new Button(calcFrame, SearchCriteria.ByAutomationId("134"), "4");
            Button5     = new Button(calcFrame, SearchCriteria.ByAutomationId("135"), "5");
            Button6     = new Button(calcFrame, SearchCriteria.ByAutomationId("136"), "6");
            Button7     = new Button(calcFrame, SearchCriteria.ByAutomationId("137"), "7");
            Button8     = new Button(calcFrame, SearchCriteria.ByAutomationId("138"), "8");
            Button9     = new Button(calcFrame, SearchCriteria.ByAutomationId("139"), "9");
            ButtonMplus = new Button(calcFrame, SearchCriteria.ByAutomationId("125"), "M+");
            ButtonMR    = new Button(calcFrame, SearchCriteria.ByAutomationId("123"), "MR");
            ButtonPlus  = new Button(calcFrame, SearchCriteria.ByAutomationId("93"), "+");
            ButtonEqual = new Button(calcFrame, SearchCriteria.ByAutomationId("121"), "=");

            Result = new Label(calcFrame, SearchCriteria.ByAutomationId("150"), "Result");
        }
Exemplo n.º 7
0
        public void AdvanceSearchGeneralCase()
        {
            logger.Info("Get window");
            gmtTab.OpenTab(gMTWindow, "Cases").Click();
            logger.Info("Open Case Tab");

            caseScreen2.SelectAdvancedSearch(gMTWindow);
            logger.Info("Select Advanced Search");
            #region
            //DateTime mayStDay = new DateTime(DateTime.Now.Year, 01, 01);
            //DateTime mayEdDay = new DateTime(DateTime.Now.Year, 01, 31);
            #endregion
            logger.Info("Apply General Case-> Case Filter");
            caseScreen2.GeneralCases("L2CZ", 0, "", "LexisNexis", 0, 00);

            Panel output = caseScreen2.GetCasesResult(gMTWindow);
            logger.Debug("Getting cases per applied search filters");

            Table result = output.Get <Table>(SearchCriteria.ByAutomationId("dgObjectExplorer"));
            Console.WriteLine(Int32.Parse(result.Rows.Count.ToString()));
        }
Exemplo n.º 8
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);
        }
Exemplo n.º 9
0
        public void AdvSrchAffiliation()
        {
            /////////////////////////////////
            /////  This Test will Filter out Employee on basis Industry/Enabler Affiliation
            /////  The Filter is applied on Advance filter field
            //////////////////////////////
            logger.Debug("STARTED RUNNING TEST CASE: " + System.Reflection.MethodBase.GetCurrentMethod().Name);
            logger.Info("Get window");
            gmtTab.OpenTab(gMTWindow, "Employees").Click();
            logger.Info("Open Employee Tab");
            empScreen2.SelectAdvancedSearch(gMTWindow);
            logger.Info("Open Advance Search");

            empScreen2.GeneralEmployeetv(GeneralEmployees.OfficeRegion, "New York");
            logger.Info("Select Office Region");
            empScreen2.GeneralEmployeetv(GeneralEmployees.LevelDeptt, "Principal");
            logger.Info("Apply Level/Deptt Filter");

            empScreen2.hasPracticeAreaAff().Click();
            empScreen2.affiliations(Affiliation.Industry, "Health", "OR", "And");
            empScreen2.affiliations(Affiliation.Enabler, "", "OR", "And");
            logger.Info("Apply Industry and Enabler Affiliation Filter");

            Panel output = empScreen2.GetEmployeeResult(gMTWindow);
            Table result = output.Get <Table>(SearchCriteria.ByAutomationId("dgObjectExplorer"));

            logger.Info("Get Data per selected filter");

            for (int i = 0; i < Int32.Parse(result.Rows.Count.ToString()); i++)
            {
                if (result.Rows[i].Cells[5].Value.ToString().ToLower().Contains("22aad"))
                {
                    string c = result.Rows[i].Cells[2].Value.ToString().ToLower();
                    Assert.IsTrue(result.Rows[i].Cells[2].Value.ToString().ToLower().Contains("adler, amanda"));
                    logger.Info("Assert if correct Employee is selected against applied filter");
                    Assert.IsTrue(result.Rows[i].Cells[4].Value.ToString().ToLower().Contains("m"));
                    logger.Info("Assert if filtered employee are of Principal Level");
                }
            }
        }
        /// <summary>
        ///     Chooses the 'Generate from database' option for the wizard and walks thru the wizard
        /// </summary>
        private void CreateModelFromDBNonDefaults(Window wizard, string dbName)
        {
            // Select the 'Generate from Database' option
            SelectModelOption(
                wizard,
                _resourceHelper.GetEntityDesignResourceString("GenerateFromDatabaseOption"));

            ClickNextButton(wizard);

            var appconfig = _wizard.Get <TextBox>(SearchCriteria.ByAutomationId("textBoxAppConfigConnectionName"));

            if (appconfig.Text != "SchoolEntities")
            {
                var newConnectionButton =
                    wizard.Get <Button>(
                        SearchCriteria.ByText(_resourceHelper.GetEntityDesignResourceString("NewDatabaseConnectionBtn")));

                newConnectionButton.Click();
                HandleConnectionDialog(wizard, dbName);
                wizard.WaitTill(WaitTillNewDBSettingsLoaded, new TimeSpan(0, 1, 0));
            }

            ClickNextButton(wizard);
            var versionsPanel   = _wizard.Get <Panel>(SearchCriteria.ByAutomationId("versionsPanel"));
            var selectionButton =
                versionsPanel.Get <RadioButton>(
                    SearchCriteria.ByText(String.Format(_resourceHelper.GetEntityDesignResourceString("EntityFrameworkVersionName"), "6.0")));

            Assert.IsTrue(selectionButton.IsSelected);
            ClickNextButton(wizard);

            wizard.WaitTill(WaitTillDBTablesLoaded, new TimeSpan(0, 1, 0));
            CheckAllCheckBoxes(wizard);
            ChangeDefaultValues(wizard);

            var finishButton = wizard.Get <Button>(
                SearchCriteria.ByText(_resourceHelper.GetWizardFrameworkResourceString("ButtonFinishText")));

            finishButton.Click();
        }
Exemplo n.º 11
0
        /// <summary>
        /// 输入排牙师姓名,点击查询按钮,加载该排牙师
        /// </summary>
        public static bool Search_DentureUserName(Window appWin, out string msg)
        {
            try
            {
                var startTime = DateTime.Now;

                //输入排牙师姓名
                TextBox txtName = appWin.Get <TextBox>(SearchCriteria.ByAutomationId("txtName"));

                //appWin.Keyboard.PressSpecialKey(TestStack.White.WindowsAPI.KeyboardInput.SpecialKeys.SHIFT);
                //Thread.Sleep(1000);
                txtName.Text = "001";
                //appWin.Keyboard.PressSpecialKey(TestStack.White.WindowsAPI.KeyboardInput.SpecialKeys.SPACE);

                //点击查询按钮
                Button btnSearchOrderList = appWin.Get <Button>(SearchCriteria.ByAutomationId("btnSearchOrderList"));
                btnSearchOrderList.Click();

                var endTime = DateTime.Now;

                try
                {
                    Thread.Sleep(300);
                    //捕捉提醒信息,如果能铺捉到,则测试未通过
                    string error_info = appWin.Get <Label>(SearchCriteria.ByText("查询排牙师列表异常!")).ToString();
                    msg = "测试【输入排牙师姓名,点击查询按钮,加载该排牙师】--未通过," + error_info + "用时:" + (endTime - startTime).TotalSeconds;
                    return(false);
                }
                catch
                {
                    msg = "测试【输入排牙师姓名,点击查询按钮,加载该排牙师】--通过,用时:" + (endTime - startTime).TotalSeconds;
                    return(true);
                }
            }
            catch (Exception e)
            {
                msg = "测试【输入排牙师姓名,点击查询按钮,加载该排牙师】--失败,原因:" + e.ToString();
                return(false);
            }
        }
        public void TestMethod1()
        {
            Application app = base.Application;

            Window window = app.GetWindow(SearchCriteria.ByAutomationId("StartScreen"), InitializeOption.WithCache);

            window.WaitWhileBusy();
            //click the cont button
            Button newBtn = window.Get <Button>(SearchCriteria.ByAutomationId("button1"));

            window.WaitWhileBusy();
            newBtn.Click();
            window.WaitWhileBusy();

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

            IUIItem[] children1 = story.GetMultiple(SearchCriteria.All);
            story.WaitWhileBusy();
            Button nextBtn = (Button)children1[1];

            nextBtn.Click();
            nextBtn.Click();
            nextBtn.Click();
            nextBtn.Click();
            nextBtn.Click();
            nextBtn.Click();
            story.ReloadIfCached();
            children1 = story.GetMultiple(SearchCriteria.All);
            Button beginBtn = (Button)children1[7];

            beginBtn.Click();

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

            game.Close();
            app.Close();
            app.Dispose();
        }
Exemplo n.º 13
0
        /// <summary>
        /// 编辑技工厂,无修改操作,点击确定按钮
        /// </summary>
        /// <param name="appWin"></param>
        /// <param name="msg"></param>
        /// <returns></returns>
        public static bool EditFactory_NoEdit(Window appWin, out string msg)
        {
            try
            {
                var startTime = DateTime.Now;

                //点击编辑按钮
                Button btnAddFactory = appWin.Get <Button>(SearchCriteria.ByAutomationId("btnEditFactory").AndIndex(1));
                btnAddFactory.Click();

                //点击确定按钮
                Button btnComfirmEditFactory = appWin.Get <Button>(SearchCriteria.ByAutomationId("btnComfirmEditFactory"));
                btnComfirmEditFactory.Click();

                try
                {
                    //捕捉提醒信息,如果能捕捉到,则测试通过
                    string error_info = appWin.Get <Label>(SearchCriteria.ByText("编辑成功!")).ToString();
                    //关闭提醒框
                    Button btnTips = appWin.Get <Button>(SearchCriteria.ByAutomationId("2"));
                    btnTips.Click();

                    //捕捉编辑技工厂窗口,如果不能捕捉到,则测试通过
                    string add_win = appWin.Get <Label>(SearchCriteria.ByText("编辑工厂")).ToString();

                    msg = "测试【编辑技工厂,无修改操作,点击确定按钮】--未通过,用时:" + (DateTime.Now - startTime).TotalSeconds;
                    return(false);
                }
                catch
                {
                    msg = "测试【编辑技工厂,无修改操作,点击确定按钮】--通过,用时:" + (DateTime.Now - startTime).TotalSeconds;
                    return(true);
                }
            }
            catch (Exception e)
            {
                msg = "测试【编辑技工厂,无修改操作,点击确定按钮】--失败,原因:" + e.ToString();
                return(false);
            }
        }
Exemplo n.º 14
0
        public void askMeAboutMapping(string searchKeyword, string mappedToTerm, Operator AndOr)
        {
            advanceSearch.Get <Button>(SearchCriteria.ByAutomationId("btnAskMeAboutMapping")).Click();

            advanceSearch.Get(SearchCriteria.ByAutomationId("txtSearch")).SetValue(searchKeyword);
            advanceSearch.Get(SearchCriteria.ByAutomationId("btnSearch")).Click();

            Table searchResult = advanceSearch.Get <Table>(SearchCriteria.ByAutomationId("dgSearchResults"));
            Table selectedTerm = advanceSearch.Get <Table>(SearchCriteria.ByAutomationId("dgDisplaySelection"));

            List <string> selVal = new List <string>();

            for (int i = 0; i < Int32.Parse(searchResult.Rows.Count.ToString()); i++)
            {
                bool va = searchResult.Rows[i].Cells[1].Value.ToString().ToLower().Contains(mappedToTerm.ToLower());
                if (va.ToString() == "True")
                {
                    searchResult.Rows[i].Cells[0].Click();
                    searchResult.Rows[i].Cells[0].DoubleClick();

                    selVal.Add(searchResult.Rows[i].Cells[1].Value.ToString());
                }
            }
            for (int j = 0; j < Int32.Parse(selectedTerm.Rows.Count.ToString()); j++)
            {
                Assert.AreEqual(selVal[j], selectedTerm.Rows[j].Cells[0].Value.ToString());


                Console.WriteLine(selectedTerm.Rows[j].Cells[0].Value.ToString());
            }

            switch (AndOr)
            {
            case Operator.And: advanceSearch.Get <RadioButton>(SearchCriteria.ByAutomationId("rdbAnd")).Click(); break;

            case Operator.Or: advanceSearch.Get <RadioButton>(SearchCriteria.ByAutomationId("rdbOr")).Click(); break;
            }

            advanceSearch.Get <Button>(SearchCriteria.ByAutomationId("btnOk")).Click();
        }
Exemplo n.º 15
0
        /// <summary>
        /// 编辑医院,修改医院名称
        /// </summary>
        /// <param name="appWin"></param>
        /// <param name="msg"></param>
        /// <returns></returns>
        public static bool EditHospital_HospitalNameEdit(Window appWin, out string msg)
        {
            try
            {
                var startTime = DateTime.Now;

                //修改医院名称
                TextBox txtHospitalName = appWin.MdiChild(SearchCriteria.ByAutomationId("AddOrEditHospitalView")).Get <TextBox>(SearchCriteria.ByAutomationId("txtHospitalName"));
                txtHospitalName.BulkText = Generate.GenerateChineseWords(5);

                //点击确定按钮
                Button btnComfirmEditHospital = appWin.Get <Button>(SearchCriteria.ByAutomationId("btnComfirmEditHospital"));
                btnComfirmEditHospital.Click();
                try
                {
                    Thread.Sleep(300);
                    //捕捉提醒信息,如果能捕捉到,则测试通过
                    string succ_info = appWin.Get <Label>(SearchCriteria.ByText("编辑成功!")).ToString();
                    //关闭提醒框
                    Button btnTips = appWin.Get <Button>(SearchCriteria.ByAutomationId("2"));
                    btnTips.Click();

                    //捕捉新增角色窗口,如果不能捕捉到,则测试通过
                    string add_win = appWin.Get <Label>(SearchCriteria.ByText("编辑医院")).ToString();

                    msg = "测试【编辑医院成功,同时关闭编辑医院窗口】--未通过,用时:" + (DateTime.Now - startTime).TotalSeconds;
                    return(false);
                }
                catch
                {
                    msg = "测试【编辑医院成功,同时关闭编辑医院窗口】--通过,用时:" + (DateTime.Now - startTime).TotalSeconds;
                    return(true);
                }
            }
            catch (Exception e)
            {
                msg = "测试【编辑医院成功,同时关闭编辑医院窗口】--失败,原因:" + e.ToString();
                return(false);
            }
        }
Exemplo n.º 16
0
        /// <summary>
        /// 新增医院,详细地址为空
        /// </summary>
        /// <param name="appWin"></param>
        /// <param name="msg"></param>
        /// <returns></returns>
        public static bool AddHospital_DetailNull(Window appWin, out string msg)
        {
            try
            {
                var startTime = DateTime.Now;

                //选择区
                ComboBox cbDistrict = appWin.MdiChild(SearchCriteria.ByAutomationId("AddOrEditHospitalView")).Get <ComboBox>(SearchCriteria.ByAutomationId("cbDistrict"));
                cbDistrict.Select(1);

                //点击确定按钮
                Button btnComfirmAddHospital = appWin.Get <Button>(SearchCriteria.ByAutomationId("btnComfirmAddHospital"));
                btnComfirmAddHospital.Click();

                var endTime = DateTime.Now;

                try
                {
                    Thread.Sleep(300);
                    //捕捉提醒信息,如果能捕捉到,则测试通过
                    string succ_info = appWin.Get <Label>(SearchCriteria.ByText("详细地址不能为空!")).ToString();
                    //关闭提醒框
                    Button btnTips = appWin.Get <Button>(SearchCriteria.ByAutomationId("2"));
                    btnTips.Click();

                    msg = "测试【新增医院,详细地址为空】--通过,用时:" + (endTime - startTime).TotalSeconds;
                    return(true);
                }
                catch
                {
                    msg = "测试【新增医院,详细地址为空】--未通过,缺少详细地址错误提醒。用时:" + (endTime - startTime).TotalSeconds;
                    return(false);
                }
            }
            catch (Exception e)
            {
                msg = "测试【新增医院,详细地址为空】--失败,原因:" + e.ToString();
                return(false);
            }
        }
Exemplo n.º 17
0
        private void GetMultipleButtons(WindowsFramework framework)
        {
            MainWindow.Get <Button>("GetMultipleButton").Click();
            var window = MainWindow.ModalWindow("GetMultiple");

            try
            {
                var buttons = window.GetMultiple(SearchCriteria.ByNativeProperty(AutomationElement.NameProperty, "Button")).OfType <Button>();
                Assert.AreEqual(3, buttons.Count());

                if (framework == WindowsFramework.Wpf)
                {
                    buttons = window.GetMultiple(SearchCriteria.ByAutomationId("Test")).OfType <Button>();
                    Assert.AreEqual(3, buttons.Count());
                }

                var checkboxes = window.GetMultiple(SearchCriteria.ByControlType(ControlType.CheckBox)).OfType <CheckBox>();
                Assert.AreEqual(3, checkboxes.Count());

                checkboxes = window.GetMultiple(SearchCriteria.ByNativeProperty(AutomationElement.NameProperty, "Checkbox")).OfType <CheckBox>();
                Assert.AreEqual(3, checkboxes.Count());

                if (framework == WindowsFramework.Wpf)
                {
                    checkboxes = window.GetMultiple(SearchCriteria.ByAutomationId("Test2")).OfType <CheckBox>();
                    Assert.AreEqual(3, checkboxes.Count());
                }

                if (framework == WindowsFramework.Wpf)
                {
                    var customControls = window.GetMultiple(SearchCriteria.ByClassName("CustomItem"));

                    Assert.AreEqual(3, customControls.Length);
                }
            }
            finally
            {
                window.Close();
            }
        }
        public void AddAndRemoveCondition(int repeatCount)
        {
            string workPath = Path.GetDirectoryName(new Uri(Assembly.GetExecutingAssembly().CodeBase).AbsolutePath);

            ProcessStartInfo info        = new ProcessStartInfo(Path.Combine(workPath, "DecisionTableCreator.exe"));
            Application      application = Application.AttachOrLaunch(info);
            Window           mainWnd     = application.GetWindow(SearchCriteria.ByAutomationId("MainWindow"), InitializeOption.NoCache);

            for (int repeatIdx = 0; repeatIdx < repeatCount; repeatIdx++)
            {
                for (int condIdx = 0; condIdx < 2; condIdx++)
                {
                    AddCondition(mainWnd, application);
                }
                for (int tcIdx = 0; tcIdx < 2; tcIdx++)
                {
                    AddTestCase(mainWnd, application);
                }

                for (int idx = 0; idx < 2; idx++)
                {
                    Menu menuItemEdit           = mainWnd.Get(SearchCriteria.ByText("Edit")) as Menu;
                    Menu menuItemDeleteTestCase = menuItemEdit.SubMenu(SearchCriteria.ByAutomationId("MenuItemDeleteMostRightTestCase"));
                    menuItemDeleteTestCase.Click();

                    menuItemEdit = mainWnd.Get(SearchCriteria.ByText("Edit")) as Menu;
                    Menu menuItemDeleteCond = menuItemEdit.SubMenu(SearchCriteria.ByAutomationId("MenuItemDeleteBottomCondition"));
                    menuItemDeleteCond.Click();
                }
            }
            Menu menuItemFile = mainWnd.Get(SearchCriteria.ByText("File")) as Menu;
            Menu menuItemExit = menuItemFile.SubMenu("Exit");

            menuItemExit.Click();

            Window saveWindow = mainWnd.ModalWindow(SearchCriteria.ByText("Save"));
            Button btnNo      = saveWindow.Get <Button>("No");

            btnNo.Click();
        }
Exemplo n.º 19
0
        public Window In_ClientCaseSearch_SelectClient_Load_Desktop_Display_ClientNotebook(Window window)
        {
            Console.WriteLine("In_ClientCaseSearch_SelectClient_Load_ClientNotebook");

            ListView listView = window.Get <ListView>(SearchCriteria.ByAutomationId("listView"));

            Assert.IsTrue(listView.Items.Count > 0);

            foreach (var x in listView.Rows)
            {
                if (x.Name == "TestAccount, Catechism")
                {
                    x.DoubleClick();
                    break;
                }
            }

            List <Window> w = application.GetWindows();

            Assert.IsTrue(w.Count == 1);
            return(w[0]);
        }
Exemplo n.º 20
0
        public void GetMultipleButtonsTest()
        {
            MainWindow.Get <Button>("GetMultipleButton").Click();
            var window = MainWindow.ModalWindow("GetMultiple");

            try
            {
                var buttons = window.GetMultiple(SearchCriteria.ByNativeProperty(AutomationElement.NameProperty, "Button")).OfType <Button>().ToList();
                Assert.That(buttons, Has.Count.EqualTo(3));

                if (Framework == WindowsFramework.Wpf)
                {
                    buttons = window.GetMultiple(SearchCriteria.ByAutomationId("Test")).OfType <Button>().ToList();
                    Assert.That(buttons, Has.Count.EqualTo(3));
                }

                var checkboxes = window.GetMultiple(SearchCriteria.ByControlType(ControlType.CheckBox)).OfType <CheckBox>().ToList();
                Assert.That(checkboxes, Has.Count.EqualTo(3));

                checkboxes = window.GetMultiple(SearchCriteria.ByNativeProperty(AutomationElement.NameProperty, "Checkbox")).OfType <CheckBox>().ToList();
                Assert.That(checkboxes, Has.Count.EqualTo(3));

                if (Framework == WindowsFramework.Wpf)
                {
                    checkboxes = window.GetMultiple(SearchCriteria.ByAutomationId("Test2")).OfType <CheckBox>().ToList();
                    Assert.That(checkboxes, Has.Count.EqualTo(3));
                }

                if (Framework == WindowsFramework.Wpf)
                {
                    var customControls = window.GetMultiple(SearchCriteria.ByClassName("CustomItem")).ToList();
                    Assert.That(customControls, Has.Count.EqualTo(3));
                }
            }
            finally
            {
                window.Close();
            }
        }
Exemplo n.º 21
0
        /// <summary>
        /// 输入医院名称,点击查询按钮,加载该医院
        /// </summary>
        public static bool Search_HospitalName(Window appWin, out string msg)
        {
            try
            {
                var startTime = DateTime.Now;
                //输入医院名称
                TextBox txtSearchHospital = appWin.Get <TextBox>(SearchCriteria.ByAutomationId("txtSearchHospital"));
                txtSearchHospital.BulkText = "口腔";

                //点击查询按钮
                Button btnSearch = appWin.Get <Button>(SearchCriteria.ByAutomationId("btnSearch"));
                btnSearch.Click();

                var endTime = DateTime.Now;

                try
                {
                    //捕捉报错信息,如果能捕捉到,则测试未通过
                    string error_info = appWin.Get <Label>(SearchCriteria.ByText("查询角色列表异常!")).ToString();

                    btnSearch.Click();

                    error_info = appWin.Get <Label>(SearchCriteria.ByText("查询角色列表异常!")).ToString();

                    msg = "测试【输入医院名称,点击查询按钮,加载该医院】--未通过," + error_info + "用时:" + (endTime - startTime).TotalSeconds;
                    return(false);
                }
                catch
                {
                    msg = "测试【输入医院名称,点击查询按钮,加载该医院】--通过,用时:" + (endTime - startTime).TotalSeconds;
                    return(true);
                }
            }
            catch (Exception e)
            {
                msg = "测试【输入医院名称,点击查询按钮,加载该医院】--失败,原因:" + e.ToString();
                return(false);
            }
        }
Exemplo n.º 22
0
        /// <summary>
        /// 新增医院,省份为空
        /// </summary>
        /// <param name="appWin"></param>
        /// <param name="msg"></param>
        /// <returns></returns>
        public static bool AddHospital_ProvinceNull(Window appWin, out string msg)
        {
            try
            {
                var startTime = DateTime.Now;

                //角色名称不为空
                TextBox txtHospitalName = appWin.MdiChild(SearchCriteria.ByAutomationId("AddOrEditHospitalView")).Get <TextBox>(SearchCriteria.ByAutomationId("txtHospitalName"));
                txtHospitalName.BulkText = Generate.GenerateChineseWords(6);

                //点击确定按钮
                Button btnComfirmAddHospital = appWin.Get <Button>(SearchCriteria.ByAutomationId("btnComfirmAddHospital"));
                btnComfirmAddHospital.Click();

                var endTime = DateTime.Now;

                try
                {
                    //捕捉报错信息,如果能捕捉到,则测试通过
                    string error_info = appWin.Get <Label>(SearchCriteria.ByText("省不能为空!")).ToString();
                    //关闭提醒框
                    Button btnTips = appWin.Get <Button>(SearchCriteria.ByAutomationId("2"));
                    btnTips.Click();

                    msg = "测试【新增医院,省份为空】--通过,用时:" + (endTime - startTime).TotalSeconds;
                    return(true);
                }
                catch
                {
                    msg = "测试【新增医院,省份为空】--未通过,缺少省份错误提醒。用时:" + (endTime - startTime).TotalSeconds;
                    return(false);
                }
            }
            catch (Exception e)
            {
                msg = "测试【新增医院,省份为空】--失败,原因:" + e.ToString();
                return(false);
            }
        }
Exemplo n.º 23
0
        /// <summary>
        /// 新增医院,医院名称为空
        /// </summary>
        /// <param name="appWin"></param>
        /// <param name="msg"></param>
        /// <returns></returns>
        /// 增加按钮:btnAddHospital
        /// 医院名称:txtHospitalName
        /// 选择省:cbProvince
        /// 选择市:cbCity
        /// 选择区:cbDistrict
        /// 详细地址:txtAddress
        /// 医院简介:txtHospitalIntro
        /// 医院负责人:txtHospitalManager
        /// 负责人图片:btnManagerBadgeUpdated
        /// 营业执照:btnCharterUpdated
        /// 执照编号:txtCharterSn
        /// 注册时间:dpRegisterDate
        /// 市场负责人:txtMarketLeader
        /// 确认按钮:btnComfirmAddHospital
        /// 取消按钮:btnCancleAddHospital
        public static bool AddHospital_NameNull(Window appWin, out string msg)
        {
            try
            {
                var startTime = DateTime.Now;

                //点击新增按钮
                Button btnAddHospital = appWin.Get <Button>(SearchCriteria.ByAutomationId("btnAddHospital"));
                btnAddHospital.Click();

                //点击确定按钮
                Button btnComfirmAddHospital = appWin.Get <Button>(SearchCriteria.ByAutomationId("btnComfirmAddHospital"));
                btnComfirmAddHospital.Click();

                var endTime = DateTime.Now;

                try
                {
                    //捕捉报错信息,如果能捕捉到,则测试通过
                    string error_info = appWin.Get <Label>(SearchCriteria.ByText("医院名称不能为空!")).ToString();
                    //关闭提醒框
                    Button btnTips = appWin.Get <Button>(SearchCriteria.ByAutomationId("2"));
                    btnTips.Click();

                    msg = "测试【新增医院,医院名称为空】--通过,用时:" + (endTime - startTime).TotalSeconds;
                    return(true);
                }
                catch
                {
                    msg = "测试【新增医院,医院名称为空】--未通过,缺少医院名称验证提醒。用时:" + (endTime - startTime).TotalSeconds;
                    return(false);
                }
            }
            catch (Exception e)
            {
                msg = "测试【新增医院,医院名称为空】--失败,原因:" + e.ToString();
                return(false);
            }
        }
        public void TestPlayerStats_NoData()
        {
            Application app    = base.Application;
            Window      window = app.GetWindow(SearchCriteria.ByAutomationId("StartScreen"), InitializeOption.WithCache);

            Delete_AchievementData();
            window.WaitWhileBusy();
            //click the stats button
            Button statsBtn = window.Get <Button>(SearchCriteria.ByAutomationId("button4"));

            window.WaitWhileBusy();
            statsBtn.Click();
            window.WaitWhileBusy();
            //get stats window
            Window playerStats = app.GetWindow(SearchCriteria.ByAutomationId("PlayerStats"), InitializeOption.WithCache);

            playerStats.WaitWhileBusy();
            playerStats.Close();
            window.Close();
            app.Close();
            app.Dispose();
        }
Exemplo n.º 25
0
 //This method select perticular button on the page
 public static bool Click(pscWindow window, string elementid)
 {
     try
     {
         Console.WriteLine("Trying to access the element using automation id");
         try
         {
             Button button = window.Get <Button>(SearchCriteria.ByAutomationId(elementid));
             button.Click();
             return(true);
         }
         catch (Exception)
         {
             try
             {
                 Console.WriteLine("Trying to access the element using Name of element");
                 Button button = window.Get <Button>(SearchCriteria.ByText(elementid));
                 button.Click();
                 return(true);
             }
             catch (Exception)
             {
                 try
                 {
                     Console.WriteLine("Trying to access the element using ClassName id");
                     Button button = window.Get <Button>(SearchCriteria.ByClassName(elementid));
                     button.Click();
                     return(true);
                 }
                 catch (Exception)
                 { Console.WriteLine("Not able to find out the element id");
                   return(false); }
             }
         }
     }
     catch (Exception)
     { Console.WriteLine("Not able to click on button");
       return(false); }
 }
Exemplo n.º 26
0
        public void InternetExplorerTests()
        {
            using (var app = Application.Launch(InternetExplorer))
            {
                using (var window = app.GetWindows().Single())
                {
                    var button = window.Get <Button>(SearchCriteria.ByAutomationId("Item 3"));
                    //check if we can get a win32 tooltip
                    Assert.That(window.GetToolTipOn(button).Text, Is.EqualTo("Tools (Alt+X)"));
                    button.Click();
                    window.PopupMenu("Internet options").Click();
                    using (var internetOptions = window.ModalWindow("Internet Options"))
                    {
                        var textBox = internetOptions.Get <TextBox>(SearchCriteria.ByAutomationId("1487"));

                        textBox.Text = "http://google.com";

                        Assert.That(textBox.Text, Is.EqualTo("http://google.com"));
                    }
                }
            }
        }
Exemplo n.º 27
0
        public void LeftHelloDetected()
        {
            //Arrange
            Application application = Application.Launch(@"..\..\..\HelloKinectWPF\bin\Debug\HelloKinectWPF.exe");
            Window      window      = application.GetWindow("MainWindow", InitializeOption.NoCache);

            window.WaitWhileBusy();

            //Act
            var fileStream = new FileStream(RecordingPath, FileMode.Open);

            Kinect.ReplayStart(fileStream);
            Thread.Sleep(8000);

            //Assert
            var label = window.Get <TestStack.White.UIItems.Label>(SearchCriteria.ByAutomationId("Label"));

            Assert.That(label.Text == "Hello Kinect");

            fileStream.Close();
            application.Close();
        }
Exemplo n.º 28
0
        public Window In_SelectFacility_Choose_Facility_Load_Desktop(Window window, string facility)
        {
            ListBox facilityFilter = window.Get <ListBox>(SearchCriteria.ByAutomationId("ListBox"));

            facilityFilter.Item("Any").Select();

            ListView facilityListings = window.Get <ListView>(SearchCriteria.ByAutomationId("listView"));

            ListViewRow row = facilityListings.Rows.Where(x => x.Name == facility).FirstOrDefault();

            row.Select();
            row.DoubleClick();

            List <Window> newWindows = application.GetWindows();

            Assert.IsTrue(newWindows.Count == 1);
            Assert.IsTrue(newWindows[0].Id == "HomeHealthDesktop");

            window.Close();

            return(newWindows[0]);
        }
Exemplo n.º 29
0
        static void test2()
        {
            Application app    = Application.Attach("CnEport.SuperPass.UIModule.Eport");
            Window      window = app.GetWindow(SearchCriteria.ByAutomationId("AppForm"), InitializeOption.NoCache);

            SearchCriteria searchGName = SearchCriteria.ByClassName("WindowsForms10.EDIT.app.0.202c666");

            searchGName.AndControlType(typeof(TextBox), WindowsFramework.WinForms);
            //searchGName.AndAutomationId("GName");
            //searchGName.AndByText("规格型号");
            StringBuilder sb = new StringBuilder();

            foreach (TextBox a in window.GetMultiple(searchGName))
            {
                sb.AppendFormat("name:{0} id:{1} helpText:{2}\n", a.Name, a.Id, a.HelpText);
                if (a.HelpText.IndexOf("规格型号") > -1)
                {
                    a.Text = "testtest";
                }
            }
            System.IO.File.WriteAllText("textbox.txt", sb.ToString());
        }
Exemplo n.º 30
0
        public void AddContact(contact search, string keyword)
        {
            advanceSearch.Get <Button>(SearchCriteria.ByAutomationId("btnEmployees")).Click();
            Window addContactWin = advanceSearch.ModalWindow("Add Contact");
            //Panel empSearch = addContactWin.Get<Panel>(SearchCriteria.ByAutomationId("panLeft"));
            contact c = search;

            switch (c)
            {
            case contact.Employee:
                addContactWin.Get <RadioButton>(SearchCriteria.ByAutomationId("optEmployeeLastName")).Click();
                addContactWin.Get(SearchCriteria.ByAutomationId("txtLastName")).SetValue(keyword);
                break;

            case contact.CaseCode:
                addContactWin.Get <RadioButton>(SearchCriteria.ByAutomationId("optCaseCode")).Click();
                addContactWin.Get(SearchCriteria.ByAutomationId("txtCaseCode")).SetValue(keyword);
                addContactWin.Get <Button>(SearchCriteria.ByAutomationId("btnSearch")).Click();
                addContactWin.Get <Button>(SearchCriteria.ByNativeProperty(AutomationElement.NameProperty, "Select All")).Click();
                break;

            case contact.Office:
                addContactWin.Get <RadioButton>(SearchCriteria.ByAutomationId("optEmployeeOffice")).Click();
                addContactWin.Get <ComboBox>(SearchCriteria.ByAutomationId("cboEmployeeOffice")).SetValue(keyword);
                addContactWin.Get <Button>(SearchCriteria.ByAutomationId("btnSearch")).Click();
                addContactWin.Get <Button>(SearchCriteria.ByNativeProperty(AutomationElement.NameProperty, "Select All")).Click();
                break;

            case contact.All:
                addContactWin.Get <RadioButton>(SearchCriteria.ByAutomationId("optAll")).Click();
                break;

            default:
                addContactWin.Get <RadioButton>(SearchCriteria.ByAutomationId("btnCancel")).Click();
                break;
            }

            addContactWin.Get <Button>(SearchCriteria.ByAutomationId("btnSave")).Click();
        }