Skip to content

Commit

Permalink
chore: Update exception pattern (#11828)
Browse files Browse the repository at this point in the history
It would seem like chrome changed
the exception after last update making
it the same as was gotten on the
windows agent.
  • Loading branch information
caalador authored and vaadin-bot committed Sep 14, 2021
1 parent 8daea34 commit df9d4e1
Showing 1 changed file with 3 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
public class ClientSideExceptionHandlingIT extends ChromeBrowserTest {

private static final By ERROR_LOCATOR = By.className("v-system-error");
public static final String UNIX_PATTERN = ".*TypeError.* property 'foo' of.*null.*";
public static final String WINDOWS_PATTERN = ".*TypeError.* : Cannot read properties of null .*reading 'foo'.*";

public static final String ERROR_PATTERN = ".*TypeError.* : Cannot read properties of null .*reading 'foo'.*";

@Test
public void developmentModeExceptions() {
Expand All @@ -38,14 +38,8 @@ public void developmentModeExceptions() {

String errorMessage = findElement(ERROR_LOCATOR).getText();

// Windows formats the error differently from unix
final boolean isWindows = (boolean) ((JavascriptExecutor) getDriver())
.executeScript(
"return navigator.appVersion.indexOf(\"Win\")!=-1");
String testPattern = isWindows ? WINDOWS_PATTERN : UNIX_PATTERN;

Assert.assertTrue("Unexpected error message: " + errorMessage,
Pattern.matches(testPattern, errorMessage));
Pattern.matches(ERROR_PATTERN, errorMessage));
}

@Test
Expand Down

0 comments on commit df9d4e1

Please sign in to comment.