aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/test/java/com/vaadin/tests/layouts/layouttester/VLayout/VAlignmentTest.java
blob: 693b6f0de97eb6e47e4f89f9d3514856f9614605 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package com.vaadin.tests.layouts.layouttester.VLayout;

import static org.junit.Assert.assertEquals;

import java.io.IOException;
import java.util.List;

import org.openqa.selenium.JavascriptExecutor;

import com.vaadin.testbench.elements.TextFieldElement;
import com.vaadin.tests.layouts.layouttester.BaseAlignmentTest;

public class VAlignmentTest extends BaseAlignmentTest {

    @Override
    public void layoutAlignment() throws IOException {
        super.layoutAlignment();

        // The layout is too high to fit into one screenshot, we need to scroll
        // and take another.

        List<TextFieldElement> textFields = $(TextFieldElement.class).all();
        assertEquals(9, textFields.size());
        TextFieldElement lastTextField = textFields.get(8);

        // moveToElement fails on Firefox since the component is out of viewport
        ((JavascriptExecutor) driver).executeScript(
                "arguments[0].scrollIntoView(true);", lastTextField);

        compareScreen("alignment-scrolled");
    }
}