summaryrefslogtreecommitdiff
path: root/tests/FunctionalTests/framework/Demos/testHangMan.php
blob: e6bc8c940f690e4cb4f51ab48ad87e45b9084b1f (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
<?php

class testHangMan extends SeleniumTestCase
{
	function setup()
	{
		$this->open('../../demos/hangman/index.php');
	}

	function testHangManGame()
	{
		$this->assertLocation('hangman/index.php');
		$this->assertTextPresent('Prado Hangman Game');

		//use xpath to select input with value "HardLevel",
		//i.e the radio button with value "HardLevel"
		$this->click('//input[@value="HardLevel"]');
		$this->clickAndWait('//input[@value="Play!"]');

		//try 3 alphabets that sure doesn't exists
		$this->clickAndWait('link=X');
		$this->assertTextPresent('made 1 bad guesses');

		$this->clickAndWait('link=J');
		$this->assertTextPresent('made 2 bad guesses');

		$this->clickAndWait('link=Q');
		$this->assertTextPresent('You Lose!');
	}
}

?>