lib/Assertions/Browser/DOMContentLoadedLessThan.php 1 location
|
@@ 7-25 (lines=19) @@
|
4 |
|
|
5 |
|
use Magium\Assertions\AbstractAssertion; |
6 |
|
|
7 |
|
class DOMContentLoadedLessThan extends AbstractAssertion |
8 |
|
{ |
9 |
|
const ASSERTION = 'Browser\DOMContentLoadedLessThan'; |
10 |
|
|
11 |
|
protected $milli; |
12 |
|
|
13 |
|
public function setMaxElapsedMilliseconds($milli) |
14 |
|
{ |
15 |
|
$this->milli = $milli; |
16 |
|
} |
17 |
|
|
18 |
|
public function assert() |
19 |
|
{ |
20 |
|
$domContent = $this->webDriver->executeScript('return window.performance.timing'); |
21 |
|
$timing = $domContent['domContentLoadedEventEnd'] - $domContent['connectStart']; |
22 |
|
$this->testCase->assertLessThanOrEqual($this->milli, $timing); |
23 |
|
} |
24 |
|
|
25 |
|
} |
lib/Assertions/Browser/DOMPageLoadedLessThan.php 1 location
|
@@ 7-25 (lines=19) @@
|
4 |
|
|
5 |
|
use Magium\Assertions\AbstractAssertion; |
6 |
|
|
7 |
|
class DOMPageLoadedLessThan extends AbstractAssertion |
8 |
|
{ |
9 |
|
const ASSERTION = 'Browser\DOMPageLoadedLessThan'; |
10 |
|
|
11 |
|
protected $milli; |
12 |
|
|
13 |
|
public function setMaxElapsedMilliseconds($milli) |
14 |
|
{ |
15 |
|
$this->milli = $milli; |
16 |
|
} |
17 |
|
|
18 |
|
public function assert() |
19 |
|
{ |
20 |
|
$domContent = $this->webDriver->executeScript('return window.performance.timing'); |
21 |
|
$timing = $domContent['loadEventEnd'] - $domContent['connectStart']; |
22 |
|
$this->testCase->assertLessThanOrEqual($this->milli, $timing); |
23 |
|
} |
24 |
|
|
25 |
|
} |
lib/Assertions/Browser/TTFBLoadedLessThan.php 1 location
|
@@ 7-25 (lines=19) @@
|
4 |
|
|
5 |
|
use Magium\Assertions\AbstractAssertion; |
6 |
|
|
7 |
|
class TTFBLoadedLessThan extends AbstractAssertion |
8 |
|
{ |
9 |
|
const ASSERTION = 'Browser\TTFBLoadedLessThan'; |
10 |
|
|
11 |
|
protected $milli; |
12 |
|
|
13 |
|
public function setMaxElapsedMilliseconds($milli) |
14 |
|
{ |
15 |
|
$this->milli = $milli; |
16 |
|
} |
17 |
|
|
18 |
|
public function assert() |
19 |
|
{ |
20 |
|
$domContent = $this->webDriver->executeScript('return window.performance.timing'); |
21 |
|
$timing = $domContent['responseStart'] - $domContent['connectStart']; |
22 |
|
$this->testCase->assertLessThanOrEqual($this->milli, $timing); |
23 |
|
} |
24 |
|
|
25 |
|
} |