diff --git a/tests/Fixture/files/javascript.html b/tests/Fixture/files/javascript.html index 0e8a08b..fda8e6d 100644 --- a/tests/Fixture/files/javascript.html +++ b/tests/Fixture/files/javascript.html @@ -31,6 +31,7 @@

Timeout Test


Console Log Test

+
@@ -62,6 +63,9 @@

Console Log Test

$('#toggle').click(function() { $('#toggle-box').toggle(); }); + $('#log').click(function() { + console.log('console.log message'); + }); $('#log-error').click(function() { console.error('console.error message'); }); diff --git a/tests/PantherBrowserTest.php b/tests/PantherBrowserTest.php index 58c57b2..4dac990 100644 --- a/tests/PantherBrowserTest.php +++ b/tests/PantherBrowserTest.php @@ -158,6 +158,22 @@ public function can_dump_console_log_with_console_error(): void $this->assertStringContainsString('console.error message', \json_encode($output, \JSON_THROW_ON_ERROR)); } + /** + * @test + */ + public function can_dump_console_log_with_console_log(): void + { + $output = self::catchVarDumperOutput(function() { + $this->browser() + ->visit('/javascript') + ->click('log') + ->dumpConsoleLog() + ; + }); + + $this->assertStringContainsString('console.log message', \json_encode($output, JSON_THROW_ON_ERROR)); + } + /** * @test */