public void Setup()
        {
            _application = LaunchApplication();
            _horizonWindow = FindMainWindow();

            CustomCommandSerializer.AddKnownTypes(typeof(Background));
        }
Example #2
0
 public void Slide(Window window)
 {
     var thumb = window.Get<Thumb>("Splitter");
     double originalX = thumb.Location.X;
     thumb.SlideHorizontally(50);
     Assert.AreEqual(originalX + 50, thumb.Location.X);
 }
 public void RunTheApplication()
 {
     application = Application.Launch("ShopSchedule.exe");
     Assume.That(application, Is.Not.Null, "Application failed to start!");
     mainWindow = application.GetWindows()[0];
     Assume.That(mainWindow, Is.Not.Null, "Could not find the primary window!");
 }
Example #4
0
 public void SetUp()
 {
     application =
         Application.Launch(
             @"..\..\..\Components\CustomCommands\Tests\WPFTestApplication\bin\debug\White.CustomCommands.WPFTestApplication.exe");
     window = application.GetWindow("Form1");
 }
 public void FindModalWindowBasedOnSearchCriteriaWhenThereIsNoWindow()
 {
     window = application.GetWindow("Form1", InitializeOption.NoCache);
     window.Get<Button>("launchModal").Click();
     Window modalWindow = window.ModalWindow(SearchCriteria.ByText("ModalForm1"), InitializeOption.NoCache);
     Assert.AreEqual(null, modalWindow);
 }
Example #6
0
 public void Slide(Window window)
 {
     var thumb = window.Get<Thumb>("Splitter");
     var originalY = thumb.Location.Y;
     thumb.SlideVertically(50);
     Assert.AreEqual(originalY + 50, thumb.Location.Y);
 }
Example #7
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;
        }
        public AuctionSniperDriver(int timeoutMillis)
        {
            application = Application.Attach(ProcessName);

            window = application.GetWindow("Form1");

            Assert.That(window.DisplayState, Is.EqualTo(DisplayState.Restored));
        }
Example #9
0
		public API_VisualStudio_2010 attach()
		{
			GUI = VS_Process = new API_GuiAutomation("devenv");				
			if (VS_Process.TargetProcess.notNull())
				VS_MainWindow = VS_Process.windows()[0];//MAIN_WINDOW_TITLE);
			else
				start();
			return this;
		}
Example #10
0
        public void GivenIAmAtANon_BlackLevel()
        {
            _application = Application.Launch(@"..\..\CcdAddIn.TestHarness\bin\Debug\CcdAddIn.TestHarness.exe");
            _mainWindow = _application.GetWindow("MainWindow");
            _mainWindow.Get<Button>("goToRedLevelButton").Click();

            var firstPrinciple = _mainWindow.Get<ListBox>("principlesListView").Items[0];
            Assert.That(firstPrinciple.Text, Is.StringContaining(Resource.DoNotRepeatYourself));
        }
        public virtual string Generate(Window window)
        {
            window.ReInitialize(InitializeOption.WithCache);
            var stringBuilder = new StringBuilder();
            var stringWriter = new StringWriter(stringBuilder);

            var cscProvider = new CSharpCodeProvider();
            ICodeGenerator codeGenerator = cscProvider.CreateGenerator(stringWriter);
            var codeGeneratorOptions = new CodeGeneratorOptions {BlankLinesBetweenMembers = false, VerbatimOrder = false};

            codeGenerator.GenerateCodeFromCompileUnit(new CodeSnippetCompileUnit(string.Format("using {0};", typeof(UIItem).Namespace)), stringWriter, codeGeneratorOptions);
            codeGenerator.GenerateCodeFromCompileUnit(new CodeSnippetCompileUnit(string.Format("using {0};", typeof(Window).Namespace)), stringWriter, codeGeneratorOptions);
            codeGenerator.GenerateCodeFromCompileUnit(new CodeSnippetCompileUnit(string.Format("using {0};", typeof(AppScreen).Namespace)), stringWriter, codeGeneratorOptions);

            CodeNamespace codeNamespace = null;
            if (S.IsNotEmpty(options.Namespace))
            {
                codeNamespace = new CodeNamespace(options.Namespace);
            }

            var classDefinition = new CodeTypeDeclaration
                                      {
                                          IsClass = true,
                                          IsPartial = true,
                                          Name = window.Title.Trim().Replace(" ", string.Empty),
                                          TypeAttributes = TypeAttributes.Public
                                      };
            classDefinition.BaseTypes.Add(typeof (AppScreen));

            var constructor = new CodeConstructor {Attributes = MemberAttributes.Family};
            classDefinition.Members.Add(constructor);

            constructor = new CodeConstructor {Attributes = MemberAttributes.Public};
            constructor.Parameters.Add(new CodeParameterDeclarationExpression(typeof(Window), "window"));
            constructor.Parameters.Add(new CodeParameterDeclarationExpression(typeof (ScreenRepository), "screenRepository"));
            constructor.BaseConstructorArgs.Add(new CodeVariableReferenceExpression("window"));
            constructor.BaseConstructorArgs.Add(new CodeVariableReferenceExpression("screenRepository"));
            classDefinition.Members.Add(constructor);

            var visitor = new CodeGenerationVisitor(new WindowCodeGenerationStrategy(options));
            window.Visit(visitor);
            visitor.Generate(classDefinition);

            if (codeNamespace != null)
            {
                codeNamespace.Types.Add(classDefinition);
                codeGenerator.GenerateCodeFromNamespace(codeNamespace, stringWriter, codeGeneratorOptions);
            }
            else
            {
                codeGenerator.GenerateCodeFromType(classDefinition, stringWriter, codeGeneratorOptions);
            }

            stringWriter.Close();
            return stringBuilder.ToString();
        }
