Skip to content

Commit

Permalink
Merge pull request #48 from 2gis/feature/xpath
Browse files Browse the repository at this point in the history
Feature/xpath
  • Loading branch information
tkurnosova committed Oct 12, 2015
2 parents a38dfab + d1da6f8 commit 2549467
Show file tree
Hide file tree
Showing 20 changed files with 1,053 additions and 389 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,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
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
<Compile Include="CheckFindByXPath.cs" />
<Compile Include="CheckFocusedElement.cs" />
<Compile Include="Map\ElementExtension.cs" />
<Compile Include="Map\FirstRibbonTab.cs" />
Expand Down
Loading

0 comments on commit 2549467

Please sign in to comment.