Exemple #1
1
        public static CondictionScript GetBaseCondiction(AutomationElement element,Window rootWindow)
        {
            var walker =
              new System.Windows.Automation.TreeWalker(
                  System.Windows.Automation.Condition.TrueCondition);

            System.Windows.Automation.AutomationElement testparent;
            var baseCondiction = new CondictionScript();
            var paths=new List<AutomationElement>();

            GetPath(element, rootWindow, walker, paths);

            int flag = AnalyseSimpleCondiction(paths, rootWindow, baseCondiction);

            if(flag>0)
            {
                return baseCondiction;
            }
            else if(flag==0)
            {
                return new CondictionScript();
            }
            else
            {
                return null;
            }
        }
 public void Slide(Window window)
 {
     var thumb = window.Get<Thumb>("Splitter");
     double originalX = thumb.Location.X;
     thumb.SlideHorizontally(50);
     Assert.Equal(originalX + 50, thumb.Location.X);
 }
Exemple #3
0
        //**************************************************************************************************************************************************************
        public static bool CheckWindowExists(Window mainWindow, string childWindowName)
        {
            bool window = false;

            try
            {
                List<Window> allChildWindows = mainWindow.ModalWindows();

                foreach (Window w in allChildWindows)
                {
                    if (w.Name.Equals(childWindowName) || w.Name.Contains(childWindowName))
                    {
                        window = true;
                        Thread.Sleep(int.Parse(Execution_Speed));
                        break;
                    }
                }

                return window;
            }
            catch (Exception e)
            {
                String sMessage = e.Message;
                LastException.SetLastError(sMessage);
                throw new Exception(sMessage);
            }
        }
Exemple #4
0
        /// <summary>
        /// reset action after executing
        /// </summary>
        public override void Reset()
        {
            base.Reset();

            Window = null;
            Control = null;
        }
