Skip to content

Commit ffecc22

Browse files
committed
[feature] access "console.log" in browser console
1 parent ea84ec6 commit ffecc22

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
@@ -31,6 +31,7 @@ <h1>Timeout Test</h1>
3131
<hr>
3232

3333
<h1>Console Log Test</h1>
34+
<button id="log">log</button>
3435
<button id="log-error">log error</button>
3536
<button id="throw-error">throw error</button>
3637
<hr>
@@ -62,6 +63,9 @@ <h1>Console Log Test</h1>
6263
$('#toggle').click(function() {
6364
$('#toggle-box').toggle();
6465
});
66+
$('#log').click(function() {
67+
console.log('console.log message');
68+
});
6569
$('#log-error').click(function() {
6670
console.error('console.error message');
6771
});

tests/PantherBrowserTest.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,22 @@ public function can_dump_console_log_with_console_error(): void
158158
$this->assertStringContainsString('console.error message', \json_encode($output, \JSON_THROW_ON_ERROR));
159159
}
160160

161+
/**
162+
* @test
163+
*/
164+
public function can_dump_console_log_with_console_log(): void
165+
{
166+
$output = self::catchVarDumperOutput(function() {
167+
$this->browser()
168+
->visit('/javascript')
169+
->click('log')
170+
->dumpConsoleLog()
171+
;
172+
});
173+
174+
$this->assertStringContainsString('console.log message', \json_encode($output, JSON_THROW_ON_ERROR));
175+
}
176+
161177
/**
162178
* @test
163179
*/

0 commit comments

Comments
 (0)