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

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

	static $baseurl='http://10.0.2.2/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);
	}

}