Examples of ButtonElement


Examples of com.vaadin.testbench.elements.ButtonElement

        ButtonElement button = $(ButtonElement.class).get(3);
        button.click();
    }

    private void jumpToFifteenthRow() {
        ButtonElement button = $(ButtonElement.class).get(2);
        button.click();
    }
View Full Code Here

Examples of com.vaadin.testbench.elements.ButtonElement

        ButtonElement button = $(ButtonElement.class).get(2);
        button.click();
    }

    private void jumpToLastRow() {
        ButtonElement button = $(ButtonElement.class).get(1);
        button.click();
    }
View Full Code Here

Examples of com.vaadin.testbench.elements.ButtonElement

    private WebElement getTab(int index) {
        return getDriver().findElement(By.vaadin("//TabSheet#tab[1]"));
    }

    private String getHideButtonText() {
        ButtonElement buttonCaption = $(ButtonElement.class).first();
        return buttonCaption.getText();
    }
View Full Code Here

Examples of com.vaadin.testbench.elements.ButtonElement

    public void testWidth() throws IOException {
        openTestURL();

        compareScreen("initial");

        ButtonElement button = $(ButtonElement.class).first();
        button.click();
        button.click();

        compareScreen("after");
    }
View Full Code Here

Examples of com.vaadin.testbench.elements.ButtonElement

    }

    @Test
    public void testSecondDateField() throws InterruptedException {
        DateFieldElement dateField = $(DateFieldElement.class).all().get(1);
        ButtonElement button = $(ButtonElement.class).first();

        // change the date
        button.click();
        sleep(100);

        // open the popup
        dateField.findElement(By.tagName("button")).click();
View Full Code Here

Examples of com.vaadin.testbench.elements.ButtonElement

    }

    @Test
    public void testThirdDateField() throws InterruptedException {
        DateFieldElement dateField = $(DateFieldElement.class).all().get(2);
        ButtonElement button = $(ButtonElement.class).first();

        // change the date
        button.click();
        sleep(100);

        // open the popup
        dateField.findElement(By.tagName("button")).click();

        assertTrue("popup not found when there should be one",
                isElementPresent(By.className("v-datefield-popup")));

        // verify contents
        WebElement popup = findElement(By.className("v-datefield-popup"));
        assertEquals(
                "unexpected month",
                "helmikuu 2010",
                popup.findElements(
                        By.className("v-datefield-calendarpanel-month")).get(1)
                        .getText());
        List<WebElement> headerElements = popup.findElement(
                By.className("v-datefield-calendarpanel-weekdays"))
                .findElements(By.tagName("td"));
        List<WebElement> weekdays = new ArrayList<WebElement>();
        for (WebElement headerElement : headerElements) {
            if ("columnheader".equals(headerElement.getAttribute("role"))) {
                weekdays.add(headerElement);
            }
        }
        assertEquals("unexpected weekday count", 7, weekdays.size());
        assertEquals("unexpected first day of week", "MA", weekdays.get(0)
                .getText());
        List<WebElement> weeknumbers = popup.findElements(By
                .className("v-datefield-calendarpanel-weeknumber"));
        assertEquals("unexpected weeknumber count", 6, weeknumbers.size());
        assertEquals("unexpected weeknumber content", "5", weeknumbers.get(0)
                .getText());
        assertEquals("unexpected weeknumber content", "10", weeknumbers.get(5)
                .getText());
        assertEquals(
                "unexpected selection",
                "16",
                popup.findElement(
                        By.className("v-datefield-calendarpanel-day-selected"))
                        .getText());
        assertEquals(
                "unexpected focus",
                "16",
                popup.findElement(
                        By.className("v-datefield-calendarpanel-day-focused"))
                        .getText());
        List<WebElement> days = popup.findElements(By
                .className("v-datefield-calendarpanel-day"));
        assertEquals("unexpected day count", 42, days.size());
        assertEquals("unexpected day content", "1", days.get(0).getText());
        assertEquals("unexpected day content", "9", days.get(8).getText());
        assertEquals("unexpected day content", "26", days.get(25).getText());
        assertEquals("unexpected day content", "14", days.get(41).getText());

        // navigate to previous month
        WebElement popupBody = popup.findElement(By
                .className("v-datefield-calendarpanel"));
        new Actions(driver).keyDown(Keys.SHIFT).perform();
        popupBody.sendKeys(Keys.ARROW_LEFT);
        new Actions(driver).keyUp(Keys.SHIFT).perform();

        // TODO: remove this once #14406 has been fixed
        if (!getBrowsersExcludingIE().contains(getDesiredCapabilities())
                && !Browser.IE8.getDesiredCapabilities().equals(
                        getDesiredCapabilities())) {
            popup.findElement(
                    By.className("v-datefield-calendarpanel-prevmonth"))
                    .findElement(By.tagName("button")).click();
        }

        // verify contents
        assertEquals(
                "unexpected month",
                "tammikuu 2010",
                popup.findElements(
                        By.className("v-datefield-calendarpanel-month")).get(1)
                        .getText());
        weeknumbers = popup.findElements(By
                .className("v-datefield-calendarpanel-weeknumber"));
        assertEquals("unexpected weeknumber count", 6, weeknumbers.size());
        assertEquals("unexpected weeknumber content", "53", weeknumbers.get(0)
                .getText());
        assertEquals("unexpected weeknumber content", "5", weeknumbers.get(5)
                .getText());
        assertEquals(
                "unexpected selection",
                0,
                popup.findElements(
                        By.className("v-datefield-calendarpanel-day-selected"))
                        .size());
        // TODO: remove this check once #14406 has been fixed -- clicking the
        // button instead of navigating with arrow keys steals the focus
        if (getBrowsersExcludingIE().contains(getDesiredCapabilities())
                || Browser.IE8.getDesiredCapabilities().equals(
                        getDesiredCapabilities())) {
            assertEquals(
                    "unexpected focus",
                    "16",
                    popup.findElement(
                            By.className("v-datefield-calendarpanel-day-focused"))
                            .getText());
        }
        days = popup
                .findElements(By.className("v-datefield-calendarpanel-day"));
        assertEquals("unexpected day count", 42, days.size());
        assertEquals("unexpected day content", "28", days.get(0).getText());
        assertEquals("unexpected day content", "5", days.get(8).getText());
        assertEquals("unexpected day content", "22", days.get(25).getText());
        assertEquals("unexpected day content", "7", days.get(41).getText());

        // navigate to previous year
        new Actions(driver).keyDown(Keys.SHIFT).perform();
        popupBody.sendKeys(Keys.ARROW_DOWN);
        new Actions(driver).keyUp(Keys.SHIFT).perform();

        // TODO: remove this once #14406 has been fixed
        popup.findElement(By.className("v-datefield-calendarpanel-prevyear"))
                .findElement(By.tagName("button")).click();

        // verify contents
        assertEquals(
                "unexpected month",
                "tammikuu 2009",
                popup.findElements(
                        By.className("v-datefield-calendarpanel-month")).get(1)
                        .getText());
        weeknumbers = popup.findElements(By
                .className("v-datefield-calendarpanel-weeknumber"));
        assertEquals("unexpected weeknumber count", 6, weeknumbers.size());
        assertEquals("unexpected weeknumber content", "1", weeknumbers.get(0)
                .getText());
        assertEquals("unexpected weeknumber content", "6", weeknumbers.get(5)
                .getText());
        assertEquals(
                "unexpected selection",
                0,
                popup.findElements(
                        By.className("v-datefield-calendarpanel-day-selected"))
                        .size());
        // TODO: remove this check once #14406 has been fixed -- clicking the
        // button instead of navigating with arrow keys steals the focus
        if (false) {
            assertEquals(
                    "unexpected focus",
                    "16",
                    popup.findElement(
                            By.className("v-datefield-calendarpanel-day-focused"))
                            .getText());
        }
        days = popup
                .findElements(By.className("v-datefield-calendarpanel-day"));
        assertEquals("unexpected day count", 42, days.size());
        assertEquals("unexpected day content", "29", days.get(0).getText());
        assertEquals("unexpected day content", "6", days.get(8).getText());
        assertEquals("unexpected day content", "23", days.get(25).getText());
        assertEquals("unexpected day content", "8", days.get(41).getText());

        // close the popup by clicking an unrelated element
        button.click();

        assertFalse("popup found when there should be none",
                isElementPresent(By.className("v-datefield-popup")));
    }
