Conditions | 4 |
Paths | 6 |
Total Lines | 18 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
20 | public function assert() |
||
21 | { |
||
22 | if (!$this->url) { |
||
23 | $this->testCase->fail('Assertion requires a URL'); |
||
24 | } |
||
25 | |||
26 | $assets = $this->webDriver->executeScript('return window.performance.getEntries()'); |
||
27 | $foundAsset = false; |
||
28 | |||
29 | foreach ($assets as $asset) { |
||
30 | if (strpos($asset['name'], $this->url) !== false) { |
||
31 | $this->testCase->assertEquals(0, $asset['duration'], 'Asset was not cached: ' . $asset['name']); |
||
32 | $foundAsset = true; |
||
33 | } |
||
34 | } |
||
35 | |||
36 | $this->testCase->assertTrue($foundAsset, 'Unable to find asset: ' . $this->url); |
||
37 | } |
||
38 | |||
39 | } |