summaryrefslogtreecommitdiffstats
path: root/uitest
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2014-08-19 14:54:16 +0300
committerVaadin Code Review <review@vaadin.com>2014-08-19 14:46:28 +0000
commit403b9b5870ea643edfe7fe8a2390f0a012f69d5e (patch)
tree404791d71c87f28dd1a969464c8e39c5edd4f7b8 /uitest
parent2987485ccbae5f6bf4f975e1386baf22ba00a52b (diff)
downloadvaadin-framework-403b9b5870ea643edfe7fe8a2390f0a012f69d5e.tar.gz
vaadin-framework-403b9b5870ea643edfe7fe8a2390f0a012f69d5e.zip
Make test more stable
* Added tests for tabsheet variants Change-Id: Ib8d5c88cdedf1bbac439f91346b7b8a6a6756ede
Diffstat (limited to 'uitest')
-rw-r--r--uitest/src/com/vaadin/tests/themes/valo/ValoThemeUI.java29
-rw-r--r--uitest/src/com/vaadin/tests/themes/valo/ValoThemeUITest.java60
2 files changed, 87 insertions, 2 deletions
diff --git a/uitest/src/com/vaadin/tests/themes/valo/ValoThemeUI.java b/uitest/src/com/vaadin/tests/themes/valo/ValoThemeUI.java
index 501b5f573b..b33a604033 100644
--- a/uitest/src/com/vaadin/tests/themes/valo/ValoThemeUI.java
+++ b/uitest/src/com/vaadin/tests/themes/valo/ValoThemeUI.java
@@ -89,6 +89,16 @@ public class ValoThemeUI extends UI {
protected void init(VaadinRequest request) {
if (request.getParameter("test") != null) {
testMode = true;
+
+ if (browserCantRenderFontsConsistently()) {
+ getPage().getStyles().add(
+ ".v-app.v-app.v-app {font-family: Sans-Serif;}");
+ }
+ }
+
+ if (getPage().getWebBrowser().isIE()
+ && getPage().getWebBrowser().getBrowserMajorVersion() == 9) {
+ menu.setWidth("320px");
}
// Show .v-app-loading valo-menu-badge
// try {
@@ -97,7 +107,9 @@ public class ValoThemeUI extends UI {
// e.printStackTrace();
// }
- Responsive.makeResponsive(this);
+ if (!testMode) {
+ Responsive.makeResponsive(this);
+ }
getPage().setTitle("Valo Theme Test");
setContent(root);
@@ -167,6 +179,19 @@ public class ValoThemeUI extends UI {
}
+ private boolean browserCantRenderFontsConsistently() {
+ // PhantomJS renders font correctly about 50% of the time, so
+ // disable it to have consistent screenshots
+ // https://github.com/ariya/phantomjs/issues/10592
+
+ // IE8 also has randomness in its font rendering...
+
+ return getPage().getWebBrowser().getBrowserApplication()
+ .contains("PhantomJS")
+ || (getPage().getWebBrowser().isIE() && getPage()
+ .getWebBrowser().getBrowserMajorVersion() <= 9);
+ }
+
static boolean isTestMode() {
return ((ValoThemeUI) getCurrent()).testMode;
}
@@ -440,4 +465,4 @@ public class ValoThemeUI extends UI {
}
return container;
}
-} \ No newline at end of file
+}
diff --git a/uitest/src/com/vaadin/tests/themes/valo/ValoThemeUITest.java b/uitest/src/com/vaadin/tests/themes/valo/ValoThemeUITest.java
index fdb2eabeee..b5b7e16b34 100644
--- a/uitest/src/com/vaadin/tests/themes/valo/ValoThemeUITest.java
+++ b/uitest/src/com/vaadin/tests/themes/valo/ValoThemeUITest.java
@@ -20,6 +20,7 @@ import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import com.vaadin.testbench.elements.ButtonElement;
+import com.vaadin.testbench.elements.CheckBoxElement;
import com.vaadin.testbench.elements.CssLayoutElement;
import com.vaadin.testbench.elements.LabelElement;
import com.vaadin.testbench.elements.TreeElement;
@@ -127,6 +128,7 @@ public class ValoThemeUITest extends MultiBrowserTest {
public void tables() throws Exception {
openTestURL("test");
open("Tables");
+ check("Components in Cells");
compareScreen("tables");
}
@@ -156,6 +158,64 @@ public class ValoThemeUITest extends MultiBrowserTest {
openTestURL("test");
open("Tabs <span class=\"valo-menu-badge\">123</span>", "Tabs");
compareScreen("tabs");
+
+ }
+
+ @Test
+ public void tabsClosable() throws Exception {
+ openTestURL("test");
+ open("Tabs <span class=\"valo-menu-badge\">123</span>", "Tabs");
+ check("Closable");
+ check("Disable tabs");
+ check("Overflow");
+ compareScreen("tabs-closable-disabled");
+ }
+
+ @Test
+ public void tabsAlignRight() throws Exception {
+ openTestURL("test");
+ open("Tabs <span class=\"valo-menu-badge\">123</span>", "Tabs");
+ check("Right-aligned tabs");
+ compareScreen("tabs-align-right");
+ }
+
+ /**
+ * workaround for http://dev.vaadin.com/ticket/13763
+ */
+ private void check(String caption) {
+ WebElement cb = $(CheckBoxElement.class).caption(caption).first()
+ .findElement(By.xpath("input"));
+ if (BrowserUtil.isChrome(getDesiredCapabilities())) {
+ testBenchElement(cb).click(0, 0);
+ } else {
+ cb.click();
+ }
+ }
+
+ @Test
+ public void tabsAlignCenter() throws Exception {
+ openTestURL("test");
+ open("Tabs <span class=\"valo-menu-badge\">123</span>", "Tabs");
+ check("Centered tabs");
+ compareScreen("tabs-align-center");
+ }
+
+ @Test
+ public void tabsIconsOnTop() throws Exception {
+ openTestURL("test");
+ open("Tabs <span class=\"valo-menu-badge\">123</span>", "Tabs");
+ check("Icons on top");
+ compareScreen("tabs-icons-on-top");
+ }
+
+ @Test
+ public void tabsEqualCompactPadded() throws Exception {
+ openTestURL("test");
+ open("Tabs <span class=\"valo-menu-badge\">123</span>", "Tabs");
+ check("Equal-width tabs");
+ check("Padded tabbar");
+ check("Compact");
+ compareScreen("tabs-equal-compact-padded");
}
@Test