fix UITestCleanup error

This commit is contained in:
Zhaopeng Wang (from Dev Box)
2025-03-10 14:40:00 +08:00
parent c38faa959a
commit f0d2c209e3
2 changed files with 10 additions and 5 deletions

View File

@@ -71,6 +71,7 @@ namespace Microsoft.PowerToys.UITest
try
{
appDriver?.Kill();
appDriver?.WaitForExit();
}
catch (Exception ex)
{

View File

@@ -31,11 +31,6 @@ namespace Microsoft.PowerToys.UITest
this.Session = new Session(this.sessionHelper.GetRoot(), this.sessionHelper.GetDriver());
}
~UITestBase()
{
this.sessionHelper.Cleanup();
}
/// <summary>
/// Initializes the test.
/// </summary>
@@ -53,6 +48,15 @@ namespace Microsoft.PowerToys.UITest
}
}
/// <summary>
/// Initializes the test.
/// </summary>
[TestCleanup]
public void TestCleanup()
{
this.sessionHelper.Cleanup();
}
/// <summary>
/// Finds an element by selector.
/// Shortcut for this.Session.Find<T>(by, timeoutMS)