From bbe85ab5884c21d5b6be948f4c7f356822fec109 Mon Sep 17 00:00:00 2001 From: Dor-bl Date: Sat, 21 Dec 2024 00:04:37 +0200 Subject: [PATCH] test: update scrolling tests to use modern mobile commands for visibility checks --- .../integration/IOS/ScrollingSearchingTest.cs | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/test/integration/IOS/ScrollingSearchingTest.cs b/test/integration/IOS/ScrollingSearchingTest.cs index 749525f9..7fa486e5 100644 --- a/test/integration/IOS/ScrollingSearchingTest.cs +++ b/test/integration/IOS/ScrollingSearchingTest.cs @@ -1,4 +1,5 @@ -using Appium.Net.Integration.Tests.helpers; +using System.Collections.Generic; +using Appium.Net.Integration.Tests.helpers; using NUnit.Framework; using OpenQA.Selenium.Appium; using OpenQA.Selenium.Appium.iOS; @@ -29,21 +30,20 @@ public void AfterEach() } [Test] - public void ScrollToTestCase() + public void ScrollToToolbarsElementUsingToVisibleTrueTest() { - var slider = _driver - .FindElement(new ByIosUIAutomation(".tableViews()[0]" - + ".scrollToElementWithPredicate(\"name CONTAINS 'Slider'\")")); - Assert.That(slider.GetAttribute("name"), Is.EqualTo("Sliders")); + var Toolbars = _driver.FindElement(new ByIosNSPredicate("name == 'Toolbars'")); + _driver.ExecuteScript("mobile: scroll", new Dictionary { { "element", Toolbars.Id }, { "toVisible", "true" } }); + Assert.That(Toolbars.Displayed, Is.True, "The 'Toolbars' element should be visible after scrolling."); } [Test] - public void ScrollToExactTestCase() + public void ScrollToSwitchesElementUsingDirectionDownTest() { - var table = _driver.FindElement(new ByIosUIAutomation(".tableViews()[0]")); - var slider = table.FindElement( - new ByIosUIAutomation(".scrollToElementWithPredicate(\"name CONTAINS 'Slider'\")")); - Assert.That(slider.GetAttribute("name"), Is.EqualTo("Sliders")); + var table = _driver.FindElement(new ByIosNSPredicate("type == 'XCUIElementTypeTable'")); + _driver.ExecuteScript("mobile: scroll", new Dictionary { { "direction", "down" }, { "element", table.Id } }); + var switches = table.FindElement(new ByIosNSPredicate("name CONTAINS 'Switches'")); + Assert.That(switches.GetAttribute("visible"), Is.EqualTo("true")); } } } \ No newline at end of file