-
Notifications
You must be signed in to change notification settings - Fork 63
/
CheckFindByXPath.cs
65 lines (50 loc) · 1.69 KB
/
CheckFindByXPath.cs
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
57
58
59
60
61
62
63
64
65
namespace WpfTestApplication.Tests
{
#region using
using System.Linq;
using NUnit.Framework;
using Winium.Cruciatus;
using Winium.Cruciatus.Core;
using WpfTestApplication.Tests.Map;
#endregion
[TestFixture]
public class CheckFindByXPath
{
#region Fields
private WpfTestApplicationApp application;
#endregion
#region Public Methods and Operators
[Test]
public void FindElementsByPartName()
{
const string XPath = "*[starts-with(@Name, 'M')]";
var results = this.application.MainWindow.TabItem1.TextListBox.FindElements(By.XPath(XPath)).ToList();
Assert.That(results, Has.Count.EqualTo(2));
}
[Test]
public void FindMainWindowFromRoot()
{
const string XPath = "*[@AutomationId='WpfTestApplicationMainWindow']";
var mainWindow = CruciatusFactory.Root.FindElement(By.XPath(XPath));
Assert.AreEqual(mainWindow, this.application.MainWindow);
}
[Test]
public void FindMainWindowUseRootXPathFunction()
{
const string XPath = "/*[@AutomationId='WpfTestApplicationMainWindow']";
var mainWindow = this.application.MainWindow.TabItem1.SetTextButton.FindElement(By.XPath(XPath));
Assert.AreEqual(mainWindow, this.application.MainWindow);
}
[TestFixtureSetUp]
public void FixtureSetUp()
{
TestClassHelper.Initialize(out this.application);
}
[TestFixtureTearDown]
public void FixtureTearDown()
{
TestClassHelper.Cleanup(this.application);
}
#endregion
}
}