Search in sources :

Example 46 with UIElement

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

the class IssuesTestsCommon method issue_2942_keyBoardFocusInListViewTemplateLandScape.

@Test(groups = { "android" })
public void issue_2942_keyBoardFocusInListViewTemplateLandScape() throws Exception {
    if (this.settings.platform == PlatformType.iOS && this.settings.platformVersion < 10) {
        this.log.error("This test in not included for ios 8/9 ");
        return;
    }
    this.issuesBasePage.navToPage("2942");
    this.client.getDriver().rotate(ScreenOrientation.LANDSCAPE);
    this.find.byTextContains("Click me 1st").click();
    if (this.settings.platform == PlatformType.Android && this.settings.platformVersion == 27.0) {
        if (this.imageVerification.compareScreens("issue_2942_keyBoardFocusInListViewTemplateLandScape_with_suggestions", 5, 0, this.maxPixelTolerance, 0.05)) {
            this.assertScreen("issue_2942_keyBoardFocusInListViewTemplateLandScape_with_suggestions", 5, 0.05);
        } else if (this.imageVerification.compareScreens("issue_2942_keyBoardFocusInListViewTemplateLandScape_with_suggestions_info", 5, 0, this.maxPixelTolerance, 0.05)) {
            this.assertScreen("issue_2942_keyBoardFocusInListViewTemplateLandScape_with_suggestions_info", 5, 0.05);
        } else {
            this.assertScreen("issue_2942_keyBoardFocusInListViewTemplateLandScape_without_suggestions", 5, 0.05);
        }
    } else {
        this.compareScreens(15, 0.05, true);
    }
    this.hideKeyBoard();
    UIElement textFieldSecond = this.find.byTextContains("Click me 2nd");
    textFieldSecond.click();
    if (this.settings.platform == PlatformType.Android && this.settings.platformVersion == 27.0) {
        this.assertScreen("issue_2942_keyBoardFocusInListViewTemplateLandScape_2", 5, 0.05);
    } else {
        this.compareScreens(15, 0.05, true);
    }
    this.hideKeyBoard();
    this.client.getDriver().rotate(ScreenOrientation.PORTRAIT);
    if (this.settings.platform == PlatformType.Android && this.settings.platformVersion == 27.0) {
        this.log.info("Skip image verification.");
    } else {
        this.assertImagesResults();
    }
}
Also used : UIElement(functional.tests.core.mobile.element.UIElement) Test(org.testng.annotations.Test)

Example 47 with UIElement

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

the class IssuesTestsCommon method issue_1657_ios_translucent.

@Test(groups = { "ios" })
public void issue_1657_ios_translucent() throws Exception {
    this.issuesBasePage.navToPage("1657-ios");
    UIElement changeTranslucent = this.issuesBasePage.findElement("changeTranslucent");
    changeTranslucent.click();
    double tolerance = 1D;
    if (this.settings.platform == PlatformType.iOS && this.settings.platformVersion < 10) {
        tolerance = 3D;
    }
    UIElement navBar = this.issuesBasePage.find.byLocator(this.locators.navigationBarLocator());
    this.compareElements(navBar, 5, tolerance);
    changeTranslucent.click();
    this.compareElements(navBar, 5, tolerance);
    this.issuesBasePage.findElement("change speed to very slow").click();
    UIElement el = this.issuesBasePage.findElement("go to subPage");
    this.issuesBasePage.navigateTo(el, ClickType.Click, "sub page");
    this.compareScreens(60, 1.00);
    UIElement subPage = this.issuesBasePage.findElement("SUB PAGE");
    this.log.info(subPage.getUIRectangle() + "; " + subPage.getUIRectangle().getX());
    while (subPage.getUIRectangle().x > 0) {
        subPage = this.issuesBasePage.findElement("SUB PAGE");
        this.log.info(subPage.getUIRectangle() + "; " + subPage.getUIRectangle().getX());
    }
    Wait.sleep(35000);
    this.issuesBasePage.navigateBack();
    this.compareScreens(60, 4.0);
    this.issuesBasePage.findElement("default layer speed").click();
    this.app.restart();
    this.context.navigationManager.resetNavigationMainPage();
    this.assertImagesResults();
}
Also used : UIElement(functional.tests.core.mobile.element.UIElement) Test(org.testng.annotations.Test)

