Skip to content

Commit

Permalink
Test: Fix Mac test (#778)
Browse files Browse the repository at this point in the history
* test: remove obsolete ByIosUIAutomation and add new test

* Add mac2 to AutomationName enums
Update mac platformName

* test: Fix Mac Test
  • Loading branch information
Dor-bl authored Apr 20, 2024
1 parent 991e500 commit ad860eb
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
1 change: 1 addition & 0 deletions src/Appium.Net/Appium/Enums/AutomationName.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,6 @@ public sealed class AutomationName
public static readonly string AndroidUIAutomator2 = "UIAutomator2";
public static readonly string AndroidEspresso = "Espresso";
public static readonly string YouiEngine = "youiengine";
public static readonly string Mac2 = "mac2";
}
}
2 changes: 1 addition & 1 deletion src/Appium.Net/Appium/Enums/MobilePlatform.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public sealed class MobilePlatform

public const string IOS = "iOS";

public const string MacOS = "Mac";
public const string MacOS = "mac";

public const string Windows = "Windows";

Expand Down
15 changes: 9 additions & 6 deletions test/integration/Mac/AlertTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,18 @@ namespace Appium.Net.Integration.Tests.Mac
{
public class FindElementTest
{
private AppiumDriver _driver;
private MacDriver _driver;

[OneTimeSetUp]
public void BeforeAll()
{
var capabilities = new AppiumOptions();
capabilities.AddAdditionalAppiumOption(MobileCapabilityType.DeviceName, "Mac"); // Requires until Appium 1.15.1
var capabilities = new AppiumOptions
{
AutomationName = AutomationName.Mac2,
PlatformName = MobilePlatform.MacOS
};
var serverUri = Env.ServerIsRemote() ? AppiumServers.RemoteServerUri : AppiumServers.LocalServiceUri;
_driver = new MacDriver(serverUri, capabilities, Env.InitTimeoutSec);
_driver.Manage().Timeouts().ImplicitWait = Env.ImplicitTimeoutSec;
}

[OneTimeTearDown]
Expand All @@ -31,9 +33,10 @@ public void AfterAll()
}

[Test]
public void ClickFinderIconOnDoc()
public void ClickAboutThisMacTest()
{
_driver.FindElement(MobileBy.XPath("/AXApplication[@AXTitle='Dock']/AXList[0]/AXDockItem[@AXTitle='Finder']")).Click();
_driver.FindElement(MobileBy.IosNSPredicate("elementType == 56 AND title = 'Apple'")).Click();
_driver.FindElement(MobileBy.AccessibilityId("_aboutThisMacRequested:")).Click();
}
}
}

0 comments on commit ad860eb

Please sign in to comment.