Exemple #5
0
        public virtual object New(Window window, ScreenRepository screenRepository)
        {
            var o = Activator.CreateInstance(type, window, screenRepository);
            //Get all fields, even from base types
            var fieldInfos = AllTypes(type).SelectMany(t=>t.GetFields(Entity.BindingFlag));
            foreach (var fieldInfo in fieldInfos)
            {
                if (nonInjectedTypes.Any(t=>t.IsAssignableFrom(fieldInfo.FieldType))) continue;

                object injectedObject = null;
                if (typeof(IUIItem).IsAssignableFrom(fieldInfo.FieldType))
                {
                    var interceptor = new UIItemInterceptor(SearchCondition(fieldInfo, window.Framework), window, screenRepository.SessionReport);
                    injectedObject = DynamicProxyGenerator.Instance.CreateProxy(fieldInfo.FieldType, interceptor);
                }
                else if (typeof(AppScreenComponent).IsAssignableFrom(fieldInfo.FieldType))
                {
                    var componentScreenClass = new ScreenClass(fieldInfo.FieldType);
                    injectedObject = componentScreenClass.New(window, screenRepository);
                }

                if (injectedObject != null) fieldInfo.SetValue(o, injectedObject);
            }

            return o;
        }
        /// <summary>
        /// given a criteria, find a control within a window
        /// </summary>
        /// <param name="window">the containing window</param>
        /// <param name="criteria">the criteria to find the control</param>
        /// <returns>the found control. null - if not found</returns>
        public IUIItem FindControl(Window window, Dictionary<string, string> criteria)
        {
            // the "all" condition
            SearchCriteria crit = SearchCriteria.All;

            // for each criteria, AND with a new condition
            foreach (string key in criteria.Keys)
            {
                switch (key.ToLower())
                {
                    //case Constants.PropertyNames.ControlType:
                    //    crit = crit.AndControlType(GetTypeByName(criteria[key]));
                    //    break;
                    case Constants.PropertyNames.AutomationId:
                        crit = crit.AndAutomationId(criteria[key]);
                        break;
                    case Constants.PropertyNames.Text:
                        crit = crit.AndByText(criteria[key]);
                        break;
                    case Constants.PropertyNames.ClassName:
                        crit = crit.AndByClassName(criteria[key]);
                        break;
                    case Constants.PropertyNames.Index:
                        crit = crit.AndIndex(int.Parse(criteria[key]));
                        break;
                    default:
                        {
                            bool bNativeFound = false;
                            AutomationProperty[] props = window.AutomationElement.GetSupportedProperties();
                            foreach (AutomationProperty prop in props)
                            {
                                string propName = prop.ProgrammaticName.Substring(prop.ProgrammaticName.IndexOf('.') + 1);
                                propName = propName.Substring(0, propName.IndexOf("Property"));
                                if (propName.Equals(key, StringComparison.CurrentCultureIgnoreCase))
                                {
                                    crit.AndNativeProperty(prop, criteria[key]);
                                    bNativeFound = true;
                                    break;
                                }
                            }
                            if (bNativeFound)
                                break; ;
                        }
                        return null;
                };
            }

            try
            {
                // search for control with 'crit'
                IUIItem item = window.Get(crit, WaitTime);

                // return the found control
                return item;
            }
            catch(Exception)
            {
                return null;
            }
        }
        /// <summary>
        /// given a criteria, find a control within a window
        /// </summary>
        /// <param name="window">the containing window</param>
        /// <param name="criteria">the criteria to find the control</param>
        /// <returns>the found control. null - if not found</returns>
        public IUIItem FindControl(Window window, Dictionary<string, string> criteria)
        {
            // the "all" condition
            SearchCriteria crit = SearchCriteria.All;

            // for each criteria, AND with a new condition
            foreach (string key in criteria.Keys)
            {
                switch (key.ToLower())
                {
                    case Constants.PropertyNames.ControlType:
                        crit = crit.AndControlType(GetTypeByName(criteria[key]));
                        break;
                    case Constants.PropertyNames.AutomationId:
                        crit = crit.AndAutomationId(criteria[key]);
                        break;
                    case Constants.PropertyNames.Text:
                        crit = crit.AndByText(criteria[key]);
                        break;
                    default:
                        return null;
                };
            }

            // search for control with 'crit'
            IUIItem item = window.Get(crit, WaitTime);

            // return the found control
            return item;
        }
        public static void ClassInit(TestContext context)
        {
            var applicationPath = "WhiteTest.exe";

            application = Application.Launch(applicationPath);
            window = application.GetWindow("MainWindow", InitializeOption.NoCache);
        }
 public void Initialize()
 {
     qbApp = FrameworkLibraries.AppLibs.WhiteAPI.QuickBooks.Initialize(exe);
     qbWindow = FrameworkLibraries.AppLibs.WhiteAPI.QuickBooks.PrepareBaseState(qbApp);
     QuickBooks.ResetQBWindows(qbApp, qbWindow, false);
     InitQB();
 }
Exemple #10
0
 public void Slide(Window window)
 {
     var thumb = window.Get<Thumb>("Splitter");
     var originalY = thumb.Location.Y;
     thumb.SlideVertically(50);
     Assert.Equal(originalY + 50, thumb.Location.Y);
 }
 public void Initialize()
 {
     Logger test = new Logger("US_Commented_Reports_Test");
     qbApp = FrameworkLibraries.AppLibs.WhiteAPI.QuickBooks.Initialize(exe);
     qbWindow = FrameworkLibraries.AppLibs.WhiteAPI.QuickBooks.PrepareBaseState(qbApp);
     QuickBooks.ResetQBWindows(qbApp, qbWindow, false);
     InitQB();
 }
