summaryrefslogtreecommitdiff
path: root/tests/test_tools/PradoGenericSelenium2Test.php
blob: 66350e11162d081e4c37f0a9982abf5bf4a3736f (plain)
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
<?php
require_once 'PHPUnit/Extensions/Selenium2TestCase.php';

// TODO: stub
class PradoGenericSelenium2Test extends PHPUnit_Extensions_Selenium2TestCase
{
	static $browser='chrome';
	static $baseurl='http://127.0.0.1/prado-3.2/tests/FunctionalTests/';
	static $timeout=5; //seconds
	static $wait=1000; //msecs

	protected function setUp()
	{
		$this->setBrowser(static::$browser);
		$this->setBrowserUrl(static::$baseurl);
		$this->setSeleniumServerRequestsTimeout(static::$timeout);
	}

	public function setUpPage()
	{
		$this->timeouts()->implicitWait(static::$wait);
	}

	protected function open($url)
	{
		$this->url($url);
	}

	protected function tearDown()
	{
	}

	protected function verifyTextPresent($txt)
	{
		$this->assertContains($txt, $this->source());
	}

	protected function assertText($id, $txt)
	{
        $element = $this->byId($id);
        $this->assertEquals($txt, $element->text());
	}

	protected function pause($msec)
	{
		usleep($msec*1000);
	}

}