From 2b90f0d2a6ce4c17dde8f69cb8b9d9f9757707b7 Mon Sep 17 00:00:00 2001
From: wei <>
Date: Sat, 10 Dec 2005 12:14:53 +0000
Subject: Adding Hangman game functional test.

---
 tests/FunctionalTests/framework/Demos/testControls |  0
 .../framework/Demos/testControls.php               |  4 +--
 .../framework/Demos/testHangMan.php                | 32 ++++++++++++++++++++++
 3 files changed, 34 insertions(+), 2 deletions(-)
 delete mode 100644 tests/FunctionalTests/framework/Demos/testControls
 create mode 100644 tests/FunctionalTests/framework/Demos/testHangMan.php

(limited to 'tests')

diff --git a/tests/FunctionalTests/framework/Demos/testControls b/tests/FunctionalTests/framework/Demos/testControls
deleted file mode 100644
index e69de29b..00000000
diff --git a/tests/FunctionalTests/framework/Demos/testControls.php b/tests/FunctionalTests/framework/Demos/testControls.php
index c55f3618..49f8e99e 100644
--- a/tests/FunctionalTests/framework/Demos/testControls.php
+++ b/tests/FunctionalTests/framework/Demos/testControls.php
@@ -7,10 +7,10 @@ class testControls extends SeleniumTestCase
 		$this->open('../../demos/controls/index.php');
 	}
 
-	function testIndexPage()
+	function testControlSamples()
 	{
 		$this->assertTextPresent("Welcome! Guest");
-		$this->clickAndWait('ctl0$header$ctl15');
+		$this->clickAndWait('//input[@value="Toggle Button"]');
 		$this->assertTextPresent("Login");
 	}
 }
\ No newline at end of file
diff --git a/tests/FunctionalTests/framework/Demos/testHangMan.php b/tests/FunctionalTests/framework/Demos/testHangMan.php
new file mode 100644
index 00000000..e6bc8c94
--- /dev/null
+++ b/tests/FunctionalTests/framework/Demos/testHangMan.php
@@ -0,0 +1,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!');
+	}
+}
+
+?>
\ No newline at end of file
-- 
cgit v1.2.3