diff options
author | Ilia Motornyi <elmot@vaadin.com> | 2018-08-31 17:29:23 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-31 17:29:23 +0300 |
commit | 328b057f4087f546a0a26302e23014aae09920d7 (patch) | |
tree | 903c3792fc973385fb56559f5537f4e8789e48e0 | |
parent | 52b7d447296a7c8c6f48f0c8b15abb7e250dc640 (diff) | |
download | vaadin-framework-328b057f4087f546a0a26302e23014aae09920d7.tar.gz vaadin-framework-328b057f4087f546a0a26302e23014aae09920d7.zip |
Update tests for new Chrome (#11150)
9 files changed, 40 insertions, 29 deletions
diff --git a/uitest/reference-screenshots/chrome/HeaderSyncOnScrollTest-testFooter_ANY_Chrome__300px-scrolled-right.png b/uitest/reference-screenshots/chrome/HeaderSyncOnScrollTest-testFooter_ANY_Chrome__300px-scrolled-right.png Binary files differindex 9afc441819..9c3b058de0 100755 --- a/uitest/reference-screenshots/chrome/HeaderSyncOnScrollTest-testFooter_ANY_Chrome__300px-scrolled-right.png +++ b/uitest/reference-screenshots/chrome/HeaderSyncOnScrollTest-testFooter_ANY_Chrome__300px-scrolled-right.png diff --git a/uitest/reference-screenshots/chrome/ResponsiveLayoutUpdateTest-testWidthAndHeightRanges_ANY_Chrome__small.png b/uitest/reference-screenshots/chrome/ResponsiveLayoutUpdateTest-testWidthAndHeightRanges_ANY_Chrome__small.png Binary files differindex 03cede81c2..f2f7b8b40b 100755 --- a/uitest/reference-screenshots/chrome/ResponsiveLayoutUpdateTest-testWidthAndHeightRanges_ANY_Chrome__small.png +++ b/uitest/reference-screenshots/chrome/ResponsiveLayoutUpdateTest-testWidthAndHeightRanges_ANY_Chrome__small.png diff --git a/uitest/reference-screenshots/chrome/TableTooManyColumnsTest-testDropdownTable_ANY_Chrome__init.png b/uitest/reference-screenshots/chrome/TableTooManyColumnsTest-testDropdownTable_ANY_Chrome__init.png Binary files differindex df895a3082..41b5011265 100755 --- a/uitest/reference-screenshots/chrome/TableTooManyColumnsTest-testDropdownTable_ANY_Chrome__init.png +++ b/uitest/reference-screenshots/chrome/TableTooManyColumnsTest-testDropdownTable_ANY_Chrome__init.png diff --git a/uitest/reference-screenshots/chrome/TestTooSmallSubwindowSizeTest-testSubwindowStyles_ANY_Chrome__initial_state.png b/uitest/reference-screenshots/chrome/TestTooSmallSubwindowSizeTest-testSubwindowStyles_ANY_Chrome__initial_state.png Binary files differindex 53db1069f9..e2bad0f38f 100755 --- a/uitest/reference-screenshots/chrome/TestTooSmallSubwindowSizeTest-testSubwindowStyles_ANY_Chrome__initial_state.png +++ b/uitest/reference-screenshots/chrome/TestTooSmallSubwindowSizeTest-testSubwindowStyles_ANY_Chrome__initial_state.png diff --git a/uitest/src/test/java/com/vaadin/tests/VerifyBrowserVersionTest.java b/uitest/src/test/java/com/vaadin/tests/VerifyBrowserVersionTest.java index f7d0563441..0bfbf90953 100644 --- a/uitest/src/test/java/com/vaadin/tests/VerifyBrowserVersionTest.java +++ b/uitest/src/test/java/com/vaadin/tests/VerifyBrowserVersionTest.java @@ -25,7 +25,7 @@ public class VerifyBrowserVersionTest extends MultiBrowserTest { // Chrome version does not necessarily match the desired version // because of auto updates... browserIdentifier = getExpectedUserAgentString( - getDesiredCapabilities()) + "66"; + getDesiredCapabilities()) + "68"; } else if (BrowserUtil.isFirefox(getDesiredCapabilities())) { browserIdentifier = getExpectedUserAgentString( getDesiredCapabilities()) + "58"; diff --git a/uitest/src/test/java/com/vaadin/tests/components/uitest/ThemeTest.java b/uitest/src/test/java/com/vaadin/tests/components/uitest/ThemeTest.java index 39ee947fb6..4f9d095b6b 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/uitest/ThemeTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/uitest/ThemeTest.java @@ -38,7 +38,7 @@ public abstract class ThemeTest extends MultiBrowserTest { runThemeTest(); } - private void runThemeTest() throws IOException { + private void runThemeTest() throws IOException, InterruptedException { TabSheetElement themeTabSheet = $(TabSheetElement.class).first(); // Labels tab @@ -187,15 +187,19 @@ public abstract class ThemeTest extends MultiBrowserTest { compareScreen("selects-fifth-open"); } - private void testDates() throws IOException { + private void testDates() throws IOException, InterruptedException { compareScreen("dates"); $(DateFieldElement.class).id("datefield0").openPopup(); + Thread.sleep(200); compareScreen("dates-first-popup"); $(DateFieldElement.class).id("datefield1").openPopup(); + Thread.sleep(200); compareScreen("dates-second-popup"); $(DateFieldElement.class).id("datefield2").openPopup(); + Thread.sleep(200); compareScreen("dates-third-popup"); $(DateFieldElement.class).id("datefield3").openPopup(); + Thread.sleep(200); compareScreen("dates-fourth-popup"); } } diff --git a/uitest/src/test/java/com/vaadin/tests/components/upload/InterruptUploadTest.java b/uitest/src/test/java/com/vaadin/tests/components/upload/InterruptUploadTest.java index b956820303..877455414a 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/upload/InterruptUploadTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/upload/InterruptUploadTest.java @@ -1,55 +1,63 @@ package com.vaadin.tests.components.upload; -import static org.junit.Assert.assertTrue; - -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; - +import com.vaadin.testbench.elements.LabelElement; +import com.vaadin.testbench.elements.WindowElement; +import com.vaadin.tests.tb3.MultiBrowserTest; +import com.vaadin.tests.util.LoremIpsum; import org.junit.Test; import org.openqa.selenium.By; +import org.openqa.selenium.JavascriptExecutor; import org.openqa.selenium.WebElement; import org.openqa.selenium.internal.WrapsElement; import org.openqa.selenium.remote.LocalFileDetector; import org.openqa.selenium.remote.RemoteWebElement; -import com.vaadin.testbench.elements.ButtonElement; -import com.vaadin.testbench.elements.LabelElement; -import com.vaadin.testbench.elements.WindowElement; -import com.vaadin.tests.tb3.MultiBrowserTest; -import com.vaadin.tests.util.LoremIpsum; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; + +import static org.junit.Assert.assertTrue; public class InterruptUploadTest extends MultiBrowserTest { + private static final String EXPECTED_COUNTER_TEXT = " (counting interrupted at "; + @Test public void testInterruptUpload() throws Exception { openTestURL(); File tempFile = createTempFile(); - fillPathToUploadInput(tempFile.getPath()); + scheduleUploadCancel(); - waitForElementPresent(By.className("v-window")); - - $(ButtonElement.class).caption("Cancel").first().click(); + fillPathToUploadInput(tempFile.getPath()); - // Wait for 1 second for server to finish up. - Thread.sleep(1000); + // Wait for 3 seconds until everything is done. + Thread.sleep(3000); - String expected = " (counting interrupted at "; String actual = $(LabelElement.class).caption("Line breaks counted") .first().getText(); assertTrue("Line break count note does not match expected (was: " - + actual + ")", actual.contains(expected)); + + actual + ")", actual.contains(EXPECTED_COUNTER_TEXT)); $(WindowElement.class).first().close(); waitForElementNotPresent(By.className("v-window")); + // Check if second upload happens tempFile = createTempFile(); + scheduleUploadCancel(); fillPathToUploadInput(tempFile.getPath()); - waitForElementPresent(By.className("v-window")); - $(ButtonElement.class).caption("Cancel").first().click(); + actual = $(LabelElement.class).caption("Line breaks counted").first() + .getText(); + assertTrue("Line break count note does not match expected (was: " + + actual + ")", actual.contains(EXPECTED_COUNTER_TEXT)); + } + + private void scheduleUploadCancel() { + // Schedule upload cancel in 2 seconds + ((JavascriptExecutor) getDriver()).executeScript( + "setTimeout( function () {window.document.querySelector(\".v-window .v-button\").click()},2000)"); } /** @@ -74,7 +82,7 @@ public class InterruptUploadTest extends MultiBrowserTest { return sb.toString(); } - private void fillPathToUploadInput(String tempFileName) throws Exception { + private void fillPathToUploadInput(String tempFileName) { // create a valid path in upload input element. Instead of selecting a // file by some file browsing dialog, we use the local path directly. WebElement input = getInput(); @@ -86,7 +94,7 @@ public class InterruptUploadTest extends MultiBrowserTest { return getDriver().findElement(By.className("gwt-FileUpload")); } - private void setLocalFileDetector(WebElement element) throws Exception { + private void setLocalFileDetector(WebElement element) { if (getRunLocallyBrowser() != null) { return; } diff --git a/uitest/src/test/java/com/vaadin/tests/extensions/ResponsiveLayoutUpdateTest.java b/uitest/src/test/java/com/vaadin/tests/extensions/ResponsiveLayoutUpdateTest.java index 4bc725d96c..507770efa2 100644 --- a/uitest/src/test/java/com/vaadin/tests/extensions/ResponsiveLayoutUpdateTest.java +++ b/uitest/src/test/java/com/vaadin/tests/extensions/ResponsiveLayoutUpdateTest.java @@ -21,7 +21,7 @@ public class ResponsiveLayoutUpdateTest extends MultiBrowserTest { compareScreen("large"); // Resize below 600px width breakpoint - testBench().resizeViewPortTo(400, 768); + testBench().resizeViewPortTo(550, 768); waitUntil(input -> panelElement.getSize().getWidth() < 500); compareScreen("small"); diff --git a/uitest/src/test/java/com/vaadin/tests/tb3/ScreenshotTB3Test.java b/uitest/src/test/java/com/vaadin/tests/tb3/ScreenshotTB3Test.java index 455930bd14..6a21906527 100644 --- a/uitest/src/test/java/com/vaadin/tests/tb3/ScreenshotTB3Test.java +++ b/uitest/src/test/java/com/vaadin/tests/tb3/ScreenshotTB3Test.java @@ -6,7 +6,6 @@ import java.util.ArrayList; import java.util.List; import org.junit.After; -import org.junit.Before; import org.openqa.selenium.HasCapabilities; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; |