Skip to content

Commit

Permalink
Simplify capability matching
Browse files Browse the repository at this point in the history
Remove type restrictions on capability matching to remove duplicate code.
  • Loading branch information
aristotelos committed Apr 23, 2024
1 parent a0340cd commit fc2ab29
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/FlaUI.WebDriver/Controllers/SessionController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -142,24 +142,24 @@ private bool IsMatchingCapabilitySet(IDictionary<string, JsonElement> capabiliti

if (appPath != "Root")
{
if(TryGetStringCapability(capabilities, "appium:appArguments", out _))
if(capabilities.ContainsKey("appium:appArguments"))
{
matchedCapabilities.Add("appium:appArguments", capabilities["appium:appArguments"]);
}
if (!appPath.EndsWith("!App"))
{
if (TryGetStringCapability(capabilities, "appium:appWorkingDir", out _))
if (capabilities.ContainsKey("appium:appWorkingDir"))
{
matchedCapabilities.Add("appium:appWorkingDir", capabilities["appium:appWorkingDir"]);
}
}
}
}
else if (TryGetStringCapability(capabilities, "appium:appTopLevelWindow", out _))
else if (capabilities.ContainsKey("appium:appTopLevelWindow"))
{
matchedCapabilities.Add("appium:appTopLevelWindow", capabilities["appium:appTopLevelWindow"]);
}
else if (TryGetStringCapability(capabilities, "appium:appTopLevelWindowTitleMatch", out _))
else if (capabilities.ContainsKey("appium:appTopLevelWindowTitleMatch"))
{
matchedCapabilities.Add("appium:appTopLevelWindowTitleMatch", capabilities["appium:appTopLevelWindowTitleMatch"]);
}
Expand Down

0 comments on commit fc2ab29

Please sign in to comment.