From 9db90898be134c9f70c0b334ec071223e60ed76c Mon Sep 17 00:00:00 2001 From: xue <> Date: Sun, 16 Apr 2006 18:02:31 +0000 Subject: Merge from 3.0 branch till 924 --- .../features/protected/pages/ImageMap/Home.page | 43 ------------- .../features/protected/pages/ImageMap/Home.php | 12 ---- .../features/protected/pages/ImageMap/hotspot.jpg | Bin 12206 -> 0 bytes .../features/protected/pages/MultiView/Home.page | 24 -------- .../features/protected/pages/Wizard/Home.page | 35 ----------- tests/FunctionalTests/index.php | 1 + tests/FunctionalTests/validators.php | 8 +++ tests/FunctionalTests/validators/index.php | 8 +++ .../validators/protected/pages/Button.page | 37 ++++++++++++ .../validators/protected/pages/Button.php | 27 +++++++++ .../validators/protected/pages/CheckBox.page | 40 ++++++++++++ .../validators/protected/pages/CheckBox.php | 27 +++++++++ .../validators/protected/pages/ImageButton.page | 37 ++++++++++++ .../validators/protected/pages/ImageButton.php | 27 +++++++++ .../validators/protected/pages/Layout.php | 7 +++ .../validators/protected/pages/Layout.tpl | 34 +++++++++++ .../validators/protected/pages/LinkButton.page | 37 ++++++++++++ .../validators/protected/pages/LinkButton.php | 27 +++++++++ .../validators/protected/pages/config.xml | 5 ++ .../validators/tests/ButtonTestCase.php | 65 ++++++++++++++++++++ .../validators/tests/CheckBoxTestCase.php | 67 +++++++++++++++++++++ .../validators/tests/ImageButtonTestCase.php | 65 ++++++++++++++++++++ .../validators/tests/LinkButtonTestCase.php | 64 ++++++++++++++++++++ 23 files changed, 583 insertions(+), 114 deletions(-) delete mode 100644 tests/FunctionalTests/features/protected/pages/ImageMap/Home.page delete mode 100644 tests/FunctionalTests/features/protected/pages/ImageMap/Home.php delete mode 100644 tests/FunctionalTests/features/protected/pages/ImageMap/hotspot.jpg delete mode 100644 tests/FunctionalTests/features/protected/pages/MultiView/Home.page delete mode 100644 tests/FunctionalTests/features/protected/pages/Wizard/Home.page create mode 100644 tests/FunctionalTests/validators.php create mode 100644 tests/FunctionalTests/validators/index.php create mode 100644 tests/FunctionalTests/validators/protected/pages/Button.page create mode 100644 tests/FunctionalTests/validators/protected/pages/Button.php create mode 100644 tests/FunctionalTests/validators/protected/pages/CheckBox.page create mode 100644 tests/FunctionalTests/validators/protected/pages/CheckBox.php create mode 100644 tests/FunctionalTests/validators/protected/pages/ImageButton.page create mode 100644 tests/FunctionalTests/validators/protected/pages/ImageButton.php create mode 100644 tests/FunctionalTests/validators/protected/pages/Layout.php create mode 100644 tests/FunctionalTests/validators/protected/pages/Layout.tpl create mode 100644 tests/FunctionalTests/validators/protected/pages/LinkButton.page create mode 100644 tests/FunctionalTests/validators/protected/pages/LinkButton.php create mode 100644 tests/FunctionalTests/validators/protected/pages/config.xml create mode 100644 tests/FunctionalTests/validators/tests/ButtonTestCase.php create mode 100644 tests/FunctionalTests/validators/tests/CheckBoxTestCase.php create mode 100644 tests/FunctionalTests/validators/tests/ImageButtonTestCase.php create mode 100644 tests/FunctionalTests/validators/tests/LinkButtonTestCase.php (limited to 'tests') diff --git a/tests/FunctionalTests/features/protected/pages/ImageMap/Home.page b/tests/FunctionalTests/features/protected/pages/ImageMap/Home.page deleted file mode 100644 index 34631125..00000000 --- a/tests/FunctionalTests/features/protected/pages/ImageMap/Home.page +++ /dev/null @@ -1,43 +0,0 @@ -<com:TContent ID="Content"> - -<com:TImageMap ImageUrl=<%~hotspot.jpg%> AlternateText="Navigate buttons" OnClick="buttonClicked" > - -<com:TRectangleHotSpot - hotspotmode="Navigate" - NavigateUrl="navigate1.htm" - alternatetext="Button 1" - top="30" - left="175" - bottom="110" - right="355" /> - -<com:TRectangleHotSpot - hotspotmode="PostBack" - PostBackValue="test" - CausesValidation="true" - ValidationGroup="Group1" - alternatetext="Button 2" - top="155" - left="175" - bottom="240" - right="355" /> - -<com:TRectangleHotSpot - hotspotmode="Inactive" - NavigateUrl="navigate3.htm" - alternatetext="Button 3" - top="285" - left="175" - bottom="365" - right="355" /> - -</com:TImageMap> - -<com:TTextBox ID="TextBox" /> -<com:TRequiredFieldValidator - ValidationGroup="Group1" - EnableClientScript="true" - ControlToValidate="TextBox" - Text="required" /> - -</com:TContent> \ No newline at end of file diff --git a/tests/FunctionalTests/features/protected/pages/ImageMap/Home.php b/tests/FunctionalTests/features/protected/pages/ImageMap/Home.php deleted file mode 100644 index 36ec7e9c..00000000 --- a/tests/FunctionalTests/features/protected/pages/ImageMap/Home.php +++ /dev/null @@ -1,12 +0,0 @@ -<?php - -class Home extends TPage -{ - public function buttonClicked($sender,$param) - { - //echo $param->getPostBackValue(); - print_r($param); - } -} - -?> \ No newline at end of file diff --git a/tests/FunctionalTests/features/protected/pages/ImageMap/hotspot.jpg b/tests/FunctionalTests/features/protected/pages/ImageMap/hotspot.jpg deleted file mode 100644 index 3491813f..00000000 Binary files a/tests/FunctionalTests/features/protected/pages/ImageMap/hotspot.jpg and /dev/null differ diff --git a/tests/FunctionalTests/features/protected/pages/MultiView/Home.page b/tests/FunctionalTests/features/protected/pages/MultiView/Home.page deleted file mode 100644 index 30ee1bbe..00000000 --- a/tests/FunctionalTests/features/protected/pages/MultiView/Home.page +++ /dev/null @@ -1,24 +0,0 @@ -<com:TContent ID="Content"> - -<com:TMultiView ActiveViewIndex="2"> - <com:TView ID="View1"> - view 1 - <com:TTextBox Text="view 1" /> - <com:TButton Text="see view 2" CommandName="SwitchViewIndex" CommandParameter="1" /> - <com:TButton Text="see view 3" CommandName="SwitchViewIndex" CommandParameter="2" /> - </com:TView> - <com:TView ID="View2"> - view 2 - <com:TTextBox Text="view 2" /> - <com:TButton Text="see view 1" CommandName="SwitchViewID" CommandParameter="View1" /> - <com:TButton Text="see view 3" CommandName="NextView" /> - </com:TView> - <com:TView ID="View3"> - view 3 - <com:TTextBox Text="view 3" /> - <com:TButton Text="see view 1" CommandName="SwitchViewIndex" CommandParameter="0" /> - <com:TButton Text="see view 2" CommandName="PreviousView" /> - </com:TView> -</com:TMultiView> - -</com:TContent> \ No newline at end of file diff --git a/tests/FunctionalTests/features/protected/pages/Wizard/Home.page b/tests/FunctionalTests/features/protected/pages/Wizard/Home.page deleted file mode 100644 index bcd93fef..00000000 --- a/tests/FunctionalTests/features/protected/pages/Wizard/Home.page +++ /dev/null @@ -1,35 +0,0 @@ -<com:TContent ID="Content"> - -<com:TWizard - HeaderText="Wizard Test" - Width="300px" - NavigationStyle.BackColor="silver" - NavigationButtonStyle.BackColor="green" - FinishCompleteButtonStyle.BackColor="red" - > - <com:TWizardStep Title="Step 1"> - step 1 - <com:TTextBox Text="step 1" ID="TextBox1" /> - <com:TRequiredFieldValidator ControlToValidate="TextBox1" Text="required 1" /> - </com:TWizardStep> - <com:TWizardStep Title="Step 2" AllowReturn="false"> - step 2 - <com:TTextBox Text="step 2" ID="TextBox2" /> - <com:TRequiredFieldValidator ControlToValidate="TextBox2" Text="required 2" /> - </com:TWizardStep> - <com:TTemplatedWizardStep Title="Step 22"> - <prop:ContentTemplate> - <com:TTextBox Text="step 22" ID="TextBox22" /> - </prop:ContentTemplate> - <prop:NavigationTemplate> - <com:TButton Text="N...ext" CommandName="Complete" /> - </prop:NavigationTemplate> - </com:TTemplatedWizardStep> - <com:TWizardStep Title="Step 3" StepType="Complete"> - step 3 - <com:TTextBox Text="step 3" ID="TextBox3" /> - <com:TRequiredFieldValidator ControlToValidate="TextBox3" Text="required 3" /> - </com:TWizardStep> -</com:TWizard> - -</com:TContent> \ No newline at end of file diff --git a/tests/FunctionalTests/index.php b/tests/FunctionalTests/index.php index 2cfcfd1f..c22543c0 100644 --- a/tests/FunctionalTests/index.php +++ b/tests/FunctionalTests/index.php @@ -8,6 +8,7 @@ Prado Functional Test Suites <h1>Prado Functional Test Suites</h1> <ul> <li><a href="quickstart.php">Tests of QuickStart Tutorial Demo</a></li> + <li><a href="validators.php">Tests of Validators</a></li> <li><a href="tickets.php">Tests of Trac Tickets</a></li> <li><a href="features.php">Tests of New Features</a> (<a href="features/index.php">list of new features</a>)</li> </ul> diff --git a/tests/FunctionalTests/validators.php b/tests/FunctionalTests/validators.php new file mode 100644 index 00000000..c86604c8 --- /dev/null +++ b/tests/FunctionalTests/validators.php @@ -0,0 +1,8 @@ +<?php + +require(dirname(__FILE__).'/PradoTester.php'); + +$tester=new PradoTester(dirname(__FILE__).'/validators/tests'); +$tester->run(new SimpleReporter()); + +?> \ No newline at end of file diff --git a/tests/FunctionalTests/validators/index.php b/tests/FunctionalTests/validators/index.php new file mode 100644 index 00000000..fe127639 --- /dev/null +++ b/tests/FunctionalTests/validators/index.php @@ -0,0 +1,8 @@ +<?php + +require_once(dirname(__FILE__).'/../../../framework/prado.php'); + +$app=new TApplication; +$app->run(); + +?> \ No newline at end of file diff --git a/tests/FunctionalTests/validators/protected/pages/Button.page b/tests/FunctionalTests/validators/protected/pages/Button.page new file mode 100644 index 00000000..5acc596b --- /dev/null +++ b/tests/FunctionalTests/validators/protected/pages/Button.page @@ -0,0 +1,37 @@ +<com:TContent ID="Content"> +<h1>Validations Triggered by TButton</h1> + +<com:TTextBox ID="TextBox1" /> +<com:TRequiredFieldValidator + Text="Textbox1 required" + ControlToValidate="TextBox1" + ValidationGroup="Group1" /> +<com:TButton Text="Submit1" + ValidationGroup="Group1" + OnClick="button1Clicked" /> +<com:TLabel ID="Result1" /> + +<hr/> + +<com:TTextBox ID="TextBox2" /> +<com:TRequiredFieldValidator + Text="Textbox2 required" + ControlToValidate="TextBox2" /> +<com:TButton Text="Submit2" + OnClick="button2Clicked" /> +<com:TLabel ID="Result2" /> + +<hr/> + +<com:TTextBox ID="TextBox3" /> +<com:TRequiredFieldValidator + Text="Textbox3 required" + EnableClientScript="false" + ControlToValidate="TextBox3" + ValidationGroup="Group3" /> +<com:TButton Text="Submit3" + ValidationGroup="Group3" + OnClick="button3Clicked" /> +<com:TLabel ID="Result3" /> + +</com:TContent> \ No newline at end of file diff --git a/tests/FunctionalTests/validators/protected/pages/Button.php b/tests/FunctionalTests/validators/protected/pages/Button.php new file mode 100644 index 00000000..3dbbc7d6 --- /dev/null +++ b/tests/FunctionalTests/validators/protected/pages/Button.php @@ -0,0 +1,27 @@ +<?php + +class Button extends TPage +{ + public function button1Clicked($sender,$param) + { + $this->Result1->Text="Button1 is clicked"; + if($this->IsValid) + $this->Result1->Text.=' and valid'; + } + + public function button2Clicked($sender,$param) + { + $this->Result2->Text="Button2 is clicked"; + if($this->IsValid) + $this->Result2->Text.=' and valid'; + } + + public function button3Clicked($sender,$param) + { + $this->Result3->Text="Button3 is clicked"; + if($this->IsValid) + $this->Result3->Text.=' and valid'; + } +} + +?> \ No newline at end of file diff --git a/tests/FunctionalTests/validators/protected/pages/CheckBox.page b/tests/FunctionalTests/validators/protected/pages/CheckBox.page new file mode 100644 index 00000000..e5cb39ff --- /dev/null +++ b/tests/FunctionalTests/validators/protected/pages/CheckBox.page @@ -0,0 +1,40 @@ +<com:TContent ID="Content"> +<h1>Validations Triggered by TCheckBox</h1> + +<com:TTextBox ID="TextBox1" /> +<com:TRequiredFieldValidator + Text="Textbox1 required" + ControlToValidate="TextBox1" + ValidationGroup="Group1" /> +<com:TCheckBox Text="Submit1" + AutoPostBack="true" + ValidationGroup="Group1" + OnCheckedChanged="button1Clicked" /> +<com:TLabel ID="Result1" /> + +<hr/> + +<com:TTextBox ID="TextBox2" /> +<com:TRequiredFieldValidator + Text="Textbox2 required" + ControlToValidate="TextBox2" /> +<com:TCheckBox Text="Submit2" + AutoPostBack="true" + OnCheckedChanged="button2Clicked" /> +<com:TLabel ID="Result2" /> + +<hr/> + +<com:TTextBox ID="TextBox3" /> +<com:TRequiredFieldValidator + Text="Textbox3 required" + EnableClientScript="false" + ControlToValidate="TextBox3" + ValidationGroup="Group3" /> +<com:TCheckBox Text="Submit3" + AutoPostBack="true" + ValidationGroup="Group3" + OnCheckedChanged="button3Clicked" /> +<com:TLabel ID="Result3" /> + +</com:TContent> \ No newline at end of file diff --git a/tests/FunctionalTests/validators/protected/pages/CheckBox.php b/tests/FunctionalTests/validators/protected/pages/CheckBox.php new file mode 100644 index 00000000..700ac171 --- /dev/null +++ b/tests/FunctionalTests/validators/protected/pages/CheckBox.php @@ -0,0 +1,27 @@ +<?php + +class CheckBox extends TPage +{ + public function button1Clicked($sender,$param) + { + $this->Result1->Text="Button1 is clicked"; + if($this->IsValid) + $this->Result1->Text.=' and valid'; + } + + public function button2Clicked($sender,$param) + { + $this->Result2->Text="Button2 is clicked"; + if($this->IsValid) + $this->Result2->Text.=' and valid'; + } + + public function button3Clicked($sender,$param) + { + $this->Result3->Text="Button3 is clicked"; + if($this->IsValid) + $this->Result3->Text.=' and valid'; + } +} + +?> \ No newline at end of file diff --git a/tests/FunctionalTests/validators/protected/pages/ImageButton.page b/tests/FunctionalTests/validators/protected/pages/ImageButton.page new file mode 100644 index 00000000..d1fae361 --- /dev/null +++ b/tests/FunctionalTests/validators/protected/pages/ImageButton.page @@ -0,0 +1,37 @@ +<com:TContent ID="Content"> +<h1>Validations Triggered by TImageButton</h1> + +<com:TTextBox ID="TextBox1" /> +<com:TRequiredFieldValidator + Text="Textbox1 required" + ControlToValidate="TextBox1" + ValidationGroup="Group1" /> +<com:TImageButton ImageUrl="http://www.pradosoft.com/images/powered.gif" + ValidationGroup="Group1" + OnClick="button1Clicked" /> +<com:TLabel ID="Result1" /> + +<hr/> + +<com:TTextBox ID="TextBox2" /> +<com:TRequiredFieldValidator + Text="Textbox2 required" + ControlToValidate="TextBox2" /> +<com:TImageButton ImageUrl="http://www.pradosoft.com/images/powered.gif" + OnClick="button2Clicked" /> +<com:TLabel ID="Result2" /> + +<hr/> + +<com:TTextBox ID="TextBox3" /> +<com:TRequiredFieldValidator + Text="Textbox3 required" + EnableClientScript="false" + ControlToValidate="TextBox3" + ValidationGroup="Group3" /> +<com:TImageButton ImageUrl="http://www.pradosoft.com/images/powered.gif" + ValidationGroup="Group3" + OnClick="button3Clicked" /> +<com:TLabel ID="Result3" /> + +</com:TContent> \ No newline at end of file diff --git a/tests/FunctionalTests/validators/protected/pages/ImageButton.php b/tests/FunctionalTests/validators/protected/pages/ImageButton.php new file mode 100644 index 00000000..ecedd5bf --- /dev/null +++ b/tests/FunctionalTests/validators/protected/pages/ImageButton.php @@ -0,0 +1,27 @@ +<?php + +class ImageButton extends TPage +{ + public function button1Clicked($sender,$param) + { + $this->Result1->Text="Button1 is clicked"; + if($this->IsValid) + $this->Result1->Text.=' and valid'; + } + + public function button2Clicked($sender,$param) + { + $this->Result2->Text="Button2 is clicked"; + if($this->IsValid) + $this->Result2->Text.=' and valid'; + } + + public function button3Clicked($sender,$param) + { + $this->Result3->Text="Button3 is clicked"; + if($this->IsValid) + $this->Result3->Text.=' and valid'; + } +} + +?> \ No newline at end of file diff --git a/tests/FunctionalTests/validators/protected/pages/Layout.php b/tests/FunctionalTests/validators/protected/pages/Layout.php new file mode 100644 index 00000000..ba96038b --- /dev/null +++ b/tests/FunctionalTests/validators/protected/pages/Layout.php @@ -0,0 +1,7 @@ +<?php + +class Layout extends TTemplateControl +{ +} + +?> \ No newline at end of file diff --git a/tests/FunctionalTests/validators/protected/pages/Layout.tpl b/tests/FunctionalTests/validators/protected/pages/Layout.tpl new file mode 100644 index 00000000..224481e1 --- /dev/null +++ b/tests/FunctionalTests/validators/protected/pages/Layout.tpl @@ -0,0 +1,34 @@ +<!DOCTYPE html PUBLIC + "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> + +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<com:THead Title="PRADO Functional Tests"> + <meta http-equiv="Content-type" content="text/html; charset=UTF-8" /> + <style type="text/css"> + /*<![CDATA[*/ + .defect + { + color: #c00; + font-size: 1.15em; + } + body + { + font-family: Georgia, "Times New Roman", Times, serif; + } + .w3c + { + margin-top: 2em; + display: block; + } + /*]]>*/ + </style> +</com:THead> +<body> +<com:TForm> +<com:TContentPlaceHolder ID="Content" /> +<hr style="margin-top: 2em" /> +<com:TJavascriptLogger /> +</com:TForm> +</body> +</html> \ No newline at end of file diff --git a/tests/FunctionalTests/validators/protected/pages/LinkButton.page b/tests/FunctionalTests/validators/protected/pages/LinkButton.page new file mode 100644 index 00000000..8ed1c338 --- /dev/null +++ b/tests/FunctionalTests/validators/protected/pages/LinkButton.page @@ -0,0 +1,37 @@ +<com:TContent ID="Content"> +<h1>Validations Triggered by TLinkButton</h1> + +<com:TTextBox ID="TextBox1" /> +<com:TRequiredFieldValidator + Text="Textbox1 required" + ControlToValidate="TextBox1" + ValidationGroup="Group1" /> +<com:TLinkButton Text="Submit1" + ValidationGroup="Group1" + OnClick="button1Clicked" /> +<com:TLabel ID="Result1" /> + +<hr/> + +<com:TTextBox ID="TextBox2" /> +<com:TRequiredFieldValidator + Text="Textbox2 required" + ControlToValidate="TextBox2" /> +<com:TLinkButton Text="Submit2" + OnClick="button2Clicked" /> +<com:TLabel ID="Result2" /> + +<hr/> + +<com:TTextBox ID="TextBox3" /> +<com:TRequiredFieldValidator + Text="Textbox3 required" + EnableClientScript="false" + ControlToValidate="TextBox3" + ValidationGroup="Group3" /> +<com:TLinkButton Text="Submit3" + ValidationGroup="Group3" + OnClick="button3Clicked" /> +<com:TLabel ID="Result3" /> + +</com:TContent> \ No newline at end of file diff --git a/tests/FunctionalTests/validators/protected/pages/LinkButton.php b/tests/FunctionalTests/validators/protected/pages/LinkButton.php new file mode 100644 index 00000000..5130dd01 --- /dev/null +++ b/tests/FunctionalTests/validators/protected/pages/LinkButton.php @@ -0,0 +1,27 @@ +<?php + +class LinkButton extends TPage +{ + public function button1Clicked($sender,$param) + { + $this->Result1->Text="Button1 is clicked"; + if($this->IsValid) + $this->Result1->Text.=' and valid'; + } + + public function button2Clicked($sender,$param) + { + $this->Result2->Text="Button2 is clicked"; + if($this->IsValid) + $this->Result2->Text.=' and valid'; + } + + public function button3Clicked($sender,$param) + { + $this->Result3->Text="Button3 is clicked"; + if($this->IsValid) + $this->Result3->Text.=' and valid'; + } +} + +?> \ No newline at end of file diff --git a/tests/FunctionalTests/validators/protected/pages/config.xml b/tests/FunctionalTests/validators/protected/pages/config.xml new file mode 100644 index 00000000..83bb5791 --- /dev/null +++ b/tests/FunctionalTests/validators/protected/pages/config.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?> + +<configuration> + <pages MasterClass="Application.pages.Layout" /> +</configuration> \ No newline at end of file diff --git a/tests/FunctionalTests/validators/tests/ButtonTestCase.php b/tests/FunctionalTests/validators/tests/ButtonTestCase.php new file mode 100644 index 00000000..46e037dc --- /dev/null +++ b/tests/FunctionalTests/validators/tests/ButtonTestCase.php @@ -0,0 +1,65 @@ +<?php + +class ButtonTestCase extends SeleniumTestCase +{ + function test() + { + $this->open('validators/index.php?page=Button'); + + + // verify all error messages are invisible + $this->verifyNotVisible('ctl0_Content_ctl0'); + $this->verifyNotVisible('ctl0_Content_ctl2'); + $this->verifyNotVisible('ctl0_Content_ctl4'); + + // verify the first validator shows the error + $this->click("ctl0_Content_ctl1"); + $this->verifyVisible('ctl0_Content_ctl0'); + $this->verifyNotVisible('ctl0_Content_ctl2'); + $this->verifyNotVisible('ctl0_Content_ctl4'); + + // verify the first validation is passed + $this->pause(500); + $this->verifyTextNotPresent('Button1 is clicked'); + $this->type("ctl0_Content_TextBox1", "test"); + $this->clickAndWait("ctl0_Content_ctl1"); + $this->verifyNotVisible('ctl0_Content_ctl0'); + $this->verifyNotVisible('ctl0_Content_ctl2'); + $this->verifyNotVisible('ctl0_Content_ctl4'); + $this->verifyTextPresent('Button1 is clicked and valid'); + + // verify the second validator shows the error + $this->click("ctl0_Content_ctl3"); + $this->verifyNotVisible('ctl0_Content_ctl0'); + $this->verifyVisible('ctl0_Content_ctl2'); + $this->verifyNotVisible('ctl0_Content_ctl4'); + + // verify the second validation is passed + $this->pause(500); + $this->verifyTextNotPresent('Button2 is clicked'); + $this->type("ctl0_Content_TextBox2", "test"); + $this->clickAndWait("ctl0_Content_ctl3"); + $this->verifyNotVisible('ctl0_Content_ctl0'); + $this->verifyNotVisible('ctl0_Content_ctl2'); + $this->verifyNotVisible('ctl0_Content_ctl4'); + $this->verifyTextPresent('Button2 is clicked and valid'); + + // verify the third validator shows the error + $this->clickAndWait("ctl0_Content_ctl5"); + $this->verifyNotVisible('ctl0_Content_ctl0'); + $this->verifyNotVisible('ctl0_Content_ctl2'); + $this->verifyVisible('ctl0_Content_ctl4'); + + // verify the third validation is passed + $this->verifyTextPresent('Button3 is clicked'); + $this->verifyTextNotPresent('Button3 is clicked and valid'); + $this->type("ctl0_Content_TextBox3", "test"); + $this->clickAndWait("ctl0_Content_ctl5"); + $this->verifyNotVisible('ctl0_Content_ctl0'); + $this->verifyNotVisible('ctl0_Content_ctl2'); + $this->verifyNotVisible('ctl0_Content_ctl4'); + $this->verifyTextPresent('Button3 is clicked and valid'); + } +} + +?> \ No newline at end of file diff --git a/tests/FunctionalTests/validators/tests/CheckBoxTestCase.php b/tests/FunctionalTests/validators/tests/CheckBoxTestCase.php new file mode 100644 index 00000000..6783572d --- /dev/null +++ b/tests/FunctionalTests/validators/tests/CheckBoxTestCase.php @@ -0,0 +1,67 @@ +<?php + +class CheckBoxTestCase extends SeleniumTestCase +{ + function test() + { + $this->open('validators/index.php?page=CheckBox'); + + + // verify all error messages are invisible + $this->verifyNotVisible('ctl0_Content_ctl0'); + $this->verifyNotVisible('ctl0_Content_ctl2'); + $this->verifyNotVisible('ctl0_Content_ctl4'); + + // verify the first validator shows the error + $this->click("ctl0_Content_ctl1"); + $this->verifyVisible('ctl0_Content_ctl0'); + $this->verifyNotVisible('ctl0_Content_ctl2'); + $this->verifyNotVisible('ctl0_Content_ctl4'); + + // verify the first validation is passed + $this->pause(500); + $this->verifyTextNotPresent('Button1 is clicked'); + $this->type("ctl0_Content_TextBox1", "test"); + $this->clickAndWait("ctl0_Content_ctl1"); + $this->clickAndWait("ctl0_Content_ctl1"); + $this->verifyNotVisible('ctl0_Content_ctl0'); + $this->verifyNotVisible('ctl0_Content_ctl2'); + $this->verifyNotVisible('ctl0_Content_ctl4'); + $this->verifyTextPresent('Button1 is clicked and valid'); + + // verify the second validator shows the error + $this->click("ctl0_Content_ctl3"); + $this->verifyNotVisible('ctl0_Content_ctl0'); + $this->verifyVisible('ctl0_Content_ctl2'); + $this->verifyNotVisible('ctl0_Content_ctl4'); + + // verify the second validation is passed + $this->pause(500); + $this->verifyTextNotPresent('Button2 is clicked'); + $this->type("ctl0_Content_TextBox2", "test"); + $this->clickAndWait("ctl0_Content_ctl3"); + $this->clickAndWait("ctl0_Content_ctl3"); + $this->verifyNotVisible('ctl0_Content_ctl0'); + $this->verifyNotVisible('ctl0_Content_ctl2'); + $this->verifyNotVisible('ctl0_Content_ctl4'); + $this->verifyTextPresent('Button2 is clicked and valid'); + + // verify the third validator shows the error + $this->clickAndWait("ctl0_Content_ctl5"); + $this->verifyNotVisible('ctl0_Content_ctl0'); + $this->verifyNotVisible('ctl0_Content_ctl2'); + $this->verifyVisible('ctl0_Content_ctl4'); + + // verify the third validation is passed + $this->verifyTextPresent('Button3 is clicked'); + $this->verifyTextNotPresent('Button3 is clicked and valid'); + $this->type("ctl0_Content_TextBox3", "test"); + $this->clickAndWait("ctl0_Content_ctl5"); + $this->verifyNotVisible('ctl0_Content_ctl0'); + $this->verifyNotVisible('ctl0_Content_ctl2'); + $this->verifyNotVisible('ctl0_Content_ctl4'); + $this->verifyTextPresent('Button3 is clicked and valid'); + } +} + +?> \ No newline at end of file diff --git a/tests/FunctionalTests/validators/tests/ImageButtonTestCase.php b/tests/FunctionalTests/validators/tests/ImageButtonTestCase.php new file mode 100644 index 00000000..1a4d88c1 --- /dev/null +++ b/tests/FunctionalTests/validators/tests/ImageButtonTestCase.php @@ -0,0 +1,65 @@ +<?php + +class ImageButtonTestCase extends SeleniumTestCase +{ + function test() + { + $this->open('validators/index.php?page=ImageButton'); + + + // verify all error messages are invisible + $this->verifyNotVisible('ctl0_Content_ctl0'); + $this->verifyNotVisible('ctl0_Content_ctl2'); + $this->verifyNotVisible('ctl0_Content_ctl4'); + + // verify the first validator shows the error + $this->click("ctl0_Content_ctl1"); + $this->verifyVisible('ctl0_Content_ctl0'); + $this->verifyNotVisible('ctl0_Content_ctl2'); + $this->verifyNotVisible('ctl0_Content_ctl4'); + + // verify the first validation is passed + $this->pause(500); + $this->verifyTextNotPresent('Button1 is clicked'); + $this->type("ctl0_Content_TextBox1", "test"); + $this->clickAndWait("ctl0_Content_ctl1"); + $this->verifyNotVisible('ctl0_Content_ctl0'); + $this->verifyNotVisible('ctl0_Content_ctl2'); + $this->verifyNotVisible('ctl0_Content_ctl4'); + $this->verifyTextPresent('Button1 is clicked and valid'); + + // verify the second validator shows the error + $this->click("ctl0_Content_ctl3"); + $this->verifyNotVisible('ctl0_Content_ctl0'); + $this->verifyVisible('ctl0_Content_ctl2'); + $this->verifyNotVisible('ctl0_Content_ctl4'); + + // verify the second validation is passed + $this->pause(500); + $this->verifyTextNotPresent('Button2 is clicked'); + $this->type("ctl0_Content_TextBox2", "test"); + $this->clickAndWait("ctl0_Content_ctl3"); + $this->verifyNotVisible('ctl0_Content_ctl0'); + $this->verifyNotVisible('ctl0_Content_ctl2'); + $this->verifyNotVisible('ctl0_Content_ctl4'); + $this->verifyTextPresent('Button2 is clicked and valid'); + + // verify the third validator shows the error + $this->clickAndWait("ctl0_Content_ctl5"); + $this->verifyNotVisible('ctl0_Content_ctl0'); + $this->verifyNotVisible('ctl0_Content_ctl2'); + $this->verifyVisible('ctl0_Content_ctl4'); + + // verify the third validation is passed + $this->verifyTextPresent('Button3 is clicked'); + $this->verifyTextNotPresent('Button3 is clicked and valid'); + $this->type("ctl0_Content_TextBox3", "test"); + $this->clickAndWait("ctl0_Content_ctl5"); + $this->verifyNotVisible('ctl0_Content_ctl0'); + $this->verifyNotVisible('ctl0_Content_ctl2'); + $this->verifyNotVisible('ctl0_Content_ctl4'); + $this->verifyTextPresent('Button3 is clicked and valid'); + } +} + +?> \ No newline at end of file diff --git a/tests/FunctionalTests/validators/tests/LinkButtonTestCase.php b/tests/FunctionalTests/validators/tests/LinkButtonTestCase.php new file mode 100644 index 00000000..47122442 --- /dev/null +++ b/tests/FunctionalTests/validators/tests/LinkButtonTestCase.php @@ -0,0 +1,64 @@ +<?php + +class LinkButtonTestCase extends SeleniumTestCase +{ + function test() + { + $this->open('validators/index.php?page=LinkButton'); + + // verify all error messages are invisible + $this->verifyNotVisible('ctl0_Content_ctl0'); + $this->verifyNotVisible('ctl0_Content_ctl2'); + $this->verifyNotVisible('ctl0_Content_ctl4'); + + // verify the first validator shows the error + $this->click("ctl0_Content_ctl1"); + $this->verifyVisible('ctl0_Content_ctl0'); + $this->verifyNotVisible('ctl0_Content_ctl2'); + $this->verifyNotVisible('ctl0_Content_ctl4'); + + // verify the first validation is passed + $this->pause(500); + $this->verifyTextNotPresent('Button1 is clicked'); + $this->type("ctl0_Content_TextBox1", "test"); + $this->clickAndWait("ctl0_Content_ctl1"); + $this->verifyNotVisible('ctl0_Content_ctl0'); + $this->verifyNotVisible('ctl0_Content_ctl2'); + $this->verifyNotVisible('ctl0_Content_ctl4'); + $this->verifyTextPresent('Button1 is clicked and valid'); + + // verify the second validator shows the error + $this->click("ctl0_Content_ctl3"); + $this->verifyNotVisible('ctl0_Content_ctl0'); + $this->verifyVisible('ctl0_Content_ctl2'); + $this->verifyNotVisible('ctl0_Content_ctl4'); + + // verify the second validation is passed + $this->pause(500); + $this->verifyTextNotPresent('Button2 is clicked'); + $this->type("ctl0_Content_TextBox2", "test"); + $this->clickAndWait("ctl0_Content_ctl3"); + $this->verifyNotVisible('ctl0_Content_ctl0'); + $this->verifyNotVisible('ctl0_Content_ctl2'); + $this->verifyNotVisible('ctl0_Content_ctl4'); + $this->verifyTextPresent('Button2 is clicked and valid'); + + // verify the third validator shows the error + $this->clickAndWait("ctl0_Content_ctl5"); + $this->verifyNotVisible('ctl0_Content_ctl0'); + $this->verifyNotVisible('ctl0_Content_ctl2'); + $this->verifyVisible('ctl0_Content_ctl4'); + + // verify the third validation is passed + $this->verifyTextPresent('Button3 is clicked'); + $this->verifyTextNotPresent('Button3 is clicked and valid'); + $this->type("ctl0_Content_TextBox3", "test"); + $this->clickAndWait("ctl0_Content_ctl5"); + $this->verifyNotVisible('ctl0_Content_ctl0'); + $this->verifyNotVisible('ctl0_Content_ctl2'); + $this->verifyNotVisible('ctl0_Content_ctl4'); + $this->verifyTextPresent('Button3 is clicked and valid'); + } +} + +?> \ No newline at end of file -- cgit v1.2.3