forked from janodvarko/harviewer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestTimeStamps.php
More file actions
42 lines (34 loc) · 1.55 KB
/
Copy pathtestTimeStamps.php
File metadata and controls
42 lines (34 loc) · 1.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
require_once("HARTestCase.php");
/**
* Check custom time stamps generated by console.timeStamp() method.
*/
class HAR_TestTimeStamps extends HAR_TestCase
{
public function testTimeStamps()
{
print "\ntestTimeStamps.php";
$viewer_base = $GLOBALS["harviewer_base"];
$test_base = $GLOBALS["test_base"];
// Example of the result URL:
// http://legoas/har/viewer/?path=http://legoas/har/viewer/selenium/tests/hars/time-stamps.har
$url = $viewer_base."?path=".$test_base."tests/hars/time-stamps.har";
$this->open($url);
$this->waitForElement(".PreviewTab.selected");
// Make sure we are in the Preview tab.
$this->assertElementContainsText("css=.PreviewTab.selected", "Preview");
// There must be 6 time stamps bars (3 per request * 2 requests)
$this->assertEquals(6, $this->getCssCount(".netTimeStampBar.netBar"));
// Check position on the waterfall graph
$script = "var bars = window.document.querySelectorAll('.netTimeStampBar.netBar');";
$script .= "(bars[0].style.left == '55.03%') && ";
$script .= "(bars[1].style.left == '77.515%') && ";
$script .= "(bars[2].style.left == '100%') && ";
$script .= "(bars[3].style.left == '55.03%') && ";
$script .= "(bars[4].style.left == '77.515%') && ";
$script .= "(bars[5].style.left == '100%')";
// Evaluate in the page, must return "true".
$this->assertEquals("true", $this->getEval($script));
}
}
?>