use of functional.tests.core.mobile.element.UIElement in project functional-tests by NativeScript.
the class TransitionsPage method navigateToTransition.
private boolean navigateToTransition(String buttonTextContent) {
int timeOut = 20000;
int displayTimeOut = timeOut;
UIElement button = this.wait.waitForVisible(this.locators.byText(buttonTextContent), timeOut, false);
if (button != null) {
Point point = mainLayoutContainer().getLocation();
this.log.info("Main container location before while cycle is: x = " + point.getX() + " y = " + point.getY());
this.log.info("The button is visible before while cycle is: " + button.isDisplayed());
while ((!button.isDisplayed() || point.getX() > 0) && displayTimeOut > 0) {
this.log.info("The button is visible: " + button.isDisplayed());
this.log.info("Display retries: " + displayTimeOut);
point = mainLayoutContainer().getLocation();
this.log.info("Main container location is: x = " + point.getX() + " y = " + point.getY());
button = this.find.byText(buttonTextContent, timeOut);
displayTimeOut -= 1000;
if (displayTimeOut < 0) {
this.log.error("The element is not visible: " + button);
}
}
if (button.isDisplayed()) {
this.log.info("Navigate to transition: " + buttonTextContent);
return NavigationHelper.navigateTo(button, ClickType.Click, null, buttonTextContent);
} else {
this.log.error("Button is not visible");
return false;
}
}
return false;
}
use of functional.tests.core.mobile.element.UIElement in project functional-tests by NativeScript.
the class BindingsBasePage method navigateToBindings.
private void navigateToBindings() {
UIElement btnBindings = this.wait.waitForVisible(this.locators.byText(BINDINGS));
this.navigateTo(btnBindings, this.mainPage);
}
use of functional.tests.core.mobile.element.UIElement in project functional-tests by NativeScript.
the class NavOptionsTests method navOption_01_clearHistory_navigateBack.
@Test(groups = { "android", "ios" })
public void navOption_01_clearHistory_navigateBack() throws Exception {
this.clearHistoryAndUpdate("0", "1");
if (this.settings.platform == PlatformType.Android) {
// Navigate back should go to home screen
this.navOptionsPage.navigateBack();
if (this.settings.platformVersion < 7.1) {
UIElement phone = this.wait.waitForVisible(this.locators.byText("Phone"), false);
UIElement people = this.wait.waitForVisible(this.locators.byText("People"), false);
Assert.assertTrue((phone != null) || (people != null), "Back button do not set app in background.");
} else {
this.wait.waitForVisible(this.locators.byText("Chrome"), true);
}
this.app.restart();
this.navOptionsPage.homePageLoaded();
this.compareScreens(10, 5);
} else if (this.settings.platform == PlatformType.iOS) {
this.compareScreens(5);
this.navOptionsPage.navigateWithBackToMain();
}
this.assertImagesResults();
}
use of functional.tests.core.mobile.element.UIElement in project functional-tests by NativeScript.
the class SdkTraceModuleTests method sdkTraceModuleTest.
@Test(dataProvider = "example")
public void sdkTraceModuleTest(String example) {
this.mainPage.navigateTo(example);
UIElement alert = this.wait.waitForVisible(this.mainPage.btnOkLocator(), 30, false);
if (alert != null) {
alert.tap(500);
}
}
use of functional.tests.core.mobile.element.UIElement in project functional-tests by NativeScript.
the class SdkLocationModuleTests method sdkLocationModuleTest.
@Test(dataProvider = "example")
public void sdkLocationModuleTest(String example) throws Exception {
// This only works on Google API emulators (and it currently crash on Api26, no idea why)
if ((this.settings.platform == PlatformType.Android && this.settings.platformVersion != 8.0) || settings.platform == PlatformType.iOS) {
this.mainPage.navigateTo(example);
if (example.equalsIgnoreCase("Basic location") && ((this.settings.platform == PlatformType.Android && this.settings.platformVersion > 5.1) || settings.platform == PlatformType.iOS)) {
UIElement btn = this.mainPage.wait.waitForVisible(this.locators.byText("Allow"), 6, false);
if (btn != null) {
btn.tap();
this.log.info("Handle popup by clicking allow.");
UIElement okbtn = this.mainPage.wait.waitForVisible(this.locators.byText("Ok", false, false), 15, false);
if (okbtn != null) {
okbtn.tap();
this.log.info("Handle popup by clicking ok.");
}
} else {
try {
this.client.driver.switchTo().alert().accept();
this.log.info("Accept alert via driver.");
} catch (Exception e) {
this.log.info("No alert (or fail to accept it).");
}
}
} else if (example == "Basic location") {
UIElement okbtn = this.mainPage.wait.waitForVisible(this.locators.byText("Ok", false, false), 15, false);
if (okbtn != null) {
okbtn.tap();
this.log.info("Handle popup by clicking ok.");
}
}
if (example == "Basic location") {
this.mainPage.wait.waitForVisible(this.locators.byText("Get current location", false, false), 15, true);
}
if (example == "Monitoring location") {
UIElement okbtn = this.mainPage.wait.waitForVisible(this.locators.byText("Ok", false, false), 15, false);
if (okbtn != null) {
okbtn.tap();
this.log.info("Handle popup by clicking ok.");
}
if (this.settings.platformVersion == 29.0) {
UIElement btn = this.mainPage.wait.waitForVisible(this.locators.byText("Allow only while using the app"), 6, false);
if (btn != null) {
btn.tap();
this.log.info("Handle popup by clicking allow.");
}
}
this.mainPage.wait.waitForVisible(this.locators.byText("Start location monitoring", false, false), 15, true);
}
} else {
this.log.warn("This test don't run on Api26 Google API emulator!");
}
}
Aggregations