Exemple #12
0
        public OperationsPage(Window window)
        {
            this.window = window;

            string[] operations = { "*", "/", "-", "+", "=" };

            operationButtons = operations.ToDictionary(o => o, o => window.Get<Button>(SearchCriteria.ByText(o)));
        }
 public void TestInitialize()
 {
     qbApp = FrameworkLibraries.AppLibs.QBDT.WhiteAPI.QuickBooks.Initialize(exe);
     qbWindow = FrameworkLibraries.AppLibs.QBDT.WhiteAPI.QuickBooks.PrepareBaseState(qbApp);
     QuickBooks.ResetQBWindows(qbApp, qbWindow);
     invoiceNumber = rand.Next(12345, 99999);
     poNumber = rand.Next(12345, 99999);
 }
 public void SetUp()
 {
     application     = Application.Launch(Path.Combine(TestContext.CurrentContext.TestDirectory, "YodaSpeak.exe"));
     window          = application.GetWindow("Yoda Speak");
     txtOriginalText = window.Get <TextBox>(SearchCriteria.ByAutomationId("txtOriginalText"));
     button          = window.Get <Button>(SearchCriteria.ByAutomationId("btnTranslate"));
     txtResult       = window.Get <Label>(SearchCriteria.ByAutomationId("txtResult"));
 }
Exemple #15
0
        //This process get Window of application
        public static pscWindow getWindow(TestStack.White.Application application)
        {
            WindowItems.Window pscWindow = application.GetWindow
                                               (SearchCriteria.ByText("Theranos.PSC"), InitializeOption.NoCache);

            Console.WriteLine("Application has been detected");
            return(pscWindow);
        }
Exemple #16
0
 public DeskSelectionModel(Window window)
 {
     deskSelection = window.Get<ComboBox>(SearchCriteria.ByAutomationId(DeskSelectionIDs.DESKSELECTIONCOMBOBOX));
     makeMeImmediatlyAvailable = window.Get<CheckBox>(SearchCriteria.ByAutomationId(DeskSelectionIDs.MAKEMEIMMEDIATELYAVAILABLECHECKBOX));
     okButton = window.Get<Button>(SearchCriteria.ByAutomationId(DeskSelectionIDs.OKBUTTON));
     cancelButton = window.Get<Button>(SearchCriteria.ByAutomationId(DeskSelectionIDs.OKBUTTON));
     closeButton = window.Get<Button>(SearchCriteria.ByAutomationId(DeskSelectionIDs.CLOSEBUTTON));
 }
        public void CleanUp()
        {
            _mainWindow.Close();
            _application.Dispose();

            _application = null;
            _mainWindow = null;
        }
Exemple #18
0
 public LoginModel(Window loginWindow)
 {
     loginTextBox = loginWindow.Get<TextBox>(SearchCriteria.ByAutomationId(LoginWindowIDs.LOGINTEXTBOX));
     passwordField = loginWindow.Get<TextBox>(SearchCriteria.ByAutomationId(LoginWindowIDs.PASSWORDTEXTBOX));
     clientField = loginWindow.Get<TextBox>(SearchCriteria.ByAutomationId(LoginWindowIDs.CLIENDTEXTBOX));
     rememberMeCheckBox = loginWindow.Get<CheckBox>(SearchCriteria.ByClassName(LoginWindowIDs.REMEMBERMECHECKBOX));
     loginButton = loginButton = loginWindow.Get<Button>(SearchCriteria.ByAutomationId(LoginWindowIDs.LOGINBUTTON));
 }
Exemple #19
0
        public ResultPage(Window window)
        {
            this.window = window;

            var edits = window.GetMultiple(SearchCriteria.ByControlType(ControlType.Edit)).Cast<TextBox>().ToArray();
            resultField = edits.First(edit => edit.Text == "0");
            resultScreen = edits.First(edit => edit != resultField);
            resultButton = window.Get<Button>(SearchCriteria.ByText("="));
            okButtonCriteria = SearchCriteria.ByText("OK");
        }
Exemple #20
0
 internal WhiteWindowShim(Window whiteWindow)
 {
     this._white = whiteWindow;
     try
     {
         if (_white.Exists<Label>())
             _text = _white.Get<Label>().Text;
     }
     catch { }
 }
