Skip to content

Commit

Permalink
Update Appium dependency to v5 (#18)
Browse files Browse the repository at this point in the history
* Update Appium dependency to v5

* Update Plugin.Maui.UITestHelpers.Appium.csproj

* Update AppiumLifecycleActions.cs

* Update AppiumLifecycleActions.cs
  • Loading branch information
jfversluis authored Jul 3, 2024
1 parent daa4120 commit 03a13bb
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 14 deletions.
2 changes: 1 addition & 1 deletion samples/UITests.Android/UITests.Android.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Appium.WebDriver" Version="5.0.0-rc.7" />
<PackageReference Include="Appium.WebDriver" Version="5.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="NUnit" Version="4.1.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
Expand Down
2 changes: 1 addition & 1 deletion samples/UITests.Windows/UITests.Windows.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Appium.WebDriver" Version="5.0.0-rc.7" />
<PackageReference Include="Appium.WebDriver" Version="5.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="NUnit" Version="4.1.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
Expand Down
2 changes: 1 addition & 1 deletion samples/UITests.iOS/UITests.iOS.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Appium.WebDriver" Version="5.0.0-rc.7" />
<PackageReference Include="Appium.WebDriver" Version="5.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="NUnit" Version="4.1.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
Expand Down
2 changes: 1 addition & 1 deletion samples/UITests.macOS/UITests.macOS.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Appium.WebDriver" Version="5.0.0-rc.7" />
<PackageReference Include="Appium.WebDriver" Version="5.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="NUnit" Version="4.1.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using OpenQA.Selenium.Appium.Android;
using OpenQA.Selenium.Appium.Windows;
using Plugin.Maui.UITestHelpers.Core;

namespace Plugin.Maui.UITestHelpers.Appium
Expand Down Expand Up @@ -60,11 +61,13 @@ CommandResponse LaunchApp(IDictionary<string, object> parameters)
{ "bundleId", _app.GetAppId() },
});
}
else if (_app.GetTestDevice() == TestDevice.Windows)
else if (_app.Driver is WindowsDriver windowsDriver)
{
#pragma warning disable CS0618 // Type or member is obsolete
_app.Driver.LaunchApp();
#pragma warning restore CS0618 // Type or member is obsolete
// Appium driver removed the LaunchApp method in 5.0.0, so we need to use the executeScript method instead
// Currently the appium-windows-driver reports the following commands as compatible:
// startRecordingScreen,stopRecordingScreen,launchApp,closeApp,deleteFile,deleteFolder,
// click,scroll,clickAndDrag,hover,keys,setClipboard,getClipboard
windowsDriver.ExecuteScript("windows: launchApp", [_app.GetAppId()]);
}
else
{
Expand Down Expand Up @@ -122,11 +125,12 @@ CommandResponse CloseApp(IDictionary<string, object> parameters)
{ "bundleId", _app.GetAppId() },
});
}
else if (_app.GetTestDevice() == TestDevice.Windows)
else if (_app.Driver is WindowsDriver windowsDriver)
{
#pragma warning disable CS0618 // Type or member is obsolete
_app.Driver.CloseApp();
#pragma warning restore CS0618 // Type or member is obsolete
// This is still here for now, but it looks like it will get removed just like
// LaunchApp was in 5.0.0, in which case we may need to use:
// windowsDriver.ExecuteScript("windows: closeApp", [_app.GetAppId()]);
windowsDriver.CloseApp();
}
else
_app.Driver.TerminateApp(_app.GetAppId());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Appium.WebDriver" Version="5.0.0-rc.7" />
<PackageReference Include="System.Drawing.Common" Version="8.0.3" />
<PackageReference Include="Appium.WebDriver" Version="5.0.0" />
<PackageReference Include="System.Drawing.Common" Version="8.0.6" />
</ItemGroup>

<ItemGroup>
Expand Down

0 comments on commit 03a13bb

Please sign in to comment.