Skip to content

Commit d769028

Browse files
committed
disable error output check when running with real browsers
1 parent eb1f666 commit d769028

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

src/test/java/org/htmlunit/ErrorOutputChecker.java renamed to src/test/java/org/htmlunit/junit/ErrorOutputChecker.java

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,16 @@
1212
* See the License for the specific language governing permissions and
1313
* limitations under the License.
1414
*/
15-
package org.htmlunit;
15+
package org.htmlunit.junit;
1616

1717
import java.io.ByteArrayOutputStream;
1818
import java.io.OutputStream;
1919
import java.io.PrintStream;
20+
import java.util.Optional;
2021
import java.util.regex.Pattern;
2122

2223
import org.apache.commons.lang3.StringUtils;
24+
import org.htmlunit.WebDriverTestCase;
2325
import org.junit.jupiter.api.extension.AfterEachCallback;
2426
import org.junit.jupiter.api.extension.BeforeEachCallback;
2527
import org.junit.jupiter.api.extension.ExtensionContext;
@@ -58,7 +60,18 @@ public void beforeEach(final ExtensionContext context) throws Exception {
5860
@Override
5961
public void afterEach(final ExtensionContext context) throws Exception {
6062
try {
61-
verifyNoOutput();
63+
final Optional<Object> testInstance = context.getTestInstance();
64+
65+
if (testInstance.isPresent()
66+
&& testInstance.get() instanceof WebDriverTestCase) {
67+
final WebDriverTestCase webDriverTestCase = (WebDriverTestCase) testInstance.get();
68+
if (!webDriverTestCase.useRealBrowser()) {
69+
verifyNoOutput();
70+
}
71+
}
72+
else {
73+
verifyNoOutput();
74+
}
6275
}
6376
finally {
6477
restoreSystemErr();
@@ -100,7 +113,6 @@ void restoreSystemErr() {
100113
/**
101114
* A {@link PrintStream} spying what is written on the wrapped stream.
102115
* It prints the content to the wrapped {@link PrintStream} and captures it simultaneously.
103-
* @author Marc Guillemot
104116
*/
105117
class NSAPrintStreamWrapper extends PrintStream {
106118
private PrintStream wrapped_;

0 commit comments

Comments
 (0)