Exemple #21
0
        public void SetUp()
        {
            var applicationDirectory = TestContext.CurrentContext.TestDirectory;
            var applicationPath = Path.Combine(applicationDirectory, "AvalonCalculator.exe");
            Application application = Application.Launch(applicationPath);
            window = application.GetWindow("WPF Calculator", InitializeOption.NoCache);

            numbersPage = new NumbersPage(window);
            operationsPage = new OperationsPage(window);
            resultPage = new ResultPage(window);
        }
Exemple #22
0
        public NumbersPage(Window window)
        {
            var symbolToButtonNameMappings = Enumerable.Range(0, 10)
                .Select(i => i.ToString()).Concat(new [] {"." })
                .ToDictionary(i => i, i => i);
            symbolToButtonNameMappings["-"] = "+/-";

            symbolButtons = symbolToButtonNameMappings
                .ToDictionary(mapping => mapping.Key,
                    mapping => window.Get<Button>(SearchCriteria.ByText(mapping.Value)));
        }
 public void Initialize()
 {
    
     qbApp = FrameworkLibraries.AppLibs.WhiteAPI.QuickBooks.Initialize(exe);
     qbWindow = FrameworkLibraries.AppLibs.WhiteAPI.QuickBooks.PrepareBaseState(qbApp);
     QuickBooks.ResetQBWindows(qbApp, qbWindow, false);
     //InitQB();
     if (!qbWindow.Title.Contains("COSMETICS"))
     {
         FrameworkLibraries.AppLibs.WhiteAPI.QuickBooks.OpenOrUpgradeCompanyFile(DefaultCompanyFilePath, qbApp, qbWindow, false, false);
     }
     qbWindow.Focus();
 }
        public void OneTimeSetUp()
        {
            var title = "EnumRowWindow";
            this.application = Application.AttachOrLaunch(Info.CreateStartInfo(title));
            this.window = this.application.GetWindow(title);
            this.loseFocusButton = this.window.GetByText<Button>("lose focus");
            this.currentCultureTextBlock = this.window.Get<Label>("currentTextBlock");

            this.currentBox = this.window.FindRow("current").Value<ComboBox>();
            this.explicitTypeBox = this.window.FindRow("explicit_type").Value<ComboBox>();
            this.lostFocusBox = this.window.FindRow("lostfocus").Value<ComboBox>();
            this.readonlyBox = this.window.FindRow("readonly").Value<ComboBox>();
            this.editableBox = this.window.FindRow("editable").Value<ComboBox>();
        }
        public void Initialize()
        {
            this._window = Desktop.Instance.Windows().Find(w => w.Name.Equals("JiraEX - Microsoft Visual Studio"));

            this._home           = (Button)this._window.Get(SearchCriteria.ByText("Home").AndByClassName("Button"));
            this._back           = (Button)this._window.Get(SearchCriteria.ByText("Back").AndByClassName("Button"));
            this._forward        = (Button)this._window.Get(SearchCriteria.ByText("Forward").AndByClassName("Button"));
            this._refresh        = (Button)this._window.Get(SearchCriteria.ByText("Refresh Issues").AndByClassName("Button"));
            this._connections    = (Button)this._window.Get(SearchCriteria.ByText("Sign-in").AndByClassName("Button"));
            this._filters        = (Button)this._window.Get(SearchCriteria.ByText("Filters").AndByClassName("Button"));
            this._advancedSearch = (Button)this._window.Get(SearchCriteria.ByText("Advanced Search").AndByClassName("Button"));

            this._home.Click();
        }
        public static void SetValuesOnProcessCreditCardPaymentWindow(Window paymentWin, string ccNumber, string expMonth, string expYear, string nameOnCard, string secCode, string billingAddr, string zipCode)
        {
            try
            {
                Logger.logMessage("---------------------------------------------------------------------------------");

                var paymentPanel = Actions.GetPaneByName(paymentWin, "Quickbooks Payments: Process Credit Card");

                PropertyCondition editCondition = new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.Edit);
                AutomationElementCollection editElements = paymentPanel.AutomationElement.FindAll(TreeScope.Children, editCondition);
                int count = 0;

                foreach (AutomationElement item in editElements)
                {
                    count = count + 1;
                    TestStack.White.UIItems.TextBox t = new TestStack.White.UIItems.TextBox(item, paymentWin.ActionListener);

                    if (count == 1)
                        t.Text = ccNumber;

                    if (count == 2)
                        t.Text = expMonth;

                    if (count == 3)
                        t.Text = expYear;

                    if (count == 4)
                        t.Text = nameOnCard;

                    if (count == 5)
                        t.Text = secCode;

                    if (count == 6)
                        t.Text = billingAddr;

                    if (count == 7)
                        t.Text = zipCode;
                }

                Thread.Sleep(int.Parse(Execution_Speed));
                Logger.logMessage("---------------------------------------------------------------------------------");
            }
            catch (Exception e)
            {
                String sMessage = e.Message;
                LastException.SetLastError(sMessage);
                throw new Exception(sMessage);
            }

        }
