Skip to content

Commit 1d6299d

Browse files
authored
fix(test): add explicit wait for app package to load before assertion (#838)
1 parent 4c35acb commit 1d6299d

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

test/integration/Android/CurrentPackageTest.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
11
using Appium.Net.Integration.Tests.helpers;
22
using NUnit.Framework;
33
using OpenQA.Selenium.Appium.Android;
4+
using OpenQA.Selenium.Support.UI;
5+
using System;
46

57
namespace Appium.Net.Integration.Tests.Android
68
{
79
[TestFixture]
810
public class CurrentPackageTest
911
{
1012
private AndroidDriver _driver;
13+
private WebDriverWait _waitDriver;
14+
private readonly TimeSpan _driverTimeOut = TimeSpan.FromSeconds(5);
15+
1116
private const string DemoAppPackage = "io.appium.android.apis";
1217

1318
[OneTimeSetUp]
@@ -37,6 +42,8 @@ public void TearDowwn()
3742
[Test]
3843
public void ReturnsCorrectNameForCurrentApp()
3944
{
45+
_waitDriver = new WebDriverWait(_driver, _driverTimeOut);
46+
_waitDriver.Until(driver => _driver.CurrentPackage == DemoAppPackage);
4047
Assert.That(_driver.CurrentPackage, Is.EqualTo(DemoAppPackage));
4148
}
4249
}

0 commit comments

Comments
 (0)