summaryrefslogtreecommitdiff
path: root/tests/FunctionalTests
diff options
context:
space:
mode:
authorwei <>2006-02-02 05:04:50 +0000
committerwei <>2006-02-02 05:04:50 +0000
commita2a030c3cfbb0249762fffa4159107bc13f8952d (patch)
treee8b2f97068cf92a314df360ccf8dfb1d37b92bd6 /tests/FunctionalTests
parent93f6933c39b2e1896ff781a8f839a3c73a7e56b1 (diff)
Fixed #19
Diffstat (limited to 'tests/FunctionalTests')
-rw-r--r--tests/FunctionalTests/index.php5
-rw-r--r--tests/FunctionalTests/protected/pages/I18N/BasicI18N.page2
-rw-r--r--tests/FunctionalTests/protected/pages/Layout.tpl5
-rw-r--r--tests/FunctionalTests/protected/pages/UI/DatePicker.page2
-rw-r--r--tests/FunctionalTests/protected/pages/UI/TestTPanelDefaultButton.page13
-rw-r--r--tests/FunctionalTests/protected/pages/UI/TestTPanelDefaultButton.php15
-rw-r--r--tests/FunctionalTests/protected/pages/UI/testLabeledTextBox.page2
-rw-r--r--tests/FunctionalTests/protected/pages/UI/testOnClickAttribute.page7
-rw-r--r--tests/FunctionalTests/protected/pages/UI/testOnClickAttribute.php36
-rw-r--r--tests/FunctionalTests/protected/pages/Validation/CheckBox.page4
-rw-r--r--tests/FunctionalTests/protected/pages/Validation/RequiredFieldValidator.page3
-rw-r--r--tests/FunctionalTests/protected/pages/Validation/testInitialValueRequired.page11
-rw-r--r--tests/FunctionalTests/protected/pages/Validation/testInitialValueRequired.php25
13 files changed, 105 insertions, 25 deletions
diff --git a/tests/FunctionalTests/index.php b/tests/FunctionalTests/index.php
index 47ef19ce..d104f10e 100644
--- a/tests/FunctionalTests/index.php
+++ b/tests/FunctionalTests/index.php
@@ -9,10 +9,11 @@ class BrowserTestConfig extends PradoTestConfig
{
$groups = array();
+ //tests for quickstart samples
$this->get_directories(dirname(__FILE__).'/quickstart_tests', $groups);
- //for tests in the protected dirs
- //$this->get_directories($this->tests_directory(),$groups);
+ //tests to verify tickets
+ $this->get_directories($this->tests_directory(),$groups);
return $groups;
}
diff --git a/tests/FunctionalTests/protected/pages/I18N/BasicI18N.page b/tests/FunctionalTests/protected/pages/I18N/BasicI18N.page
index 24cb9831..e13eecf2 100644
--- a/tests/FunctionalTests/protected/pages/I18N/BasicI18N.page
+++ b/tests/FunctionalTests/protected/pages/I18N/BasicI18N.page
@@ -1,4 +1,4 @@
-<%@ Title="Basic I18N Test" Culture="zh_CN" %>
+<%@ Title="Basic I18N Test" Application.Globalization.Culture="zh_CN" %>
<com:TContent ID="Content">
<h1>Basic I18N Test</h1>
<com:TTranslate>
diff --git a/tests/FunctionalTests/protected/pages/Layout.tpl b/tests/FunctionalTests/protected/pages/Layout.tpl
index 8fd64429..d58acd5d 100644
--- a/tests/FunctionalTests/protected/pages/Layout.tpl
+++ b/tests/FunctionalTests/protected/pages/Layout.tpl
@@ -20,9 +20,10 @@
</style>
</com:THead>
<body>
-
+<com:TForm>
<com:TContentPlaceHolder ID="Content" />
-
+<com:TJavascriptLogger />
+</com:TForm>
<div class="w3c">
<a href="http://validator.w3.org/check?uri=referer">
Validate XHTML 1.0
diff --git a/tests/FunctionalTests/protected/pages/UI/DatePicker.page b/tests/FunctionalTests/protected/pages/UI/DatePicker.page
index c6204408..5c826a85 100644
--- a/tests/FunctionalTests/protected/pages/UI/DatePicker.page
+++ b/tests/FunctionalTests/protected/pages/UI/DatePicker.page
@@ -1,5 +1,4 @@
<com:TContent ID="Content">
-<com:TForm>
<com:TDatePicker Mode="Button"/>
<br />
<select style="width: 200px; height: 50px"><option value="1">One</option></select>
@@ -43,5 +42,4 @@ d<br/>
asd<br/>
a<br/>
sd<br/>
-</com:TForm>
</com:TContent> \ No newline at end of file
diff --git a/tests/FunctionalTests/protected/pages/UI/TestTPanelDefaultButton.page b/tests/FunctionalTests/protected/pages/UI/TestTPanelDefaultButton.page
index 753550d8..68b5445e 100644
--- a/tests/FunctionalTests/protected/pages/UI/TestTPanelDefaultButton.page
+++ b/tests/FunctionalTests/protected/pages/UI/TestTPanelDefaultButton.page
@@ -1,17 +1,16 @@
+<%@ Title="Test DefaultButton On Panel" %>
<com:TContent ID="Content">
-<com:TForm>
+ <h1>Test DefaultButton On Panel</h1>
<com:TPanel DefaultButton="Button2" Width="400px">
This is panel content with a <com:TLabel Text="label" Font.Italic="true" />
and two buttons: <br/>
- <com:TCheckBox />
- <com:TButton ID="Button1" Text="button1" Click="buttonClicked" />
- <com:TButton ID="Button2" Text="button2" Click="buttonClicked" />
+ <com:TCheckBox id="check1"/>
+ <com:TButton ID="Button1" Text="button1" OnClick="buttonClicked" />
+ <com:TButton ID="Button2" Text="button2" OnClick="buttonClicked" />
<com:TLabel ID="Result" ForeColor="red" />
<br/>
When you change focus to the panel and hit 'enter' key, <tt>button2</tt>
will be clicked because it is set as the default button of the panel.
</com:TPanel>
- <com:TLinkButton Text="button 3" Click="buttonClicked" />
- <com:TJavascriptLogger />
-</com:TForm>
+ <com:TLinkButton Text="button 3" OnClick="buttonClicked" />
</com:TContent> \ No newline at end of file
diff --git a/tests/FunctionalTests/protected/pages/UI/TestTPanelDefaultButton.php b/tests/FunctionalTests/protected/pages/UI/TestTPanelDefaultButton.php
index 2b0ba466..49418efd 100644
--- a/tests/FunctionalTests/protected/pages/UI/TestTPanelDefaultButton.php
+++ b/tests/FunctionalTests/protected/pages/UI/TestTPanelDefaultButton.php
@@ -26,8 +26,19 @@ class DefaultButtonTest extends SeleniumTestCase
function testClick()
{
- $this->clickAndWait("ctl0_Content_Button2");
- $this->assertTextPresent("You have clicked on 'button2'.");
+ $this->verifyTitle("Test DefaultButton On Panel", "");
+ $this->assertTextNotPresent("You have clicked on", "");
+ $this->clickAndWait("link=button 3", "");
+ $this->verifyTextPresent("You have clicked on 'button 3'.", "");
+ $this->clickAndWait("//input[@type='submit' and @value='button1']", "");
+ $this->verifyTextPresent("You have clicked on 'button1'. ", "");
+ $this->clickAndWait("//input[@type='submit' and @value='button2']", "");
+ $this->verifyTextPresent("You have clicked on 'button2'. ", "");
+ $this->clickAndWait("link=button 3", "");
+ $this->verifyTextPresent("You have clicked on 'button 3'. ", "");
+ $this->click("ctl0_Content_check1", "");
+ $this->clickAndWait("//input[@type='submit' and @value='button2']", "");
+ $this->verifyTextPresent("You have clicked on 'button2'. ", "");
}
}
?> \ No newline at end of file
diff --git a/tests/FunctionalTests/protected/pages/UI/testLabeledTextBox.page b/tests/FunctionalTests/protected/pages/UI/testLabeledTextBox.page
index f1e46544..248e0cc5 100644
--- a/tests/FunctionalTests/protected/pages/UI/testLabeledTextBox.page
+++ b/tests/FunctionalTests/protected/pages/UI/testLabeledTextBox.page
@@ -1,6 +1,4 @@
<com:TContent ID="Content">
-<com:TForm>
<com:LabeledTextBox Label.Text="username:"/>
<com:LabeledTextBox Label.Text="password:"/>
-</com:TForm>
</com:TContent> \ No newline at end of file
diff --git a/tests/FunctionalTests/protected/pages/UI/testOnClickAttribute.page b/tests/FunctionalTests/protected/pages/UI/testOnClickAttribute.page
new file mode 100644
index 00000000..31381c40
--- /dev/null
+++ b/tests/FunctionalTests/protected/pages/UI/testOnClickAttribute.page
@@ -0,0 +1,7 @@
+<%@ Title="Test Attributes.OnClick" %>
+<com:TContent ID="Content">
+<h1>Test Attributes.OnClick</h1>
+ <com:TLinkButton OnClick="doClick" Text="Click me"
+ Attributes.OnClick="if(!confirm('Are you sure?')) return false;" />
+ <com:TLabel ID="clickState" />
+</com:TContent> \ No newline at end of file
diff --git a/tests/FunctionalTests/protected/pages/UI/testOnClickAttribute.php b/tests/FunctionalTests/protected/pages/UI/testOnClickAttribute.php
new file mode 100644
index 00000000..3d9fc840
--- /dev/null
+++ b/tests/FunctionalTests/protected/pages/UI/testOnClickAttribute.php
@@ -0,0 +1,36 @@
+<?php
+
+/**
+ * testOnClickAttribute
+ *
+ * @author Wei Zhuo <weizhuo[at]gmail[dot]com>
+ * @version $Revision: $ $Date: $
+ * @package System.Web.UI.WebControls
+ * @since 3.0
+ */
+class testOnClickAttribute extends TPage
+{
+ function doClick()
+ {
+ $this->clickState->setText("Post Back clicked!");
+ }
+}
+
+class OnClickAttributeTestCase extends SeleniumTestCase
+{
+ function test()
+ {
+ $page = Prado::getApplication()->getTestPage(__FILE__);
+ $this->open($page);
+ $this->assertTitle("Test Attributes.OnClick");
+ $this->click("link=Click me");
+ $this->assertConfirmation("Are you sure?");
+ $this->chooseCancelOnNextConfirmation();
+ $this->assertTextNotPresent("Post Back clicked!");
+ $this->clickAndWait("link=Click me");
+ $this->assertConfirmation("Are you sure?");
+ $this->assertTextPresent("Post Back clicked!");
+ }
+}
+
+?> \ No newline at end of file
diff --git a/tests/FunctionalTests/protected/pages/Validation/CheckBox.page b/tests/FunctionalTests/protected/pages/Validation/CheckBox.page
index 109710fb..0653a0c2 100644
--- a/tests/FunctionalTests/protected/pages/Validation/CheckBox.page
+++ b/tests/FunctionalTests/protected/pages/Validation/CheckBox.page
@@ -1,6 +1,5 @@
<%@ Title="An AutoPostBack CheckBox" %>
<com:TContent ID="Content">
-<com:TForm>
<h1>An AutoPostBack CheckBox</h1>
@@ -33,7 +32,4 @@ Input: <com:TTextBox ID="TextBox"/>
ID="validator1"
/>
<br/>
-<com:TJavascriptLogger />
-
-</com:TForm>
</com:TContent> \ No newline at end of file
diff --git a/tests/FunctionalTests/protected/pages/Validation/RequiredFieldValidator.page b/tests/FunctionalTests/protected/pages/Validation/RequiredFieldValidator.page
index e6b67c8d..5447b834 100644
--- a/tests/FunctionalTests/protected/pages/Validation/RequiredFieldValidator.page
+++ b/tests/FunctionalTests/protected/pages/Validation/RequiredFieldValidator.page
@@ -1,6 +1,5 @@
<%@ Title="Basic TRequiredFieldValidator" %>
<com:TContent ID="Content">
-<com:TForm>
<h1>Basic TRequiredFieldValidator Test1</h1>
<com:TTextBox ID="text1" />
<com:TRequiredFieldValidator
@@ -11,6 +10,4 @@
ErrorMessage="*" />
<com:TButton ID="button1" Text="Click" />
<com:TTextBox ID="text2" />
- <com:TJavascriptLogger />
-</com:TForm>
</com:TContent> \ No newline at end of file
diff --git a/tests/FunctionalTests/protected/pages/Validation/testInitialValueRequired.page b/tests/FunctionalTests/protected/pages/Validation/testInitialValueRequired.page
new file mode 100644
index 00000000..62cf761c
--- /dev/null
+++ b/tests/FunctionalTests/protected/pages/Validation/testInitialValueRequired.page
@@ -0,0 +1,11 @@
+<%@ Title="InitialValue Validation Test" %>
+<com:TContent ID="Content">
+<h1>InitialValue Validation Test</h1>
+<com:TTextBox ID="text1" />
+<com:TRequiredFieldValidator ID="validator1"
+ ControlToValidate="text1"
+ InitialValue="test"
+ ErrorMessage="Text must not equal to 'test'" />
+
+<com:TButton ID="submit" Text="Submit!" />
+</com:TContent> \ No newline at end of file
diff --git a/tests/FunctionalTests/protected/pages/Validation/testInitialValueRequired.php b/tests/FunctionalTests/protected/pages/Validation/testInitialValueRequired.php
new file mode 100644
index 00000000..cc35accc
--- /dev/null
+++ b/tests/FunctionalTests/protected/pages/Validation/testInitialValueRequired.php
@@ -0,0 +1,25 @@
+<?php
+
+class testInitialValueRequired extends TPage
+{
+
+}
+
+class InitialValueRequiredTestCase extends SeleniumTestCase
+{
+ function test()
+ {
+ $page = Prado::getApplication()->getTestPage(__FILE__);
+ $this->open($page);
+ $this->assertTitle("InitialValue Validation Test");
+ $this->assertNotVisible("ctl0_Content_validator1");
+ $this->type("ctl0_Content_text1", "hello");
+ $this->clickAndWait("ctl0_Content_submit");
+ $this->assertNotVisible("ctl0_Content_validator1");
+ $this->type("ctl0_Content_text1", "test");
+ $this->click("ctl0_Content_submit");
+ $this->assertVisible("ctl0_Content_validator1");
+ }
+}
+
+?> \ No newline at end of file