diff --git a/test/integration/Android/ElementTest.cs b/test/integration/Android/ElementTest.cs index 29fa0f40..a8ba39f9 100644 --- a/test/integration/Android/ElementTest.cs +++ b/test/integration/Android/ElementTest.cs @@ -17,6 +17,10 @@ public class ElementTest [OneTimeSetUp] public void BeforeAll() { + if (Env.IsCiEnvironment()) + { + Assert.Ignore("Skipping ElementTest test fixture in CI environment"); + } var capabilities = Env.ServerIsRemote() ? Caps.GetAndroidUIAutomatorCaps(Apps.Get("androidApiDemos")) : Caps.GetAndroidUIAutomatorCaps(Apps.Get("androidApiDemos")); @@ -28,13 +32,17 @@ public void BeforeAll() [SetUp] public void SetUp() { - _driver.StartActivity("io.appium.android.apis/.ApiDemos"); + _driver?.StartActivity("io.appium.android.apis/.ApiDemos"); } [Test] [Ignore("Temporarily disabled until GetProperty(\"className\") behavior is verified for this test")] public void GetPropertyTest() { + if (Env.IsCiEnvironment()) + { + Assert.Ignore("Skipping GetPropertyTest test in CI environment"); + } var myElement = WaitForElement(_driver, MobileBy.Id("android:id/content")); var propertyValue = myElement.GetProperty("className"); Assert.That(propertyValue, Is.Not.Null); diff --git a/test/integration/helpers/Filters.cs b/test/integration/helpers/Filters.cs index ffcdaf8c..0d3cc8b0 100644 --- a/test/integration/helpers/Filters.cs +++ b/test/integration/helpers/Filters.cs @@ -7,11 +7,13 @@ public class Filters { public static IWebElement FirstWithName(IList els, string name) where TW : IWebElement { - for (var i = 0; i < els.Count; i++) + int count = els.Count; + for (var i = 0; i < count; i++) { - if (els[i].GetAttribute("name") == name) + var el = els[i]; + if (el.GetAttribute("name") == name) { - return (TW) els[i]; + return el; } } return null; @@ -20,11 +22,13 @@ public static IWebElement FirstWithName(IList els, string name) where TW public static IList FilterWithName(IList els, string name) where TW : IWebElement { var res = new List(); - for (var i = 0; i < els.Count; i++) + int count = els.Count; + for (var i = 0; i < count; i++) { - if (els[i].GetAttribute("name") == name) + var el = els[i]; + if (el.GetAttribute("name") == name) { - res.Add(els[i]); + res.Add(el); } } return res; @@ -33,12 +37,13 @@ public static IList FilterWithName(IList els, string name) public static IList FilterDisplayed(IList els) where TW : IWebElement { var res = new List(); - for (var i = 0; i < els.Count; i++) + int count = els.Count; + for (var i = 0; i < count; i++) { IWebElement el = els[i]; - if (els[i].Displayed) + if (el.Displayed) { - res.Add(els[i]); + res.Add(el); } } return res;