Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Update exception pattern #11828

Merged
merged 1 commit into from
Sep 14, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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