Exemple #27
0
 //**************************************************************************************************************************************************************
 public static void ClickButtonByAutomationID(Window win, String automationID)
 {
     try
     {
         TestStack.White.UIItems.Button b = (TestStack.White.UIItems.Button) win.Get(SearchCriteria.ByAutomationId(automationID));
         b.Click();
         Thread.Sleep(int.Parse(Execution_Speed));
     }
     catch (Exception e)
     {
         String sMessage = e.Message;
         LastException.SetLastError(sMessage);
         throw new Exception(sMessage);
     }
 }
Exemple #28
0
        //**************************************************************************************************************************************************************
        public static void CreateCompany(TestStack.White.Application qbApp, Window qbWindow, string businessName, string industry)
        {
            try
            {
                Actions.SelectMenu(qbApp, qbWindow, "File", "New Company...");
                Actions.WaitForChildWindow(qbWindow, "QuickBooks Setup", int.Parse(Sync_Timeout));

                Window QBSetupWindow = Actions.GetChildWindow(qbWindow, FrameworkLibraries.ObjMaps.QBDT.WhiteAPI.Common.Objects.QBSetup_Window_Name);
                Thread.Sleep(int.Parse(Execution_Speed));

                Actions.ClickElementByAutomationID(QBSetupWindow, FrameworkLibraries.ObjMaps.QBDT.WhiteAPI.Common.Objects.ExpressStart_Button_AutoID);
                Thread.Sleep(int.Parse(Execution_Speed));

                if (Actions.CheckElementExistsByAutomationID(QBSetupWindow, "txt_LoginEmail"))
                {
                    Actions.SetTextByAutomationID(QBSetupWindow, "txt_LoginEmail", "*****@*****.**");
                    Actions.ClickElementByAutomationID(QBSetupWindow, "btn_Next");
                    try
                    {
                        Actions.ClickElementByName(Actions.GetChildWindow(qbWindow, "Encountered a Problem"), "Skip");
                    }
                    catch (Exception) { }
                    try { Actions.ClickElementByAutomationID(QBSetupWindow, "btn_Continue"); }
                    catch (Exception) { }
                }

                Actions.SetTextByAutomationID(QBSetupWindow, FrameworkLibraries.ObjMaps.QBDT.WhiteAPI.Common.Objects.BusinessName_TxtField_AutoID, businessName);
                Actions.SetTextByAutomationID(QBSetupWindow, FrameworkLibraries.ObjMaps.QBDT.WhiteAPI.Common.Objects.IndustryList_TxtField_AutoID, "Information");
                Thread.Sleep(int.Parse(Execution_Speed));
                Actions.SelectListBoxItemByText(QBSetupWindow, "lstBox_Industry", "Information Technology");
                Actions.SelectComboBoxItemByText(QBSetupWindow, FrameworkLibraries.ObjMaps.QBDT.WhiteAPI.Common.Objects.TaxStructure_CmbBox_AutoID, "Corporation");
                Actions.SetTextByAutomationID(QBSetupWindow, FrameworkLibraries.ObjMaps.QBDT.WhiteAPI.Common.Objects.TaxID_TxtField_AutoID, "123-45-6789");
                Actions.SelectComboBoxItemByText(QBSetupWindow, FrameworkLibraries.ObjMaps.QBDT.WhiteAPI.Common.Objects.HaveEmployees_CmbBox_AutoID, "No");
                Actions.ClickElementByAutomationID(QBSetupWindow, FrameworkLibraries.ObjMaps.QBDT.WhiteAPI.Common.Objects.Continue_Button_AutoID);
                Thread.Sleep(int.Parse(Execution_Speed));
                Actions.SelectComboBoxItemByText(QBSetupWindow, FrameworkLibraries.ObjMaps.QBDT.WhiteAPI.Common.Objects.StateName_CmbBox_AutoID, "DE");
                Actions.SetTextByAutomationID(QBSetupWindow, FrameworkLibraries.ObjMaps.QBDT.WhiteAPI.Common.Objects.ZipCode_TxtField_AutoID, "DE123");
                Actions.SetTextByAutomationID(QBSetupWindow, FrameworkLibraries.ObjMaps.QBDT.WhiteAPI.Common.Objects.Phone_TxtField_AutoID, "6104567890");
                Actions.ClickElementByAutomationID(QBSetupWindow, FrameworkLibraries.ObjMaps.QBDT.WhiteAPI.Common.Objects.CreateCompany_Button_AutoID);
                Actions.WaitForAnyChildWindow(qbWindow, QBSetupWindow.Name, int.Parse(Sync_Timeout));
            }
            catch (Exception e)
            {
                String sMessage = e.Message;
                LastException.SetLastError(sMessage);
                throw new Exception(sMessage);
            }
        }
 public Navigator UseWindow(int windowIndex)
 {
     _windowId = windowIndex;
     _container = _runningApp.GetWindows()[windowIndex];
     _button = null;
     _checkBox = null;
     _label = null;
     _radioButton = null;
     _textBox = null;
     _comboBox = null;
     _image = null;
     _tab = null;
     _treeView = null;
     _panel = null;
     return this;
 }
        public void setup()
        {
            Logger test = new Logger("General");  
            qbApp = FrameworkLibraries.AppLibs.WhiteAPI.QuickBooks.Initialize(exe);
            qbWindow = FrameworkLibraries.AppLibs.WhiteAPI.QuickBooks.PrepareBaseState(qbApp);
            QuickBooks.ResetQBWindows(qbApp, qbWindow, false);
            InitQB();
            if (!qbWindow.Title.Contains("COSMETICS"))
            {
                FrameworkLibraries.AppLibs.WhiteAPI.QuickBooks.OpenOrUpgradeCompanyFile(DefaultCompanyFilePath, qbApp, qbWindow, false, false);
            }
            qbWindow.Focus();
            //Set Bringback one time messages to true and Set the Desktop view to support multiple windows 
            //Reports.ResetQBPrefForCommentedReports(qbApp, qbWindow);
 
        }
