mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-12-22 17:18:40 +01:00
Filter out fonts.gstatic.com from test logs
This should sort out ERR_NETWORK_CHANGED error that appears from time to time
This commit is contained in:
parent
4f0d15b320
commit
e0d80cb3b4
@ -55,7 +55,7 @@ import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
import static com.djrapitops.plan.delivery.export.ExportTestUtilities.assertNoLogsExceptFaviconError;
|
||||
|
||||
/**
|
||||
* This test class is for catching any JavaScript errors.
|
||||
@ -166,16 +166,8 @@ class ExportJSErrorRegressionTest {
|
||||
logs.addAll(driver.manage().logs().get(LogType.CLIENT).getAll());
|
||||
logs.addAll(driver.manage().logs().get(LogType.BROWSER).getAll());
|
||||
|
||||
assertNoLogs(logs);
|
||||
assertNoLogsExceptFaviconError(logs);
|
||||
})
|
||||
).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private void assertNoLogs(List<LogEntry> logs) {
|
||||
List<String> loggedLines = logs.stream()
|
||||
.map(log -> "\n" + log.getLevel().getName() + " " + log.getMessage())
|
||||
.filter(line -> !line.contains("favicon.ico"))
|
||||
.toList();
|
||||
assertTrue(loggedLines.isEmpty(), () -> "Browser console included " + loggedLines.size() + " logs: " + loggedLines);
|
||||
}
|
||||
}
|
@ -63,6 +63,7 @@ public class ExportTestUtilities {
|
||||
public static void assertNoLogs(List<LogEntry> logs) {
|
||||
List<String> loggedLines = logs.stream()
|
||||
.map(log -> "\n" + log.getLevel().getName() + " " + log.getMessage())
|
||||
.filter(log -> !log.contains("fonts.gstatic.com"))
|
||||
.toList();
|
||||
assertTrue(loggedLines.isEmpty(), () -> "Browser console included " + loggedLines.size() + " logs: " + loggedLines);
|
||||
}
|
||||
@ -70,7 +71,7 @@ public class ExportTestUtilities {
|
||||
public static void assertNoLogsExceptFaviconError(List<LogEntry> logs) {
|
||||
List<String> loggedLines = logs.stream()
|
||||
.map(log -> "\n" + log.getLevel().getName() + " " + log.getMessage())
|
||||
.filter(log -> !log.contains("favicon.ico") && !log.contains("manifest.json"))
|
||||
.filter(log -> !log.contains("favicon.ico") && !log.contains("manifest.json") && !log.contains("fonts.gstatic.com"))
|
||||
.toList();
|
||||
assertTrue(loggedLines.isEmpty(), () -> "Browser console included " + loggedLines.size() + " logs: " + loggedLines);
|
||||
}
|
||||
|
@ -208,6 +208,7 @@ class JSErrorRegressionTest {
|
||||
private void assertNoLogs(String testName, List<LogEntry> logs) {
|
||||
assertTrue(logs.isEmpty(), () -> testName + "Browser console included " + logs.size() + " logs: " + logs.stream()
|
||||
.map(log -> "\n" + log.getLevel().getName() + " " + log.getMessage())
|
||||
.filter(log -> !log.contains("fonts.gstatic.com"))
|
||||
.toList());
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user