Search in sources :

Example 6 with UIElement

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

the class HtmlViewTests method htmlView_01.

@Test(groups = { "android", "ios" })
public void htmlView_01() throws Exception {
    this.homePage = new HomePageExtended("htmlview", this.context);
    UIElement el = this.find.byTextContains("one");
    String htmlContent = el.getText();
    Assert.assertTrue(htmlContent.contains("one"));
    Assert.assertTrue(htmlContent.contains("two"));
}
Also used : UIElement(functional.tests.core.mobile.element.UIElement) HomePageExtended(uitests.Screens.HomePageExtended) Test(org.testng.annotations.Test) MobileTest(functional.tests.core.mobile.basetest.MobileTest)

Example 7 with UIElement

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

the class ModalsBaseTest method openAndAssertModalDialogs.

public void openAndAssertModalDialogs(String navigate, String openComponent) throws Exception {
    this.modalPageBase.navigateToMainPage();
    UIElement navigationButton = this.modalPageBase.wait.waitForVisible(this.locators.byText(navigate, false, false), 6, true);
    this.modalPageBase.navigateTo(navigationButton);
    UIElement optionButton = this.modalPageBase.wait.waitForVisible(this.locators.byText(openComponent, false, false), 6, true);
    this.modalPageBase.navigateTo(optionButton);
    this.compareScreens(this.getImageName(navigate, openComponent), 5);
    this.modalPageBase.navigateBack(this.modalPageBase.btnOk());
    this.compareScreens(5);
    optionButton = this.modalPageBase.find.byTextContains(openComponent);
    this.modalPageBase.navigateTo(optionButton);
    this.compareScreens(this.getImageName(navigate, openComponent), 5);
    this.modalPageBase.navigateBack(this.modalPageBase.btnCancel());
    this.compareScreens(this.getImageName(navigate, openComponent), 5);
    this.assertImagesResults();
}
Also used : UIElement(functional.tests.core.mobile.element.UIElement)

Example 8 with UIElement

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

the class NavOptionsTests method navOption_03_pageTransition.

@Test(groups = { "android", "ios" })
public void navOption_03_pageTransition() throws Exception {
    double tollerance = 7.5;
    if (this.settings.platform == PlatformType.Android) {
        this.navOptionsPage.resetNavigationToLastPage();
    } else {
        UIElement btnNavOptions = this.wait.waitForVisible(this.locators.byText(NavOptionsPage.navOptionsPage), 3, true);
        this.navOptionsPage.navigateTo(btnNavOptions);
        tollerance = 19;
    }
    this.rect = this.navOptionsPage.getPageTransitionsBtn().getUIRectangle();
    this.navOptionsPage.pageTransitions();
    this.compareScreens(15, tollerance);
    this.assertImagesResults();
}
Also used : UIElement(functional.tests.core.mobile.element.UIElement) Test(org.testng.annotations.Test)

Example 9 with UIElement

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

the class LoginPage method login.

public void login(String userName, String userPass) {
    loginButton().click();
    // Handle Api26
    if (this.settings.platform == PlatformType.Android) {
        UIElement accept = this.find.byText("ACCEPT & CONTINUE", true, this.settings.shortTimeout);
        if (accept != null) {
            accept.click();
            this.find.byText("NO THANKS", true, this.settings.shortTimeout).click();
        }
    }
    UIElement userEditText = this.find.byLocator(this.locators.editTextLocator());
    UIElement nextButton = this.find.byText("Next");
    Wait.sleep(1000);
    this.gestures.swipeInWindow(SwipeElementDirection.DOWN, 1000);
    Wait.sleep(1000);
    userEditText.setText(userName);
    Wait.sleep(1000);
    this.app.hideKeyboard();
    Wait.sleep(1000);
    nextButton.click();
    Wait.sleep(3000);
    UIElement passBox;
    if (this.settings.platform == PlatformType.Android) {
        passBox = this.find.byLocator(this.locators.editTextLocator());
    } else {
        passBox = this.find.byLocator(By.className("XCUIElementTypeSecureTextField"));
    }
    this.app.hideKeyboard();
    Wait.sleep(1000);
    passBox.setText(userPass);
    this.find.byText("Sign in").click();
    this.find.byText("Yes", false, this.settings.defaultTimeout).click();
}
Also used : UIElement(functional.tests.core.mobile.element.UIElement)

Example 10 with UIElement

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

the class SdkTextViewTests method sdkTextViewTest.

@Test(dataProvider = "example")
public void sdkTextViewTest(String example) {
    this.mainPage.navigateTo(example);
    if (example.equals("Usage")) {
        String text = "This is very long text. This is very long text. This is very long text. " + "This is very long text. This is very long text.";
        UIElement textField;
        if (this.settings.platform == PlatformType.Android) {
            textField = this.mainPage.wait.waitForVisible(this.locators.editTextLocator(), this.settings.shortTimeout, true);
        } else {
            textField = this.mainPage.find.byType("UIATextView");
        }
        textField.setText(text);
        if (this.settings.platform == PlatformType.Android) {
            this.mainPage.hideKeyboard();
        }
    }
}
Also used : UIElement(functional.tests.core.mobile.element.UIElement) Test(org.testng.annotations.Test) SdkBaseTest(sdkexamples.SdkBaseTest)

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