ButtonTests.cs 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. using OpenQA.Selenium.Appium.Windows;
  2. using Xunit;
  3. namespace Avalonia.IntegrationTests.Win32
  4. {
  5. [Collection("IntegrationTestApp collection")]
  6. public class ButtonTests
  7. {
  8. private WindowsDriver<WindowsElement> _session;
  9. public ButtonTests(TestAppFixture fixture) => _session = fixture.Session;
  10. [Fact]
  11. public void BasicButton()
  12. {
  13. SelectButtonTab();
  14. var button = _session.FindElementByAccessibilityId("BasicButton");
  15. Assert.Equal("Basic Button", button.Text);
  16. }
  17. [Fact]
  18. public void ButtonWithTextBlock()
  19. {
  20. SelectButtonTab();
  21. var button = _session.FindElementByAccessibilityId("ButtonWithTextBlock");
  22. Assert.Equal("Button with TextBlock", button.Text);
  23. }
  24. private WindowsElement SelectButtonTab()
  25. {
  26. var tabs = _session.FindElementByAccessibilityId("MainTabs");
  27. var buttonTab = tabs.FindElementByName("Button");
  28. buttonTab.Click();
  29. return (WindowsElement)buttonTab;
  30. }
  31. }
  32. }