From e90dee8ad9d2e0f545e063e3232ed874e3cfaee7 Mon Sep 17 00:00:00 2001 From: Kevin Bond Date: Wed, 23 Dec 2020 16:05:15 -0500 Subject: [PATCH] [feature] access "throw 'string'" in browser console --- tests/Fixture/files/javascript.html | 4 ++++ tests/PantherBrowserTest.php | 16 ++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/tests/Fixture/files/javascript.html b/tests/Fixture/files/javascript.html index 0e8a08b..7fb1a9d 100644 --- a/tests/Fixture/files/javascript.html +++ b/tests/Fixture/files/javascript.html @@ -33,6 +33,7 @@

Timeout Test

Console Log Test

+
invisible link @@ -68,6 +69,9 @@

Console Log Test

$('#throw-error').click(function() { throw new Error('error object message'); }); + $('#throw-raw').click(function() { + throw 'raw error message'; + }); }); diff --git a/tests/PantherBrowserTest.php b/tests/PantherBrowserTest.php index 58c57b2..b846638 100644 --- a/tests/PantherBrowserTest.php +++ b/tests/PantherBrowserTest.php @@ -188,6 +188,22 @@ public function cannot_follow_invisible_link(): void ; } + /** + * @test + */ + public function can_dump_console_log_with_throw_raw(): void + { + $output = self::catchVarDumperOutput(function() { + $this->browser() + ->visit('/javascript') + ->click('throw raw') + ->dumpConsoleLog() + ; + }); + + $this->assertStringContainsString('raw error message', \json_encode($output, JSON_THROW_ON_ERROR)); + } + protected function browser(): PantherBrowser { return $this->pantherBrowser();