diff options
author | xue <> | 2006-02-13 06:04:33 +0000 |
---|---|---|
committer | xue <> | 2006-02-13 06:04:33 +0000 |
commit | 934069ca2164753f72783eaa7d9fd98e4280f2ec (patch) | |
tree | 2b671bdabbe5896f2af6c766c43cacbc1f8338cc /tests/FunctionalTests/quickstart | |
parent | acf77801d4066055cfc3c20e5b634722923f865f (diff) |
Reorganized FT test folder.
Diffstat (limited to 'tests/FunctionalTests/quickstart')
18 files changed, 766 insertions, 0 deletions
diff --git a/tests/FunctionalTests/quickstart/Advanced/I18N.php b/tests/FunctionalTests/quickstart/Advanced/I18N.php new file mode 100644 index 00000000..fc45b096 --- /dev/null +++ b/tests/FunctionalTests/quickstart/Advanced/I18N.php @@ -0,0 +1,54 @@ +<?php
+
+//New Test
+class I18NTestCase extends SeleniumTestCase
+{
+ function test ()
+ {
+ $this->open("../../demos/quickstart/index.php?page=Advanced.Samples.I18N.Home&lang=en&notheme=true", "");
+ $this->verifyTitle("Internationlization in PRADO", "");
+ $this->verifyTextPresent("46.412,42 €", "");
+ $this->verifyTextPresent("$12.40", "");
+ $this->verifyTextPresent("€100.00", "");
+ $this->verifyTextPresent("December 6, 2004", "");
+ $this->open("../../demos/quickstart/index.php?page=Advanced.Samples.I18N.Home&lang=zh&notheme=true", "");
+ $this->verifyTitle("PRADO 国际化", "");
+ $this->verifyTextPresent("2004 十二月", "");
+ $this->verifyTextPresent("US$ 12.40", "");
+ $this->verifyTextPresent("46.412,42 €", "");
+ $this->verifyTextPresent("€100.00 ", "");
+ $this->open("../../demos/quickstart/index.php?page=Advanced.Samples.I18N.Home&lang=zh_TW&notheme=true", "");
+ $this->verifyTitle("PRADO 國際化", "");
+ $this->verifyTextPresent("2004年12月6日", "");
+ $this->verifyTextPresent("US$12.40", "");
+ $this->verifyTextPresent("46.412,42 €", "");
+ $this->verifyTextPresent("€100.00", "");
+ $this->open("../../demos/quickstart/index.php?page=Advanced.Samples.I18N.Home&lang=de&notheme=true", "");
+ $this->verifyTitle("Internationalisierung in PRADO", "");
+ $this->verifyTextPresent("6. Dezember 2004 ", "");
+ $this->verifyTextPresent("$ 12,40", "");
+ $this->verifyTextPresent("46.412,42 €", "");
+ $this->verifyTextPresent("€100.00", "");
+ $this->open("../../demos/quickstart/index.php?page=Advanced.Samples.I18N.Home&lang=es&notheme=true", "");
+ $this->verifyTitle("Internationlization en PRADO", "");
+ $this->verifyTextPresent("6 de diciembre de 2004", "");
+ $this->verifyTextPresent("US$12.40", "");
+ $this->verifyTextPresent("46.412,42 €", "");
+ $this->verifyTextPresent("€100.00", "");
+ $this->open("../../demos/quickstart/index.php?page=Advanced.Samples.I18N.Home&lang=fr&notheme=true", "");
+ $this->verifyTitle("Internationalisation dans PRADO", "");
+ $this->verifyTextPresent("6 décembre 2004", "");
+ $this->verifyTextPresent("12,40 $", "");
+ $this->verifyTextPresent("46.412,42 €", "");
+ $this->verifyTextPresent("€100.00", "");
+ $this->open("../../demos/quickstart/index.php?page=Advanced.Samples.I18N.Home&lang=pl&notheme=true", "");
+ $this->verifyTitle("Internacjonalizacja w PRADO", "");
+ $this->verifyTextPresent("6 grudnia 2004", "");
+ $this->verifyTextPresent("US$ 12,40", "");
+ $this->verifyTextPresent("46.412,42 €", "");
+ $this->verifyTextPresent("€100.00", "");
+
+ }
+}
+
+?>
\ No newline at end of file diff --git a/tests/FunctionalTests/quickstart/Controls/ButtonTestCase.php b/tests/FunctionalTests/quickstart/Controls/ButtonTestCase.php new file mode 100644 index 00000000..032f5ff1 --- /dev/null +++ b/tests/FunctionalTests/quickstart/Controls/ButtonTestCase.php @@ -0,0 +1,35 @@ +<?php
+
+class ButtonTestCase extends SeleniumTestCase
+{
+ function test ()
+ {
+ $this->open("../../demos/quickstart/index.php?page=Controls.Samples.TButton.Home&notheme=true", "");
+
+ $this->verifyTitle("PRADO QuickStart Sample", "");
+
+ // a regular button
+ $this->clickAndWait("//input[@type='submit' and @value='text']", "");
+
+ // a click button
+ $this->verifyElementNotPresent("//input[@type='submit' and @value=\"I'm clicked\"]");
+ $this->clickAndWait("//input[@type='submit' and @value='click me']", "");
+ $this->verifyElementPresent("//input[@type='submit' and @value=\"I'm clicked\"]");
+
+ // a command button
+ $this->verifyElementNotPresent("//input[@type='submit' and @value=\"Name: test, Param: value\"]");
+ $this->clickAndWait("//input[@type='submit' and @value='click me']", "");
+ $this->verifyElementPresent("//input[@type='submit' and @value=\"Name: test, Param: value\"]");
+
+ // a button causing validation
+ $this->verifyNotVisible('ctl0_body_ctl3');
+ $this->click("//input[@type='submit' and @value='submit']", "");
+ $this->pause(1000);
+ $this->verifyVisible('ctl0_body_ctl3');
+ $this->type("ctl0\$body\$TextBox", "test");
+ $this->clickAndWait("//input[@type='submit' and @value='submit']", "");
+ $this->verifyNotVisible('ctl0_body_ctl3');
+ }
+}
+
+?>
\ No newline at end of file diff --git a/tests/FunctionalTests/quickstart/Controls/CheckBoxListTestCase.php b/tests/FunctionalTests/quickstart/Controls/CheckBoxListTestCase.php new file mode 100644 index 00000000..783e2ccc --- /dev/null +++ b/tests/FunctionalTests/quickstart/Controls/CheckBoxListTestCase.php @@ -0,0 +1,54 @@ +<?php
+
+//New Test
+class CheckBoxListTestCase extends SeleniumTestCase
+{
+ function test ()
+ {
+ $this->open("../../demos/quickstart/index.php?page=Controls.Samples.TCheckBoxList.Home&notheme=true", "");
+
+ // Check box list with default settings:
+ $this->click("//input[@name='ctl0\$body\$ctl0\$0' and @value='value 1']", "");
+
+ // Check box list with customized cellpadding, cellspacing, color and text alignment:
+ $this->click("//input[@name='ctl0\$body\$ctl1\$1' and @value='value 2']", "");
+
+ // *** Currently unable to test the following cases:
+ // Check box list with vertical (default) repeat direction
+ // Check box list with horizontal repeat direction
+ // Check box list with flow layout and vertical (default) repeat direction
+ // Check box list with flow layout and horizontal repeat direction:
+
+ // Check box list's behavior upon postback
+ $this->click("//input[@name='ctl0\$body\$CheckBoxList\$2' and @value='value 3']", "");
+ $this->clickAndWait("//input[@type='submit' and @value='Submit']", "");
+ $this->verifyTextPresent("Your selection is: (Index: 1, Value: value 2, Text: item 2)(Index: 2, Value: value 3, Text: item 3)(Index: 4, Value: value 5, Text: item 5)", "");
+
+ // Auto postback check box list
+ $this->clickAndWait("//input[@name='ctl0\$body\$ctl7\$1' and @value='value 2']", "");
+ $this->verifyTextPresent("Your selection is: (Index: 4, Value: value 5, Text: item 5)", "");
+
+ // Databind to an integer-indexed array
+ $this->clickAndWait("//input[@name='ctl0\$body\$DBCheckBoxList1\$1' and @value='item 2']", "");
+ $this->verifyTextPresent("Your selection is: (Index: 1, Value: item 2, Text: item 2)", "");
+
+ // Databind to an associative array:
+ $this->clickAndWait("//input[@name='ctl0\$body\$DBCheckBoxList2\$1' and @value='key 2']", "");
+ $this->verifyTextPresent("Your selection is: (Index: 1, Value: key 2, Text: item 2)", "");
+
+ // Databind with DataTextField and DataValueField specified
+ $this->clickAndWait("//input[@name='ctl0\$body\$DBCheckBoxList3\$2' and @value='003']", "");
+ $this->verifyTextPresent("Your selection is: (Index: 2, Value: 003, Text: Cary)", "");
+
+ // CheckBox list causing validation
+ $this->verifyNotVisible('ctl0_body_ctl8');
+ $this->click("//input[@name='ctl0\$body\$ctl9$0' and @value='Agree']", "");
+ $this->pause(1000);
+ $this->verifyVisible('ctl0_body_ctl8');
+ $this->type("ctl0\$body\$TextBox", "test");
+ $this->clickAndWait("//input[@name='ctl0\$body\$ctl9$0' and @value='Agree']", "");
+ $this->verifyNotVisible('ctl0_body_ctl8');
+ }
+}
+
+?>
\ No newline at end of file diff --git a/tests/FunctionalTests/quickstart/Controls/CheckBoxTestCase.php b/tests/FunctionalTests/quickstart/Controls/CheckBoxTestCase.php new file mode 100644 index 00000000..a24ce937 --- /dev/null +++ b/tests/FunctionalTests/quickstart/Controls/CheckBoxTestCase.php @@ -0,0 +1,55 @@ +<?php
+
+class CheckBoxTestCase extends SeleniumTestCase
+{
+ function test ()
+ {
+ $this->open("../../demos/quickstart/index.php?page=Controls.Samples.TCheckBox.Home&notheme=true", "");
+
+ $this->verifyTitle("PRADO QuickStart Sample", "");
+
+ // a regular checkbox
+ $this->click("//input[@name='ctl0\$body\$ctl0' and @value='ctl0\$body\$ctl0']", "");
+
+ // a checkbox with customized value
+ $this->click("//input[@name='ctl0\$body\$ctl1' and @value='value']", "");
+
+ // an auto postback checkbox
+ $this->verifyTextNotPresent("I'm clicked");
+ $this->clickAndWait("//input[@name='ctl0\$body\$ctl2' and @value='ctl0\$body\$ctl2']", "");
+ $this->verifyTextPresent("I'm clicked");
+ $this->clickAndWait("//input[@name='ctl0\$body\$ctl2' and @value='ctl0\$body\$ctl2']", "");
+ $this->verifyTextPresent("I'm clicked");
+
+ // a checkbox causing validation on a textbox
+ $this->verifyNotVisible('ctl0_body_ctl3');
+ $this->click("//input[@name='ctl0\$body\$ctl4' and @value='ctl0\$body\$ctl4']", "");
+ $this->pause(1000);
+ $this->verifyVisible('ctl0_body_ctl3');
+ $this->click("//input[@name='ctl0\$body\$ctl4' and @value='ctl0\$body\$ctl4']", "");
+ $this->pause(1000);
+ $this->verifyVisible('ctl0_body_ctl3');
+ $this->type("ctl0\$body\$TextBox", "test");
+ $this->clickAndWait("//input[@name='ctl0\$body\$ctl4' and @value='ctl0\$body\$ctl4']", "");
+ $this->verifyNotVisible('ctl0_body_ctl3');
+
+ // a checkbox validated by a required field validator
+ $this->verifyNotVisible('ctl0_body_ctl6');
+ $this->click("//input[@type='submit' and @value='Submit']", "");
+ $this->pause(1000);
+ $this->verifyVisible('ctl0_body_ctl6');
+ $this->click("//input[@name='ctl0\$body\$CheckBox' and @value='ctl0\$body\$CheckBox']", "");
+ $this->clickAndWait("//input[@type='submit' and @value='Submit']", "");
+ $this->verifyNotVisible('ctl0_body_ctl6');
+
+ // a checkbox validated by a required field validator using AutoPostBack
+ $this->verifyNotVisible('ctl0_body_ctl7');
+ $this->click("//input[@name='ctl0\$body\$CheckBox2' and @value='ctl0\$body\$CheckBox2']", "");
+ $this->pause(1000);
+ $this->verifyVisible('ctl0_body_ctl7');
+ $this->clickAndWait("//input[@name='ctl0\$body\$CheckBox2' and @value='ctl0\$body\$CheckBox2']", "");
+ $this->verifyNotVisible('ctl0_body_ctl7');
+ }
+}
+
+?>
\ No newline at end of file diff --git a/tests/FunctionalTests/quickstart/Controls/DropDownListTestCase.php b/tests/FunctionalTests/quickstart/Controls/DropDownListTestCase.php new file mode 100644 index 00000000..cfb2047b --- /dev/null +++ b/tests/FunctionalTests/quickstart/Controls/DropDownListTestCase.php @@ -0,0 +1,67 @@ +<?php
+
+class DropDownListTestCase extends SeleniumTestCase
+{
+ function test ()
+ {
+ $this->open("../../demos/quickstart/index.php?page=Controls.Samples.TDropDownList.Home&notheme=true", "");
+
+ $this->verifyTitle("PRADO QuickStart Sample", "");
+
+ // dropdown list with default settings
+ $this->verifyElementPresent("ctl0\$body\$ctl0");
+
+ // dropdown list with initial options
+ $this->verifySelectOptions("ctl0\$body\$ctl1","item 1,item 2,item 3,item 4");
+ $this->verifySelected("ctl0\$body\$ctl1","value=value 2");
+
+ // dropdown list with customized styles
+ $this->verifySelectOptions("ctl0\$body\$ctl2","item 1,item 2,item 3,item 4");
+ $this->verifySelected("ctl0\$body\$ctl2","value=value 2");
+
+ // a disabled dropdown list
+ $this->verifyAttribute("ctl0\$body\$ctl3@disabled","regexp:true|disabled");
+
+ // an auto postback dropdown list
+ $this->verifyTextNotPresent("Your selection is: (Index: 2, Value: value 3, Text: item 3)", "");
+ $this->selectAndWait("ctl0\$body\$ctl4", "label=item 3");
+ $this->verifyTextPresent("Your selection is: (Index: 2, Value: value 3, Text: item 3)", "");
+
+ // a single selection list box upon postback
+ $this->select("ctl0\$body\$DropDownList1", "label=item 4");
+ $this->verifyTextNotPresent("Your selection is: (Index: 3, Value: value 4, Text: item 4)", "");
+ $this->clickAndWait("//input[@type='submit' and @value='Submit']", "");
+ $this->verifyTextPresent("Your selection is: (Index: 3, Value: value 4, Text: item 4)", "");
+
+ // Databind to an integer-indexed array
+ $this->selectAndWait("ctl0\$body\$DBDropDownList1", "label=item 3");
+ $this->verifyTextPresent("Your selection is: (Index: 2, Value: item 3, Text: item 3)", "");
+
+ // Databind to an associative array
+ $this->selectAndWait("ctl0\$body\$DBDropDownList2", "label=item 2");
+ $this->verifyTextPresent("Your selection is: (Index: 1, Value: key 2, Text: item 2)", "");
+
+ // Databind with DataTextField and DataValueField specified
+ $this->selectAndWait("ctl0\$body\$DBDropDownList3", "label=Cary");
+ $this->verifyTextPresent("Your selection is: (Index: 2, Value: 003, Text: Cary)", "");
+
+ // dropdown list is being validated
+ $this->verifyNotVisible('ctl0_body_ctl6');
+ $this->click("id=ctl0_body_ctl7", "");
+ $this->verifyVisible('ctl0_body_ctl6');
+ $this->select("ctl0\$body\$VDropDownList1", "label=item 2");
+ $this->clickAndWait("id=ctl0_body_ctl7", "");
+ $this->verifyNotVisible('ctl0_body_ctl6');
+
+ // dropdown list causing validation
+ $this->verifyNotVisible('ctl0_body_ctl8');
+ $this->select("ctl0\$body\$VDropDownList2", "label=Disagree");
+ $this->pause(1000);
+ $this->verifyVisible('ctl0_body_ctl8');
+ $this->type("ctl0\$body\$TextBox", "test");
+ $this->selectAndWait("ctl0\$body\$VDropDownList2", "label=Agree");
+ $this->verifyNotVisible('ctl0_body_ctl8');
+ }
+}
+
+?>
\ No newline at end of file diff --git a/tests/FunctionalTests/quickstart/Controls/HyperLinkTestCase.php b/tests/FunctionalTests/quickstart/Controls/HyperLinkTestCase.php new file mode 100644 index 00000000..b0b964f8 --- /dev/null +++ b/tests/FunctionalTests/quickstart/Controls/HyperLinkTestCase.php @@ -0,0 +1,17 @@ +<?php
+
+class HyperLinkTestCase extends SeleniumTestCase
+{
+ function test ()
+ {
+ $this->open("../../demos/quickstart/index.php?page=Controls.Samples.THyperLink.Home&notheme=true", "");
+ $this->verifyTitle("PRADO QuickStart Sample", "");
+ $this->verifyElementPresent("//a[@href=\"http://www.pradosoft.com/\" and @target=\"_blank\"]");
+ $this->verifyTextPresent("Welcome to", "");
+ $this->verifyTextPresent("Body contents", "");
+ $this->verifyElementPresent("//a[img/@alt='Hello World']");
+ $this->verifyElementPresent("//a[contains(text(),'Body contents')]");
+ }
+}
+
+?>
\ No newline at end of file diff --git a/tests/FunctionalTests/quickstart/Controls/ImageButtonTestCase.php b/tests/FunctionalTests/quickstart/Controls/ImageButtonTestCase.php new file mode 100644 index 00000000..cc0bda53 --- /dev/null +++ b/tests/FunctionalTests/quickstart/Controls/ImageButtonTestCase.php @@ -0,0 +1,30 @@ +<?php
+
+class ImageButtonTestCase extends SeleniumTestCase
+{
+ function test ()
+ {
+ $this->open("../../demos/quickstart/index.php?page=Controls.Samples.TImageButton.Home&notheme=true", "");
+
+ $this->verifyTitle("PRADO QuickStart Sample", "");
+
+ // a click button
+ $this->clickAndWait("//input[@type='image' and @alt='hello world']", "");
+ $this->verifyTextPresent("You clicked at ","");
+
+ // a command button
+ $this->clickAndWait("ctl0\$body\$ctl1", "");
+ $this->verifyTextPresent("Command name: test, Command parameter: value","");
+
+ // a button causing validation
+ $this->verifyNotVisible('ctl0_body_ctl2');
+ $this->click("id=ctl0_body_ctl3", "");
+ $this->pause(1000);
+ $this->verifyVisible('ctl0_body_ctl2');
+ $this->type("ctl0\$body\$TextBox", "test");
+ $this->clickAndWait("id=ctl0_body_ctl3", "");
+ $this->verifyNotVisible('ctl0_body_ctl2');
+ }
+}
+
+?>
\ No newline at end of file diff --git a/tests/FunctionalTests/quickstart/Controls/ImageTestCase.php b/tests/FunctionalTests/quickstart/Controls/ImageTestCase.php new file mode 100644 index 00000000..a0ad6d6b --- /dev/null +++ b/tests/FunctionalTests/quickstart/Controls/ImageTestCase.php @@ -0,0 +1,20 @@ +<?php
+
+//New Test
+class ImageTestCase extends SeleniumTestCase
+{
+ function test ()
+ {
+ $this->open("../../demos/quickstart/index.php?page=Controls.Samples.TImage.Home&notheme=true", "");
+
+ $this->verifyTitle("PRADO QuickStart Sample", "");
+
+ //$this->verifyElementPresent("//img[contains(@src,'/hello_world.gif') and @alt='']");
+ $this->verifyElementPresent("//img[contains(@src,'/hello_world.gif') and @alt='Hello World!']");
+ $this->verifyTextPresent("Hello World! Hello World! Hello World!", "");
+ //$this->verifyElementPresent("//img[contains(@src,'/hello_world.gif') and @align='baseline']");
+ //$this->verifyElementPresent("//img[contains(@src,'/hello_world.gif') and contains(@longdesc,'HelloWorld.html')]");
+ }
+}
+
+?>
\ No newline at end of file diff --git a/tests/FunctionalTests/quickstart/Controls/LabelTestCase.php b/tests/FunctionalTests/quickstart/Controls/LabelTestCase.php new file mode 100644 index 00000000..aa045e0c --- /dev/null +++ b/tests/FunctionalTests/quickstart/Controls/LabelTestCase.php @@ -0,0 +1,23 @@ +<?php
+
+//New Test
+class LabelTestCase extends SeleniumTestCase
+{
+ function test ()
+ {
+ $this->open("../../demos/quickstart/index.php?page=Controls.Samples.TLabel.Home&notheme=true", "");
+ $this->verifyTitle("PRADO QuickStart Sample", "");
+ $this->verifyTextPresent("This is a label with customized color and font.", "");
+ $this->verifyTextPresent("This is a form label associated with the TTextBox control below", "");
+ $this->verifyTextPresent("This is a label with empty Text property and nonempty body", "");
+ $this->verifyTextPresent("This is a disabled label", "");
+
+ $this->verifyAttribute("ctl0_body_Label2@disabled","regexp:true|disabled");
+
+ //$this->verifyAttribute("ctl0_body_Label1@for","ctl0_body_test");
+
+ $this->type("ctl0\$body\$test", "test");
+ }
+}
+
+?>
\ No newline at end of file diff --git a/tests/FunctionalTests/quickstart/Controls/LinkButtonTestCase.php b/tests/FunctionalTests/quickstart/Controls/LinkButtonTestCase.php new file mode 100644 index 00000000..49c3c61a --- /dev/null +++ b/tests/FunctionalTests/quickstart/Controls/LinkButtonTestCase.php @@ -0,0 +1,34 @@ +<?php
+
+class LinkButtonTestCase extends SeleniumTestCase
+{
+ function test ()
+ {
+ $this->open("../../demos/quickstart/index.php?page=Controls.Samples.TLinkButton.Home&notheme=true", "");
+
+ $this->verifyTitle("PRADO QuickStart Sample", "");
+
+ // regular buttons
+ $this->clickAndWait("link=link button", "");
+ $this->clickAndWait("//a[contains(text(),'body content')]", "");
+
+ // a click button
+ $this->clickAndWait("link=click me", "");
+ $this->clickAndWait("link=I'm clicked", "");
+
+ // a command button
+ $this->clickAndWait("link=click me", "");
+ $this->clickAndWait("//a[contains(text(),'Name: test, Param: value')]", "");
+
+ // a button causing validation
+ $this->verifyNotVisible('ctl0_body_ctl4');
+ $this->click("link=submit", "");
+ $this->pause(1000);
+ $this->verifyVisible('ctl0_body_ctl4');
+ $this->type("ctl0\$body\$TextBox", "test");
+ $this->clickAndWait("link=submit", "");
+ $this->verifyNotVisible('ctl0_body_ctl4');
+ }
+}
+
+?>
\ No newline at end of file diff --git a/tests/FunctionalTests/quickstart/Controls/ListBoxTestCase.php b/tests/FunctionalTests/quickstart/Controls/ListBoxTestCase.php new file mode 100644 index 00000000..6f86719a --- /dev/null +++ b/tests/FunctionalTests/quickstart/Controls/ListBoxTestCase.php @@ -0,0 +1,84 @@ +<?php
+
+//New Test
+class ListBoxTestCase extends SeleniumTestCase
+{
+ function test ()
+ {
+ $this->open("../../demos/quickstart/index.php?page=Controls.Samples.TListBox.Home&notheme=true", "");
+
+ // a default single selection listbox
+ $this->verifyAttribute("ctl0\$body\$ctl0@size","4");
+
+ // single selection list box with initial options
+ $this->verifySelectOptions("ctl0\$body\$ctl1","item 1,item 2,item 3,item 4");
+ $this->verifySelected("ctl0\$body\$ctl1","value=value 2");
+
+ // a single selection list box with customized style
+ $this->verifyAttribute("ctl0\$body\$ctl2@size","3");
+ $this->verifySelectOptions("ctl0\$body\$ctl2","item 1,item 2,item 3,item 4");
+ $this->verifySelected("ctl0\$body\$ctl2","value=value 2");
+
+ // a disabled list box
+ $this->verifyAttribute("ctl0\$body\$ctl3@disabled","regexp:true|disabled");
+
+ // an auto postback single selection list box
+ $this->verifyTextNotPresent("Your selection is: (Index: 2, Value: value 3, Text: item 3)", "");
+ $this->selectAndWait("ctl0\$body\$ctl4", "label=item 3");
+ $this->verifyTextPresent("Your selection is: (Index: 2, Value: value 3, Text: item 3)", "");
+
+ // a single selection list box upon postback
+ $this->select("ctl0\$body\$ListBox1", "label=item 4");
+ $this->verifyTextNotPresent("Your selection is: (Index: 3, Value: value 4, Text: item 4)", "");
+ $this->clickAndWait("//input[@type='submit' and @value='Submit']", "");
+ $this->verifyTextPresent("Your selection is: (Index: 3, Value: value 4, Text: item 4)", "");
+
+ // a multiple selection list box
+ $this->verifyAttribute("ctl0\$body\$ctl6[]@size","4");
+ $this->verifyAttribute("ctl0\$body\$ctl6[]@multiple","regexp:true|multiple");
+
+ // a multiple selection list box with initial options
+ $this->verifyAttribute("ctl0\$body\$ctl7[]@multiple","regexp:true|multiple");
+ $this->verifySelectOptions("ctl0\$body\$ctl7[]","item 1,item 2,item 3,item 4");
+
+ // multiselection list box's behavior upon postback
+ $this->select("ctl0\$body\$ListBox2[]", "label=item 3");
+ $this->clickAndWait("name=ctl0\$body\$ctl8", "");
+ $this->verifyText("ctl0_body_MultiSelectionResult2","Your selection is: (Index: 1, Value: value 2, Text: item 2)(Index: 2, Value: value 3, Text: item 3)(Index: 3, Value: value 4, Text: item 4)");
+
+ // Auto postback multiselection list box
+ $this->selectAndWait("ctl0\$body\$ctl9[]", "label=item 1");
+ $this->verifyText("ctl0_body_MultiSelectionResult","Your selection is: (Index: 0, Value: value 1, Text: item 1)(Index: 1, Value: value 2, Text: item 2)(Index: 3, Value: value 4, Text: item 4)");
+
+ // Databind to an integer-indexed array
+ $this->selectAndWait("ctl0\$body\$DBListBox1[]", "label=item 3");
+ $this->verifyTextPresent("Your selection is: (Index: 2, Value: item 3, Text: item 3)", "");
+
+ // Databind to an associative array
+ $this->selectAndWait("ctl0\$body\$DBListBox2[]", "label=item 2");
+ $this->verifyTextPresent("Your selection is: (Index: 1, Value: key 2, Text: item 2)", "");
+
+ // Databind with DataTextField and DataValueField specified
+ $this->selectAndWait("ctl0\$body\$DBListBox3[]", "label=Cary");
+ $this->verifyTextPresent("Your selection is: (Index: 2, Value: 003, Text: Cary)", "");
+
+ // List box is being validated
+ $this->verifyNotVisible('ctl0_body_ctl10');
+ $this->click("id=ctl0_body_ctl11", "");
+ $this->verifyVisible('ctl0_body_ctl10');
+ $this->select("ctl0\$body\$VListBox1", "label=item 2");
+ $this->clickAndWait("id=ctl0_body_ctl11", "");
+ $this->verifyNotVisible('ctl0_body_ctl10');
+
+ // List box causing validation
+ $this->verifyNotVisible('ctl0_body_ctl12');
+ $this->select("ctl0\$body\$VListBox2", "label=Agree");
+ $this->pause(1000);
+ $this->verifyVisible('ctl0_body_ctl12');
+ $this->type("ctl0\$body\$TextBox", "test");
+ $this->selectAndWait("ctl0\$body\$VListBox2", "label=Disagree");
+ $this->verifyNotVisible('ctl0_body_ctl12');
+ }
+}
+
+?>
\ No newline at end of file diff --git a/tests/FunctionalTests/quickstart/Controls/PanelTestCase.php b/tests/FunctionalTests/quickstart/Controls/PanelTestCase.php new file mode 100644 index 00000000..32134512 --- /dev/null +++ b/tests/FunctionalTests/quickstart/Controls/PanelTestCase.php @@ -0,0 +1,18 @@ +<?php
+
+class PanelTestCase extends SeleniumTestCase
+{
+ function test ()
+ {
+ $this->open("../../demos/quickstart/index.php?page=Controls.Samples.TPanel.Home&notheme=true", "");
+ $this->verifyTextPresent("This is panel content with", "");
+ $this->verifyElementPresent("//span[text()='label']");
+ $this->verifyTextPresent("grouping text", "");
+ $this->click("//input[@name='ctl0\$body\$ctl17' and @value='ctl0\$body\$ctl17']", "");
+ $this->verifyTextNotPresent("You have clicked on 'button2'.");
+ $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/quickstart/Controls/RadioButtonListTestCase.php b/tests/FunctionalTests/quickstart/Controls/RadioButtonListTestCase.php new file mode 100644 index 00000000..b6242d05 --- /dev/null +++ b/tests/FunctionalTests/quickstart/Controls/RadioButtonListTestCase.php @@ -0,0 +1,54 @@ +<?php
+
+//New Test
+class RadioButtonListTestCase extends SeleniumTestCase
+{
+ function test ()
+ {
+ $this->open("../../demos/quickstart/index.php?page=Controls.Samples.TRadioButtonList.Home&notheme=true", "");
+
+ // RadioButton list with default settings:
+ $this->click("//input[@name='ctl0\$body\$ctl0' and @value='value 3']", "");
+
+ // RadioButton list with customized cellpadding, cellspacing, color and text alignment:
+ $this->click("//input[@name='ctl0\$body\$ctl1' and @value='value 1']", "");
+
+ // *** Currently unable to test the following cases:
+ // RadioButton list with vertical (default) repeat direction
+ // RadioButton list with horizontal repeat direction
+ // RadioButton list with flow layout and vertical (default) repeat direction
+ // RadioButton list with flow layout and horizontal repeat direction:
+
+ // RadioButton list's behavior upon postback
+ $this->click("//input[@name='ctl0\$body\$RadioButtonList' and @value='value 3']", "");
+ $this->clickAndWait("//input[@type='submit' and @value='Submit']", "");
+ $this->verifyTextPresent("Your selection is: (Index: 2, Value: value 3, Text: item 3)", "");
+
+ // Auto postback check box list
+ $this->clickAndWait("//input[@name='ctl0\$body\$ctl7' and @value='value 5']", "");
+ $this->verifyTextPresent("Your selection is: (Index: 4, Value: value 5, Text: item 5)", "");
+
+ // Databind to an integer-indexed array
+ $this->clickAndWait("//input[@name='ctl0\$body\$DBRadioButtonList1' and @value='item 1']", "");
+ $this->verifyTextPresent("Your selection is: (Index: 0, Value: item 1, Text: item 1)", "");
+
+ // Databind to an associative array:
+ $this->clickAndWait("//input[@name='ctl0\$body\$DBRadioButtonList2' and @value='key 2']", "");
+ $this->verifyTextPresent("Your selection is: (Index: 1, Value: key 2, Text: item 2)", "");
+
+ // Databind with DataTextField and DataValueField specified
+ $this->clickAndWait("//input[@name='ctl0\$body\$DBRadioButtonList3' and @value='003']", "");
+ $this->verifyTextPresent("Your selection is: (Index: 2, Value: 003, Text: Cary)", "");
+
+ // RadioButton list causing validation
+ $this->verifyNotVisible('ctl0_body_ctl8');
+ $this->click("//input[@name='ctl0\$body\$ctl9' and @value='Agree']", "");
+ $this->pause(1000);
+ $this->verifyVisible('ctl0_body_ctl8');
+ $this->type("ctl0\$body\$TextBox", "test");
+ $this->clickAndWait("//input[@name='ctl0\$body\$ctl9' and @value='Disagree']", "");
+ $this->verifyNotVisible('ctl0_body_ctl8');
+ }
+}
+
+?>
\ No newline at end of file diff --git a/tests/FunctionalTests/quickstart/Controls/RadioButtonTestCase.php b/tests/FunctionalTests/quickstart/Controls/RadioButtonTestCase.php new file mode 100644 index 00000000..d6d5f2e3 --- /dev/null +++ b/tests/FunctionalTests/quickstart/Controls/RadioButtonTestCase.php @@ -0,0 +1,58 @@ +<?php
+
+class RadioButtonTestCase extends SeleniumTestCase
+{
+ function test ()
+ {
+ $this->open("../../demos/quickstart/index.php?page=Controls.Samples.TRadioButton.Home&notheme=true", "");
+
+ $this->verifyTitle("PRADO QuickStart Sample", "");
+
+ // a regular radiobutton
+ $this->click("//input[@name='ctl0\$body\$ctl0' and @value='ctl0\$body\$ctl0']", "");
+
+ // a radiobutton with customized value
+ $this->click("//input[@name='ctl0\$body\$ctl1' and @value='value']", "");
+
+ // an auto postback radiobutton
+ $this->verifyTextNotPresent("I'm clicked");
+ $this->clickAndWait("//input[@name='ctl0\$body\$ctl2' and @value='ctl0\$body\$ctl2']", "");
+ $this->verifyTextPresent("I'm clicked");
+ $this->click("//input[@name='ctl0\$body\$ctl2' and @value='ctl0\$body\$ctl2']", "");
+ $this->verifyTextPresent("I'm clicked");
+
+ // a radiobutton causing validation on a textbox
+ $this->verifyNotVisible('ctl0_body_ctl3');
+ $this->click("//input[@name='ctl0\$body\$ctl4' and @value='ctl0\$body\$ctl4']", "");
+ $this->pause(1000);
+ $this->verifyVisible('ctl0_body_ctl3');
+ $this->click("//input[@name='ctl0\$body\$ctl4' and @value='ctl0\$body\$ctl4']", "");
+ $this->pause(1000);
+ $this->verifyVisible('ctl0_body_ctl3');
+ $this->type("ctl0\$body\$TextBox", "test");
+ $this->clickAndWait("//input[@name='ctl0\$body\$ctl4' and @value='ctl0\$body\$ctl4']", "");
+ $this->verifyNotVisible('ctl0_body_ctl3');
+
+ // a radiobutton validated by a required field validator
+ $this->verifyNotVisible('ctl0_body_ctl6');
+ $this->click("//input[@type='submit' and @value='Submit']", "");
+ $this->pause(1000);
+ $this->verifyVisible('ctl0_body_ctl6');
+ $this->click("//input[@name='ctl0\$body\$RadioButton' and @value='ctl0\$body\$RadioButton']", "");
+ $this->clickAndWait("//input[@type='submit' and @value='Submit']", "");
+ $this->verifyNotVisible('ctl0_body_ctl6');
+
+ // a radiobutton group
+ $this->clickAndWait("name=ctl0\$body\$ctl7", "");
+ $this->verifyTextPresent("Your selection is empty");
+ $this->click("//input[@name='ctl0\$body\$RadioGroup' and @value='ctl0\$body\$Radio2']", "");
+ $this->clickAndWait("name=ctl0\$body\$ctl7", "");
+ $this->verifyTextPresent("Your selection is 2");
+ $this->click("//input[@name='ctl0\$body\$RadioGroup' and @value='ctl0\$body\$Radio3']", "");
+ $this->click("//input[@name='ctl0\$body\$Radio4' and @value='ctl0\$body\$Radio4']", "");
+ $this->clickAndWait("name=ctl0\$body\$ctl7", "");
+ $this->verifyTextPresent("Your selection is 34");
+ }
+}
+
+?>
\ No newline at end of file diff --git a/tests/FunctionalTests/quickstart/Controls/TableTestCase.php b/tests/FunctionalTests/quickstart/Controls/TableTestCase.php new file mode 100644 index 00000000..e9bd63be --- /dev/null +++ b/tests/FunctionalTests/quickstart/Controls/TableTestCase.php @@ -0,0 +1,20 @@ +<?php
+
+class TableTestCase extends SeleniumTestCase
+{
+ function test ()
+ {
+ $this->open("../../demos/quickstart/index.php?page=Controls.Samples.TTable.Home&notheme=true", "");
+
+ $this->verifyElementPresent("//table[@rules='all' and @border='1']");
+ $this->verifyElementPresent("//table/caption[@align='bottom' and text()='This is table caption']");
+ $this->verifyElementPresent("//th[text()='header cell 2']");
+ $this->verifyElementPresent("//tr[@align='right']/td[text()='text']");
+ $this->verifyElementPresent("//td[@align='center' and contains(text(),'cell 5')]");
+
+ $this->verifyElementPresent("//th[text()='Header 1']");
+ $this->verifyElementPresent("//td[text()='Cell 1']");
+ }
+}
+
+?>
\ No newline at end of file diff --git a/tests/FunctionalTests/quickstart/Controls/TextBoxTestCase.php b/tests/FunctionalTests/quickstart/Controls/TextBoxTestCase.php new file mode 100644 index 00000000..e1c76938 --- /dev/null +++ b/tests/FunctionalTests/quickstart/Controls/TextBoxTestCase.php @@ -0,0 +1,93 @@ +<?php
+
+class TextBoxTestCase extends SeleniumTestCase
+{
+ function test ()
+ {
+ $this->open("../../demos/quickstart/index.php?page=Controls.Samples.TTextBox.Home&notheme=true", "");
+
+ $this->verifyTitle("PRADO QuickStart Sample", "");
+
+ // a normal textbox
+ $this->type("ctl0\$body\$ctl0", "test");
+
+ // textbox with maxlength set
+ $this->verifyAttribute("ctl0\$body\$ctl1@size","4");
+ $this->verifyAttribute("ctl0\$body\$ctl1@maxlength","6");
+ $this->type("ctl0\$body\$ctl1", "textte");
+
+ // vCard textboxes
+ $this->verifyAttribute("ctl0\$body\$ctl2@vcard_name","vCard.FirstName");
+ $this->type("ctl0\$body\$ctl2", "first");
+ $this->verifyAttribute("ctl0\$body\$ctl3@vcard_name","vCard.LastName");
+ $this->type("ctl0\$body\$ctl3", "last");
+
+ // a disabled textbox
+ $this->verifyAttribute("ctl0\$body\$ctl4@disabled","regexp:true|disabled");
+
+ // a read-only textbox
+ $this->verifyAttribute("ctl0\$body\$ctl5@readonly","regexp:true|readonly");
+
+ // auto postback textbox, CausesValidation=false
+ $this->verifyValue("ctl0\$body\$ctl6", "change me");
+ $this->typeAndWait("ctl0\$body\$ctl6", "change mes");
+ $this->verifyValue("ctl0\$body\$ctl6", "text changed");
+
+ // auto postback textbox, CausesValidation=true
+ $this->verifyNotVisible('ctl0_body_ctl7');
+ $this->type("ctl0\$body\$TextBox3", "test");
+ $this->pause(1000);
+ $this->verifyVisible('ctl0_body_ctl7');
+ $this->typeAndWait("ctl0\$body\$TextBox3", "non test");
+ $this->verifyNotVisible('ctl0_body_ctl7');
+
+ // submitting textbox with a button
+ $this->type("ctl0\$body\$TextBox1", "texttext");
+ $this->clickAndWait("//input[@type='submit' and @value='Submit']", "");
+ $this->verifyValue("ctl0\$body\$TextBox1", "You just entered 'texttext'.");
+
+ // SafeText
+ $this->verifyText("ctl0_body_Output","test");
+ $this->typeAndWait("ctl0\$body\$TextBox2","<a href=javascript:xxx>malicious code</a>");
+ $this->verifyText("ctl0_body_Output","malicious code");
+
+ // password
+ $this->verifyAttribute("ctl0\$body\$ctl9@type","password");
+
+ // ------------------multiline textbox----------------------
+
+ // regular textbox
+ $this->type("ctl0\$body\$ctl10", "This is a\nmultiline\ntextbox.");
+ $this->type("ctl0\$body\$ctl11", "This is a multiline text box.
+In HTML, it is displayed as a textarea.
+End of message
+");
+
+ // a disabled multiline textbox
+ $this->verifyAttribute("ctl0\$body\$ctl12@disabled","regexp:true|disabled");
+
+ // a read-only multiline textbox
+ $this->verifyAttribute("ctl0\$body\$ctl13@readonly","regexp:true|readonly");
+ $this->verifyAttribute("ctl0\$body\$ctl13@wrap","off");
+
+ // auto postback textbox
+ $this->verifyValue("ctl0\$body\$ctl14", "change me");
+ $this->typeAndWait("ctl0\$body\$ctl14", "change mes");
+ $this->verifyValue("ctl0\$body\$ctl14", "text changed");
+ $this->verifyValue("ctl0\$body\$ctl10", "This is a\nmultiline\ntextbox.");
+ $this->verifyValue("ctl0\$body\$ctl11", "This is a multiline text box.
+In HTML, it is displayed as a textarea.
+End of message
+");
+
+ // textbox associated with a validator
+ $this->verifyNotVisible('ctl0_body_ctl15');
+ $this->type("ctl0\$body\$MultiTextBox3", "demo");
+ $this->pause(1000);
+ $this->verifyVisible('ctl0_body_ctl15');
+ $this->typeAndWait("ctl0\$body\$MultiTextBox3", "non demo");
+ $this->verifyNotVisible('ctl0_body_ctl15');
+ }
+}
+
+?>
\ No newline at end of file diff --git a/tests/FunctionalTests/quickstart/Fundamentals/HangmanTestCase.php b/tests/FunctionalTests/quickstart/Fundamentals/HangmanTestCase.php new file mode 100644 index 00000000..cad3dc0e --- /dev/null +++ b/tests/FunctionalTests/quickstart/Fundamentals/HangmanTestCase.php @@ -0,0 +1,34 @@ +<?php
+
+class HangmanTestCase extends SeleniumTestCase
+{
+ function test ()
+ {
+ $this->open("../../demos/quickstart/index.php?page=Fundamentals.Samples.Hangman.Home&notheme=true", "");
+ $this->verifyTitle("Hangman Game", "");
+ $this->verifyTextPresent("Medium game; you are allowed 5 misses.", "");
+ $this->clickAndWait("//input[@type='submit' and @value='Play!']", "");
+ $this->verifyTextPresent("You must choose a difficulty level", "");
+ $this->clickAndWait("//input[@type='submit' and @value='Play!']", "");
+ $this->click("//input[@name='ctl0\$body\$LevelSelection' and @value='3']", "");
+ $this->clickAndWait("//input[@type='submit' and @value='Play!']", "");
+ $this->verifyTextPresent("Please make a guess", "");
+ $this->verifyTextPresent("maximum of 3", "");
+ $this->clickAndWait("link=B", "");
+ $this->clickAndWait("link=F", "");
+ $this->clickAndWait("link=Give up?", "");
+ $this->verifyTextPresent("You Lose", "");
+ $this->clickAndWait("link=Start Again", "");
+ $this->clickAndWait("//input[@type='submit' and @value='Play!']", "");
+ $this->verifyTextPresent("Please make a guess", "");
+ $this->verifyTextPresent("maximum of 3", "");
+ $this->clickAndWait("link=Give up?", "");
+ $this->verifyTextPresent("You Lose", "");
+ $this->clickAndWait("link=Start Again", "");
+ $this->click("//input[@name='ctl0\$body\$LevelSelection' and @value='5']", "");
+ $this->clickAndWait("//input[@type='submit' and @value='Play!']", "");
+ $this->verifyTextPresent("maximum of 5", "");
+ }
+}
+
+?>
\ No newline at end of file diff --git a/tests/FunctionalTests/quickstart/Fundamentals/HelloWorldTestCase.php b/tests/FunctionalTests/quickstart/Fundamentals/HelloWorldTestCase.php new file mode 100644 index 00000000..e3da5a72 --- /dev/null +++ b/tests/FunctionalTests/quickstart/Fundamentals/HelloWorldTestCase.php @@ -0,0 +1,16 @@ +<?php
+
+//New Test
+class HelloWorldTestCase extends SeleniumTestCase
+{
+ function test ()
+ {
+ $this->open("../../demos/quickstart/index.php?page=Fundamentals.Samples.HelloWorld.Home&notheme=true", "");
+ $this->verifyTitle("Hello World", "");
+ $this->clickAndWait("//input[@type='submit' and @value='Click Me']", "");
+ $this->clickAndWait("//input[@type='submit' and @value='Hello World']", "");
+ $this->verifyTitle("Hello World", "");
+ }
+}
+
+?>
\ No newline at end of file |