77import functional .tests .core .mobile .basetest .MobileContext ;
88import functional .tests .core .mobile .element .UIElement ;
99import functional .tests .core .mobile .element .UIRectangle ;
10- import functional .tests .core .mobile .find .Find ;
1110import functional .tests .core .mobile .find .Wait ;
11+ import io .appium .java_client .MobileBy ;
1212import org .openqa .selenium .By ;
1313import org .testng .Assert ;
1414
@@ -42,7 +42,6 @@ public static boolean navigateTo(String demoPath, MobileContext mobileContext, i
4242 */
4343 public static boolean navigateTo (String demoPath , NavigationManager navigationManager , MobileContext mobileContext , int scrollToElementRetriesCount ) {
4444 LOGGER_BASE .info ("Navigating to \" " + demoPath + "\" ." );
45- Find find = mobileContext .find ;
4645 String splitSeparator = demoPath .contains ("/" ) ? "/" : "." ;
4746 String [] demos = demoPath .split (splitSeparator );
4847
@@ -56,14 +55,14 @@ public static boolean navigateTo(String demoPath, NavigationManager navigationMa
5655 UIElement demoBtn = null ;
5756 UIRectangle rectBtn = null ;
5857 if (navigationManager != null ) {
59- if (navigationManager != null && navigationManager .getScrollMethod () != null ) {
58+ if (navigationManager .getScrollMethod () != null ) {
6059 demoBtn = navigationManager .getScrollMethod ().apply (btnText );
61- } else if (navigationManager != null && navigationManager .getScrollToRectangleMethod () != null ) {
60+ } else if (navigationManager .getScrollToRectangleMethod () != null ) {
6261 Rectangle rect = navigationManager .getScrollToRectangleMethod ().apply (btnText );
6362 if (rect != null ) {
6463 rectBtn = new UIRectangle (rect , mobileContext );
6564 }
66- } else if (navigationManager != null && navigationManager .getNavigationMethod () != null ) {
65+ } else if (navigationManager .getNavigationMethod () != null ) {
6766 navigationManager .getNavigationMethod ().accept (btnText );
6867 } else {
6968 demoBtn = scrollTo (btnText , mobileContext , scrollToElementRetriesCount );
@@ -122,7 +121,7 @@ public static boolean navigateTo(UIElement element, NavigationManager navigation
122121 * @return
123122 */
124123 public static boolean navigateTo (UIElement element , ClickType clickType , NavigationManager navigationManager , String page ) {
125- String btnContent = (page == "" || page == null ) ? (element .getText () == "" ? element .getId () : element .getText ()) : page ;
124+ String btnContent = (page . equals ( "" ) || page == null ) ? (element .getText (). equals ( "" ) ? element .getId () : element .getText ()) : page ;
126125 switch (clickType ) {
127126 case Click :
128127 element .click ();
@@ -181,14 +180,19 @@ public static void navigateForward(MobileContext mobileContext) {
181180 }
182181
183182 /**
184- * TODO(): Add docs .
183+ * Scroll to example .
185184 *
186- * @param example
187- * @param mobileContext
188- * @return
185+ * @param example Example name.
186+ * @param mobileContext mobile context.
187+ * @return UIElement.
189188 */
190189 public static UIElement scrollTo (String example , MobileContext mobileContext , int retryCount ) {
191- UIElement demoBtn = mobileContext .wait .waitForVisible (mobileContext .locators .byText (example , true , false ), 3 , false );
190+ UIElement demoBtn ;
191+ if (mobileContext .settings .platform == PlatformType .Android ) {
192+ demoBtn = mobileContext .wait .waitForVisible (mobileContext .locators .byText (example , true , false ), 3 , false );
193+ } else {
194+ demoBtn = mobileContext .wait .waitForVisible (MobileBy .AccessibilityId (example ), 3 , false );
195+ }
192196
193197 if (demoBtn == null && retryCount > 0 ) {
194198 LOGGER_BASE .info ("Scroll to \" " + example + "\" ..." );
0 commit comments