Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Access "console.log" in PantherBrowser console #9

Open
wants to merge 1 commit into
base: 1.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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