Skip to content

How do I submit a test case on GMD?

Mark Kevin Baldemor edited this page Aug 15, 2017 · 9 revisions

Introduction

Creating Test Cases are very important to GMD Projects to ensure the quality of our Material Design widget's API, not only it's behavioral aspect but also the layout / structure of it. We used the default GWT Test which is the integration of JUnit Testing Framework and it's an Open Source project.

On the other hand, we are using BrowserStack Automate to easily create a StoryBoard of your GMD Application for Testing on different Browser / Platform - using Selenium Test.

Click here for more information on GWT Testing.

Widget Testing Guide (JUnit Framework)

On this guide, you will learn how to contribute a simple test case of each Widget API. Let's focus first on how you will create new Test Case for existing Widget. Also take note that we created already each individual Material Widget initial tests.

Result

  • Step 5 - If the test you've updated / created are successfull you can now submit a Pull Request for your contribution. Please see the Contribution Guidelines.

App Test (Selenium Framework)

Simple Test Suite for GMD Widget

  1. Open Browser
  2. Navigate to gmd demo
  3. Click on Icon Search
  4. Open Search and Type DatePicker
  5. Click on the first DatePicker

Selenium Source Code

   @Test
    public void testDatePicker() throws MalformedURLException {
        String gmdUrl = "https://gwtmaterialdesign.github.io/gwt-material-demo/";

        DesiredCapabilities caps = new DesiredCapabilities();
        caps.setCapability("os", "OS X");
        caps.setCapability("browser", "chrome");
        caps.setCapability("browserstack.debug", "true");
        caps.setCapability("resolution", "1920x1080");
        caps.setCapability("build", "First build");

        WebDriver driver = new RemoteWebDriver(new URL(URL), caps);
        driver.manage().window().maximize();
        driver.get("https://gwtmaterialdesign.github.io/gwt-material-demo/");

        WebElement searchIcon = driver.findElement(By.cssSelector("header nav .nav-wrapper a:nth-child(3)"));
        Assert.assertNotNull(searchIcon);
        searchIcon.click();

        WebElement searchInput = driver.findElement(By.cssSelector("header nav .nav-wrapper .input-field input[type=search]"));
        Assert.assertNotNull(searchInput);
        searchInput.sendKeys("Date Picker");
        searchInput.sendKeys(Keys.ENTER);

        Assert.assertEquals(driver.getCurrentUrl(), gmdUrl + "#pickers");

        // DatePicker
        WebElement datePicker = driver.findElement(By.cssSelector("main .code:nth-child(1) .input-field input"));
        datePicker.click();

        System.out.println(driver.getTitle());
        driver.quit();
    }

Screenshots from Browserstack

date-picker-test

date-picker-result