Start for free Deutsch Log in Register
Please try again later or contact us. Thank you very much!

Subscribe to the newsletter to be informed about important technical updates to the Mobile Device Cloud.

* mandatory information

Save

Test automation on real mobile devices

Test automation Tester Developer Designer & UX Experts

With its mobile device testing features, the Mobile Device Cloud is aimed at test automators of mobile apps for iOS and Android and web applications, among others.

With the following features, the Mobile Device Cloud supports the successful test automation process:

Support for automation frameworks Appium, Espresso, XCUITest, Selenium. Automation of native apps and web applications. Automation using Java, Python, Ruby, JavaScript. Integration in the CI/CD pipeline using Gradle or Maven. Provision of reports of the test executions. Developer mode (analysis of the app and website structure).
<
>
Automated test execution(Video) reports of the test executionDeveloper mode | Mobile Device Cloud
import io.appium.java_client.ios.IOSDriver;
import io.appium.java_client.ios.IOSElement;
import io.appium.java_client.remote.MobileBrowserType;
import org.openqa.selenium.By;
import org.openqa.selenium.ScreenOrientation;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.testng.Assert;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;

import java.net.MalformedURLException;
import java.net.URL;
import java.util.List;

public class LocalMobileTest {
    private String accessKey = "ACCESS_KEY";
    WebDriverWait webDriverWait = null;
    protected IOSDriver<IOSElement> driver = null;
    DesiredCapabilities dc = new DesiredCapabilities();

    @BeforeTest
    public void setUp() throws MalformedURLException {
        dc.setCapability("accessKey", accessKey);
        dc.setCapability("testName", "Quick Start iOS Browser Demo");
        dc.setCapability("deviceQuery", "@os='ios' and @category='PHONE'");
        dc.setBrowserName(MobileBrowserType.SAFARI);
        driver = new IOSDriver<>(new URL("https://mobiledevicecloud.t-systems-mms.eu/wd/hub"), dc);
        webDriverWait = new WebDriverWait(driver, 5);
    }

    @Test
    public void quickStartiOSBrowserDemo() {
        driver.rotate(ScreenOrientation.PORTRAIT);

        driver.get("https://mobiledevice.cloud/");

        waitUntilElementLoaded("//*[@id='no_consent']").click();
        waitUntilElementLoaded("//*[@class='navbar-toggler-icon']").click();

        waitUntilElementLoaded("//*[@id='blog']").click();
        waitUntilElementLoaded("//*[@id='article1']").click();

        WebElement author = waitUntilElementLoaded("//*[@class='author']");

        Assert.assertTrue(author.isDisplayed());

        waitUntilElementLoaded("//*[@class='navbar-toggler-icon']").click();
        waitUntilElementLoaded("//*[@id='link_faq']").click();

        List<WebElement> faq_blocks = waitUntilElementsLoaded("//*[@class='faq_block']");
        WebElement faqSearch = waitUntilElementLoaded("//*[@id='faq-search']");

        Assert.assertTrue(faqSearch.isDisplayed());
        Assert.assertTrue(
            faq_blocks.size() > 0,
            "Expected at least one faq_block element, but there are no elements with that name");
        Assert.assertEquals(
            faq_blocks.size(),
            12,
            "Expected twelve faq_block elements, but there are " + faq_blocks.size() + " elements");

        faqSearch.sendKeys("automatisierte");

        List<WebElement> found_faqs = waitUntilElementsLoaded("//*[@class='faq_block search-hit']");

        Assert.assertTrue(
            found_faqs.size() > 0,
            "Expected at least one faq_block element, but there are no elements with that name");
        Assert.assertEquals(
            found_faqs.size(),
            5,
            "Expected five faq_block elements, but there are " + found_faqs.size() + " elements");
    }

    @AfterTest
    public void tearDown() {
        System.out.println("Report URL: "+ driver.getCapabilities().getCapability("reportUrl"));
        driver.quit();
    }

    private WebElement waitUntilElementLoaded(String xpath) {
        return webDriverWait.until(ExpectedConditions.presenceOfElementLocated(By.xpath(xpath)));
    }

    private List<WebElement> waitUntilElementsLoaded(String xpath) {
        return webDriverWait.until(ExpectedConditions.presenceOfAllElementsLocatedBy(By.xpath(xpath)));
    }
}

Do you have any questions?

Contact now Start for free