Exemple #31
0
        //**************************************************************************************************************************************************************
        public static bool CheckElementExistsByAutomationID(Window win, String automationID)
        {
            bool exists = false;

            try
            {
                exists = win.Get(SearchCriteria.ByAutomationId(automationID)).Visible;
                Thread.Sleep(int.Parse(Execution_Speed));
                return exists;
            }
            catch (Exception e)
            {
                String sMessage = e.Message;
                LastException.SetLastError(sMessage);
                throw new Exception(sMessage);
            }
        }
Exemple #32
0
        static void Main()
        {

            // Setup data
            SetupData();

            SetupNotify(out sNotifyIcon);

            // Check the bot is running
            var botProcesses = Process.GetProcessesByName(BB_PROCESS_NAME);
            Process botProcess;

            // Check if it's already run or need to launch
            if (!botProcesses.Any())
            {
                botProcess = Process.Start(BB_PATH, null);
                Thread.Sleep(BB_STARTUP_INTERVAL);
            }
            else
            {
                botProcess = botProcesses[0];
            }

            // Change bot priority
            botProcess.PriorityClass = APPS_PRIORITY;

            // Start the bot
            var application = Application.Attach(BB_PROCESS_NAME);

            bbWindow = application.GetWindow(SearchCriteria.All, InitializeOption.NoCache);
            
            BbStartStop(Operations.Start);

            // After BB has start it's good idea to start the server
            StartServer();

            // Change bluestacks priority
            // Make sure the bot is work and bluestacks priority as needed
            while (true)
            {
                ChangeBluestack();
                Task.Delay(WAIT_INTERVAL).Wait();
            }
        }
