Skip to content

Commit e90dee8

Browse files
committed
[feature] access "throw 'string'" in browser console
1 parent ea84ec6 commit e90dee8

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

tests/Fixture/files/javascript.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ <h1>Timeout Test</h1>
3333
<h1>Console Log Test</h1>
3434
<button id="log-error">log error</button>
3535
<button id="throw-error">throw error</button>
36+
<button id="throw-raw">throw raw</button>
3637
<hr>
3738

3839
<a style="display: none;" href="/page1">invisible link</a>
@@ -68,6 +69,9 @@ <h1>Console Log Test</h1>
6869
$('#throw-error').click(function() {
6970
throw new Error('error object message');
7071
});
72+
$('#throw-raw').click(function() {
73+
throw 'raw error message';
74+
});
7175
});
7276
</script>
7377
</body>

tests/PantherBrowserTest.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,22 @@ public function cannot_follow_invisible_link(): void
188188
;
189189
}
190190

191+
/**
192+
* @test
193+
*/
194+
public function can_dump_console_log_with_throw_raw(): void
195+
{
196+
$output = self::catchVarDumperOutput(function() {
197+
$this->browser()
198+
->visit('/javascript')
199+
->click('throw raw')
200+
->dumpConsoleLog()
201+
;
202+
});
203+
204+
$this->assertStringContainsString('raw error message', \json_encode($output, JSON_THROW_ON_ERROR));
205+
}
206+
191207
protected function browser(): PantherBrowser
192208
{
193209
return $this->pantherBrowser();

0 commit comments

Comments
 (0)