View Full Code Here

Examples of com.vaadin.testbench.elements.ButtonElement

    @Test
    public void testPopupViewContainsAddedItem() {
        openTestURL();
        ComboBoxElement cBox = $(ComboBoxElement.class).first();
        ButtonElement focusTarget = $(ButtonElement.class).first();
        cBox.openPopup();
        int i = 0;
        while (i < 3) {
            assertTrue("No item added on focus", cBox.getPopupSuggestions()
                    .contains("Focus" + i++));
            focusTarget.focus();
            ((TestBenchElement) cBox.findElement(By.vaadin("#textbox")))
                    .focus();
        }
        assertTrue("No item added on focus", cBox.getPopupSuggestions()
                .contains("Focus" + i));
View Full Code Here

Examples of com.vaadin.testbench.elements.ButtonElement

        openTestURL();

        ComboBoxElement comboBox = $(ComboBoxElement.class).first();
        String oldStyle = comboBox.getAttribute("style");

        ButtonElement button = $(ButtonElement.class).first();
        button.click();
        String newStyle = comboBox.getAttribute("style");

        assertEquals("width has changed, should remain equal", oldStyle,
                newStyle);
View Full Code Here

Examples of com.vaadin.testbench.elements.ButtonElement

        openTestURL();

        TextFieldElement prefix = $(TextFieldElement.class).first();
        TextFieldElement postfix = $(TextFieldElement.class).get(1);
        NativeSelectElement type = $(NativeSelectElement.class).first();
        ButtonElement show = $(ButtonElement.class).first();

        prefix.clear();
        prefix.sendKeys("Prefix:");

        postfix.clear();
        postfix.sendKeys("- press ESC to close");

        type.selectByText(NotificationRole.ALERT.toString());

        show.click();
        waitForElementPresent(By.className("v-Notification"));

        NotificationElement notification = $(NotificationElement.class).first();

        String text = notification.getAttribute("role");
        Assert.assertTrue("Expected attribute 'role' to equal 'alert', found "
                + text, text.equals("alert"));

        text = getHiddenText(notification.findElements(
                By.className("v-assistive-device-only")).get(0));
        Assert.assertTrue("Expected 'Prefix:', found " + text,
                text.equals("Prefix:"));

        text = getHiddenText(notification.findElements(
                By.className("v-assistive-device-only")).get(1));
        Assert.assertTrue("Expected '- press ESC to close', found " + text,
                text.equals("- press ESC to close"));

        try {
            notification.closeNotification();
        } catch (Exception e) {
        }

        type.selectByText("STATUS");

        show.click();
        waitForElementPresent(By.className("v-Notification"));

        notification = $(NotificationElement.class).first();

        text = notification.getAttribute("role");
        Assert.assertTrue("Expected attribute 'role' to equal 'status', found "
                + text, text.equals("status"));

        try {
            notification.closeNotification();
        } catch (Exception e) {
        }

        prefix.clear();
        postfix.clear();

        show.click();
        waitForElementPresent(By.className("v-Notification"));

        WebElement element;
        try {
            element = getDriver()
View Full Code Here

Examples of com.vaadin.testbench.elements.ButtonElement

    public void LayoutMarginSpacing() throws IOException, InterruptedException {
        openTestURL();
        sleep(500);
        compareScreen("initial");
        String[] states = { "marginOnSpaceOff", "marginOnfSpaceOn" };
        ButtonElement marginBtn = $(ButtonElement.class).get(0);
        ButtonElement spaceBtn = $(ButtonElement.class).get(1);
        marginBtn.click();
        sleep(1000);
        compareScreen(states[0]);
        spaceBtn.click();
        sleep(1000);
        compareScreen(states[1]);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.