AutomationTests.cs 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. using OpenQA.Selenium.Appium;
  2. using Xunit;
  3. namespace Avalonia.IntegrationTests.Appium
  4. {
  5. [Collection("Default")]
  6. public class AutomationTests
  7. {
  8. private readonly AppiumDriver<AppiumWebElement> _session;
  9. public AutomationTests(DefaultAppFixture fixture)
  10. {
  11. _session = fixture.Session;
  12. var tabs = _session.FindElementByAccessibilityId("MainTabs");
  13. var tab = tabs.FindElementByName("Automation");
  14. tab.Click();
  15. }
  16. [Fact]
  17. public void AutomationId()
  18. {
  19. // AutomationID can be specified by the Name or AutomationProperties.AutomationId
  20. // properties, with the latter taking precedence.
  21. var byName = _session.FindElementByAccessibilityId("TextBlockWithName");
  22. var byAutomationId = _session.FindElementByAccessibilityId("TextBlockWithNameAndAutomationId");
  23. }
  24. [Fact]
  25. public void LabeledBy()
  26. {
  27. var label = _session.FindElementByAccessibilityId("TextBlockAsLabel");
  28. var labeledTextBox = _session.FindElementByAccessibilityId("LabeledByTextBox");
  29. Assert.Equal("Label for TextBox", label.Text);
  30. Assert.Equal("Label for TextBox", labeledTextBox.GetName());
  31. }
  32. }
  33. }