Example #12
0
 public void CleanupApplication()
 {
     if (mainWindow != null) {
         mainWindow.Close();
         mainWindow = null;
     }
     if (application != null && application.HasExited) {
         application.Kill();
         application = null;
     }
 }
Example #13
0
 public void getGridData(Window win)
 {
     Thread.Sleep(1000);
      table = win.Get<Table>(SearchCriteria.ByAutomationId("grdDisplay"));
     TableRows rows = table.Rows;
     row = rows[0];
     // below line fails even though it is identified in Spy
     TableCell cell = row.Cells[0];
     String ab = cell.Value.ToString();
     Console.WriteLine(ab + " Cell Data");
     Console.ReadLine();
 }
 protected void CloseModal(Window window)
 {
     Window modalWindow = null;
     try
     {
         modalWindow = window.ModalWindow("ModalForm", InitializeOption.NoCache);
     }
     finally
     {
         if (modalWindow != null) modalWindow.Get<Button>("ok").Click();
     }
 }
Example #15
0
        public void GivenIFinishMyRetrospectiveWithASuggestionToAdvanceToTheNextLevel()
        {
            File.Delete(@"..\..\CcdAddIn.TestHarness\bin\Debug\repository");
            File.Copy(@"..\..\repository21perfectRetrospectives", @"..\..\CcdAddIn.TestHarness\bin\Debug\repository");

            _application = Application.Launch(@"..\..\CcdAddIn.TestHarness\bin\Debug\CcdAddIn.TestHarness.exe");
            _mainWindow = _application.GetWindow("MainWindow");
            _mainWindow.Get<Button>("retrospectiveButton").Click();
            _mainWindow.Get<Button>("retrospectiveDoneButton").Click();

            File.Delete("repository");
        }
Example #16
0
 public void OpenNetworkWindow()
 {
     Application = Application.Launch(@"C:\Users\Flotschi\git\handle\Handle.WPF\Handle.WPF\bin\Debug\Handle.WPF.exe");
       Assert.IsNotNull(Application);
       MainWindow = Application.GetWindow("Handle");
       Assert.IsNotNull(MainWindow);
       MainWindow.Focus();
       Keyboard.LeaveAllKeys();
       Keyboard.HoldKey(KeyboardInput.SpecialKeys.CONTROL);
       Keyboard.Enter("n");
       NetworkWindow = MainWindow.ModalWindow("Networks");
       Assert.IsNotNull(NetworkWindow);
       Keyboard.LeaveAllKeys();
       NetworkWindow.Close();
       Application.Kill();
 }
Example #17
0
		public API_VisualStudio_2010 start()
		{
			 GUI = VS_Process = VisualStudioExe.startProcess().automation(); 
			 for(int i =0; i < 10; i++)
			 {
			 	var windows = VS_Process.windows();
			 	if (windows.notNull() && windows.size()>0)
			 	{
			 		VS_MainWindow = VS_Process.windows()[0];
			 		break;
			 	}
			 	this.sleep(500);
			 }
			 if (VS_MainWindow.isNull())
			 	"In API_VisualStudio_2010 could not find the main Window".error();
			 return this;
		}			    	
 protected override void BaseTestFixtureTearDown()
 {
     keyboard.PressSpecialKey(KeyboardInput.SpecialKeys.ESCAPE);
     if (window == null)
         application.Kill();
     else
     {
         try
         {
             window.Focus();
             window.Close();
         }
         catch {}
     }
     if (ConfigurationManager.AppSettings["SaveWindowItemsMap"] == "true") application.ApplicationSession.Save();
     window = null;
     resultLabel = null;
 }