Exemple #33
0
        /// <summary>
        /// Implements <see cref="IUIItem.ErrorProviderMessage"/>
        /// </summary>
        public virtual string ErrorProviderMessage(Window window)
        {
            var element =
                Desktop.Automation.FromPoint(automationElement.BoundingRectangle.ImmediateExteriorEast);

            if (element == null)
            {
                return(null);
            }
            var errorProviderBounds = element.BoundingRectangle;

            if (automationElement.BoundingRectangle.Right != errorProviderBounds.Left)
            {
                return(null);
            }
            mouse.Location = errorProviderBounds.Center;
            actionListener.ActionPerformed(Action.WindowMessage);
            return(window.ToolTip.Text);
        }
Exemple #34
0
        void testWhite()
        {
            List <TestStack.White.UIItems.WindowItems.Window> list = TestStack.White.Desktop.Instance.Windows();

            TestStack.White.UIItems.WindowItems.Window win = null;
            foreach (TestStack.White.UIItems.WindowItems.Window item in list)
            {
                Match match = Regex.Match(item.Title, "Ember Bootloader and Range Test.*");
                if (match.Success)
                {
                    win = item;
                    break;
                }
            }

            TestStack.White.UIItems.WindowStripControls.ToolStrip toolstrip = win.GetToolStrip("toolStrip1");

            TestStack.White.UIItems.Button b = win.Get <TestStack.White.UIItems.Button>("UnLoad");
            bool t2 = win.HasPopup();
        }
