Search in sources :

Example 61 with UIElement

use of functional.tests.core.mobile.element.UIElement in project functional-tests by NativeScript.

the class MainPage method insertItem.

public UIElement insertItem(String text) {
    if (this.addItemTextEdit == null) {
        this.addItemTextEdit = this.textFieldAddAGroceryItem();
    }
    this.addItemTextEdit.tap();
    this.addItemTextEdit.sendKeys(text);
    UIElement addBtn = this.wait.forVisibleElements(this.locators.imageLocator(), 10, false).get(1);
    if (this.settings.platform == PlatformType.Android) {
        addBtn.click();
    } else {
        addBtn.tap();
    }
    Wait.sleep(2000);
    return this.getListViewItem(0);
}
Also used : UIElement(functional.tests.core.mobile.element.UIElement)

Example 62 with UIElement

use of functional.tests.core.mobile.element.UIElement in project functional-tests by NativeScript.

the class QsfDemosTests method test_example.

@Test(groups = { "android", "ios" }, dataProvider = "example")
public void test_example(String example) {
    // Go to demo
    this.homePage.navigateTo(example);
    // Hack for Reservations demo which title ActionBar title is `DataForm`
    if (example.equalsIgnoreCase("Reservations")) {
        example = "DataForm";
    }
    // Verify it is loaded
    By demoLocator = By.xpath("//*[@content-desc='ActionBar']//*[@text='" + example + "']");
    if (this.settings.platform == PlatformType.iOS) {
        demoLocator = By.xpath("//*[@name='ActionBar']//*[@label='" + example + "']");
    }
    UIElement demoTitle = this.wait.waitForVisible(demoLocator, this.settings.shortTimeout, false);
    if (demoTitle == null) {
        this.gestures.swipeInWindow(SwipeElementDirection.DOWN, 500, 500);
        demoTitle = this.find.byText(example, this.settings.shortTimeout);
    }
    Assert.assertNotNull(demoTitle, demoTitle + "not loaded.");
    // Log current screen
    this.log.logScreen(example.replace(" ", ""), example);
}
Also used : UIElement(functional.tests.core.mobile.element.UIElement) By(org.openqa.selenium.By) Test(org.testng.annotations.Test)

Example 63 with UIElement

use of functional.tests.core.mobile.element.UIElement in project functional-tests by NativeScript.

the class CutenessActivitiesTests method enableOption.

private void enableOption(String optionName) {
    this.log.info("Swiping to \"" + optionName + "\" option.");
    UIElement optionBtn = this.find.byText(optionName, 3);
    int count = 0;
    while (optionBtn == null) {
        if (count <= 5) {
            optionBtn = this.gestures.scrollToElement(SwipeElementDirection.DOWN, optionName, 5);
        } else {
            Assert.fail("Failed to navigate to \"" + optionName + "\".");
        }
        count++;
    }
    optionBtn.click();
    this.log.info("Tap on '" + optionName + "' option.");
}
Also used : UIElement(functional.tests.core.mobile.element.UIElement)

Example 64 with UIElement

use of functional.tests.core.mobile.element.UIElement in project functional-tests by NativeScript.

the class GroceriesRecentItemsPage method selectItem.

public UIElement selectItem(int index) {
    UIElement element = this.getListViewItems().get(index);
    element.click();
    return element;
}
Also used : UIElement(functional.tests.core.mobile.element.UIElement)

Example 65 with UIElement

use of functional.tests.core.mobile.element.UIElement in project functional-tests by NativeScript.

the class LoginPage method login.

public SecondaryLoginPage login() {
    UIElement login = this.wait.waitForVisible(this.btnLogin);
    login.tap();
    SecondaryLoginPage page = new SecondaryLoginPage();
    return page;
}
Also used : UIElement(functional.tests.core.mobile.element.UIElement)

Aggregations

UIElement (functional.tests.core.mobile.element.UIElement)79 Test (org.testng.annotations.Test)37 MobileTest (functional.tests.core.mobile.basetest.MobileTest)15 SdkBaseTest (sdkexamples.SdkBaseTest)8 By (org.openqa.selenium.By)3 AnimationsBaseTest (animations.Tests.AnimationsBaseTest)1 ScrollableListObject (functional.tests.core.extensions.ScrollableListObject)1 UIRectangle (functional.tests.core.mobile.element.UIRectangle)1 Point (org.openqa.selenium.Point)1 AfterMethod (org.testng.annotations.AfterMethod)1 BeforeClass (org.testng.annotations.BeforeClass)1 HomePage (templates.tabnavigation.pages.HomePage)1 HomePage (testsappng.Screens.HomePage)1 HomePageExtended (uitests.Screens.HomePageExtended)1