diff --git a/samples/UITests.Android/UITests.Android.csproj b/samples/UITests.Android/UITests.Android.csproj index 1e20c99a..e61d4154 100644 --- a/samples/UITests.Android/UITests.Android.csproj +++ b/samples/UITests.Android/UITests.Android.csproj @@ -13,7 +13,7 @@ - + diff --git a/samples/UITests.Windows/UITests.Windows.csproj b/samples/UITests.Windows/UITests.Windows.csproj index 1aaf7966..f62a39c6 100644 --- a/samples/UITests.Windows/UITests.Windows.csproj +++ b/samples/UITests.Windows/UITests.Windows.csproj @@ -13,7 +13,7 @@ - + diff --git a/samples/UITests.iOS/UITests.iOS.csproj b/samples/UITests.iOS/UITests.iOS.csproj index 12a43d49..c9a00bd2 100644 --- a/samples/UITests.iOS/UITests.iOS.csproj +++ b/samples/UITests.iOS/UITests.iOS.csproj @@ -13,7 +13,7 @@ - + diff --git a/samples/UITests.macOS/UITests.macOS.csproj b/samples/UITests.macOS/UITests.macOS.csproj index feae6e03..735b68da 100644 --- a/samples/UITests.macOS/UITests.macOS.csproj +++ b/samples/UITests.macOS/UITests.macOS.csproj @@ -13,7 +13,7 @@ - + diff --git a/src/Plugin.Maui.UITestHelpers.Appium/Actions/AppiumLifecycleActions.cs b/src/Plugin.Maui.UITestHelpers.Appium/Actions/AppiumLifecycleActions.cs index 2700d4e9..bddea5de 100644 --- a/src/Plugin.Maui.UITestHelpers.Appium/Actions/AppiumLifecycleActions.cs +++ b/src/Plugin.Maui.UITestHelpers.Appium/Actions/AppiumLifecycleActions.cs @@ -1,4 +1,5 @@ using OpenQA.Selenium.Appium.Android; +using OpenQA.Selenium.Appium.Windows; using Plugin.Maui.UITestHelpers.Core; namespace Plugin.Maui.UITestHelpers.Appium @@ -60,11 +61,13 @@ CommandResponse LaunchApp(IDictionary 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 { @@ -122,11 +125,12 @@ CommandResponse CloseApp(IDictionary 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()); diff --git a/src/Plugin.Maui.UITestHelpers.Appium/Plugin.Maui.UITestHelpers.Appium.csproj b/src/Plugin.Maui.UITestHelpers.Appium/Plugin.Maui.UITestHelpers.Appium.csproj index c8084df6..a8e453a7 100644 --- a/src/Plugin.Maui.UITestHelpers.Appium/Plugin.Maui.UITestHelpers.Appium.csproj +++ b/src/Plugin.Maui.UITestHelpers.Appium/Plugin.Maui.UITestHelpers.Appium.csproj @@ -27,8 +27,8 @@ - - + +