Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Tests] Update to Appium 5.0.0 #23118

Merged
merged 2 commits into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Appium.WebDriver" Version="5.0.0-rc.7" />
<PackageReference Include="Appium.WebDriver" Version="5.0.0" />
<PackageReference Include="NUnit" Version="4.0.1" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Appium.WebDriver" Version="5.0.0-rc.7" />
<PackageReference Include="Appium.WebDriver" Version="5.0.0" />
<PackageReference Include="NUnit" Version="4.0.1" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Appium.WebDriver" Version="5.0.0-rc.7" />
<PackageReference Include="Appium.WebDriver" Version="5.0.0" />
<PackageReference Include="NUnit" Version="4.0.1" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Appium.WebDriver" Version="5.0.0-rc.7" />
<PackageReference Include="Appium.WebDriver" Version="5.0.0" />
<PackageReference Include="NUnit" Version="4.0.1" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
</ItemGroup>
Expand Down
25 changes: 14 additions & 11 deletions src/TestUtils/src/UITest.Appium/Actions/AppiumLifecycleActions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,19 +55,21 @@ CommandResponse LaunchApp(IDictionary<string, object> parameters)
return CommandResponse.FailedEmptyResponse;

if (_app.GetTestDevice() == TestDevice.Mac)
{
{
_app.Driver.ExecuteScript("macos: activateApp", new Dictionary<string, object>
{
{ "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
else
{
_app.Driver.ActivateApp(_app.GetAppId());
}
Expand Down Expand Up @@ -127,7 +129,7 @@ CommandResponse CloseApp(IDictionary<string, object> parameters)
}
catch (Exception)
{
// TODO Pass in logger so we can log these exceptions
// TODO: Pass in logger so we can log these exceptions

// Occasionally the app seems to get so locked up it can't
// even report back the appstate. In that case, we'll just
Expand All @@ -143,11 +145,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
{
Expand Down
3 changes: 1 addition & 2 deletions src/TestUtils/src/UITest.Appium/UITest.Appium.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
</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" />
</ItemGroup>

<ItemGroup>
Expand Down
Loading