Search in sources :

Example 1 with ScrollableListObject

use of functional.tests.core.extensions.ScrollableListObject in project functional-tests by NativeScript.

the class CssAnimationsPage method init.

private void init(String page, MobileContext context) {
    if (this.settings.platform == PlatformType.Android) {
        ScrollableListObject scrollableListObject = new ScrollableListObject(context) {

            @Override
            public String getMainContainerLocatorName() {
                return getMainContainerLocatorNameAsString();
            }

            @Override
            public String getMainContainerItemsName() {
                return getMainContainerItemsNameAsString();
            }
        };
        scrollableListObject.setRetriesCount(3);
        this.context.navigationManager.setScrollToRectangleMethod((p) -> scrollableListObject.scrollTo(p));
    } else {
        this.context.navigationManager.setNavigation((p) -> {
            UIElement el = this.find.byLocator(By.xpath("//" + this.getMainContainerItemsNameAsString() + "[@label='" + p + "']"));
            if (el != null) {
                el.tap();
                this.navigationManager.setCurrentPage(p);
            }
        });
    }
    if (page != null && !page.isEmpty()) {
        this.context.navigationManager.navigateTo(page);
        this.context.navigationManager.setMainPage(page);
        this.context.navigationManager.setHomePageLocator(context.locators.byText(page));
    }
}
Also used : UIElement(functional.tests.core.mobile.element.UIElement) ScrollableListObject(functional.tests.core.extensions.ScrollableListObject)

Example 2 with ScrollableListObject

use of functional.tests.core.extensions.ScrollableListObject in project functional-tests by NativeScript.

the class ListViewTest method cssListView_01.

@Test(groups = { "android", "ios" })
public void cssListView_01() throws Exception {
    this.homePageExtended.navigateTo("csslv");
    this.compareScreens(this.settings.defaultTimeout, 0.25);
    final String lastLocatorText = "NAME99";
    if (this.settings.platform == PlatformType.Android) {
        ScrollableListObject scrollableListObject = new ScrollableListObject(this.context) {

            @Override
            public String getMainContainerLocatorName() {
                return context.uiElementClass.listViewLocator();
            }

            @Override
            public String getMainContainerItemsName() {
                if (settings.platform == PlatformType.Android) {
                    return context.uiElementClass.textViewLocator();
                } else {
                    return context.uiElementClass.cellLocator();
                }
            }
        };
        scrollableListObject.scrollTo(lastLocatorText);
    } else {
        this.context.gestures.swipeInWindow(SwipeElementDirection.DOWN, 700, 100);
        this.context.gestures.swipeInWindow(SwipeElementDirection.DOWN, 700, 100);
        this.context.gestures.swipeInWindow(SwipeElementDirection.DOWN, 700, 100);
        this.context.gestures.swipeInWindow(SwipeElementDirection.DOWN, 700, 100);
        this.context.gestures.swipeInWindow(SwipeElementDirection.DOWN, 700, 100);
        this.context.gestures.swipeInWindow(SwipeElementDirection.DOWN, 700, 100);
        this.context.gestures.swipeInWindow(SwipeElementDirection.DOWN, 700, 100);
        this.context.gestures.swipeInWindow(SwipeElementDirection.DOWN, 700, 100);
        this.context.gestures.swipeInWindow(SwipeElementDirection.DOWN, 700, 100);
        this.context.gestures.swipeInWindow(SwipeElementDirection.DOWN, 700, 100);
        this.context.gestures.swipeInWindow(SwipeElementDirection.DOWN, 700, 100);
        this.context.gestures.swipeInWindow(SwipeElementDirection.DOWN, 700, 100);
        this.context.gestures.swipeInWindow(SwipeElementDirection.DOWN, 700, 100);
        this.context.gestures.swipeInWindow(SwipeElementDirection.DOWN, 700, 100);
    }
    By lastItemLocator = this.locators.byText(lastLocatorText);
    if (this.settings.platform == PlatformType.iOS) {
        lastItemLocator = By.id(lastLocatorText);
    }
    if (this.settings.platform == PlatformType.iOS && this.settings.platformVersion > 10) {
        this.wait.forVisibleElements(lastItemLocator, 5, true);
    }
    double tolerance = 0.28d;
    if (this.settings.platform == PlatformType.iOS) {
        tolerance = 0.60d;
    }
    this.compareScreens(10, tolerance);
    this.assertImagesResults();
}
Also used : ScrollableListObject(functional.tests.core.extensions.ScrollableListObject) By(org.openqa.selenium.By) Test(org.testng.annotations.Test)

Example 3 with ScrollableListObject

use of functional.tests.core.extensions.ScrollableListObject in project functional-tests by NativeScript.

the class SdkMainPage method init.

private void init(String page, MobileContext context) {
    if (this.settings.platform == PlatformType.Android) {
        ScrollableListObject scrollableListObject = new ScrollableListObject(context) {

            @Override
            public String getMainContainerLocatorName() {
                return context.uiElementClass.listViewLocator();
            }

            @Override
            public String getMainContainerItemsName() {
                return context.uiElementClass.textViewLocator();
            }
        };
        this.context.navigationManager.setScrollToRectangleMethod((p) -> scrollableListObject.scrollTo(p));
    } else {
        this.scrollTo(page, 25);
    }
    if (page != null && !page.isEmpty()) {
        this.context.navigationManager.navigateTo(page);
        this.context.navigationManager.setMainPage(page);
        this.context.navigationManager.setHomePageLocator(context.locators.byText(page, true, false));
    }
}
Also used : ScrollableListObject(functional.tests.core.extensions.ScrollableListObject)

Aggregations

ScrollableListObject (functional.tests.core.extensions.ScrollableListObject)3 UIElement (functional.tests.core.mobile.element.UIElement)1 By (org.openqa.selenium.By)1 Test (org.testng.annotations.Test)1