public void Setup() { _application = LaunchApplication(); _horizonWindow = FindMainWindow(); CustomCommandSerializer.AddKnownTypes(typeof(Background)); }
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!"); }
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); }
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); }
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)); }
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; }
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(); }
public void CleanupApplication() { if (mainWindow != null) { mainWindow.Close(); mainWindow = null; } if (application != null && application.HasExited) { application.Kill(); application = null; } }
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(); } }
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"); }
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(); }
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; }
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"); } }
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; }
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); }
public MainScreen(Application application, Window window) { Application = application; Window = window; }
public AppScreenComponent(Window window, ScreenRepository screenRepository) : base(window, screenRepository) { }
public ScreenClassContainingComponent(Window window, ScreenRepository screenRepository) : base(window, screenRepository) { }
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"); }
protected override void BaseTestFixtureSetup() { window = application.GetWindow("FormContainingCustomControl", InitializeOption.NoCache); }
private void OpenChannelWindow() { Keyboard.HoldKey(KeyboardInput.SpecialKeys.CONTROL); Keyboard.Enter("t"); Keyboard.LeaveAllKeys(); ChannelWindow = MainWindow.ModalWindow("Join Channel"); Assert.IsNotNull(ChannelWindow); }