Skip to content

Commit

Permalink
Merge pull request #136 from chrome-php/dev-v0.8.1
Browse files Browse the repository at this point in the history
Dev v0.8.1
  • Loading branch information
gsouf authored Feb 20, 2020
2 parents 5caadeb + 81d4df7 commit 7abdf64
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 6 deletions.
14 changes: 13 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,21 @@
* none


## 0.8.1

> *2020-02-20*
> Description
* Bug fixes:
* fixed browser close
* fixed unit tests
* testing php 7.3 and 7.4


## 0.8.0

> *2020-02-20* (not released)
> *2020-02-20*
* Features:
* Added Page::pdf (thanks @tanasecosminromeo)
Expand Down
10 changes: 9 additions & 1 deletion src/Browser.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,15 @@ public function setPagePreScript(string $script = null)
*/
public function close()
{
// TODO check browser.close on chrome 63
$this->sendCloseMessage();
}

/**
* Send close message to the browser
* @throws OperationTimedOut
*/
final public function sendCloseMessage()
{
$r = $this->connection->sendMessageSync(new Message('Browser.close'));
if (!$r->isSuccessful()) {
// log
Expand Down
2 changes: 1 addition & 1 deletion src/Browser/BrowserProcess.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ public function kill()
try {
// log
$this->logger->debug('process: trying to close chrome gracefully');
$this->browser->close();
$this->browser->sendCloseMessage();
} catch (\Exception $e) {
//log
$this->logger->debug('process: closing chrome gracefully - compatibility');
Expand Down
14 changes: 11 additions & 3 deletions test/suites/HttpEnabledTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,19 @@ public static function setUpBeforeClass()

self::$process = new Process([
'php',
'-S localhost:8083',
'-t ' . __DIR__ . '/../resources/static-web'
'-S',
'localhost:8083',
'-t',
__DIR__ . '/../resources/static-web'
]);
self::$process->start();
usleep(10000); //wait for server to get going
usleep(80000); //wait for server to get going

// ensure it started
if (!self::$process->isRunning()) {
$message = self::$process->getErrorOutput();
throw new \Exception('Cannot start webserver for tests: ' . $message);
}
}

public static function tearDownAfterClass()
Expand Down

0 comments on commit 7abdf64

Please sign in to comment.