forked from janodvarko/harviewer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHARTestCase.php
More file actions
65 lines (58 loc) · 1.94 KB
/
Copy pathHARTestCase.php
File metadata and controls
65 lines (58 loc) · 1.94 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
<?php
require_once("PHPUnit/Extensions/SeleniumTestCase.php");
require_once("config.php");
/**
* Base class for all HAR Viewer tests.
*/
class HAR_TestCase extends PHPUnit_Extensions_SeleniumTestCase
{
protected function setUp()
{
$this->setBrowser("*firefox");
//$this->setBrowser("*firefox C:\\mozilla-dev\\firefox\\Firefox 6\\firefox.exe");
//$this->setBrowser("*firefox I:\\Program Files\\Mozilla Firefox\\firefox.exe");
//$this->setBrowser("*firefox C:\\mozilla-dev\\firefox\\Firefox 7\\firefox.exe");
$this->setBrowserUrl($GLOBALS["harviewer_base"]);
}
protected function tearDown()
{
}
/**
* Asserts that an element exists on the page.
* @param object $locator
* @param object $message [optional]
*/
public function assertElementExists($locator, $message = '')
{
$this->assertTrue($this->isElementPresent($locator), $message);
}
/**
* Asserts that an element does not exists on the page.
* @param object $locator
* @param object $message [optional]
*/
public function assertElementNotExists($locator, $message = '')
{
$this->assertFalse($this->isElementPresent($locator), $message);
}
/**
* Returns the number of nodes that match the specified css selector,
* eg. "table" would give the number of tables.
* @param string $locator CSS selector
*/
public function getCssCount($locator)
{
$script = "window.document.querySelectorAll('".$locator."').length";
return $this->getEval($script);
}
/**
* Waits till the element exists on the page.
*/
public function waitForElement($locator, $timeout = 10000, $message = '')
{
$this->waitForCondition(
"selenium.browserbot.getCurrentWindow().document.querySelector('".$locator."')",
$timeout);
}
}
?>