]> source.dussan.org Git - vaadin-framework.git/commitdiff
Replace the screenshot usage in framework test (#11547)
authorSun Zhe <31067185+ZheSun88@users.noreply.github.com>
Mon, 29 Apr 2019 08:27:35 +0000 (11:27 +0300)
committerSun Zhe <31067185+ZheSun88@users.noreply.github.com>
Mon, 29 Apr 2019 11:29:30 +0000 (14:29 +0300)
- Replace the GridDisabledTest screenshot usage
- Replace the screenshot tests in BasicCrudGridEditorRowTest
- Replace the screenshot tests in ComboboxVaadinIcons
- Replace the screenshot tests in ValoThemeUITest::accordions
- Added screenshotcomparetolerance to some screenshot test to make tests stable

30 files changed:
uitest/reference-screenshots/chrome/BasicCrudGridEditorRowTest-lookAndFeel_ANY_Chrome__editorrow.png [deleted file]
uitest/reference-screenshots/chrome/BasicCrudGridEditorRowTest-lookAndFeel_ANY_Chrome__grid.png [deleted file]
uitest/reference-screenshots/chrome/ComboBoxVaadinIconsTest-testComboBoxIconRendering_ANY_Chrome__paperplane.png [deleted file]
uitest/reference-screenshots/chrome/ComboBoxVaadinIconsTest-testComboBoxIconRendering_ANY_Chrome__paperplane_1.png [deleted file]
uitest/reference-screenshots/chrome/ComboBoxVaadinIconsTest-testComboBoxIconRendering_ANY_Chrome__popup.png [deleted file]
uitest/reference-screenshots/chrome/GridDisabledTest-disabledGrid_ANY_Chrome__disabled.png [deleted file]
uitest/reference-screenshots/chrome/HIconTest-LayoutIcon_ANY_Chrome__icon.png
uitest/reference-screenshots/firefox/BasicCrudGridEditorRowTest-lookAndFeel_ANY_Firefox__grid.png [deleted file]
uitest/reference-screenshots/firefox/ComboBoxVaadinIconsTest-testComboBoxIconRendering_ANY_Firefox__paperplane.png [deleted file]
uitest/reference-screenshots/firefox/ComboBoxVaadinIconsTest-testComboBoxIconRendering_ANY_Firefox__popup.png [deleted file]
uitest/reference-screenshots/firefox/GridDisabledTest-disabledGrid_ANY_Firefox__disabled.png [deleted file]
uitest/reference-screenshots/internetexplorer/BasicCrudGridEditorRowTest-lookAndFeel_Windows_InternetExplorer_11_editorrow.png [deleted file]
uitest/reference-screenshots/internetexplorer/BasicCrudGridEditorRowTest-lookAndFeel_Windows_InternetExplorer_11_grid.png [deleted file]
uitest/reference-screenshots/internetexplorer/ComboBoxVaadinIconsTest-testComboBoxIconRendering_Windows_InternetExplorer_11_paperplane.png [deleted file]
uitest/reference-screenshots/internetexplorer/ComboBoxVaadinIconsTest-testComboBoxIconRendering_Windows_InternetExplorer_11_popup.png [deleted file]
uitest/reference-screenshots/internetexplorer/GridDisabledTest-disabledGrid_Windows_InternetExplorer_11_disabled.png [deleted file]
uitest/reference-screenshots/phantomjs/BasicCrudGridEditorRowTest-lookAndFeel_LINUX_PhantomJS_1_editorrow.png [deleted file]
uitest/reference-screenshots/phantomjs/BasicCrudGridEditorRowTest-lookAndFeel_LINUX_PhantomJS_1_grid.png [deleted file]
uitest/reference-screenshots/phantomjs/ComboBoxVaadinIconsTest-testComboBoxIconRendering_LINUX_PhantomJS_1_paperplane.png [deleted file]
uitest/reference-screenshots/phantomjs/ComboBoxVaadinIconsTest-testComboBoxIconRendering_LINUX_PhantomJS_1_popup.png [deleted file]
uitest/reference-screenshots/phantomjs/GridDisabledTest-disabledGrid_LINUX_PhantomJS_1_disabled.png [deleted file]
uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxVaadinIcons.java
uitest/src/main/java/com/vaadin/tests/themes/valo/GridDisabled.java
uitest/src/test/java/com/vaadin/tests/components/combobox/ComboBoxVaadinIconsTest.java
uitest/src/test/java/com/vaadin/tests/components/grid/GridEditorFrozenColumnsUITest.java
uitest/src/test/java/com/vaadin/tests/components/table/TableDropIndicatorValoTest.java
uitest/src/test/java/com/vaadin/tests/fieldgroup/BasicCrudGridEditorRowTest.java
uitest/src/test/java/com/vaadin/tests/themes/valo/GridDisabledTest.java
uitest/src/test/java/com/vaadin/tests/themes/valo/ResponsiveStylesTest.java
uitest/src/test/java/com/vaadin/tests/themes/valo/ValoThemeUITest.java

diff --git a/uitest/reference-screenshots/chrome/BasicCrudGridEditorRowTest-lookAndFeel_ANY_Chrome__editorrow.png b/uitest/reference-screenshots/chrome/BasicCrudGridEditorRowTest-lookAndFeel_ANY_Chrome__editorrow.png
deleted file mode 100755 (executable)
index 13b1520..0000000
Binary files a/uitest/reference-screenshots/chrome/BasicCrudGridEditorRowTest-lookAndFeel_ANY_Chrome__editorrow.png and /dev/null differ
diff --git a/uitest/reference-screenshots/chrome/BasicCrudGridEditorRowTest-lookAndFeel_ANY_Chrome__grid.png b/uitest/reference-screenshots/chrome/BasicCrudGridEditorRowTest-lookAndFeel_ANY_Chrome__grid.png
deleted file mode 100755 (executable)
index 7be4fde..0000000
Binary files a/uitest/reference-screenshots/chrome/BasicCrudGridEditorRowTest-lookAndFeel_ANY_Chrome__grid.png and /dev/null differ
diff --git a/uitest/reference-screenshots/chrome/ComboBoxVaadinIconsTest-testComboBoxIconRendering_ANY_Chrome__paperplane.png b/uitest/reference-screenshots/chrome/ComboBoxVaadinIconsTest-testComboBoxIconRendering_ANY_Chrome__paperplane.png
deleted file mode 100644 (file)
index 4c4eac9..0000000
Binary files a/uitest/reference-screenshots/chrome/ComboBoxVaadinIconsTest-testComboBoxIconRendering_ANY_Chrome__paperplane.png and /dev/null differ
diff --git a/uitest/reference-screenshots/chrome/ComboBoxVaadinIconsTest-testComboBoxIconRendering_ANY_Chrome__paperplane_1.png b/uitest/reference-screenshots/chrome/ComboBoxVaadinIconsTest-testComboBoxIconRendering_ANY_Chrome__paperplane_1.png
deleted file mode 100644 (file)
index 847c2f0..0000000
Binary files a/uitest/reference-screenshots/chrome/ComboBoxVaadinIconsTest-testComboBoxIconRendering_ANY_Chrome__paperplane_1.png and /dev/null differ
diff --git a/uitest/reference-screenshots/chrome/ComboBoxVaadinIconsTest-testComboBoxIconRendering_ANY_Chrome__popup.png b/uitest/reference-screenshots/chrome/ComboBoxVaadinIconsTest-testComboBoxIconRendering_ANY_Chrome__popup.png
deleted file mode 100644 (file)
index db632a2..0000000
Binary files a/uitest/reference-screenshots/chrome/ComboBoxVaadinIconsTest-testComboBoxIconRendering_ANY_Chrome__popup.png and /dev/null differ
diff --git a/uitest/reference-screenshots/chrome/GridDisabledTest-disabledGrid_ANY_Chrome__disabled.png b/uitest/reference-screenshots/chrome/GridDisabledTest-disabledGrid_ANY_Chrome__disabled.png
deleted file mode 100755 (executable)
index 9331d8e..0000000
Binary files a/uitest/reference-screenshots/chrome/GridDisabledTest-disabledGrid_ANY_Chrome__disabled.png and /dev/null differ
index 14f3a7b596aa93f1362c00638d488f64c6d462c6..63cb3b579fa6beaa0c3869216593656401672917 100755 (executable)
Binary files a/uitest/reference-screenshots/chrome/HIconTest-LayoutIcon_ANY_Chrome__icon.png and b/uitest/reference-screenshots/chrome/HIconTest-LayoutIcon_ANY_Chrome__icon.png differ
diff --git a/uitest/reference-screenshots/firefox/BasicCrudGridEditorRowTest-lookAndFeel_ANY_Firefox__grid.png b/uitest/reference-screenshots/firefox/BasicCrudGridEditorRowTest-lookAndFeel_ANY_Firefox__grid.png
deleted file mode 100644 (file)
index e118498..0000000
Binary files a/uitest/reference-screenshots/firefox/BasicCrudGridEditorRowTest-lookAndFeel_ANY_Firefox__grid.png and /dev/null differ
diff --git a/uitest/reference-screenshots/firefox/ComboBoxVaadinIconsTest-testComboBoxIconRendering_ANY_Firefox__paperplane.png b/uitest/reference-screenshots/firefox/ComboBoxVaadinIconsTest-testComboBoxIconRendering_ANY_Firefox__paperplane.png
deleted file mode 100644 (file)
index 3990122..0000000
Binary files a/uitest/reference-screenshots/firefox/ComboBoxVaadinIconsTest-testComboBoxIconRendering_ANY_Firefox__paperplane.png and /dev/null differ
diff --git a/uitest/reference-screenshots/firefox/ComboBoxVaadinIconsTest-testComboBoxIconRendering_ANY_Firefox__popup.png b/uitest/reference-screenshots/firefox/ComboBoxVaadinIconsTest-testComboBoxIconRendering_ANY_Firefox__popup.png
deleted file mode 100644 (file)
index 3e453cc..0000000
Binary files a/uitest/reference-screenshots/firefox/ComboBoxVaadinIconsTest-testComboBoxIconRendering_ANY_Firefox__popup.png and /dev/null differ
diff --git a/uitest/reference-screenshots/firefox/GridDisabledTest-disabledGrid_ANY_Firefox__disabled.png b/uitest/reference-screenshots/firefox/GridDisabledTest-disabledGrid_ANY_Firefox__disabled.png
deleted file mode 100644 (file)
index aa7b32a..0000000
Binary files a/uitest/reference-screenshots/firefox/GridDisabledTest-disabledGrid_ANY_Firefox__disabled.png and /dev/null differ
diff --git a/uitest/reference-screenshots/internetexplorer/BasicCrudGridEditorRowTest-lookAndFeel_Windows_InternetExplorer_11_editorrow.png b/uitest/reference-screenshots/internetexplorer/BasicCrudGridEditorRowTest-lookAndFeel_Windows_InternetExplorer_11_editorrow.png
deleted file mode 100644 (file)
index a8bd7d2..0000000
Binary files a/uitest/reference-screenshots/internetexplorer/BasicCrudGridEditorRowTest-lookAndFeel_Windows_InternetExplorer_11_editorrow.png and /dev/null differ
diff --git a/uitest/reference-screenshots/internetexplorer/BasicCrudGridEditorRowTest-lookAndFeel_Windows_InternetExplorer_11_grid.png b/uitest/reference-screenshots/internetexplorer/BasicCrudGridEditorRowTest-lookAndFeel_Windows_InternetExplorer_11_grid.png
deleted file mode 100755 (executable)
index cf991ad..0000000
Binary files a/uitest/reference-screenshots/internetexplorer/BasicCrudGridEditorRowTest-lookAndFeel_Windows_InternetExplorer_11_grid.png and /dev/null differ
diff --git a/uitest/reference-screenshots/internetexplorer/ComboBoxVaadinIconsTest-testComboBoxIconRendering_Windows_InternetExplorer_11_paperplane.png b/uitest/reference-screenshots/internetexplorer/ComboBoxVaadinIconsTest-testComboBoxIconRendering_Windows_InternetExplorer_11_paperplane.png
deleted file mode 100755 (executable)
index c12e961..0000000
Binary files a/uitest/reference-screenshots/internetexplorer/ComboBoxVaadinIconsTest-testComboBoxIconRendering_Windows_InternetExplorer_11_paperplane.png and /dev/null differ
diff --git a/uitest/reference-screenshots/internetexplorer/ComboBoxVaadinIconsTest-testComboBoxIconRendering_Windows_InternetExplorer_11_popup.png b/uitest/reference-screenshots/internetexplorer/ComboBoxVaadinIconsTest-testComboBoxIconRendering_Windows_InternetExplorer_11_popup.png
deleted file mode 100755 (executable)
index f1c0ef3..0000000
Binary files a/uitest/reference-screenshots/internetexplorer/ComboBoxVaadinIconsTest-testComboBoxIconRendering_Windows_InternetExplorer_11_popup.png and /dev/null differ
diff --git a/uitest/reference-screenshots/internetexplorer/GridDisabledTest-disabledGrid_Windows_InternetExplorer_11_disabled.png b/uitest/reference-screenshots/internetexplorer/GridDisabledTest-disabledGrid_Windows_InternetExplorer_11_disabled.png
deleted file mode 100755 (executable)
index 0230614..0000000
Binary files a/uitest/reference-screenshots/internetexplorer/GridDisabledTest-disabledGrid_Windows_InternetExplorer_11_disabled.png and /dev/null differ
diff --git a/uitest/reference-screenshots/phantomjs/BasicCrudGridEditorRowTest-lookAndFeel_LINUX_PhantomJS_1_editorrow.png b/uitest/reference-screenshots/phantomjs/BasicCrudGridEditorRowTest-lookAndFeel_LINUX_PhantomJS_1_editorrow.png
deleted file mode 100644 (file)
index 611f8de..0000000
Binary files a/uitest/reference-screenshots/phantomjs/BasicCrudGridEditorRowTest-lookAndFeel_LINUX_PhantomJS_1_editorrow.png and /dev/null differ
diff --git a/uitest/reference-screenshots/phantomjs/BasicCrudGridEditorRowTest-lookAndFeel_LINUX_PhantomJS_1_grid.png b/uitest/reference-screenshots/phantomjs/BasicCrudGridEditorRowTest-lookAndFeel_LINUX_PhantomJS_1_grid.png
deleted file mode 100644 (file)
index 254b8f3..0000000
Binary files a/uitest/reference-screenshots/phantomjs/BasicCrudGridEditorRowTest-lookAndFeel_LINUX_PhantomJS_1_grid.png and /dev/null differ
diff --git a/uitest/reference-screenshots/phantomjs/ComboBoxVaadinIconsTest-testComboBoxIconRendering_LINUX_PhantomJS_1_paperplane.png b/uitest/reference-screenshots/phantomjs/ComboBoxVaadinIconsTest-testComboBoxIconRendering_LINUX_PhantomJS_1_paperplane.png
deleted file mode 100644 (file)
index 943f3b7..0000000
Binary files a/uitest/reference-screenshots/phantomjs/ComboBoxVaadinIconsTest-testComboBoxIconRendering_LINUX_PhantomJS_1_paperplane.png and /dev/null differ
diff --git a/uitest/reference-screenshots/phantomjs/ComboBoxVaadinIconsTest-testComboBoxIconRendering_LINUX_PhantomJS_1_popup.png b/uitest/reference-screenshots/phantomjs/ComboBoxVaadinIconsTest-testComboBoxIconRendering_LINUX_PhantomJS_1_popup.png
deleted file mode 100644 (file)
index 1114dc7..0000000
Binary files a/uitest/reference-screenshots/phantomjs/ComboBoxVaadinIconsTest-testComboBoxIconRendering_LINUX_PhantomJS_1_popup.png and /dev/null differ
diff --git a/uitest/reference-screenshots/phantomjs/GridDisabledTest-disabledGrid_LINUX_PhantomJS_1_disabled.png b/uitest/reference-screenshots/phantomjs/GridDisabledTest-disabledGrid_LINUX_PhantomJS_1_disabled.png
deleted file mode 100755 (executable)
index 36528b0..0000000
Binary files a/uitest/reference-screenshots/phantomjs/GridDisabledTest-disabledGrid_LINUX_PhantomJS_1_disabled.png and /dev/null differ
index a510e41bfc00664422f55157b1b77af0fbf2072e..8c1abd37fd2ae711a5b8aa472463ba02ca67ecd7 100644 (file)
@@ -7,6 +7,7 @@ import com.vaadin.icons.VaadinIcons;
 import com.vaadin.server.VaadinRequest;
 import com.vaadin.tests.components.AbstractTestUI;
 import com.vaadin.ui.ComboBox;
+import com.vaadin.ui.Label;
 
 @Widgetset("com.vaadin.DefaultWidgetSet")
 public class ComboBoxVaadinIcons extends AbstractTestUI {
@@ -19,7 +20,13 @@ public class ComboBoxVaadinIcons extends AbstractTestUI {
         ComboBox<String> comboBox = new ComboBox<>();
         comboBox.setItems(Arrays.stream(icons).map(VaadinIcons::name));
         comboBox.setItemIconGenerator(VaadinIcons::valueOf);
+
+        Label valueLabel = new Label();
+        valueLabel.setValue("Test");
+        valueLabel.setId("value-label");
+        comboBox.addValueChangeListener(event -> valueLabel.setValue(comboBox.getValue()));
         addComponent(comboBox);
+        addComponent(valueLabel);
     }
 
 }
index cbdd9e58341af68f873b1fc4e2114eda98d8fe66..fa830a96f66519a9955c794e92bbbd77a62dd2b4 100644 (file)
@@ -13,6 +13,7 @@ public class GridDisabled extends AbstractTestUI {
         grid.addColumn("foo", String.class);
         grid.addRow("Foo");
         grid.select(grid.addRow("Bar"));
+        grid.setId("disabled-grid");
 
         addComponent(grid);
 
index 0e71475d9fe8698d7cc3879d7ff73b3551588fdb..7fe2e8154318a9cbc40721a1e3cb59f15832bf15 100644 (file)
@@ -2,7 +2,9 @@ package com.vaadin.tests.components.combobox;
 
 import java.io.IOException;
 
+import org.junit.Assert;
 import org.junit.Test;
+import org.openqa.selenium.By;
 import org.openqa.selenium.Keys;
 
 import com.vaadin.testbench.elements.ComboBoxElement;
@@ -14,10 +16,15 @@ public class ComboBoxVaadinIconsTest extends MultiBrowserTest {
     public void testComboBoxIconRendering() throws IOException {
         openTestURL();
         ComboBoxElement comboBox = $(ComboBoxElement.class).first();
+        waitForElementPresent(By.id("value-label"));
+        Assert.assertEquals(findElement(By.id("value-label")).getText(),
+                "Test");
+
         comboBox.openPopup();
-        compareScreen(comboBox.getSuggestionPopup(), "popup");
         comboBox.sendKeys(Keys.ARROW_DOWN, Keys.ARROW_DOWN, Keys.ENTER);
-        compareScreen(comboBox, "paperplane");
-    }
+        Assert.assertEquals(findElement(By.id("value-label")).getText(),
+                "PAPERPLANE");
 
+
+    }
 }
index 14735e3857f4599fbdfb7de75b728aba18bab448..34ef8847c201278005888694e1df17f6081a2ae6 100644 (file)
@@ -22,11 +22,11 @@ public class GridEditorFrozenColumnsUITest extends MultiBrowserTest {
         openTestURL();
 
         openEditor(10);
-
+        sleep(500);
         compareScreen("noscroll");
 
         scrollGridHorizontallyTo(100);
-
+        sleep(500);
         compareScreen("scrolled");
     }
 
index 764ac320d36603b47388c85979642107ec7b1e00..267d211c9ffb7d05eeb822a5b4ab812f7cf725f3 100644 (file)
@@ -7,6 +7,7 @@ import org.openqa.selenium.By;
 import org.openqa.selenium.WebElement;
 import org.openqa.selenium.interactions.Actions;
 
+import com.vaadin.testbench.Parameters;
 import com.vaadin.testbench.elements.TableElement;
 import com.vaadin.tests.tb3.MultiBrowserTest;
 
@@ -30,6 +31,7 @@ public class TableDropIndicatorValoTest extends MultiBrowserTest {
     public void indicator() throws Exception {
 
         dragRowWithoutDropping(1);
+        Parameters.setScreenshotComparisonTolerance(0.1);
         compareScreen("indicator");
     }
 
index d0ba8f2e14f75ed456e6bcbbef1ccbe90bdaeb9b..4401abc3fa0ee2845f9ccb012ce9e8d675aa2ae9 100644 (file)
@@ -1,9 +1,5 @@
 package com.vaadin.tests.fieldgroup;
 
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertTrue;
-
 import java.util.Locale;
 
 import org.junit.Before;
@@ -21,6 +17,11 @@ import com.vaadin.testbench.elements.GridElement.GridEditorElement;
 import com.vaadin.testbench.parallel.TestCategory;
 import com.vaadin.tests.tb3.MultiBrowserTest;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertTrue;
+
 @TestCategory("grid")
 public class BasicCrudGridEditorRowTest extends MultiBrowserTest {
     private GridElement grid;
@@ -29,19 +30,22 @@ public class BasicCrudGridEditorRowTest extends MultiBrowserTest {
     public void openTest() {
         openTestURL();
         grid = $(GridElement.class).first();
-
     }
 
     @Test
     public void lookAndFeel() throws Exception {
         GridCellElement ritaBirthdate = grid.getCell(2, 3);
         waitUntilLoadingIndicatorNotVisible();
-        compareScreen("grid");
+        assertEquals("May 16, 1992",ritaBirthdate.getText());
 
+        // Grid Editor should not present yet
+        waitForElementNotPresent(By.className("v-grid-editor"));
         // Open editor row
         new Actions(getDriver()).doubleClick(ritaBirthdate).perform();
         sleep(200);
-        compareScreen("editorrow");
+        // Compound class name is not allowed to use here,
+        // check the v-grid-editor class only in this case.
+        waitForElementPresent(By.className("v-grid-editor"));
     }
 
     @Test
@@ -80,7 +84,7 @@ public class BasicCrudGridEditorRowTest extends MultiBrowserTest {
         assertNotEquals("Checkbox value did not change", value, cb.getValue());
     }
 
-    @Test
+   @Test
     public void testNoTopStyleSetOnEditorOpenWithFooterOnTop() {
         GridCellElement cell = grid.getCell(2, 3);
         // Open editor row
index 34a2f38b79dabea0cecee94031635766beef037c..1cf847fee6473b80294c8f922e6c2fc79bc6de2c 100644 (file)
@@ -5,17 +5,23 @@ import java.io.IOException;
 import org.junit.Test;
 
 import com.vaadin.testbench.elements.ButtonElement;
+import com.vaadin.testbench.elements.GridElement;
 import com.vaadin.tests.tb3.MultiBrowserTest;
 
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
 public class GridDisabledTest extends MultiBrowserTest {
 
     @Test
     public void disabledGrid() throws IOException {
         openTestURL();
         waitUntilLoadingIndicatorNotVisible();
+        GridElement disabledGrid = $(GridElement.class).id("disabled-grid");
 
+        assertFalse(disabledGrid.getClassNames().toString().contains("v-disabled"));
         $(ButtonElement.class).caption("Disable").first().click();
 
-        compareScreen("disabled");
+        assertTrue(disabledGrid.getClassNames().toString().contains("v-disabled"));
     }
 }
index 074d72f4f9315a577ffb4d8c56e8125be3290819..a243c25a583da28ba63a13cc502aa50997569f97 100644 (file)
@@ -9,6 +9,7 @@ import org.junit.Test;
 import org.openqa.selenium.WebElement;
 import org.openqa.selenium.interactions.Actions;
 
+import com.vaadin.testbench.Parameters;
 import com.vaadin.testbench.elements.LabelElement;
 import com.vaadin.tests.tb3.MultiBrowserTest;
 
@@ -83,6 +84,7 @@ public class ResponsiveStylesTest extends MultiBrowserTest {
         actions.perform();
         sleep(200);
 
+        Parameters.setScreenshotComparisonTolerance(0.1);
         compareScreen("expandedMenu");
     }
 }
index 4ed665fbc2ee5b988f9a7b849ad84058cfd56e8a..de11c22d821d3055679e59dc41d2dd43faee87e6 100644 (file)
@@ -1,9 +1,11 @@
 package com.vaadin.tests.themes.valo;
 
+import org.junit.Assert;
 import org.junit.Test;
 import org.openqa.selenium.By;
 import org.openqa.selenium.WebElement;
 
+import com.vaadin.testbench.Parameters;
 import com.vaadin.testbench.elements.ButtonElement;
 import com.vaadin.testbench.elements.CheckBoxElement;
 import com.vaadin.testbench.elements.CssLayoutElement;
@@ -13,23 +15,31 @@ import com.vaadin.v7.testbench.elements.TreeElement;
 
 public class ValoThemeUITest extends MultiBrowserTest {
 
+    @Override
+    public void setup() throws Exception {
+        super.setup();
+
+        openTestURL("test");
+        // During the URL open process, we have already verified that the UI
+        // is correct, so that in this case, we can assume everything is fine
+        // as long as the UI is not totally broken
+        Parameters.setScreenshotComparisonTolerance(0.1);
+    }
+
     @Test
     public void labels() throws Exception {
-        openTestURL("test");
         open("Labels");
         compareScreen("labels");
     }
 
     @Test
     public void buttonsLinks() throws Exception {
-        openTestURL("test");
         open("Buttons & Links", "Buttons");
         compareScreen("buttonsLinks_with_disabled");
     }
 
     @Test
     public void textFields() throws Exception {
-        openTestURL("test");
         open("Text Fields <span class=\"valo-menu-badge\">123</span>",
                 "Text Fields");
         compareScreen("textFields");
@@ -37,14 +47,12 @@ public class ValoThemeUITest extends MultiBrowserTest {
 
     @Test
     public void common() throws Exception {
-        openTestURL("test");
         open("Common UI Elements");
         compareScreen("common");
     }
 
     @Test
     public void datefields() throws Exception {
-        openTestURL("test");
         open("Date Fields");
         // Note that this can look broken in IE9 because of some browser
         // rendering issue... The problem seems to be in the customized
@@ -54,49 +62,42 @@ public class ValoThemeUITest extends MultiBrowserTest {
 
     @Test
     public void comboboxes() throws Exception {
-        openTestURL("test");
         open("Combo Boxes");
         compareScreen("comboboxes");
     }
 
     @Test
     public void selects() throws Exception {
-        openTestURL("test");
         open("Selects");
         compareScreen("selects");
     }
 
     @Test
     public void checkboxes() throws Exception {
-        openTestURL("test");
         open("Check Boxes & Option Groups", "Check Boxes");
         compareScreen("checkboxes_with_readonly");
     }
 
     @Test
     public void sliders() throws Exception {
-        openTestURL("test");
         open("Sliders & Progress Bars", "Sliders");
         compareScreen("sliders");
     }
 
     @Test
     public void colorpickers() throws Exception {
-        openTestURL("test");
         open("Color Pickers");
         compareScreen("colorpickers");
     }
 
     @Test
     public void menubars() throws Exception {
-        openTestURL("test");
         open("Menu Bars");
         compareScreen("menubars");
     }
 
     @Test
     public void trees() throws Exception {
-        openTestURL("test");
         open("Trees");
         selectTreeNodeByCaption("Quid securi");
         compareScreen("trees");
@@ -111,7 +112,6 @@ public class ValoThemeUITest extends MultiBrowserTest {
 
     @Test
     public void tables() throws Exception {
-        openTestURL("test");
         open("Tables");
         check("Components in Cells");
         compareScreen("tables");
@@ -119,7 +119,6 @@ public class ValoThemeUITest extends MultiBrowserTest {
 
     @Test
     public void treeTables() throws Exception {
-        openTestURL("test");
         open("Tables");
         check("Hierarchical");
         check("Footer");
@@ -128,28 +127,24 @@ public class ValoThemeUITest extends MultiBrowserTest {
 
     @Test
     public void dragging() throws Exception {
-        openTestURL("test");
         open("Drag and Drop", "Dragging Components");
         compareScreen("dragging");
     }
 
     @Test
     public void panels() throws Exception {
-        openTestURL("test");
         open("Panels", "Panels & Layout panels");
         compareScreen("panels");
     }
 
     @Test
     public void splitpanels() throws Exception {
-        openTestURL("test");
         open("Split Panels");
         compareScreen("splitpanels");
     }
 
     @Test
     public void tabs() throws Exception {
-        openTestURL("test");
         open("Tabs <span class=\"valo-menu-badge\">123</span>", "Tabs");
         sleep(200);
         compareScreen("tabs");
@@ -158,7 +153,6 @@ public class ValoThemeUITest extends MultiBrowserTest {
 
     @Test
     public void tabsClosable() throws Exception {
-        openTestURL("test");
         open("Tabs <span class=\"valo-menu-badge\">123</span>", "Tabs");
         check("Closable");
         check("Disable tabs");
@@ -169,7 +163,6 @@ public class ValoThemeUITest extends MultiBrowserTest {
 
     @Test
     public void tabsClosableUnframed() throws Exception {
-        openTestURL("test");
         open("Tabs <span class=\"valo-menu-badge\">123</span>", "Tabs");
         check("Closable");
         // Framed option is checked by default so we are actually unchecking
@@ -181,7 +174,6 @@ public class ValoThemeUITest extends MultiBrowserTest {
 
     @Test
     public void tabsAlignRight() throws Exception {
-        openTestURL("test");
         open("Tabs <span class=\"valo-menu-badge\">123</span>", "Tabs");
         check("Right-aligned tabs");
         sleep(200);
@@ -197,7 +189,6 @@ public class ValoThemeUITest extends MultiBrowserTest {
 
     @Test
     public void tabsAlignCenter() throws Exception {
-        openTestURL("test");
         open("Tabs <span class=\"valo-menu-badge\">123</span>", "Tabs");
         check("Centered tabs");
         sleep(200);
@@ -206,7 +197,6 @@ public class ValoThemeUITest extends MultiBrowserTest {
 
     @Test
     public void tabsIconsOnTop() throws Exception {
-        openTestURL("test");
         open("Tabs <span class=\"valo-menu-badge\">123</span>", "Tabs");
         check("Icons on top");
         sleep(200);
@@ -215,7 +205,6 @@ public class ValoThemeUITest extends MultiBrowserTest {
 
     @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");
@@ -226,14 +215,20 @@ public class ValoThemeUITest extends MultiBrowserTest {
 
     @Test
     public void accordions() throws Exception {
-        openTestURL("test");
         open("Accordions");
-        compareScreen("accordions");
+
+        // Screenshot test is very unstable here. 
+        // We are testing the label contains the correct text in this case.  
+        CssLayoutElement content = wrap(CssLayoutElement.class,
+                findElement(By.className("valo-content")));
+        LabelElement labelElem = content.$(LabelElement.class).get(1);
+        String text = "Fabio vel iudice vincam, sunt in culpa qui officia. Ut " +
+                "enim ad minim veniam, quis nostrud exercitation.";
+        Assert.assertEquals(text, labelElem.getText());
     }
 
     @Test
     public void popupviews() throws Exception {
-        openTestURL("test");
         open("Popup Views");
         scrollTo(500, 0);
         compareScreen("popupviews");
@@ -241,7 +236,6 @@ public class ValoThemeUITest extends MultiBrowserTest {
 
     @Test
     public void calendar() throws Exception {
-        openTestURL("test");
         scrollTo(500, 0);
         open("Calendar");
 
@@ -250,7 +244,6 @@ public class ValoThemeUITest extends MultiBrowserTest {
 
     @Test
     public void forms() throws Exception {
-        openTestURL("test");
         scrollTo(500, 0);
         open("Forms");
         compareScreen("forms");