org.senchalabs.gwt.gwtdriver.gxt.models.ComboBoxTest.java Source code

Java tutorial

Introduction

Here is the source code for org.senchalabs.gwt.gwtdriver.gxt.models.ComboBoxTest.java

Source

package org.senchalabs.gwt.gwtdriver.gxt.models;

/*
 * #%L
 * Sencha GXT classes for gwt-driver
 * %%
 * Copyright (C) 2012 - 2013 Sencha Labs
 * %%
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * #L%
 */

import org.junit.Test;
import org.openqa.selenium.Keys;
import org.senchalabs.gwt.gwtdriver.models.GwtWidget;

public class ComboBoxTest extends BaseTest {
    @Override
    protected String getScenarioName() {
        return "combo";
    }

    @Test
    public void testAutoComplete() throws Exception {
        //TODO work on these generics
        ComboBox c = GwtWidget.find(Field.class, driver).withLabel("ComboBox").done().as(ComboBox.class);

        c.sendKeys("th");
        c.waitForDropDown();
        c.sendKeys(Keys.RETURN);

        assert c.getValue().equals("Three") : c.getValue();
    }

    @Test
    public void testExpandButton() {
        ComboBox c = GwtWidget.find(Field.class, driver).withLabel("ComboBox").done().as(ComboBox.class);

        c.clickTrigger();
        c.getDropDown().clickItemWithText("Two");

        assert c.getValue().equals("Two") : c.getValue();
    }
}