summaryrefslogtreecommitdiff
path: root/tests/FunctionalTests
diff options
context:
space:
mode:
Diffstat (limited to 'tests/FunctionalTests')
-rw-r--r--tests/FunctionalTests/active-controls/protected/pages/ActiveDropDownList.page26
-rw-r--r--tests/FunctionalTests/active-controls/protected/pages/ActiveDropDownList.php39
-rw-r--r--tests/FunctionalTests/active-controls/protected/pages/ActiveHyperLinkTest.page13
-rw-r--r--tests/FunctionalTests/active-controls/protected/pages/ActiveHyperLinkTest.php26
-rw-r--r--tests/FunctionalTests/active-controls/protected/pages/TActiveCheckBoxListTest.page24
-rw-r--r--tests/FunctionalTests/active-controls/protected/pages/TActiveCheckBoxListTest.php37
-rw-r--r--tests/FunctionalTests/active-controls/tests/ActiveCheckBoxListTestCase.php57
-rw-r--r--tests/FunctionalTests/active-controls/tests/ActiveDropDownListTestCase.php41
-rw-r--r--tests/FunctionalTests/active-controls/tests/ActiveHyperLinkTestCase.php18
-rw-r--r--tests/FunctionalTests/selenium/prado-functional-test.js16
10 files changed, 296 insertions, 1 deletions
diff --git a/tests/FunctionalTests/active-controls/protected/pages/ActiveDropDownList.page b/tests/FunctionalTests/active-controls/protected/pages/ActiveDropDownList.page
new file mode 100644
index 00000000..8b8962a8
--- /dev/null
+++ b/tests/FunctionalTests/active-controls/protected/pages/ActiveDropDownList.page
@@ -0,0 +1,26 @@
+<com:TForm ID="form1">
+ <h1>Active Drop Down List Test Case</h1>
+
+ <com:TActiveDropDownList ID="list1" AutoPostBack="true" OnSelectedIndexChanged="list1_changed">
+ <com:TListItem Value="value 1" Text="item 1" />
+ <com:TListItem Value="value 2" Text="item 2" />
+ <com:TListItem Value="value 3" Text="item 3" />
+ <com:TListItem Value="value 4" Text="item 4" />
+ </com:TActiveDropDownList>
+
+ <com:TActiveDropDownList ID="list2"
+ Enabled="false"
+ AutoPostBack="true" OnSelectedIndexChanged="list2_changed" />
+
+ <div style="margin:1em; padding:1em; border:1px solid #ccc; text-align:center;">
+ <com:TActiveLabel ID="label1" Text="Label 1" />
+ </div>
+ <div style="margin:1em; padding:0.5em; text-align:center; border:1px solid #ccc;">
+ <com:TActiveButton ID="button1" Text="Select Index 3" OnClick="select_index_3" />
+ <com:TActiveButton ID="button2" Text="Clear selection" OnClick="clear_selections" />
+ <com:TActiveButton ID="button3" Text="Select Value 'value 2'" OnClick="select_value_2" />
+ </div>
+
+ <com:TJavascriptLogger />
+
+</com:TForm> \ No newline at end of file
diff --git a/tests/FunctionalTests/active-controls/protected/pages/ActiveDropDownList.php b/tests/FunctionalTests/active-controls/protected/pages/ActiveDropDownList.php
new file mode 100644
index 00000000..7060d84b
--- /dev/null
+++ b/tests/FunctionalTests/active-controls/protected/pages/ActiveDropDownList.php
@@ -0,0 +1,39 @@
+<?php
+
+class ActiveDropDownList extends TPage
+{
+ function list1_changed($sender)
+ {
+ $this->label1->setText("Selection 1: ".$sender->getSelectedValue());
+ $this->addOptionsToList2($sender->getSelectedValue());
+ }
+
+ function addOptionsToList2($parent)
+ {
+ for($i = 0; $i < 5; $i++)
+ $this->list2->Items[$i] = $parent.' - item '.($i+1);
+ $this->list2->setEnabled(true);
+ }
+
+ function list2_changed($sender)
+ {
+ $this->label1->setText("Selection 2: ".$sender->getSelectedValue());
+ }
+
+ function select_index_3()
+ {
+ $this->list1->setSelectedIndex(3);
+ }
+
+ function clear_selections()
+ {
+ $this->list1->clearSelection();
+ }
+
+ function select_value_2()
+ {
+ $this->list1->setSelectedValue("value 2");
+ }
+}
+
+?> \ No newline at end of file
diff --git a/tests/FunctionalTests/active-controls/protected/pages/ActiveHyperLinkTest.page b/tests/FunctionalTests/active-controls/protected/pages/ActiveHyperLinkTest.page
new file mode 100644
index 00000000..59098052
--- /dev/null
+++ b/tests/FunctionalTests/active-controls/protected/pages/ActiveHyperLinkTest.page
@@ -0,0 +1,13 @@
+<com:TForm ID="form1">
+ <h1>Active HyperLink Test Case</h1>
+
+ <div style="margin:1em; padding:1em; border:1px solid #ccc; text-align:center;">
+ <com:TActiveHyperLink ID="link1" Text="Link 1" NavigateUrl="http://www.pradosoft.com" />
+ </div>
+ <com:TActiveButton ID="button1" Text="Change Text" OnClick="change_text" />
+ <com:TActiveButton ID="button2" Text="Change Image" OnClick="change_image" />
+ <com:TActiveButton ID="button3" Text="Change Target" OnClick="change_target" />
+ <com:TActiveButton ID="button4" Text="Change URL" OnClick="change_url" />
+
+ <com:TJavascriptLogger />
+</com:TForm> \ No newline at end of file
diff --git a/tests/FunctionalTests/active-controls/protected/pages/ActiveHyperLinkTest.php b/tests/FunctionalTests/active-controls/protected/pages/ActiveHyperLinkTest.php
new file mode 100644
index 00000000..cd4880d2
--- /dev/null
+++ b/tests/FunctionalTests/active-controls/protected/pages/ActiveHyperLinkTest.php
@@ -0,0 +1,26 @@
+<?php
+
+class ActiveHyperLinkTest extends TPage
+{
+ function change_text()
+ {
+ $this->link1->Text = "Pradosoft.com";
+ }
+
+ function change_image()
+ {
+ $this->link1->ImageUrl = "...";
+ }
+
+ function change_target()
+ {
+ $this->link1->Target = "_top";
+ }
+
+ function change_url()
+ {
+ $this->link1->NavigateUrl = "http://www.xlab6.com";
+ }
+}
+
+?> \ No newline at end of file
diff --git a/tests/FunctionalTests/active-controls/protected/pages/TActiveCheckBoxListTest.page b/tests/FunctionalTests/active-controls/protected/pages/TActiveCheckBoxListTest.page
new file mode 100644
index 00000000..b30ced69
--- /dev/null
+++ b/tests/FunctionalTests/active-controls/protected/pages/TActiveCheckBoxListTest.page
@@ -0,0 +1,24 @@
+<com:TForm ID="form1">
+ <h1>TActiveCheckBoxList Test Case</h1>
+
+ <com:TActiveCheckBoxList ID="list1" OnCallback="list1_callback">
+ <com:TListItem Value="value 1" Text="item 1" />
+ <com:TListItem Value="value 2" Text="item 2" />
+ <com:TListItem Value="value 3" Text="item 3" />
+ <com:TListItem Value="value 4" Text="item 4" />
+ <com:TListItem Value="value 5" Text="item 5" />
+ </com:TActiveCheckBoxList>
+ <div style="margin:1em; padding:1em; border:1px solid #ccc; text-align:center;">
+ <com:TActiveLabel ID="label1" Text="Label 1" />
+ </div>
+ <div style="margin:1em; padding:0.5em; text-align:center; border:1px solid #ccc;">
+ <com:TActiveButton ID="button1" Text="Select Index 1 2 3" OnClick="select_index_123" />
+ <com:TActiveButton ID="button2" Text="Clear selection" OnClick="clear_selections" />
+ <com:TActiveButton ID="button3" Text="Select Value 'value 1'" OnClick="select_value_1" />
+ <com:TActiveButton ID="button4" Text="Select Index 4" OnClick="select_index_4" />
+ <com:TActiveButton ID="button5" Text="Select Values 'value 2', 'value 5'" OnClick="select_values_25" />
+ </div>
+
+ <com:TJavascriptLogger />
+
+</com:TForm> \ No newline at end of file
diff --git a/tests/FunctionalTests/active-controls/protected/pages/TActiveCheckBoxListTest.php b/tests/FunctionalTests/active-controls/protected/pages/TActiveCheckBoxListTest.php
new file mode 100644
index 00000000..66bfe83d
--- /dev/null
+++ b/tests/FunctionalTests/active-controls/protected/pages/TActiveCheckBoxListTest.php
@@ -0,0 +1,37 @@
+<?php
+
+class TActiveCheckBoxListTest extends TPage
+{
+ function list1_callback($sender, $param)
+ {
+ $values = $sender->getSelectedValues();
+ $this->label1->setText("Selection: ".implode(', ', $values));
+ }
+
+ function select_index_123()
+ {
+ $this->list1->setSelectedIndices(array(1,2,3));
+ }
+
+ function select_index_4()
+ {
+ $this->list1->setSelectedIndex(4);
+ }
+
+ function clear_selections()
+ {
+ $this->list1->clearSelection();
+ }
+
+ function select_value_1()
+ {
+ $this->list1->setSelectedValue("value 1");
+ }
+
+ function select_values_25()
+ {
+ $this->list1->setSelectedValues(array('value 2', 'value 5'));
+ }
+}
+
+?> \ No newline at end of file
diff --git a/tests/FunctionalTests/active-controls/tests/ActiveCheckBoxListTestCase.php b/tests/FunctionalTests/active-controls/tests/ActiveCheckBoxListTestCase.php
new file mode 100644
index 00000000..af7ea1f0
--- /dev/null
+++ b/tests/FunctionalTests/active-controls/tests/ActiveCheckBoxListTestCase.php
@@ -0,0 +1,57 @@
+<?php
+
+class ActiveCheckBoxListTestCase extends SeleniumTestCase
+{
+ function test()
+ {
+ $this->open("active-controls/index.php?page=TActiveCheckBoxListTest");
+ $this->verifyTextPresent("TActiveCheckBoxList Test Case");
+
+ $this->assertText("label1", "Label 1");
+
+ $this->click("button1");
+ $this->pause(500);
+ $this->assertCheckBoxes(array(1,2,3));
+
+ $this->click("button2");
+ $this->pause(500);
+ $this->assertCheckBoxes(array());
+
+
+ $this->click("button3");
+ $this->pause(500);
+ $this->assertCheckBoxes(array(0));
+
+
+ $this->click("button4");
+ $this->pause(500);
+ $this->assertCheckBoxes(array(4));
+
+
+ $this->click("button5");
+ $this->pause(500);
+ $this->assertCheckBoxes(array(1,4));
+
+ $this->click("list1_c2");
+ $this->pause(500);
+ $this->assertText("label1", "Selection: value 2, value 3, value 5");
+
+ $this->click("list1_c2");
+ $this->pause(500);
+ $this->assertText("label1", "Selection: value 2, value 5");
+
+ }
+
+ function assertCheckBoxes($checks, $total = 5)
+ {
+ for($i = 0; $i < $total; $i++)
+ {
+ if(in_array($i, $checks))
+ $this->assertChecked("list1_c{$i}");
+ else
+ $this->assertNotChecked("list1_c{$i}");
+ }
+ }
+}
+
+?> \ No newline at end of file
diff --git a/tests/FunctionalTests/active-controls/tests/ActiveDropDownListTestCase.php b/tests/FunctionalTests/active-controls/tests/ActiveDropDownListTestCase.php
new file mode 100644
index 00000000..5806a3ec
--- /dev/null
+++ b/tests/FunctionalTests/active-controls/tests/ActiveDropDownListTestCase.php
@@ -0,0 +1,41 @@
+<?php
+
+class ActiveDropDownListTestCase extends SeleniumTestCase
+{
+ function test()
+ {
+ $this->open("active-controls/index.php?page=ActiveDropDownList");
+ $this->assertTextPresent('Active Drop Down List Test Case');
+
+ $this->assertText("label1", "Label 1");
+
+ $this->click("button1");
+ $this->pause(500);
+ $this->assertSelected("list1", "item 4");
+
+ $this->click("button2");
+ $this->pause(500);
+ $this->assertEmptySelection("list1");
+
+ $this->click("button3");
+ $this->pause(500);
+ $this->assertSelected("list1", "item 2");
+
+ // due to clearing selection and then updating the selection
+ // otherwise it should not fire the changed event (fired by js because of change to options).
+ $this->assertText("label1", "Selection 1: value 1");
+
+ $this->select("list2", "value 1 - item 4");
+ $this->pause(500);
+ $this->assertText("label1", "Selection 2: value 1 - item 4");
+
+ $this->select("list1", "item 3");
+ $this->pause(500);
+ $this->select("list2", "value 3 - item 5");
+ $this->pause(500);
+ $this->assertText("label1", "Selection 2: value 3 - item 5");
+
+ }
+}
+
+?> \ No newline at end of file
diff --git a/tests/FunctionalTests/active-controls/tests/ActiveHyperLinkTestCase.php b/tests/FunctionalTests/active-controls/tests/ActiveHyperLinkTestCase.php
new file mode 100644
index 00000000..53198806
--- /dev/null
+++ b/tests/FunctionalTests/active-controls/tests/ActiveHyperLinkTestCase.php
@@ -0,0 +1,18 @@
+<?php
+
+class ActiveHyperLinkTestCase extends SeleniumTestCase
+{
+ function test()
+ {
+ $this->open("active-controls/index.php?page=ActiveHyperLinkTest");
+ $this->assertTextPresent("Active HyperLink Test Case");
+
+ $this->assertText("link1", "Link 1");
+
+ $this->click("button1");
+ $this->pause(500);
+ $this->assertText("link1", "Pradosoft.com");
+ }
+}
+
+?> \ No newline at end of file
diff --git a/tests/FunctionalTests/selenium/prado-functional-test.js b/tests/FunctionalTests/selenium/prado-functional-test.js
index f9889a72..306f6a74 100644
--- a/tests/FunctionalTests/selenium/prado-functional-test.js
+++ b/tests/FunctionalTests/selenium/prado-functional-test.js
@@ -39,7 +39,21 @@ Selenium.prototype._isDisplayed = function(element) {
return true;
};
-
+Selenium.prototype.assertEmptySelection = function(selectLocator, optionLocator)
+{
+ /**
+ * Verifies that the selected option of a drop-down satisfies the optionSpecifier.
+ *
+ * <p>See the select command for more information about option locators.</p>
+ *
+ * @param selectLocator an <a href="#locators">element locator</a> identifying a drop-down menu
+ * @param optionLocator an option locator, typically just an option label (e.g. "John Smith")
+ */
+ var element = this.page().findElement(selectLocator);
+ var locator = this.optionLocatorFactory.fromLocatorString(optionLocator);
+ return element.selectedIndex == -1;
+}
+
function runNextTest() {
if (!runAllTests)
return;