-
Notifications
You must be signed in to change notification settings - Fork 476
Expand file tree
/
Copy pathRawAutomationElementFinderTests.cs
More file actions
49 lines (44 loc) · 1.53 KB
/
RawAutomationElementFinderTests.cs
File metadata and controls
49 lines (44 loc) · 1.53 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
using NUnit.Framework;
using System;
using System.Windows.Automation;
using TestStack.White.AutomationElementSearch;
using TestStack.White.Configuration;
using TestStack.White.UIItems;
namespace TestStack.White.UITests.AutomationElementSearch
{
[TestFixture(WindowsFramework.WinForms)]
[TestFixture(WindowsFramework.Wpf)]
public class RawAutomationElementFinderTests : WhiteUITestBase
{
private IDisposable cleanup;
public RawAutomationElementFinderTests(WindowsFramework framework)
: base(framework)
{
}
[OneTimeSetUp]
public void Setup()
{
cleanup = CoreConfigurationLocator.Get().ApplyTemporarySettings(c =>
{
c.RawElementBasedSearch = true;
c.MaxElementSearchDepth = 2;
});
}
[OneTimeTearDown]
public void Teardown()
{
cleanup.Dispose();
}
[Test]
public void DescendantTest()
{
using (var window = StartScenario("OpenListView", "ListViewWindow"))
{
var listView = window.Get<ListView>("ListView");
var finder = new RawAutomationElementFinder(listView.AutomationElement);
Assert.That(finder.Descendant(AutomationSearchCondition.ByControlType(ControlType.HeaderItem).WithName("Key")), Is.Not.Null);
Assert.That(finder.Descendant(AutomationSearchCondition.ByControlType(ControlType.Header).WithName("Key")), Is.Null);
}
}
}
}