diff options
Diffstat (limited to 'tests/FunctionalTests/validators')
17 files changed, 463 insertions, 467 deletions
diff --git a/tests/FunctionalTests/validators/protected/pages/Layout.tpl b/tests/FunctionalTests/validators/protected/pages/Layout.tpl index 25dbea09..47591ef3 100755 --- a/tests/FunctionalTests/validators/protected/pages/Layout.tpl +++ b/tests/FunctionalTests/validators/protected/pages/Layout.tpl @@ -33,7 +33,6 @@ <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/ListControl.page b/tests/FunctionalTests/validators/protected/pages/ListControl.page index 1429e184..a75dc3ff 100755 --- a/tests/FunctionalTests/validators/protected/pages/ListControl.page +++ b/tests/FunctionalTests/validators/protected/pages/ListControl.page @@ -1,58 +1,58 @@ <com:TContent ID="Content">
- <h1>List Control Required Field Validation Test</h1>
+ <h1>List Control Required Field Validation Test</h1>
<com:TCheckBoxList ID="list1">
<com:TListItem Text="Select a color below" Value="" />
<com:TListItem Text="Red" />
<com:TListItem Text="Blue" />
<com:TListItem Text="Green" />
</com:TCheckBoxList>
-
+
<com:TRequiredFieldValidator ID="validator1"
ControlToValidate="list1"
InitialValue="Select a color below"
ErrorMessage="*" />
-
+
<hr />
-
+
<com:TDropDownList ID="list2">
<com:TListItem Text="--- Select a color ---" />
<com:TListItem Text="Red" />
<com:TListItem Text="Blue" />
<com:TListItem Text="Green" />
</com:TDropDownList>
-
+
<com:TRequiredFieldValidator ID="validator2"
ControlToValidate="list2"
InitialValue="--- Select a color ---"
ErrorMessage="*" />
-
+
<hr />
-
+
<com:TListBox ID="list3">
- <com:TListItem Text="Don't select this one" />
+ <com:TListItem Text="Dont select this one" />
<com:TListItem Text="Red" />
<com:TListItem Text="Blue" />
<com:TListItem Text="Green" />
</com:TListBox>
-
+
<com:TRequiredFieldValidator ID="validator3"
ControlToValidate="list3"
- InitialValue="Don't select this one"
+ InitialValue="Dont select this one"
ErrorMessage="*" />
-
+
<hr />
-
+
<com:TRadioButtonList ID="list4">
<com:TListItem Text="Select something else" />
<com:TListItem Text="Red" />
<com:TListItem Text="Blue" />
<com:TListItem Text="Green" />
</com:TRadioButtonList>
-
+
<com:TRequiredFieldValidator ID="validator4"
ControlToValidate="list4"
InitialValue="Select something else"
ErrorMessage="*" />
-
+
<com:TButton ID="submit1" Text="Submit!" />
</com:TContent>
\ No newline at end of file diff --git a/tests/FunctionalTests/validators/tests/ButtonTestCase.php b/tests/FunctionalTests/validators/tests/ButtonTestCase.php index 58001322..90265156 100755 --- a/tests/FunctionalTests/validators/tests/ButtonTestCase.php +++ b/tests/FunctionalTests/validators/tests/ButtonTestCase.php @@ -1,63 +1,63 @@ <?php -class ButtonTestCase extends PradoGenericSeleniumTest +class ButtonTestCase extends PradoGenericSelenium2Test { function test() { - $this->open('validators/index.php?page=Button'); + $this->url('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'); + $this->assertNotVisible('ctl0_Content_ctl0'); + $this->assertNotVisible('ctl0_Content_ctl2'); + $this->assertNotVisible('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'); + $this->byId("ctl0_Content_ctl1")->click(); + $this->assertVisible('ctl0_Content_ctl0'); + $this->assertNotVisible('ctl0_Content_ctl2'); + $this->assertNotVisible('ctl0_Content_ctl4'); // verify the first validation is passed $this->pause(500); - $this->verifyTextNotPresent('Button1 is clicked'); + $this->assertNotContains('Button1 is clicked', $this->source()); $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'); + $this->byId("ctl0_Content_ctl1")->click(); + $this->assertNotVisible('ctl0_Content_ctl0'); + $this->assertNotVisible('ctl0_Content_ctl2'); + $this->assertNotVisible('ctl0_Content_ctl4'); + $this->assertContains('Button1 is clicked and valid', $this->source()); // 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'); + $this->byId("ctl0_Content_ctl3")->click(); + $this->assertNotVisible('ctl0_Content_ctl0'); + $this->assertVisible('ctl0_Content_ctl2'); + $this->assertNotVisible('ctl0_Content_ctl4'); // verify the second validation is passed $this->pause(500); - $this->verifyTextNotPresent('Button2 is clicked'); + $this->assertNotContains('Button2 is clicked', $this->source()); $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'); + $this->byId("ctl0_Content_ctl3")->click(); + $this->assertNotVisible('ctl0_Content_ctl0'); + $this->assertNotVisible('ctl0_Content_ctl2'); + $this->assertNotVisible('ctl0_Content_ctl4'); + $this->assertContains('Button2 is clicked and valid', $this->source()); // 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'); + $this->byId("ctl0_Content_ctl5")->click(); + $this->assertNotVisible('ctl0_Content_ctl0'); + $this->assertNotVisible('ctl0_Content_ctl2'); + $this->assertVisible('ctl0_Content_ctl4'); // verify the third validation is passed - $this->verifyTextPresent('Button3 is clicked'); - $this->verifyTextNotPresent('Button3 is clicked and valid'); + $this->assertContains('Button3 is clicked', $this->source()); + $this->assertNotContains('Button3 is clicked and valid', $this->source()); $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'); + $this->byId("ctl0_Content_ctl5")->click(); + $this->assertNotVisible('ctl0_Content_ctl0'); + $this->assertNotVisible('ctl0_Content_ctl2'); + $this->assertNotVisible('ctl0_Content_ctl4'); + $this->assertContains('Button3 is clicked and valid', $this->source()); } } diff --git a/tests/FunctionalTests/validators/tests/CheckBoxTestCase.php b/tests/FunctionalTests/validators/tests/CheckBoxTestCase.php index 847cbc9a..8e6e1583 100755 --- a/tests/FunctionalTests/validators/tests/CheckBoxTestCase.php +++ b/tests/FunctionalTests/validators/tests/CheckBoxTestCase.php @@ -1,65 +1,65 @@ <?php -class CheckBoxTestCase extends PradoGenericSeleniumTest +class CheckBoxTestCase extends PradoGenericSelenium2Test { function test() { - $this->open('validators/index.php?page=CheckBox'); + $this->url('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'); + $this->assertNotVisible('ctl0_Content_ctl0'); + $this->assertNotVisible('ctl0_Content_ctl2'); + $this->assertNotVisible('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'); + $this->byId("ctl0_Content_ctl1")->click(); + $this->assertVisible('ctl0_Content_ctl0'); + $this->assertNotVisible('ctl0_Content_ctl2'); + $this->assertNotVisible('ctl0_Content_ctl4'); // verify the first validation is passed $this->pause(500); - $this->verifyTextNotPresent('Button1 is clicked'); + $this->assertNotContains('Button1 is clicked', $this->source()); $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'); + $this->byId("ctl0_Content_ctl1")->click(); + $this->byId("ctl0_Content_ctl1")->click(); + $this->assertNotVisible('ctl0_Content_ctl0'); + $this->assertNotVisible('ctl0_Content_ctl2'); + $this->assertNotVisible('ctl0_Content_ctl4'); + $this->assertContains('Button1 is clicked and valid', $this->source()); // 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'); + $this->byId("ctl0_Content_ctl3")->click(); + $this->assertNotVisible('ctl0_Content_ctl0'); + $this->assertVisible('ctl0_Content_ctl2'); + $this->assertNotVisible('ctl0_Content_ctl4'); // verify the second validation is passed $this->pause(500); - $this->verifyTextNotPresent('Button2 is clicked'); + $this->assertNotContains('Button2 is clicked', $this->source()); $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'); + $this->byId("ctl0_Content_ctl3")->click(); + $this->byId("ctl0_Content_ctl3")->click(); + $this->assertNotVisible('ctl0_Content_ctl0'); + $this->assertNotVisible('ctl0_Content_ctl2'); + $this->assertNotVisible('ctl0_Content_ctl4'); + $this->assertContains('Button2 is clicked and valid', $this->source()); // 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'); + $this->byId("ctl0_Content_ctl5")->click(); + $this->assertNotVisible('ctl0_Content_ctl0'); + $this->assertNotVisible('ctl0_Content_ctl2'); + $this->assertVisible('ctl0_Content_ctl4'); // verify the third validation is passed - $this->verifyTextPresent('Button3 is clicked'); - $this->verifyTextNotPresent('Button3 is clicked and valid'); + $this->assertContains('Button3 is clicked', $this->source()); + $this->assertNotContains('Button3 is clicked and valid', $this->source()); $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'); + $this->byId("ctl0_Content_ctl5")->click(); + $this->assertNotVisible('ctl0_Content_ctl0'); + $this->assertNotVisible('ctl0_Content_ctl2'); + $this->assertNotVisible('ctl0_Content_ctl4'); + $this->assertContains('Button3 is clicked and valid', $this->source()); } } diff --git a/tests/FunctionalTests/validators/tests/CompareValidatorTestCase.php b/tests/FunctionalTests/validators/tests/CompareValidatorTestCase.php index 187351c1..bdc2e4a9 100755 --- a/tests/FunctionalTests/validators/tests/CompareValidatorTestCase.php +++ b/tests/FunctionalTests/validators/tests/CompareValidatorTestCase.php @@ -1,42 +1,42 @@ <?php //New Test -class CompareValidatorTestCase extends PradoGenericSeleniumTest +class CompareValidatorTestCase extends PradoGenericSelenium2Test { function test() { $base = "ctl0_Content_"; - - $this->open("validators/index.php?page=CompareValidator", ""); - $this->verifyTextPresent("Prado CompareValidator Tests", ""); + + $this->url("validators/index.php?page=CompareValidator"); + $this->assertContains("Prado CompareValidator Tests", $this->source()); $this->type("{$base}text1", "qwe"); $this->assertNotVisible("{$base}validator1"); $this->assertNotVisible("{$base}validator2"); - - $this->click("//input[@type='submit' and @value='Test']", ""); + + $this->byXPath("//input[@type='submit' and @value='Test']")->click(); $this->type("{$base}text2", "1234"); - $this->click("//input[@type='submit' and @value='Test']", ""); + $this->byXPath("//input[@type='submit' and @value='Test']")->click(); $this->assertVisible("{$base}validator1"); $this->type("{$base}text2", "qwe"); - $this->clickAndWait("//input[@type='submit' and @value='Test']", ""); + $this->byXPath("//input[@type='submit' and @value='Test']")->click(); $this->assertNotVisible("{$base}validator1"); $this->assertNotVisible("{$base}validator2"); - + $this->type("{$base}text3", "12312"); - $this->click("//input[@type='submit' and @value='Test']", ""); + $this->byXPath("//input[@type='submit' and @value='Test']")->click(); $this->assertVisible("{$base}validator2"); - + $this->type("{$base}text3", "13/1/2005"); $this->assertVisible("{$base}validator2"); - + $this->type("{$base}text3", "12/1/2005"); - $this->clickAndWait("//input[@type='submit' and @value='Test']", ""); - + $this->byXPath("//input[@type='submit' and @value='Test']")->click(); + $this->assertNotVisible("{$base}validator1"); $this->assertNotVisible("{$base}validator2"); diff --git a/tests/FunctionalTests/validators/tests/ConditionalValidationTestCase.php b/tests/FunctionalTests/validators/tests/ConditionalValidationTestCase.php index 02b174ef..32e79a90 100755 --- a/tests/FunctionalTests/validators/tests/ConditionalValidationTestCase.php +++ b/tests/FunctionalTests/validators/tests/ConditionalValidationTestCase.php @@ -1,52 +1,52 @@ <?php -class ConditionalValidationTestCase extends PradoGenericSeleniumTest +class ConditionalValidationTestCase extends PradoGenericSelenium2Test { function test() { $base = "ctl0_Content_"; - $this->open("validators/index.php?page=ConditionalValidation", ""); - $this->verifyTextPresent("Conditional Validation (clientside + server side)", ""); - $this->assertNotVisible("{$base}validator1", ""); - $this->assertNotVisible("{$base}validator2", ""); + $this->url("validators/index.php?page=ConditionalValidation"); + $this->assertContains("Conditional Validation (clientside + server side)", $this->source()); + $this->assertNotVisible("{$base}validator1"); + $this->assertNotVisible("{$base}validator2"); - $this->click("{$base}submit1"); - $this->assertVisible("{$base}validator1", ""); - $this->assertNotVisible("{$base}validator2", ""); + $this->byId("{$base}submit1")->click(); + $this->assertVisible("{$base}validator1"); + $this->assertNotVisible("{$base}validator2"); - $this->click("{$base}check1"); - $this->click("{$base}submit1"); - $this->assertVisible("{$base}validator1", ""); - $this->assertVisible("{$base}validator2", ""); + $this->byId("{$base}check1")->click(); + $this->byId("{$base}submit1")->click(); + $this->assertVisible("{$base}validator1"); + $this->assertVisible("{$base}validator2"); - $this->click("{$base}check1"); - $this->click("{$base}submit1"); - $this->assertVisible("{$base}validator1", ""); - $this->assertNotVisible("{$base}validator2", ""); + $this->byId("{$base}check1")->click(); + $this->byId("{$base}submit1")->click(); + $this->assertVisible("{$base}validator1"); + $this->assertNotVisible("{$base}validator2"); $this->type("{$base}text1", "testing"); - $this->clickAndWait("{$base}submit1"); - $this->assertNotVisible("{$base}validator1", ""); - $this->assertNotVisible("{$base}validator2", ""); + $this->byId("{$base}submit1")->click(); + $this->assertNotVisible("{$base}validator1"); + $this->assertNotVisible("{$base}validator2"); $this->type("{$base}text1" ,""); - $this->click("{$base}check1"); - $this->click("{$base}submit1"); - $this->assertVisible("{$base}validator1", ""); - $this->assertVisible("{$base}validator2", ""); + $this->byId("{$base}check1")->click(); + $this->byId("{$base}submit1")->click(); + $this->assertVisible("{$base}validator1"); + $this->assertVisible("{$base}validator2"); $this->type("{$base}text1", "test"); $this->type("{$base}text2", "123"); - $this->clickAndWait("{$base}submit1"); - $this->assertNotVisible("{$base}validator1", ""); - $this->assertNotVisible("{$base}validator2", ""); + $this->byId("{$base}submit1")->click(); + $this->assertNotVisible("{$base}validator1"); + $this->assertNotVisible("{$base}validator2"); - $this->click("{$base}check1"); + $this->byId("{$base}check1")->click(); $this->type("{$base}text1", ""); $this->type("{$base}text2", ""); - $this->click("{$base}submit1"); - $this->assertVisible("{$base}validator1", ""); - $this->assertNotVisible("{$base}validator2", ""); + $this->byId("{$base}submit1")->click(); + $this->assertVisible("{$base}validator1"); + $this->assertNotVisible("{$base}validator2"); } diff --git a/tests/FunctionalTests/validators/tests/CustomValidatorTestCase.php b/tests/FunctionalTests/validators/tests/CustomValidatorTestCase.php index 106f7a00..ca48a453 100755 --- a/tests/FunctionalTests/validators/tests/CustomValidatorTestCase.php +++ b/tests/FunctionalTests/validators/tests/CustomValidatorTestCase.php @@ -1,18 +1,18 @@ <?php //New Test -class CustomValidatorTestCase extends PradoGenericSeleniumTest +class CustomValidatorTestCase extends PradoGenericSelenium2Test { function test() { $base = "ctl0_Content_"; - $this->open("validators/index.php?page=CustomValidator", ""); - $this->assertTextPresent("Prado CustomValidator Tests", ""); + $this->url("validators/index.php?page=CustomValidator"); + $this->assertContains("Prado CustomValidator Tests", $this->source()); $this->assertNotVisible("{$base}validator1"); - $this->click("//input[@type='submit' and @value='Test']", ""); + $this->byXPath("//input[@type='submit' and @value='Test']")->click(); $this->assertVisible("{$base}validator1"); - + $this->type("{$base}text1", "Prado"); $this->pause(250); $this->assertNotVisible("{$base}validator1"); @@ -22,7 +22,7 @@ class CustomValidatorTestCase extends PradoGenericSeleniumTest $this->type("{$base}text1", "Prado"); $this->pause(250); $this->assertNotVisible("{$base}validator1"); - $this->clickAndWait("//input[@type='submit' and @value='Test']", ""); + $this->byXPath("//input[@type='submit' and @value='Test']")->click(); $this->assertNotVisible("{$base}validator1"); } diff --git a/tests/FunctionalTests/validators/tests/DataTypeValidatorTestCase.php b/tests/FunctionalTests/validators/tests/DataTypeValidatorTestCase.php index 7ec220f0..cad00f1f 100755 --- a/tests/FunctionalTests/validators/tests/DataTypeValidatorTestCase.php +++ b/tests/FunctionalTests/validators/tests/DataTypeValidatorTestCase.php @@ -3,16 +3,15 @@ * Created on 25/04/2006 */ -class DataTypeValidatorTestCase extends PradoGenericSeleniumTest +class DataTypeValidatorTestCase extends PradoGenericSelenium2Test { function test() { - $this->setSpeed(500); $base = "ctl0_Content_"; - $this->open("validators/index.php?page=DataTypeValidator", ""); - $this->verifyTextPresent("Data Type Validator Tests", ""); - $this->click("//input[@type='submit' and @value='submit!']", ""); - + $this->url("validators/index.php?page=DataTypeValidator"); + $this->assertContains("Data Type Validator Tests", $this->source()); + $this->byXPath("//input[@type='submit' and @value='submit!']")->click(); + $this->assertNotVisible("{$base}validator1"); $this->assertNotVisible("{$base}validator2"); $this->assertNotVisible("{$base}validator3"); @@ -20,31 +19,30 @@ class DataTypeValidatorTestCase extends PradoGenericSeleniumTest $this->type("{$base}textbox1", "a"); $this->type("{$base}textbox2", "b"); $this->type("{$base}textbox3", "c"); - $this->click("//input[@type='submit' and @value='submit!']", ""); + $this->byXPath("//input[@type='submit' and @value='submit!']")->click(); $this->assertVisible("{$base}validator1"); $this->assertVisible("{$base}validator2"); $this->assertVisible("{$base}validator3"); - + $this->type("{$base}textbox1", "12"); $this->type("{$base}textbox2", "12.5"); $this->type("{$base}textbox3", "2/10/2005"); - $this->clickAndWait("//input[@type='submit' and @value='submit!']", ""); - + $this->byXPath("//input[@type='submit' and @value='submit!']")->click(); + $this->assertNotVisible("{$base}validator1"); $this->assertNotVisible("{$base}validator2"); $this->assertNotVisible("{$base}validator3"); - + $this->type("{$base}textbox1", "12.2"); $this->type("{$base}textbox2", "-12.5"); $this->type("{$base}textbox3", "2/13/2005"); - $this->click("//input[@type='submit' and @value='submit!']", ""); - + $this->byXPath("//input[@type='submit' and @value='submit!']")->click(); + $this->assertVisible("{$base}validator1"); $this->assertNotVisible("{$base}validator2"); $this->assertVisible("{$base}validator3"); - $this->setSpeed(0); } - -} + +} diff --git a/tests/FunctionalTests/validators/tests/DatePickerTestCase.php b/tests/FunctionalTests/validators/tests/DatePickerTestCase.php index e7425a33..ab68a619 100755 --- a/tests/FunctionalTests/validators/tests/DatePickerTestCase.php +++ b/tests/FunctionalTests/validators/tests/DatePickerTestCase.php @@ -1,70 +1,68 @@ <?php -class DatePickerTestCase extends PradoGenericSeleniumTest +class DatePickerTestCase extends PradoGenericSelenium2Test { function test() { $year=2012; $year2=2013; $base = "ctl0_Content_"; - $this->open("validators/index.php?page=DatePicker", ""); - $this->verifyTextPresent("Date Picker validation Test", ""); - $this->assertNotVisible("{$base}validator1", ""); - $this->assertNotVisible("{$base}validator2", ""); - $this->assertNotVisible("{$base}validator4", ""); - $this->assertNotVisible("{$base}validator5", ""); - $this->assertNotVisible("{$base}validator6", ""); - $this->assertNotVisible("{$base}validator8", ""); + $this->url("validators/index.php?page=DatePicker"); + $this->assertContains("Date Picker validation Test", $this->source()); + $this->assertNotVisible("{$base}validator1"); + $this->assertNotVisible("{$base}validator2"); + $this->assertNotVisible("{$base}validator4"); + $this->assertNotVisible("{$base}validator5"); + $this->assertNotVisible("{$base}validator6"); + $this->assertNotVisible("{$base}validator8"); - $this->click("{$base}submit1"); - $this->assertVisible("{$base}validator1", ""); - $this->assertNotVisible("{$base}validator2", ""); + $this->byId("{$base}submit1")->click(); + $this->assertVisible("{$base}validator1"); + $this->assertNotVisible("{$base}validator2"); //the range validator is visible because the date is a drop down list //thus has default value != "" - $this->assertVisible("{$base}validator4", ""); - $this->assertVisible("{$base}validator5", ""); - $this->assertNotVisible("{$base}validator6", ""); - $this->assertVisible("{$base}validator8", ""); + $this->assertVisible("{$base}validator4"); + $this->assertVisible("{$base}validator5"); + $this->assertNotVisible("{$base}validator6"); + $this->assertVisible("{$base}validator8"); - $this->click("{$base}submit1"); - $this->pause(250); $this->type("{$base}picker1", "13/4/$year"); - $this->select("{$base}picker2_month", "label=9"); - $this->select("{$base}picker2_day", "label=10"); - $this->select("{$base}picker2_year", "label=$year"); + $this->select("{$base}picker2_month", "9"); + $this->select("{$base}picker2_day", "10"); + $this->select("{$base}picker2_year", "$year"); $this->pause(250); $this->type("{$base}picker3", "14/4/$year"); $this->pause(250); $this->type("{$base}picker4", "7/4/$year"); - $this->select("{$base}picker5_day", "label=6"); - $this->select("{$base}picker5_month", "label=3"); - $this->select("{$base}picker5_year", "label=$year2"); - $this->select("{$base}picker6_month", "label=3"); - $this->select("{$base}picker6_year", "label=$year2"); - $this->select("{$base}picker6_day", "label=5"); - - $this->click("{$base}submit1"); + $this->select("{$base}picker5_day", "6"); + $this->select("{$base}picker5_month", "3"); + $this->select("{$base}picker5_year", "$year2"); + $this->select("{$base}picker6_month", "3"); + $this->select("{$base}picker6_year", "$year2"); + $this->select("{$base}picker6_day", "5"); + $this->byId("{$base}submit1")->click(); + $this->pause(500); - $this->assertNotVisible("{$base}validator1", ""); - $this->assertVisible("{$base}validator2", ""); - $this->assertNotVisible("{$base}validator4", ""); - $this->assertNotVisible("{$base}validator5", ""); - $this->assertVisible("{$base}validator6", ""); - $this->assertVisible("{$base}validator8", ""); + $this->assertNotVisible("{$base}validator1"); + $this->assertVisible("{$base}validator2"); + $this->assertNotVisible("{$base}validator4"); + $this->assertNotVisible("{$base}validator5"); + $this->assertVisible("{$base}validator6"); + $this->assertVisible("{$base}validator8"); $this->type("{$base}picker1", "20/4/$year2"); $this->type("{$base}picker4", "29/4/$year"); - $this->select("{$base}picker6_day", "label=10"); + $this->select("{$base}picker6_day", "10"); - $this->clickAndWait("{$base}submit1"); + $this->byId("{$base}submit1")->click(); - $this->assertNotVisible("{$base}validator1", ""); - $this->assertNotVisible("{$base}validator2", ""); - $this->assertNotVisible("{$base}validator4", ""); - $this->assertNotVisible("{$base}validator5", ""); - $this->assertNotVisible("{$base}validator6", ""); - $this->assertNotVisible("{$base}validator8", ""); + $this->assertNotVisible("{$base}validator1"); + $this->assertNotVisible("{$base}validator2"); + $this->assertNotVisible("{$base}validator4"); + $this->assertNotVisible("{$base}validator5"); + $this->assertNotVisible("{$base}validator6"); + $this->assertNotVisible("{$base}validator8"); } } diff --git a/tests/FunctionalTests/validators/tests/ImageButtonTestCase.php b/tests/FunctionalTests/validators/tests/ImageButtonTestCase.php index e6b5d6d8..800e36ff 100755 --- a/tests/FunctionalTests/validators/tests/ImageButtonTestCase.php +++ b/tests/FunctionalTests/validators/tests/ImageButtonTestCase.php @@ -1,63 +1,63 @@ <?php -class ImageButtonTestCase extends PradoGenericSeleniumTest +class ImageButtonTestCase extends PradoGenericSelenium2Test { function test() { - $this->open('validators/index.php?page=ImageButton'); + $this->url('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'); + $this->assertNotVisible('ctl0_Content_ctl0'); + $this->assertNotVisible('ctl0_Content_ctl2'); + $this->assertNotVisible('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'); + $this->byId("ctl0_Content_ctl1")->click(); + $this->assertVisible('ctl0_Content_ctl0'); + $this->assertNotVisible('ctl0_Content_ctl2'); + $this->assertNotVisible('ctl0_Content_ctl4'); // verify the first validation is passed $this->pause(500); - $this->verifyTextNotPresent('Button1 is clicked'); + $this->assertNotContains('Button1 is clicked', $this->source()); $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'); + $this->byId("ctl0_Content_ctl1")->click(); + $this->assertNotVisible('ctl0_Content_ctl0'); + $this->assertNotVisible('ctl0_Content_ctl2'); + $this->assertNotVisible('ctl0_Content_ctl4'); + $this->assertContains('Button1 is clicked and valid', $this->source()); // 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'); + $this->byId("ctl0_Content_ctl3")->click(); + $this->assertNotVisible('ctl0_Content_ctl0'); + $this->assertVisible('ctl0_Content_ctl2'); + $this->assertNotVisible('ctl0_Content_ctl4'); // verify the second validation is passed $this->pause(500); - $this->verifyTextNotPresent('Button2 is clicked'); + $this->assertNotContains('Button2 is clicked', $this->source()); $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'); + $this->byId("ctl0_Content_ctl3")->click(); + $this->assertNotVisible('ctl0_Content_ctl0'); + $this->assertNotVisible('ctl0_Content_ctl2'); + $this->assertNotVisible('ctl0_Content_ctl4'); + $this->assertContains('Button2 is clicked and valid', $this->source()); // 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'); + $this->byId("ctl0_Content_ctl5")->click(); + $this->assertNotVisible('ctl0_Content_ctl0'); + $this->assertNotVisible('ctl0_Content_ctl2'); + $this->assertVisible('ctl0_Content_ctl4'); // verify the third validation is passed - $this->verifyTextPresent('Button3 is clicked'); - $this->verifyTextNotPresent('Button3 is clicked and valid'); + $this->assertContains('Button3 is clicked', $this->source()); + $this->assertNotContains('Button3 is clicked and valid', $this->source()); $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'); + $this->byId("ctl0_Content_ctl5")->click(); + $this->assertNotVisible('ctl0_Content_ctl0'); + $this->assertNotVisible('ctl0_Content_ctl2'); + $this->assertNotVisible('ctl0_Content_ctl4'); + $this->assertContains('Button3 is clicked and valid', $this->source()); } } diff --git a/tests/FunctionalTests/validators/tests/LinkButtonTestCase.php b/tests/FunctionalTests/validators/tests/LinkButtonTestCase.php index b523452c..394556e9 100755 --- a/tests/FunctionalTests/validators/tests/LinkButtonTestCase.php +++ b/tests/FunctionalTests/validators/tests/LinkButtonTestCase.php @@ -1,62 +1,62 @@ <?php -class LinkButtonTestCase extends PradoGenericSeleniumTest +class LinkButtonTestCase extends PradoGenericSelenium2Test { function test() { - $this->open('validators/index.php?page=LinkButton'); + $this->url('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'); + $this->assertNotVisible('ctl0_Content_ctl0'); + $this->assertNotVisible('ctl0_Content_ctl2'); + $this->assertNotVisible('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'); + $this->byId("ctl0_Content_ctl1")->click(); + $this->assertVisible('ctl0_Content_ctl0'); + $this->assertNotVisible('ctl0_Content_ctl2'); + $this->assertNotVisible('ctl0_Content_ctl4'); // verify the first validation is passed $this->pause(500); - $this->verifyTextNotPresent('Button1 is clicked'); + $this->assertNotContains('Button1 is clicked', $this->source()); $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'); + $this->byId("ctl0_Content_ctl1")->click(); + $this->assertNotVisible('ctl0_Content_ctl0'); + $this->assertNotVisible('ctl0_Content_ctl2'); + $this->assertNotVisible('ctl0_Content_ctl4'); + $this->assertContains('Button1 is clicked and valid', $this->source()); // 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'); + $this->byId("ctl0_Content_ctl3")->click(); + $this->assertNotVisible('ctl0_Content_ctl0'); + $this->assertVisible('ctl0_Content_ctl2'); + $this->assertNotVisible('ctl0_Content_ctl4'); // verify the second validation is passed $this->pause(500); - $this->verifyTextNotPresent('Button2 is clicked'); + $this->assertNotContains('Button2 is clicked', $this->source()); $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'); + $this->byId("ctl0_Content_ctl3")->click(); + $this->assertNotVisible('ctl0_Content_ctl0'); + $this->assertNotVisible('ctl0_Content_ctl2'); + $this->assertNotVisible('ctl0_Content_ctl4'); + $this->assertContains('Button2 is clicked and valid', $this->source()); // 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'); + $this->byId("ctl0_Content_ctl5")->click(); + $this->assertNotVisible('ctl0_Content_ctl0'); + $this->assertNotVisible('ctl0_Content_ctl2'); + $this->assertVisible('ctl0_Content_ctl4'); // verify the third validation is passed - $this->verifyTextPresent('Button3 is clicked'); - $this->verifyTextNotPresent('Button3 is clicked and valid'); + $this->assertContains('Button3 is clicked', $this->source()); + $this->assertNotContains('Button3 is clicked and valid', $this->source()); $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'); + $this->byId("ctl0_Content_ctl5")->click(); + $this->assertNotVisible('ctl0_Content_ctl0'); + $this->assertNotVisible('ctl0_Content_ctl2'); + $this->assertNotVisible('ctl0_Content_ctl4'); + $this->assertContains('Button3 is clicked and valid', $this->source()); } } diff --git a/tests/FunctionalTests/validators/tests/ListControlTestCase.php b/tests/FunctionalTests/validators/tests/ListControlTestCase.php index 68feee84..55e370c5 100755 --- a/tests/FunctionalTests/validators/tests/ListControlTestCase.php +++ b/tests/FunctionalTests/validators/tests/ListControlTestCase.php @@ -3,38 +3,39 @@ * Created on 24/04/2006 */ -class ListControlTestCase extends PradoGenericSeleniumTest +class ListControlTestCase extends PradoGenericSelenium2Test { function test() { $base = "ctl0_Content_"; - $this->open("validators/index.php?page=ListControl", ""); - $this->verifyTextPresent("List Control Required Field Validation Test", ""); - $this->click("//input[@type='submit' and @value='Submit!']", ""); + $this->url("validators/index.php?page=ListControl"); + $this->assertContains("List Control Required Field Validation Test", $this->source()); + $this->byXPath("//input[@type='submit' and @value='Submit!']")->click(); $this->assertVisible("{$base}validator1"); $this->assertVisible("{$base}validator2"); $this->assertVisible("{$base}validator3"); $this->assertVisible("{$base}validator4"); - $this->click("//input[@id='{$base}list1_c1' and @value='Red']", ""); - $this->select("{$base}list2", "label=Red"); - $this->select("{$base}list3", "label=Blue"); - $this->click("{$base}list4_c3", ""); - $this->clickAndWait("//input[@type='submit' and @value='Submit!']", ""); + $this->byXPath("//input[@id='{$base}list1_c1' and @value='Red']")->click(); + $this->select("{$base}list2", "Red"); + $this->select("{$base}list3", "Blue"); + $this->byId("{$base}list4_c3")->click(); + $this->byXPath("//input[@type='submit' and @value='Submit!']")->click(); $this->assertNotVisible("{$base}validator1"); $this->assertNotVisible("{$base}validator2"); $this->assertNotVisible("{$base}validator3"); $this->assertNotVisible("{$base}validator4"); - $this->select("{$base}list3", "label=Don't select this one"); - $this->click("{$base}list4_c0"); - $this->select("{$base}list2", "label=--- Select a color ---"); - $this->click("//input[@type='submit' and @value='Submit!']", ""); - $this->click("//input[@id='{$base}list1_c1' and @value='Red']", ""); - $this->click("//input[@id='{$base}list1_c0' and @value='Select a color below']", ""); - $this->click("//input[@type='submit' and @value='Submit!']", ""); + //invalid selector: Unable to locate an element with the xpath expression .//option[.='Don\'t select this one'] because of the following error: SyntaxError: Failed to execute 'evaluate' on 'Document': The string './/option[.='Don\'t select this one']' is not a valid XPath expression. + $this->select("{$base}list3", "Dont select this one"); + $this->byId("{$base}list4_c0")->click(); + $this->select("{$base}list2", "--- Select a color ---"); + $this->byXPath("//input[@type='submit' and @value='Submit!']")->click(); + $this->byXPath("//input[@id='{$base}list1_c1' and @value='Red']")->click(); + $this->byXPath("//input[@id='{$base}list1_c0' and @value='Select a color below']")->click(); + $this->byXPath("//input[@type='submit' and @value='Submit!']")->click(); $this->assertVisible("{$base}validator1"); $this->assertVisible("{$base}validator2"); diff --git a/tests/FunctionalTests/validators/tests/RangeValidatorTestCase.php b/tests/FunctionalTests/validators/tests/RangeValidatorTestCase.php index 022ee7f6..485c6a24 100755 --- a/tests/FunctionalTests/validators/tests/RangeValidatorTestCase.php +++ b/tests/FunctionalTests/validators/tests/RangeValidatorTestCase.php @@ -1,166 +1,166 @@ <?php //New Test -class RangeValidatorTestCase extends PradoGenericSeleniumTest +class RangeValidatorTestCase extends PradoGenericSelenium2Test { function testIntegerRange() { $base = "ctl0_Content_"; - $this->open("validators/index.php?page=RangeValidatorInteger", ""); - $this->verifyTextPresent("Prado RangeValidator Tests Integer", ""); - + $this->url("validators/index.php?page=RangeValidatorInteger"); + $this->assertContains("Prado RangeValidator Tests Integer", $this->source()); + //between 1 and 4 $this->type("{$base}text1", "ad"); - $this->assertNotVisible("{$base}validator1", ""); - $this->click("//input[@type='submit' and @value='Test']", ""); - $this->assertVisible("{$base}validator1", ""); + $this->assertNotVisible("{$base}validator1"); + $this->byXPath("//input[@type='submit' and @value='Test']")->click(); + $this->assertVisible("{$base}validator1"); $this->type("{$base}text1", "12"); - $this->click("//input[@type='submit' and @value='Test']", ""); - $this->assertVisible("{$base}validator1", ""); + $this->byXPath("//input[@type='submit' and @value='Test']")->click(); + $this->assertVisible("{$base}validator1"); $this->type("{$base}text1", "2"); - $this->assertNotVisible("{$base}validator1", ""); - $this->clickAndWait("//input[@type='submit' and @value='Test']", ""); - $this->assertNotVisible("{$base}validator1", ""); - - + $this->assertNotVisible("{$base}validator1"); + $this->byXPath("//input[@type='submit' and @value='Test']")->click(); + $this->assertNotVisible("{$base}validator1"); + + // >= 2 - $this->assertNotVisible("{$base}validator2", ""); + $this->assertNotVisible("{$base}validator2"); $this->type("{$base}text2", "1"); - $this->click("//input[@type='submit' and @value='Test']", ""); - $this->assertVisible("{$base}validator2", ""); + $this->byXPath("//input[@type='submit' and @value='Test']")->click(); + $this->assertVisible("{$base}validator2"); $this->type("{$base}text2", "10"); - $this->clickAndWait("//input[@type='submit' and @value='Test']", ""); - $this->assertNotVisible("{$base}validator2", ""); + $this->byXPath("//input[@type='submit' and @value='Test']")->click(); + $this->assertNotVisible("{$base}validator2"); // <= 20 - $this->assertNotVisible("{$base}validator3", ""); + $this->assertNotVisible("{$base}validator3"); $this->type("{$base}text3", "100"); - $this->click("//input[@type='submit' and @value='Test']", ""); - $this->assertVisible("{$base}validator3", ""); + $this->byXPath("//input[@type='submit' and @value='Test']")->click(); + $this->assertVisible("{$base}validator3"); $this->type("{$base}text3", "10"); - $this->clickAndWait("//input[@type='submit' and @value='Test']", ""); - $this->assertNotVisible("{$base}validator3", ""); + $this->byXPath("//input[@type='submit' and @value='Test']")->click(); + $this->assertNotVisible("{$base}validator3"); } - + function testFloatRange() { $base = "ctl0_Content_"; - $this->open("validators/index.php?page=RangeValidatorFloat", ""); - $this->verifyTextPresent("Prado RangeValidator Tests Float", ""); - + $this->url("validators/index.php?page=RangeValidatorFloat"); + $this->assertContains("Prado RangeValidator Tests Float", $this->source()); + //between 1 and 4 $this->type("{$base}text1", "ad"); - $this->assertNotVisible("{$base}validator1", ""); - $this->click("//input[@type='submit' and @value='Test']", ""); - $this->assertVisible("{$base}validator1", ""); + $this->assertNotVisible("{$base}validator1"); + $this->byXPath("//input[@type='submit' and @value='Test']")->click(); + $this->assertVisible("{$base}validator1"); $this->type("{$base}text1", "12"); - $this->click("//input[@type='submit' and @value='Test']", ""); - $this->assertVisible("{$base}validator1", ""); + $this->byXPath("//input[@type='submit' and @value='Test']")->click(); + $this->assertVisible("{$base}validator1"); $this->type("{$base}text1", "2"); - $this->assertNotVisible("{$base}validator1", ""); - $this->clickAndWait("//input[@type='submit' and @value='Test']", ""); - $this->assertNotVisible("{$base}validator1", ""); - - + $this->assertNotVisible("{$base}validator1"); + $this->byXPath("//input[@type='submit' and @value='Test']")->click(); + $this->assertNotVisible("{$base}validator1"); + + // >= 2 - $this->assertNotVisible("{$base}validator2", ""); + $this->assertNotVisible("{$base}validator2"); $this->type("{$base}text2", "1"); - $this->click("//input[@type='submit' and @value='Test']", ""); - $this->assertVisible("{$base}validator2", ""); + $this->byXPath("//input[@type='submit' and @value='Test']")->click(); + $this->assertVisible("{$base}validator2"); $this->type("{$base}text2", "10"); - $this->clickAndWait("//input[@type='submit' and @value='Test']", ""); - $this->assertNotVisible("{$base}validator2", ""); + $this->byXPath("//input[@type='submit' and @value='Test']")->click(); + $this->assertNotVisible("{$base}validator2"); // <= 20 - $this->assertNotVisible("{$base}validator3", ""); + $this->assertNotVisible("{$base}validator3"); $this->type("{$base}text3", "100"); - $this->click("//input[@type='submit' and @value='Test']", ""); - $this->assertVisible("{$base}validator3", ""); + $this->byXPath("//input[@type='submit' and @value='Test']")->click(); + $this->assertVisible("{$base}validator3"); $this->type("{$base}text3", "10"); - $this->clickAndWait("//input[@type='submit' and @value='Test']", ""); - $this->assertNotVisible("{$base}validator3", ""); + $this->byXPath("//input[@type='submit' and @value='Test']")->click(); + $this->assertNotVisible("{$base}validator3"); } - + function testDateRange() { $base = "ctl0_Content_"; - $this->open("validators/index.php?page=RangeValidatorDate", ""); - $this->verifyTextPresent("Prado RangeValidator Tests Date", ""); - + $this->url("validators/index.php?page=RangeValidatorDate"); + $this->assertContains("Prado RangeValidator Tests Date", $this->source()); + //between 22/1/2005 and 3/2/2005 $this->type("{$base}text1", "ad"); - $this->assertNotVisible("{$base}validator1", ""); - $this->click("//input[@type='submit' and @value='Test']", ""); - $this->assertVisible("{$base}validator1", ""); + $this->assertNotVisible("{$base}validator1"); + $this->byXPath("//input[@type='submit' and @value='Test']")->click(); + $this->assertVisible("{$base}validator1"); $this->type("{$base}text1", "27/2/2005"); - $this->click("//input[@type='submit' and @value='Test']", ""); - $this->assertVisible("{$base}validator1", ""); + $this->byXPath("//input[@type='submit' and @value='Test']")->click(); + $this->assertVisible("{$base}validator1"); $this->type("{$base}text1", "1/2/2005"); - $this->clickAndWait("//input[@type='submit' and @value='Test']", ""); - $this->assertNotVisible("{$base}validator1", ""); - $this->clickAndWait("//input[@type='submit' and @value='Test']", ""); - $this->assertNotVisible("{$base}validator1", ""); - - + $this->byXPath("//input[@type='submit' and @value='Test']")->click(); + $this->assertNotVisible("{$base}validator1"); + $this->byXPath("//input[@type='submit' and @value='Test']")->click(); + $this->assertNotVisible("{$base}validator1"); + + // >= 22/1/2005 - $this->assertNotVisible("{$base}validator2", ""); + $this->assertNotVisible("{$base}validator2"); $this->type("{$base}text2", "1/1/2005"); - $this->click("//input[@type='submit' and @value='Test']", ""); + $this->byXPath("//input[@type='submit' and @value='Test']")->click(); $this->pause(250); - $this->assertVisible("{$base}validator2", ""); + $this->assertVisible("{$base}validator2"); $this->type("{$base}text2", "1/4/2005"); - $this->clickAndWait("//input[@type='submit' and @value='Test']", ""); - $this->assertNotVisible("{$base}validator2", ""); + $this->byXPath("//input[@type='submit' and @value='Test']")->click(); + $this->assertNotVisible("{$base}validator2"); // <= 3/2/2005 - $this->assertNotVisible("{$base}validator3", ""); + $this->assertNotVisible("{$base}validator3"); $this->type("{$base}text3", "4/5/2005"); - $this->click("//input[@type='submit' and @value='Test']", ""); + $this->byXPath("//input[@type='submit' and @value='Test']")->click(); $this->pause(250); - $this->assertVisible("{$base}validator3", ""); + $this->assertVisible("{$base}validator3"); $this->type("{$base}text3", "1/2/2005"); - $this->clickAndWait("//input[@type='submit' and @value='Test']", ""); - $this->assertNotVisible("{$base}validator3", ""); - } - + $this->byXPath("//input[@type='submit' and @value='Test']")->click(); + $this->assertNotVisible("{$base}validator3"); + } + function testStringRange() { $base = "ctl0_Content_"; - $this->open("validators/index.php?page=RangeValidatorString", ""); - $this->verifyTextPresent("Prado RangeValidator Tests String", ""); - + $this->url("validators/index.php?page=RangeValidatorString"); + $this->assertContains("Prado RangeValidator Tests String", $this->source()); + //between 'd' and 'y' $this->type("{$base}text1", "a"); - $this->assertNotVisible("{$base}validator1", ""); - $this->click("//input[@type='submit' and @value='Test']", ""); - $this->assertVisible("{$base}validator1", ""); + $this->assertNotVisible("{$base}validator1"); + $this->byXPath("//input[@type='submit' and @value='Test']")->click(); + $this->assertVisible("{$base}validator1"); $this->type("{$base}text1", "b"); - $this->click("//input[@type='submit' and @value='Test']", ""); - $this->assertVisible("{$base}validator1", ""); + $this->byXPath("//input[@type='submit' and @value='Test']")->click(); + $this->assertVisible("{$base}validator1"); $this->type("{$base}text1", "f"); - $this->assertNotVisible("{$base}validator1", ""); - $this->clickAndWait("//input[@type='submit' and @value='Test']", ""); - $this->assertNotVisible("{$base}validator1", ""); - - + $this->assertNotVisible("{$base}validator1"); + $this->byXPath("//input[@type='submit' and @value='Test']")->click(); + $this->assertNotVisible("{$base}validator1"); + + // >= 'd' - $this->assertNotVisible("{$base}validator2", ""); + $this->assertNotVisible("{$base}validator2"); $this->type("{$base}text2", "a"); - $this->click("//input[@type='submit' and @value='Test']", ""); - $this->assertVisible("{$base}validator2", ""); + $this->byXPath("//input[@type='submit' and @value='Test']")->click(); + $this->assertVisible("{$base}validator2"); $this->type("{$base}text2", "g"); - $this->clickAndWait("//input[@type='submit' and @value='Test']", ""); - $this->assertNotVisible("{$base}validator2", ""); + $this->byXPath("//input[@type='submit' and @value='Test']")->click(); + $this->assertNotVisible("{$base}validator2"); // <= 'y' - $this->assertNotVisible("{$base}validator3", ""); + $this->assertNotVisible("{$base}validator3"); $this->type("{$base}text3", "z"); - $this->click("//input[@type='submit' and @value='Test']", ""); - $this->assertVisible("{$base}validator3", ""); + $this->byXPath("//input[@type='submit' and @value='Test']")->click(); + $this->assertVisible("{$base}validator3"); $this->type("{$base}text3", "t"); - $this->clickAndWait("//input[@type='submit' and @value='Test']", ""); - $this->assertNotVisible("{$base}validator3", ""); - } + $this->byXPath("//input[@type='submit' and @value='Test']")->click(); + $this->assertNotVisible("{$base}validator3"); + } } diff --git a/tests/FunctionalTests/validators/tests/RegExpValidatorTestCase.php b/tests/FunctionalTests/validators/tests/RegExpValidatorTestCase.php index f269bf3b..ffa30126 100755 --- a/tests/FunctionalTests/validators/tests/RegExpValidatorTestCase.php +++ b/tests/FunctionalTests/validators/tests/RegExpValidatorTestCase.php @@ -1,32 +1,32 @@ <?php //New Test -class RegExpValidatorTestCase extends PradoGenericSeleniumTest +class RegExpValidatorTestCase extends PradoGenericSelenium2Test { function test() { $base = "ctl0_Content_"; - $this->open("validators/index.php?page=RegularExpressionValidator", ""); - $this->verifyTextPresent("Prado RegularExpressionValidator Tests", ""); - $this->assertNotVisible("{$base}validator1", ""); - $this->assertNotVisible("{$base}validator2", ""); + $this->url("validators/index.php?page=RegularExpressionValidator"); + $this->assertContains("Prado RegularExpressionValidator Tests", $this->source()); + $this->assertNotVisible("{$base}validator1"); + $this->assertNotVisible("{$base}validator2"); $this->type("{$base}text1", "1"); $this->type("{$base}text2", "2"); - $this->click("//input[@type='submit' and @value='Test']", ""); - $this->assertVisible("{$base}validator1", ""); - $this->assertVisible("{$base}validator2", ""); + $this->byXPath("//input[@type='submit' and @value='Test']")->click(); + $this->assertVisible("{$base}validator1"); + $this->assertVisible("{$base}validator2"); $this->type("{$base}text1", "asdasd"); - $this->click("//input[@type='submit' and @value='Test']", ""); - $this->assertVisible("{$base}validator1", ""); + $this->byXPath("//input[@type='submit' and @value='Test']")->click(); + $this->assertVisible("{$base}validator1"); $this->type("{$base}text1", "12345"); - $this->assertNotVisible("{$base}validator1", ""); - $this->assertVisible("{$base}validator2", ""); + $this->assertNotVisible("{$base}validator1"); + $this->assertVisible("{$base}validator2"); $this->type("{$base}text2", "wei@gmail.com"); - $this->assertNotVisible("{$base}validator1", ""); - $this->assertNotVisible("{$base}validator2", ""); - $this->clickAndWait("//input[@type='submit' and @value='Test']", ""); - $this->assertNotVisible("{$base}validator1", ""); - $this->assertNotVisible("{$base}validator2", ""); + $this->assertNotVisible("{$base}validator1"); + $this->assertNotVisible("{$base}validator2"); + $this->byXPath("//input[@type='submit' and @value='Test']")->click(); + $this->assertNotVisible("{$base}validator1"); + $this->assertNotVisible("{$base}validator2"); } } diff --git a/tests/FunctionalTests/validators/tests/RequiredFieldTestCase.php b/tests/FunctionalTests/validators/tests/RequiredFieldTestCase.php index f8b54eb0..249f5ae8 100755 --- a/tests/FunctionalTests/validators/tests/RequiredFieldTestCase.php +++ b/tests/FunctionalTests/validators/tests/RequiredFieldTestCase.php @@ -1,54 +1,54 @@ <?php -class RequiredFieldTestCase extends PradoGenericSeleniumTest +class RequiredFieldTestCase extends PradoGenericSelenium2Test { function test() { $base = "ctl0_Content_"; - $this->open("validators/index.php?page=RequiredFieldValidator"); - $this->assertTextPresent("RequiredFieldValidator Tests"); + $this->url("validators/index.php?page=RequiredFieldValidator"); + $this->assertContains("RequiredFieldValidator Tests", $this->source()); $this->assertNotVisible("{$base}validator1"); $this->assertNotVisible("{$base}validator2"); - $this->click("{$base}submit1"); + $this->byId("{$base}submit1")->click(); $this->assertVisible("{$base}validator1"); $this->assertVisible("{$base}validator2"); $this->type("{$base}text1", "testing"); - $this->click("{$base}submit1"); + $this->byId("{$base}submit1")->click(); $this->assertNotVisible("{$base}validator1"); - $this->click("{$base}submit2"); + $this->byId("{$base}submit2")->click(); $this->assertNotVisible("{$base}validator1"); $this->assertNotVisible("{$base}validator2"); $this->assertVisible("{$base}validator3"); $this->assertVisible("{$base}validator4"); $this->type("{$base}text2", "testing2"); - $this->click("{$base}submit2"); + $this->byId("{$base}submit2")->click(); $this->assertNotVisible("{$base}validator3"); - $this->click("{$base}submit3"); + $this->byId("{$base}submit3")->click(); $this->assertVisible("{$base}summary3"); - $this->clickAndWait("{$base}submit4"); + $this->byId("{$base}submit4")->click(); $this->assertNotVisible("{$base}validator1"); $this->assertNotVisible("{$base}validator2"); $this->assertNotVisible("{$base}validator3"); $this->assertNotVisible("{$base}validator4"); - $this->click("{$base}submit1"); + $this->byId("{$base}submit1")->click(); $this->assertVisible("{$base}validator2"); - $this->click("{$base}check1"); - $this->click("{$base}submit2"); + $this->byId("{$base}check1")->click(); + $this->byId("{$base}submit2")->click(); $this->assertVisible("{$base}validator4"); - $this->clickAndWait("{$base}submit1"); + $this->byId("{$base}submit1")->click(); $this->assertNotVisible("{$base}validator1"); $this->assertNotVisible("{$base}validator2"); $this->type("{$base}text1"); - $this->click("{$base}check1"); - $this->click("{$base}submit1"); + $this->byId("{$base}check1")->click(); + $this->byId("{$base}submit1")->click(); $this->assertVisible("{$base}validator1"); $this->assertVisible("{$base}validator2"); - $this->click("{$base}check2"); - $this->clickAndWait("{$base}submit2"); + $this->byId("{$base}check2")->click(); + $this->byId("{$base}submit2")->click(); $this->type("{$base}text1", "Hello"); - $this->click("{$base}check1"); - $this->click("{$base}submit2"); + $this->byId("{$base}check1")->click(); + $this->byId("{$base}submit2")->click(); $this->assertNotVisible("{$base}validator5"); $this->assertNotVisible("{$base}validator6"); @@ -56,14 +56,14 @@ class RequiredFieldTestCase extends PradoGenericSeleniumTest $this->assertNotVisible("{$base}validator8"); $this->type("{$base}text1"); $this->type("{$base}text2"); - $this->click("{$base}check1"); - $this->click("{$base}check2"); - $this->click("{$base}submit3"); + $this->byId("{$base}check1")->click(); + $this->byId("{$base}check2")->click(); + $this->byId("{$base}submit3")->click(); $this->assertVisible("{$base}validator5"); $this->assertVisible("{$base}validator6"); $this->assertVisible("{$base}validator7"); $this->assertVisible("{$base}validator8"); - $this->clickAndWait("{$base}submit4"); + $this->byId("{$base}submit4")->click(); $this->assertNotVisible("{$base}validator5"); $this->assertNotVisible("{$base}validator6"); $this->assertNotVisible("{$base}validator7"); @@ -73,10 +73,10 @@ class RequiredFieldTestCase extends PradoGenericSeleniumTest function testInitialValue() { $base = "ctl0_Content_"; - $this->open("validators/index.php?page=RequiredFieldValidator"); - $this->assertTextPresent("InitialValue Test"); + $this->url("validators/index.php?page=RequiredFieldValidator"); + $this->assertContains("InitialValue Test", $this->source()); $this->assertNotVisible("{$base}validator9"); - $this->click("{$base}submit5"); + $this->byId("{$base}submit5")->click(); $this->pause(250); $this->assertVisible("{$base}validator9"); $this->type("{$base}text5", "adasd"); diff --git a/tests/FunctionalTests/validators/tests/RequiredListTestCase.php b/tests/FunctionalTests/validators/tests/RequiredListTestCase.php index 2662c721..0de6815e 100755 --- a/tests/FunctionalTests/validators/tests/RequiredListTestCase.php +++ b/tests/FunctionalTests/validators/tests/RequiredListTestCase.php @@ -1,35 +1,35 @@ <?php -class RequiredListTestCase extends PradoGenericSeleniumTest +class RequiredListTestCase extends PradoGenericSelenium2Test { function test() { $base = "ctl0_Content_"; - $this->open("validators/index.php?page=RequiredListValidator"); - $this->click("{$base}submit1"); + $this->url("validators/index.php?page=RequiredListValidator"); + $this->byId("{$base}submit1")->click(); $this->assertVisible("{$base}validator1"); $this->assertVisible("{$base}validator2"); $this->assertVisible("{$base}validator3"); - $this->click("{$base}list1_c0"); - $this->addSelection("{$base}list2", "label=One"); - $this->addSelection("{$base}list2", "label=Two"); - $this->click("{$base}list3_c3"); - $this->clickAndWait("{$base}submit1"); + $this->byId("{$base}list1_c0")->click(); + $this->addSelection("{$base}list2", "One"); + $this->addSelection("{$base}list2", "Two"); + $this->byId("{$base}list3_c3")->click(); + $this->byId("{$base}submit1")->click(); $this->assertNotVisible("{$base}validator1"); $this->assertNotVisible("{$base}validator2"); $this->assertNotVisible("{$base}validator3"); - $this->click("{$base}list1_c1"); - $this->click("{$base}list1_c2"); - $this->click("{$base}list1_c3"); - $this->addSelection("{$base}list2", "label=Two"); - $this->click("{$base}list1_c3"); - $this->clickAndWait("{$base}submit1"); + $this->byId("{$base}list1_c1")->click(); + $this->byId("{$base}list1_c2")->click(); + $this->byId("{$base}list1_c3")->click(); + $this->addSelection("{$base}list2", "Two"); + $this->byId("{$base}list1_c3")->click(); + $this->byId("{$base}submit1")->click(); $this->assertNotVisible("{$base}validator1"); $this->assertNotVisible("{$base}validator2"); $this->assertNotVisible("{$base}validator3"); - $this->click("{$base}list3_c3"); - $this->clickAndWait("{$base}submit1"); + $this->byId("{$base}list3_c3")->click(); + $this->byId("{$base}submit1")->click(); $this->pause(200); $this->assertNotVisible("{$base}validator1"); $this->assertNotVisible("{$base}validator2"); diff --git a/tests/FunctionalTests/validators/tests/ValidationSummaryTestCase.php b/tests/FunctionalTests/validators/tests/ValidationSummaryTestCase.php index 7dc1d6b1..d4c44a34 100755 --- a/tests/FunctionalTests/validators/tests/ValidationSummaryTestCase.php +++ b/tests/FunctionalTests/validators/tests/ValidationSummaryTestCase.php @@ -1,46 +1,46 @@ <?php //New Test -class ValidationSummaryTestCase extends PradoGenericSeleniumTest +class ValidationSummaryTestCase extends PradoGenericSelenium2Test { function test() { $base = "ctl0_Content_"; - - $this->open("validators/index.php?page=ValidationSummary", ""); - $this->verifyTextPresent("Validation Summary Test", ""); - //$this->verifyText("{$base}summary1", ""); - //$this->verifyText("{$base}summary2", ""); - - $this->click("//input[@type='submit' and @value='Create New Account']", ""); + + $this->url("validators/index.php?page=ValidationSummary"); + $this->assertContains("Validation Summary Test", $this->source()); + //$this->assertText("{$base}summary1", ""); + //$this->assertText("{$base}summary2", ""); + + $this->byXPath("//input[@type='submit' and @value='Create New Account']")->click(); $this->assertVisible("{$base}summary1"); $this->assertNotVisible("{$base}summary2"); - $this->click("//input[@type='submit' and @value='Sign In']", ""); + $this->byXPath("//input[@type='submit' and @value='Sign In']")->click(); $this->assertNotVisible("{$base}summary1"); - $this->assertVisible("{$base}summary2"); - + $this->assertVisible("{$base}summary2"); + $this->type("{$base}Username", "qwe"); $this->type("{$base}Password", "ewwq"); - $this->click("//input[@type='submit' and @value='Sign In']", ""); + $this->byXPath("//input[@type='submit' and @value='Sign In']")->click(); $this->assertNotVisible("{$base}summary1"); - $this->assertVisible("{$base}summary2"); - - /*$this->clickAndWait("//input[@type='submit' and @value='Create New Account']", ""); + $this->assertVisible("{$base}summary2"); + + /*$this->byXPath("//input[@type='submit' and @value='Create New Account']")->click(); $this->type("{$base}UserID", "123"); $this->type("{$base}Pass", "123"); - $this->clickAndWait("//input[@type='submit' and @value='Sign In']", ""); - //$this->verifyText("{$base}summary1", ""); - //$this->verifyText("{$base}summary2", ""); - $this->clickAndWait("//input[@type='submit' and @value='Create New Account']", ""); - //$this->verifyText("{$base}summary1", ""); - //$this->verifyText("{$base}summary2", ""); + $this->byXPath("//input[@type='submit' and @value='Sign In']")->click(); + //$this->assertText("{$base}summary1", ""); + //$this->assertText("{$base}summary2", ""); + $this->byXPath("//input[@type='submit' and @value='Create New Account']")->click(); + //$this->assertText("{$base}summary1", ""); + //$this->assertText("{$base}summary2", ""); $this->type("{$base}Password", ""); - $this->click("//input[@type='submit' and @value='Create New Account']", ""); + $this->byXPath("//input[@type='submit' and @value='Create New Account']")->click(); $this->assertVisible("{$base}summary1"); $this->assertNotVisible("{$base}summary2"); - + $this->type("{$base}Password", "12312"); $this->assertVisible("{$base}summary1"); */ |