Example #19
0
        public void EditBoxEnter(Window win, string Textboxname, string val)
        {
            TextBox TextObj = win.Get<TextBox>(SearchCriteria.ByAutomationId(Textboxname));
            White.Core.InputDevices.AttachedKeyboard keyboard = win.Keyboard;
            if (TextObj != null)
            {
                TextObj.Focus();
                TextObj.RaiseClickEvent();
            // below line fails
                keyboard.Enter("Harriet");
            // even below commented line fails
                //TextObj.Enter(val);
                //TextObj.BulkText = "My simple Text";
                //Keyboard.Instance.Enter("my simple");
                string aa = TextObj.Text;
                Console.WriteLine(aa + " - Value Entered in Textbox");

            }
        }
Example #20
0
        public virtual object New(Window window, ScreenRepository screenRepository)
        {
            object o = @class.New(window, screenRepository);
            @class.EachField(delegate(FieldInfo fieldInfo)
                                 {
                                     if (nonInjectedTypes.IsAssignableFrom(fieldInfo.FieldType)) return;
                                     object injectedObject = null;
                                     if (typeof (IUIItem).IsAssignableFrom(fieldInfo.FieldType))
                                     {
                                         var interceptor = new UIItemInterceptor(SearchCondition(fieldInfo), window, screenRepository.SessionReport);
                                         injectedObject = DynamicProxyGenerator.Instance.CreateProxy(interceptor, fieldInfo.FieldType);
                                     }
                                     else if (typeof (AppScreenComponent).IsAssignableFrom(fieldInfo.FieldType))
                                     {
                                         var componentScreenClass = new ScreenClass(new Class(fieldInfo.FieldType));
                                         injectedObject = componentScreenClass.New(window, screenRepository);
                                     }

                                     if (injectedObject != null) fieldInfo.SetValue(o, injectedObject);
                                 });
            return o;
        }
Example #21
0
 public virtual void Handle(Window window)
 {
     window.WaitWhileBusy();
     if (CoreAppXmlConfiguration.Instance.WaitBasedOnHourGlass)
     {
         Clock.Do @do = () => Mouse.Instance.Cursor;
         Clock.Matched matched = delegate(object obj)
                                     {
                                         var cursor = (MouseCursor) obj;
                                         if (MouseCursor.WaitCursors.Contains(cursor))
                                         {
                                             Mouse.Instance.MoveOut();
                                             return false;
                                         }
                                         return true;
                                     };
         Clock.Expired expired =
             delegate { throw new UIActionException(string.Format("Window in still wait mode. Cursor: {0}{1}", Mouse.Instance.Cursor, Constants.BusyMessage)); };
         new Clock(CoreAppXmlConfiguration.Instance.BusyTimeout).Perform(@do, matched, expired);
     }
     CustomWait(window);
     if (types.Contains(ActionType.NewControls)) window.ReloadIfCached();
 }
 public WindowsCalculatorWhite()
 {
     applicationField = Application.Launch("calc.exe");
     windowField = applicationField.GetWindow("Calculator", InitializeOption.NoCache);
 }
Example #23
0
 public MainScreen(Application application, Window window)
 {
     Application = application;
     Window = window;
 }
Example #24
0
 public AppScreenComponent(Window window, ScreenRepository screenRepository)
     : base(window, screenRepository)
 {
 }
Example #25
0
 public ScreenClassContainingComponent(Window window, ScreenRepository screenRepository)
     : base(window, screenRepository)
 {
 }
Example #26
0
 public virtual void StartRecording(Window window, UserEventListener eventListener)
 {
     windowsUnderRecording.Add(window);
     window.ReInitialize(InitializeOption.WithCache);
     window.Visit(new RecorderVisitor(eventListener, recordingOptions));
 }
 public void GivenIStartTheAddinForTheFirstTime()
 {
     _application = Application.Launch(@"..\..\CcdAddIn.TestHarness\bin\Debug\CcdAddIn.TestHarness.exe");
     _mainWindow = _application.GetWindow("MainWindow");
 }
 public void GivenIAmAtTheBlackLevel()
 {
     _application = Application.Launch(@"..\..\CcdAddIn.TestHarness\bin\Debug\CcdAddIn.TestHarness.exe");
     _mainWindow = _application.GetWindow("MainWindow");
 }
Example #29
0
 protected override void BaseTestFixtureSetup()
 {
     window = application.GetWindow("FormContainingCustomControl", InitializeOption.NoCache);
 }
Example #30
0
 private void OpenChannelWindow()
 {
     Keyboard.HoldKey(KeyboardInput.SpecialKeys.CONTROL);
       Keyboard.Enter("t");
       Keyboard.LeaveAllKeys();
       ChannelWindow = MainWindow.ModalWindow("Join Channel");
       Assert.IsNotNull(ChannelWindow);
 }