-
Notifications
You must be signed in to change notification settings - Fork 476
Expand file tree
/
Copy pathWindowsConfiguration.cs
More file actions
56 lines (49 loc) · 1.82 KB
/
WindowsConfiguration.cs
File metadata and controls
56 lines (49 loc) · 1.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using TestStack.White.Factory;
using TestStack.White.ScreenObjects;
using TestStack.White.UIItems;
using TestStack.White.UIItems.Finders;
using TestStack.White.UIItems.WindowItems;
using TestStack.White.UITests.Screens;
namespace TestStack.White.UITests.Infrastructure
{
public abstract class WindowsConfiguration : TestConfiguration
{
private readonly WindowsFramework framework;
protected WindowsConfiguration(WindowsFramework framework)
{
this.framework = framework;
}
public override Application LaunchApplication()
{
// use Codebase so that the tests work also with shadowing enabled
var codeBase = new Uri(Assembly.GetExecutingAssembly().CodeBase);
var app = Path.Combine(Path.GetDirectoryName(codeBase.LocalPath), ApplicationExePath());
var processStartInfo = new ProcessStartInfo
{
FileName = app,
UseShellExecute = false,
CreateNoWindow = true,
RedirectStandardOutput = true,
RedirectStandardError = true
};
return Application.Launch(processStartInfo);
}
public override Window GetMainWindow(Application application)
{
return application.GetWindow(Criteria(), InitializeOption.NoCache);
}
public override MainScreen GetMainScreen(ScreenRepository repository)
{
return repository.Get<MainScreen>(Criteria(), InitializeOption.NoCache);
}
SearchCriteria Criteria()
{
return SearchCriteria.ByFramework(framework.FrameworkId()).AndByText("MainWindow");
}
protected abstract string ApplicationExePath();
}
}