From bdfd9f07f17de1751a7e4d94940acb426af4be77 Mon Sep 17 00:00:00 2001 From: David Date: Thu, 6 Aug 2015 18:12:45 +0200 Subject: Fix tests work around stale references by explicitly waiting --- .../FunctionalTests/validators/tests/ButtonTestCase.php | 14 +++++++------- .../validators/tests/CheckBoxTestCase.php | 16 +++++++++------- .../validators/tests/CompareValidatorTestCase.php | 2 +- .../validators/tests/ConditionalValidationTestCase.php | 3 ++- .../validators/tests/CustomValidatorTestCase.php | 2 +- .../validators/tests/DataTypeValidatorTestCase.php | 2 +- .../validators/tests/DatePickerTestCase.php | 2 +- .../validators/tests/ImageButtonTestCase.php | 14 +++++++------- .../validators/tests/LinkButtonTestCase.php | 14 +++++++------- .../validators/tests/ListControlTestCase.php | 2 +- .../validators/tests/RangeValidatorTestCase.php | 12 ++++++------ .../validators/tests/RegExpValidatorTestCase.php | 2 +- .../validators/tests/RequiredFieldTestCase.php | 5 +++-- .../validators/tests/ValidationSummaryTestCase.php | 2 +- 14 files changed, 48 insertions(+), 44 deletions(-) (limited to 'tests/FunctionalTests/validators') diff --git a/tests/FunctionalTests/validators/tests/ButtonTestCase.php b/tests/FunctionalTests/validators/tests/ButtonTestCase.php index 90265156..7fc533a4 100755 --- a/tests/FunctionalTests/validators/tests/ButtonTestCase.php +++ b/tests/FunctionalTests/validators/tests/ButtonTestCase.php @@ -20,13 +20,13 @@ class ButtonTestCase extends PradoGenericSelenium2Test // verify the first validation is passed $this->pause(500); - $this->assertNotContains('Button1 is clicked', $this->source()); + $this->assertSourceNotContains('Button1 is clicked'); $this->type("ctl0_Content_TextBox1", "test"); $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()); + $this->assertSourceContains('Button1 is clicked and valid'); // verify the second validator shows the error $this->byId("ctl0_Content_ctl3")->click(); @@ -36,13 +36,13 @@ class ButtonTestCase extends PradoGenericSelenium2Test // verify the second validation is passed $this->pause(500); - $this->assertNotContains('Button2 is clicked', $this->source()); + $this->assertSourceNotContains('Button2 is clicked'); $this->type("ctl0_Content_TextBox2", "test"); $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()); + $this->assertSourceContains('Button2 is clicked and valid'); // verify the third validator shows the error $this->byId("ctl0_Content_ctl5")->click(); @@ -51,13 +51,13 @@ class ButtonTestCase extends PradoGenericSelenium2Test $this->assertVisible('ctl0_Content_ctl4'); // verify the third validation is passed - $this->assertContains('Button3 is clicked', $this->source()); - $this->assertNotContains('Button3 is clicked and valid', $this->source()); + $this->assertSourceContains('Button3 is clicked'); + $this->assertSourceNotContains('Button3 is clicked and valid'); $this->type("ctl0_Content_TextBox3", "test"); $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()); + $this->assertSourceContains('Button3 is clicked and valid'); } } diff --git a/tests/FunctionalTests/validators/tests/CheckBoxTestCase.php b/tests/FunctionalTests/validators/tests/CheckBoxTestCase.php index 8e6e1583..2eaa3d4a 100755 --- a/tests/FunctionalTests/validators/tests/CheckBoxTestCase.php +++ b/tests/FunctionalTests/validators/tests/CheckBoxTestCase.php @@ -20,14 +20,15 @@ class CheckBoxTestCase extends PradoGenericSelenium2Test // verify the first validation is passed $this->pause(500); - $this->assertNotContains('Button1 is clicked', $this->source()); + $this->assertSourceNotContains('Button1 is clicked'); $this->type("ctl0_Content_TextBox1", "test"); $this->byId("ctl0_Content_ctl1")->click(); + $this->pause(50); $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()); + $this->assertSourceContains('Button1 is clicked and valid'); // verify the second validator shows the error $this->byId("ctl0_Content_ctl3")->click(); @@ -37,14 +38,15 @@ class CheckBoxTestCase extends PradoGenericSelenium2Test // verify the second validation is passed $this->pause(500); - $this->assertNotContains('Button2 is clicked', $this->source()); + $this->assertSourceNotContains('Button2 is clicked'); $this->type("ctl0_Content_TextBox2", "test"); $this->byId("ctl0_Content_ctl3")->click(); + $this->pause(50); $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()); + $this->assertSourceContains('Button2 is clicked and valid'); // verify the third validator shows the error $this->byId("ctl0_Content_ctl5")->click(); @@ -53,13 +55,13 @@ class CheckBoxTestCase extends PradoGenericSelenium2Test $this->assertVisible('ctl0_Content_ctl4'); // verify the third validation is passed - $this->assertContains('Button3 is clicked', $this->source()); - $this->assertNotContains('Button3 is clicked and valid', $this->source()); + $this->assertSourceContains('Button3 is clicked'); + $this->assertSourceNotContains('Button3 is clicked and valid'); $this->type("ctl0_Content_TextBox3", "test"); $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()); + $this->assertSourceContains('Button3 is clicked and valid'); } } diff --git a/tests/FunctionalTests/validators/tests/CompareValidatorTestCase.php b/tests/FunctionalTests/validators/tests/CompareValidatorTestCase.php index f9652e76..1f1a1e12 100755 --- a/tests/FunctionalTests/validators/tests/CompareValidatorTestCase.php +++ b/tests/FunctionalTests/validators/tests/CompareValidatorTestCase.php @@ -8,7 +8,7 @@ class CompareValidatorTestCase extends PradoGenericSelenium2Test $base = "ctl0_Content_"; $this->url("validators/index.php?page=CompareValidator"); - $this->assertContains("Prado CompareValidator Tests", $this->source()); + $this->assertSourceContains("Prado CompareValidator Tests"); $this->type("{$base}text1", "qwe"); $this->assertNotVisible("{$base}validator1"); diff --git a/tests/FunctionalTests/validators/tests/ConditionalValidationTestCase.php b/tests/FunctionalTests/validators/tests/ConditionalValidationTestCase.php index 32e79a90..1629578b 100755 --- a/tests/FunctionalTests/validators/tests/ConditionalValidationTestCase.php +++ b/tests/FunctionalTests/validators/tests/ConditionalValidationTestCase.php @@ -6,7 +6,7 @@ class ConditionalValidationTestCase extends PradoGenericSelenium2Test { $base = "ctl0_Content_"; $this->url("validators/index.php?page=ConditionalValidation"); - $this->assertContains("Conditional Validation (clientside + server side)", $this->source()); + $this->assertSourceContains("Conditional Validation (clientside + server side)"); $this->assertNotVisible("{$base}validator1"); $this->assertNotVisible("{$base}validator2"); @@ -21,6 +21,7 @@ class ConditionalValidationTestCase extends PradoGenericSelenium2Test $this->byId("{$base}check1")->click(); $this->byId("{$base}submit1")->click(); + $this->pause(50); $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 ca48a453..1771e7df 100755 --- a/tests/FunctionalTests/validators/tests/CustomValidatorTestCase.php +++ b/tests/FunctionalTests/validators/tests/CustomValidatorTestCase.php @@ -7,7 +7,7 @@ class CustomValidatorTestCase extends PradoGenericSelenium2Test { $base = "ctl0_Content_"; $this->url("validators/index.php?page=CustomValidator"); - $this->assertContains("Prado CustomValidator Tests", $this->source()); + $this->assertSourceContains("Prado CustomValidator Tests"); $this->assertNotVisible("{$base}validator1"); $this->byXPath("//input[@type='submit' and @value='Test']")->click(); diff --git a/tests/FunctionalTests/validators/tests/DataTypeValidatorTestCase.php b/tests/FunctionalTests/validators/tests/DataTypeValidatorTestCase.php index 3b5ebfcb..9f313572 100755 --- a/tests/FunctionalTests/validators/tests/DataTypeValidatorTestCase.php +++ b/tests/FunctionalTests/validators/tests/DataTypeValidatorTestCase.php @@ -9,7 +9,7 @@ class DataTypeValidatorTestCase extends PradoGenericSelenium2Test { $base = "ctl0_Content_"; $this->url("validators/index.php?page=DataTypeValidator"); - $this->assertContains("Data Type Validator Tests", $this->source()); + $this->assertSourceContains("Data Type Validator Tests"); $this->byXPath("//input[@type='submit' and @value='submit!']")->click(); $this->pause(500); diff --git a/tests/FunctionalTests/validators/tests/DatePickerTestCase.php b/tests/FunctionalTests/validators/tests/DatePickerTestCase.php index 953c2f16..c5a61d25 100755 --- a/tests/FunctionalTests/validators/tests/DatePickerTestCase.php +++ b/tests/FunctionalTests/validators/tests/DatePickerTestCase.php @@ -8,7 +8,7 @@ class DatePickerTestCase extends PradoGenericSelenium2Test $year2=2013; $base = "ctl0_Content_"; $this->url("validators/index.php?page=DatePicker"); - $this->assertContains("Date Picker validation Test", $this->source()); + $this->assertSourceContains("Date Picker validation Test"); $this->assertNotVisible("{$base}validator1"); $this->assertNotVisible("{$base}validator2"); $this->assertNotVisible("{$base}validator4"); diff --git a/tests/FunctionalTests/validators/tests/ImageButtonTestCase.php b/tests/FunctionalTests/validators/tests/ImageButtonTestCase.php index 800e36ff..144d3008 100755 --- a/tests/FunctionalTests/validators/tests/ImageButtonTestCase.php +++ b/tests/FunctionalTests/validators/tests/ImageButtonTestCase.php @@ -20,13 +20,13 @@ class ImageButtonTestCase extends PradoGenericSelenium2Test // verify the first validation is passed $this->pause(500); - $this->assertNotContains('Button1 is clicked', $this->source()); + $this->assertSourceNotContains('Button1 is clicked'); $this->type("ctl0_Content_TextBox1", "test"); $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()); + $this->assertSourceContains('Button1 is clicked and valid'); // verify the second validator shows the error $this->byId("ctl0_Content_ctl3")->click(); @@ -36,13 +36,13 @@ class ImageButtonTestCase extends PradoGenericSelenium2Test // verify the second validation is passed $this->pause(500); - $this->assertNotContains('Button2 is clicked', $this->source()); + $this->assertSourceNotContains('Button2 is clicked'); $this->type("ctl0_Content_TextBox2", "test"); $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()); + $this->assertSourceContains('Button2 is clicked and valid'); // verify the third validator shows the error $this->byId("ctl0_Content_ctl5")->click(); @@ -51,13 +51,13 @@ class ImageButtonTestCase extends PradoGenericSelenium2Test $this->assertVisible('ctl0_Content_ctl4'); // verify the third validation is passed - $this->assertContains('Button3 is clicked', $this->source()); - $this->assertNotContains('Button3 is clicked and valid', $this->source()); + $this->assertSourceContains('Button3 is clicked'); + $this->assertSourceNotContains('Button3 is clicked and valid'); $this->type("ctl0_Content_TextBox3", "test"); $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()); + $this->assertSourceContains('Button3 is clicked and valid'); } } diff --git a/tests/FunctionalTests/validators/tests/LinkButtonTestCase.php b/tests/FunctionalTests/validators/tests/LinkButtonTestCase.php index 394556e9..862c0c53 100755 --- a/tests/FunctionalTests/validators/tests/LinkButtonTestCase.php +++ b/tests/FunctionalTests/validators/tests/LinkButtonTestCase.php @@ -19,13 +19,13 @@ class LinkButtonTestCase extends PradoGenericSelenium2Test // verify the first validation is passed $this->pause(500); - $this->assertNotContains('Button1 is clicked', $this->source()); + $this->assertSourceNotContains('Button1 is clicked'); $this->type("ctl0_Content_TextBox1", "test"); $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()); + $this->assertSourceContains('Button1 is clicked and valid'); // verify the second validator shows the error $this->byId("ctl0_Content_ctl3")->click(); @@ -35,13 +35,13 @@ class LinkButtonTestCase extends PradoGenericSelenium2Test // verify the second validation is passed $this->pause(500); - $this->assertNotContains('Button2 is clicked', $this->source()); + $this->assertSourceNotContains('Button2 is clicked'); $this->type("ctl0_Content_TextBox2", "test"); $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()); + $this->assertSourceContains('Button2 is clicked and valid'); // verify the third validator shows the error $this->byId("ctl0_Content_ctl5")->click(); @@ -50,13 +50,13 @@ class LinkButtonTestCase extends PradoGenericSelenium2Test $this->assertVisible('ctl0_Content_ctl4'); // verify the third validation is passed - $this->assertContains('Button3 is clicked', $this->source()); - $this->assertNotContains('Button3 is clicked and valid', $this->source()); + $this->assertSourceContains('Button3 is clicked'); + $this->assertSourceNotContains('Button3 is clicked and valid'); $this->type("ctl0_Content_TextBox3", "test"); $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()); + $this->assertSourceContains('Button3 is clicked and valid'); } } diff --git a/tests/FunctionalTests/validators/tests/ListControlTestCase.php b/tests/FunctionalTests/validators/tests/ListControlTestCase.php index 55e370c5..52ed400e 100755 --- a/tests/FunctionalTests/validators/tests/ListControlTestCase.php +++ b/tests/FunctionalTests/validators/tests/ListControlTestCase.php @@ -9,7 +9,7 @@ class ListControlTestCase extends PradoGenericSelenium2Test { $base = "ctl0_Content_"; $this->url("validators/index.php?page=ListControl"); - $this->assertContains("List Control Required Field Validation Test", $this->source()); + $this->assertSourceContains("List Control Required Field Validation Test"); $this->byXPath("//input[@type='submit' and @value='Submit!']")->click(); $this->assertVisible("{$base}validator1"); diff --git a/tests/FunctionalTests/validators/tests/RangeValidatorTestCase.php b/tests/FunctionalTests/validators/tests/RangeValidatorTestCase.php index 485c6a24..4cbc1121 100755 --- a/tests/FunctionalTests/validators/tests/RangeValidatorTestCase.php +++ b/tests/FunctionalTests/validators/tests/RangeValidatorTestCase.php @@ -7,7 +7,7 @@ class RangeValidatorTestCase extends PradoGenericSelenium2Test { $base = "ctl0_Content_"; $this->url("validators/index.php?page=RangeValidatorInteger"); - $this->assertContains("Prado RangeValidator Tests Integer", $this->source()); + $this->assertSourceContains("Prado RangeValidator Tests Integer"); //between 1 and 4 $this->type("{$base}text1", "ad"); @@ -47,7 +47,7 @@ class RangeValidatorTestCase extends PradoGenericSelenium2Test { $base = "ctl0_Content_"; $this->url("validators/index.php?page=RangeValidatorFloat"); - $this->assertContains("Prado RangeValidator Tests Float", $this->source()); + $this->assertSourceContains("Prado RangeValidator Tests Float"); //between 1 and 4 $this->type("{$base}text1", "ad"); @@ -86,7 +86,7 @@ class RangeValidatorTestCase extends PradoGenericSelenium2Test { $base = "ctl0_Content_"; $this->url("validators/index.php?page=RangeValidatorDate"); - $this->assertContains("Prado RangeValidator Tests Date", $this->source()); + $this->assertSourceContains("Prado RangeValidator Tests Date"); //between 22/1/2005 and 3/2/2005 $this->type("{$base}text1", "ad"); @@ -107,7 +107,6 @@ class RangeValidatorTestCase extends PradoGenericSelenium2Test $this->assertNotVisible("{$base}validator2"); $this->type("{$base}text2", "1/1/2005"); $this->byXPath("//input[@type='submit' and @value='Test']")->click(); - $this->pause(250); $this->assertVisible("{$base}validator2"); $this->type("{$base}text2", "1/4/2005"); $this->byXPath("//input[@type='submit' and @value='Test']")->click(); @@ -117,7 +116,6 @@ class RangeValidatorTestCase extends PradoGenericSelenium2Test $this->assertNotVisible("{$base}validator3"); $this->type("{$base}text3", "4/5/2005"); $this->byXPath("//input[@type='submit' and @value='Test']")->click(); - $this->pause(250); $this->assertVisible("{$base}validator3"); $this->type("{$base}text3", "1/2/2005"); $this->byXPath("//input[@type='submit' and @value='Test']")->click(); @@ -128,7 +126,7 @@ class RangeValidatorTestCase extends PradoGenericSelenium2Test { $base = "ctl0_Content_"; $this->url("validators/index.php?page=RangeValidatorString"); - $this->assertContains("Prado RangeValidator Tests String", $this->source()); + $this->assertSourceContains("Prado RangeValidator Tests String"); //between 'd' and 'y' $this->type("{$base}text1", "a"); @@ -140,7 +138,9 @@ class RangeValidatorTestCase extends PradoGenericSelenium2Test $this->assertVisible("{$base}validator1"); $this->type("{$base}text1", "f"); $this->assertNotVisible("{$base}validator1"); + $this->pause(50); $this->byXPath("//input[@type='submit' and @value='Test']")->click(); + $this->pause(50); $this->assertNotVisible("{$base}validator1"); diff --git a/tests/FunctionalTests/validators/tests/RegExpValidatorTestCase.php b/tests/FunctionalTests/validators/tests/RegExpValidatorTestCase.php index ffa30126..8127af61 100755 --- a/tests/FunctionalTests/validators/tests/RegExpValidatorTestCase.php +++ b/tests/FunctionalTests/validators/tests/RegExpValidatorTestCase.php @@ -7,7 +7,7 @@ class RegExpValidatorTestCase extends PradoGenericSelenium2Test { $base = "ctl0_Content_"; $this->url("validators/index.php?page=RegularExpressionValidator"); - $this->assertContains("Prado RegularExpressionValidator Tests", $this->source()); + $this->assertSourceContains("Prado RegularExpressionValidator Tests"); $this->assertNotVisible("{$base}validator1"); $this->assertNotVisible("{$base}validator2"); $this->type("{$base}text1", "1"); diff --git a/tests/FunctionalTests/validators/tests/RequiredFieldTestCase.php b/tests/FunctionalTests/validators/tests/RequiredFieldTestCase.php index e868155c..184c4258 100755 --- a/tests/FunctionalTests/validators/tests/RequiredFieldTestCase.php +++ b/tests/FunctionalTests/validators/tests/RequiredFieldTestCase.php @@ -6,7 +6,7 @@ class RequiredFieldTestCase extends PradoGenericSelenium2Test { $base = "ctl0_Content_"; $this->url("validators/index.php?page=RequiredFieldValidator"); - $this->assertContains("RequiredFieldValidator Tests", $this->source()); + $this->assertSourceContains("RequiredFieldValidator Tests"); $this->assertNotVisible("{$base}validator1"); $this->assertNotVisible("{$base}validator2"); $this->byId("{$base}submit1")->click(); @@ -45,6 +45,7 @@ class RequiredFieldTestCase extends PradoGenericSelenium2Test $this->assertVisible("{$base}validator2"); $this->byId("{$base}check2")->click(); $this->byId("{$base}submit2")->click(); + $this->pause(50); $this->type("{$base}text1", "Hello"); $this->byId("{$base}check1")->click(); @@ -74,7 +75,7 @@ class RequiredFieldTestCase extends PradoGenericSelenium2Test { $base = "ctl0_Content_"; $this->url("validators/index.php?page=RequiredFieldValidator"); - $this->assertContains("InitialValue Test", $this->source()); + $this->assertSourceContains("InitialValue Test"); $this->assertNotVisible("{$base}validator9"); $this->byId("{$base}submit5")->click(); $this->pause(250); diff --git a/tests/FunctionalTests/validators/tests/ValidationSummaryTestCase.php b/tests/FunctionalTests/validators/tests/ValidationSummaryTestCase.php index d4c44a34..9b999b01 100755 --- a/tests/FunctionalTests/validators/tests/ValidationSummaryTestCase.php +++ b/tests/FunctionalTests/validators/tests/ValidationSummaryTestCase.php @@ -8,7 +8,7 @@ class ValidationSummaryTestCase extends PradoGenericSelenium2Test $base = "ctl0_Content_"; $this->url("validators/index.php?page=ValidationSummary"); - $this->assertContains("Validation Summary Test", $this->source()); + $this->assertSourceContains("Validation Summary Test"); //$this->assertText("{$base}summary1", ""); //$this->assertText("{$base}summary2", ""); -- cgit v1.2.3