Exemple #35
0
        static void Main(string[] args)
        {
            //setup
            var psi = new ProcessStartInfo(CAExeFile);

            _CAApp        = Application.AttachOrLaunch(psi);
            _CAMainWindow = _CAApp.GetWindow(SearchCriteria.ByAutomationId("ClinicalAccess"), InitializeOption.NoCache);

            //prepare
            _CAMainWindow.Get(SearchCriteria.ByAutomationId("btnSelectPatient")).Click();
            Window _PatientSelectDialogWindow = _CAMainWindow.ModalWindow("Patient Select Dialog");

            var PatientsTab = _PatientSelectDialogWindow.Get(SearchCriteria.ByText("Patients"));

            PatientsTab.Click();

            var cmbFacility = _PatientSelectDialogWindow.Get <ComboBox>(SearchCriteria.ByAutomationId("cmbFacility"));

            //int tryCnt = 0;
            //string FacilitySelectedValue = null;
            //while ((tryCnt < 3) && (FacilitySelectedValue != "XTRSim"))
            //{
            //    cmbFacility.Select("XTRSim");
            //    FacilitySelectedValue = cmbFacility.SelectedItem.Text;
            //    tryCnt++;
            //}

            //make sure the selection on the Unit row works
            _PatientSelectDialogWindow = _CAMainWindow.ModalWindow("Patient Select Dialog");
            _PatientSelectDialogWindow.Get(SearchCriteria.ByText("Unit Row 0")).DoubleClick();
            var DataGridView_Table = _PatientSelectDialogWindow.Get <Table>(SearchCriteria.ByAutomationId("dgvUnits"));

            cmbFacility.Select("XTRSim");

            //to avoid timeout=5000 exception
            CoreAppXmlConfiguration.Instance.BusyTimeout = 100000;//50000
            bool     found   = false;
            TableRow testRow = null;

            //go through the units to find the testing bed
            for (int i = 0; i < DataGridView_Table.Rows.Count; i++)
            {
                string pos = i.ToString();
                _PatientSelectDialogWindow.Get(SearchCriteria.ByText("Unit Row " + pos)).DoubleClick();

                var PatientsDatagrid2 = _PatientSelectDialogWindow.Get <Table>(SearchCriteria.ByAutomationId("dgvPatients"));
                var rows = PatientsDatagrid2.Rows;

                foreach (TableRow row in rows)
                {
                    if ((string)row.Cells[0].Value == "BD002(2140)") //"Room3(2666)") ; //"CP255")
                    {
                        testRow = row;
                        found   = true;
                        break;
                    }
                }
                if (found == true)
                {
                    break;
                }
            }

            //after click the row, the "Patient Select Dialog" disappear and may generate exception
            try
            {
                testRow.Click();
            }
            catch (Exception e)
            {
                Console.WriteLine("test case BedsideData exception" + e.Message.ToString());
            }

            //_CAMainWindow.Get(SearchCriteria.ByAutomationId("btnArrhythmiaReview")).Click();
            //click Bedside
            //var bedsideView = _CAMainWindow.Get(SearchCriteria.ByAutomationId("btnBedSide"));
            //bedsideView.Click();
            var WaveformsView = _CAMainWindow.Get(SearchCriteria.ByText("Waveforms"));

            WaveformsView.Click();
            //_CAMainWindow.Get(SearchCriteria.ByAutomationId("btn12Lead")).Click();
            //_CAMainWindow.Get(SearchCriteria.ByAutomationId("btnAlarmHistory")).Click();
            Thread.Sleep(2000);

            //Test codes

            _CAMainWindow.Get(SearchCriteria.ByAutomationId("btnCompressed")).Click();
            Panel    CompressedWaveformContainer = _CAMainWindow.Get <Panel>(SearchCriteria.ByAutomationId("CompressedWaveformContainer"));
            Panel    TimePanel1    = CompressedWaveformContainer.Get <Panel>(SearchCriteria.ByAutomationId("TimeControl.0"));
            string   DateStr       = TimePanel1.Get <Label>(SearchCriteria.ByAutomationId("Label.0")).Text;
            string   TimeStampStr  = TimePanel1.Get <Label>(SearchCriteria.ByAutomationId("Label.1")).Text;
            DateTime displayedTime = Convert.ToDateTime(DateStr + " " + TimeStampStr);

            //Display most recent data < 15  ?
            Assert.IsTrue((DateTime.Now - displayedTime).TotalMinutes < 15);

            //end test codes

            _CAApp.Close();
            _CAApp.Dispose();
        }
Exemple #36
0
 public virtual void LocationChanged(Window window)
 {
     windowItemsMap.CurrentWindowPosition = window.Location;
 }
Exemple #37
0
 public virtual void Register(Window window)
 {
     window.Focus();
     LocationChanged(window);
 }
Exemple #38
0
 public void init()
 {
     app = Application.Launch(applicationPath);
     win = app.GetWindow("Calculator");
     win.WaitWhileBusy();
 }
 private void Given()
 {
     _application = Application.Launch(AppFileName);
     _mainWindow = _application.GetWindow("Music Manager", InitializeOption.NoCache);
     Menu selectFileMenuItem = _mainWindow.MenuBar.MenuItem("File", "Select Files (.mp3)");
     selectFileMenuItem.Click();
 }