Example 48 with UIElement

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

the class BindingTests method binding_02_xmlBasics.

@Test(groups = { "android", "ios" })
public void binding_02_xmlBasics() throws Exception {
    this.bindingsBasePage.navigateToMainPage();
    UIElement element = this.find.byTextContains("xmlbasics");
    this.bindingsBasePage.navigateTo(element);
    if (this.settings.platform == PlatformType.iOS) {
        this.compareScreens(5);
    } else {
        Assert.assertEquals(this.bindingsBasePage.bindingXmlBasicsPage.editTextField().getText(), "Text");
        Assert.assertEquals(this.bindingsBasePage.bindingXmlBasicsPage.btnText().getText(), "");
    }
    this.bindingsBasePage.bindingXmlBasicsPage.tapTextBtn();
    if (this.settings.platform == PlatformType.iOS) {
        this.compareScreens(5);
    } else {
        Assert.assertEquals(this.bindingsBasePage.bindingXmlBasicsPage.btnText().getText().toLowerCase(), "text");
    }
    this.bindingsBasePage.bindingXmlBasicsPage.tapBtn();
    if (this.settings.platform == PlatformType.iOS && this.settings.platformVersion <= 10) {
        this.compareScreens(5);
    } else {
        this.device.assertLogContains("### onTap event ###");
    }
    this.assertImagesResults();
}
Also used : UIElement(functional.tests.core.mobile.element.UIElement) Test(org.testng.annotations.Test) MobileTest(functional.tests.core.mobile.basetest.MobileTest)

Example 49 with UIElement

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

the class BindingTests method binding_01_basics.

@Test(groups = { "android", "ios" })
public void binding_01_basics() throws Exception {
    if (this.settings.platform == PlatformType.iOS && this.settings.platformVersion < 11) {
        return;
    }
    UIElement btnBasics = this.bindingsBasePage.wait.waitForVisible(this.locators.byText("basics"));
    this.bindingsBasePage.navigateTo(btnBasics, "basics");
    this.bindingsBasePage.bindingBasicsPage.tapSetTextBtn();
    this.bindingsBasePage.bindingBasicsPage.tapOneWayBtn();
    if (this.settings.platform == PlatformType.iOS) {
        this.compareScreens(5);
    } else {
        Assert.assertEquals(this.bindingsBasePage.bindingBasicsPage.editTextFieldOneWay().getText(), "Test");
        Assert.assertEquals(this.bindingsBasePage.bindingBasicsPage.btnOneWay().getText().toLowerCase(), "oneway");
    }
    this.bindingsBasePage.bindingBasicsPage.tapTwoWayBtn();
    if (this.settings.platform == PlatformType.iOS) {
        this.compareScreens(5);
    } else {
        Assert.assertEquals(this.bindingsBasePage.bindingBasicsPage.editTextFieldTwoWay().getText(), "Test");
        Assert.assertEquals(this.bindingsBasePage.bindingBasicsPage.btnTwoWay().getText().toLowerCase(), "test");
    }
    this.assertImagesResults();
}
Also used : UIElement(functional.tests.core.mobile.element.UIElement) Test(org.testng.annotations.Test) MobileTest(functional.tests.core.mobile.basetest.MobileTest)

Example 50 with UIElement

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

the class CssCommonTests method clipPath_01.

@Test(groups = { "android", "ios" })
public void clipPath_01() throws Exception {
    this.cssBasePage.navToPage("clipPath");
    UIElement mainElement = this.cssBasePage.find.byText("clipPath", false, 3);
    if ((this.settings.platformVersion.toString().startsWith("4")) && (this.settings.deviceType == DeviceType.Emulator)) {
        this.compareElements(mainElement, 10, 20d);
    } else {
        this.compareElements(mainElement, 5, 1d);
    }
    this.assertImagesResults();
}
Also used : UIElement(functional.tests.core.mobile.element.UIElement) Test(org.testng.annotations.Test)

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