Skip to content

Commit

Permalink
[feature] access "console.log" in browser console
Browse files Browse the repository at this point in the history
  • Loading branch information
kbond committed Aug 11, 2022
1 parent ea84ec6 commit ffecc22
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tests/Fixture/files/javascript.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ <h1>Timeout Test</h1>
<hr>

<h1>Console Log Test</h1>
<button id="log">log</button>
<button id="log-error">log error</button>
<button id="throw-error">throw error</button>
<hr>
Expand Down Expand Up @@ -62,6 +63,9 @@ <h1>Console Log Test</h1>
$('#toggle').click(function() {
$('#toggle-box').toggle();
});
$('#log').click(function() {
console.log('console.log message');
});
$('#log-error').click(function() {
console.error('console.error message');
});
Expand Down
16 changes: 16 additions & 0 deletions tests/PantherBrowserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down

0 comments on commit ffecc22

Please sign in to comment.