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

// TODO: stub
class PradoGenericSelenium2Test extends PHPUnit_Extensions_Selenium2TestCase
{
	public static $browsers = array(
/*
		array(
			'name'    => 'Firefox on OSX',
			'browserName' => '*firefox',
			'host'    => '127.0.0.1',
			'port'    => 4444,
			'timeout' => 30000,
		),
*/
		array(
			'name'    => 'Chrome on OSX',
			'browserName' => '*googlechrome',
			'host'    => '127.0.0.1',
			'port'    => 4444,
			'timeout' => 30000,
		),
/*
		array(
			'name'    => 'Firefox on WindowsXP',
			'browserName' => '*firefox',
			'host'    => '127.0.0.1',
			'port'    => 4445,
		),
		array(
			'name'    => 'Internet Explorer 8 on WindowsXP',
			'browserName' => '*iehta',
			'host'    => '127.0.0.1',
			'port'    => 4445,
		)
*/
	);

	static $baseurl='http://192.168.44.82/prado-master/tests/FunctionalTests/';

	static $timeout=5; //seconds
	static $wait=1000; //msecs

	protected function setUp()
	{
		$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);
	}

}