Esempio n. 1
0
        private void GrabControls(UITest uiTest)
        {
            Process p = Process.GetProcessById(_windowPid);
            ApplicationUnderTest app = ApplicationUnderTest.FromProcess(p);

            GetAllChildren(app, uiTest.Maps[0], ">");
        }
Esempio n. 2
0
        public static ApplicationUnderTest GetAUT()
        {
            var processes = Process.GetProcessesByName("Ellis");

            App = processes.Length > 0
                ? ApplicationUnderTest.FromProcess(processes[0])
                : ApplicationUnderTest.Launch(TestData.Path, TestData.AltPath);

            return(App);
        }
Esempio n. 3
0
        /// <summary>
        /// Creates a reference to an application from an existing process and returns a screen of
        /// type <typeparamref name="T"/>.
        /// </summary>
        /// <typeparam name="T">The type of the screen to return.</typeparam>
        /// <param name="processToWrap">The process to create from</param>
        /// <returns>A screen representing the launched application.</returns>
        public static T FromProcess <T>(Process processToWrap) where T : Screen, new()
        {
            if (processToWrap == null)
            {
                throw new ArgumentNullException("processToWrap");
            }

            var application = ApplicationUnderTest.FromProcess(processToWrap);

            return(new T
            {
                Application = application,
                SearchLimitContainer = application
            });
        }
Esempio n. 4
0
        public static void ClassCleanup()
        {
            // Close the app after all tests are finished
            Playback.Initialize();
            try
            {
                Process[] processes = Process.GetProcessesByName(TestProcess);

                foreach (Process process in processes)
                {
                    ApplicationUnderTest app = ApplicationUnderTest.FromProcess(process);
                    app.Close();
                }
            }
            finally
            {
                Playback.Cleanup();
            }
        }
Esempio n. 5
0
        /// <summary>
        /// Creates a reference to an application from an existing process and returns a screen of
        /// type <typeparamref name="T" />.
        /// </summary>
        /// <typeparam name="T">The type of the screen to return.</typeparam>
        /// <param name="processToWrap">The process to create from</param>
        /// <param name="title">The title.</param>
        /// <returns>
        /// A screen representing the launched application.
        /// </returns>
        /// <exception cref="System.ArgumentNullException">processToWrap</exception>
        public static T FromProcess <T>(Process processToWrap, string title = null) where T : Screen, new()
        {
            if (processToWrap == null)
            {
                throw new ArgumentNullException("processToWrap");
            }

            var application = ApplicationUnderTest.FromProcess(processToWrap);

            if (!string.IsNullOrEmpty(title))
            {
                application.SearchProperties[UITestControl.PropertyNames.Name] = title;
                application.WindowTitles.Add(title);
            }

            return(new T
            {
                Application = application,
                SearchLimitContainer = application
            });
        }
Esempio n. 6
0
        public static void KillInstance(string number, string name)
        {
            var key = String.Format("{0} №{1}", name, number);

            ApplicationUnderTest.FromProcess((Process)ScenarioContext.Current[key]).Close();
        }
Esempio n. 7
0
        public CodedUIApplication <T> Attach(Process process)
        {
            ApplicationUnderTest applicationUnderTest = ApplicationUnderTest.FromProcess(process);

            return(Create(applicationUnderTest));
        }
Esempio n. 8
0
        public static void MyClassCleanup()
        {
            var window = ApplicationUnderTest.FromProcess(_windowProcess);

            window.Close();
        }