forked from janodvarko/harviewer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestCustomizeColumns.php
More file actions
96 lines (76 loc) · 3.62 KB
/
Copy pathtestCustomizeColumns.php
File metadata and controls
96 lines (76 loc) · 3.62 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<?php
require_once("HARTestCase.php");
/**
* Check custom time stamps generated by console.timeStamp() method.
*/
class HAR_TestCustomizeColumns extends HAR_TestCase
{
public function testCustomizeColumns()
{
print "\ntestCustomizeColumns.php (1)";
// HAR file is specified inside the test page.
$viewerURL = $GLOBALS["test_base"]."tests/testCustomizeColumnsPage.php";
$harFileURL = $GLOBALS["test_base"]."tests/hars/simple.har";
$this->open($viewerURL."?path=".$harFileURL);
$this->waitForElement(".PreviewTab.selected");
// Make sure we are in the Preview tab.
$this->assertElementContainsText("css=.PreviewTab.selected", "Preview");
// Check columns visibility
$this->assertColumnIsVisible(".netTable .netHrefCol");
$this->assertColumnIsVisible(".netTable .netTypeCol");
$this->assertColumnIsVisible(".netTable .netTimeCol");
$this->assertColumnIsNotVisible(".netTable .netSizeCol");
$this->assertColumnIsNotVisible(".netTable .netStatusCol");
$this->assertColumnIsNotVisible(".netTable .netDomainCol");
}
public function testCustomizeColumns2()
{
print "\ntestCustomizeColumns.php (2)";
// HAR file is specified inside the test page.
$viewerURL = $GLOBALS["test_base"]."tests/testCustomizeColumnsPage2.php";
$harFileURL = $GLOBALS["test_base"]."tests/hars/simple.har";
$this->open($viewerURL."?path=".$harFileURL);
$this->waitForElement(".PreviewTab.selected");
// Make sure we are in the Preview tab.
$this->assertElementContainsText("css=.PreviewTab.selected", "Preview");
// Check columns visibility
$this->assertColumnIsVisible(".netTable .netHrefCol");
$this->assertColumnIsVisible(".netTable .netStatusCol");
$this->assertColumnIsVisible(".netTable .netSizeCol");
$this->assertColumnIsVisible(".netTable .netTimeCol");
$this->assertColumnIsNotVisible(".netTable .netTypeCol");
$this->assertColumnIsNotVisible(".netTable .netDomainCol");
}
public function testCustomizeColumns3()
{
print "\ntestCustomizeColumns.php (3)";
// HAR file is specified inside the test page.
$viewerURL = $GLOBALS["test_base"]."tests/testCustomizeColumnsPage3.php";
$harFileURL = $GLOBALS["test_base"]."tests/hars/simple.har";
$this->open($viewerURL."?path=".$harFileURL."&expand=true");
$this->waitForElement(".pageTable .pageRow.opened");
// Check columns visibility
$this->assertColumnIsVisible(".netTable .netHrefCol");
$this->assertColumnIsVisible(".netTable .netTimeCol");
$this->assertColumnIsNotVisible(".netTable .netStatusCol");
$this->assertColumnIsNotVisible(".netTable .netSizeCol");
$this->assertColumnIsNotVisible(".netTable .netTypeCol");
$this->assertColumnIsNotVisible(".netTable .netDomainCol");
}
public function assertColumnIsVisible($locator)
{
$this->assertColumnVisibility(true, $locator);
}
public function assertColumnIsNotVisible($locator)
{
$this->assertColumnVisibility(false, $locator);
}
public function assertColumnVisibility($visible, $locator)
{
$op = $visible ? ">" : "==";
$document = "selenium.browserbot.getCurrentWindow().document.";
$script = $document."querySelector('".$locator."').clientWidth ".$op." 0";
$this->assertEquals("true", $this->getEval($script), "Column ".$locator." is wrong");
}
}
?>