summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxue <>2006-02-14 04:43:45 +0000
committerxue <>2006-02-14 04:43:45 +0000
commit751ae8c6b3fe5a47b0592a4dd7b719ec264486bc (patch)
tree07db809903a49ef561543970ad575a53d82f8cbf
parent9e17c72bc1c6f917f032b61a16907c81ac49f322 (diff)
Added 3 FT for TDataGrid demos.
-rw-r--r--.gitattributes3
-rw-r--r--demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample2.php2
-rw-r--r--tests/FunctionalTests/quickstart/Controls/DataGrid1TestCase.php33
-rw-r--r--tests/FunctionalTests/quickstart/Controls/DataGrid2TestCase.php51
-rw-r--r--tests/FunctionalTests/quickstart/Controls/DataGrid3TestCase.php51
5 files changed, 139 insertions, 1 deletions
diff --git a/.gitattributes b/.gitattributes
index b9ee5322..dcde542b 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -785,6 +785,9 @@ tests/FunctionalTests/quickstart/Controls/BulletedListTestCase.php -text
tests/FunctionalTests/quickstart/Controls/ButtonTestCase.php -text
tests/FunctionalTests/quickstart/Controls/CheckBoxListTestCase.php -text
tests/FunctionalTests/quickstart/Controls/CheckBoxTestCase.php -text
+tests/FunctionalTests/quickstart/Controls/DataGrid1TestCase.php -text
+tests/FunctionalTests/quickstart/Controls/DataGrid2TestCase.php -text
+tests/FunctionalTests/quickstart/Controls/DataGrid3TestCase.php -text
tests/FunctionalTests/quickstart/Controls/DataList1TestCase.php -text
tests/FunctionalTests/quickstart/Controls/DataList2TestCase.php -text
tests/FunctionalTests/quickstart/Controls/DropDownListTestCase.php -text
diff --git a/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample2.php b/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample2.php
index 03795910..d40e3be3 100644
--- a/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample2.php
+++ b/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample2.php
@@ -54,7 +54,7 @@ class Sample2 extends TPage
'rating'=>4,
),
array(
- 'ISBN'=>'0321278658 ',
+ 'ISBN'=>'0321278658',
'title'=>'Extreme Programming Explained : Embrace Change',
'publisher'=>'Addison-Wesley Professional',
'price'=>34.99,
diff --git a/tests/FunctionalTests/quickstart/Controls/DataGrid1TestCase.php b/tests/FunctionalTests/quickstart/Controls/DataGrid1TestCase.php
new file mode 100644
index 00000000..d20a7955
--- /dev/null
+++ b/tests/FunctionalTests/quickstart/Controls/DataGrid1TestCase.php
@@ -0,0 +1,33 @@
+<?php
+
+class DataGrid1TestCase extends SeleniumTestCase
+{
+ function test()
+ {
+ $this->open("../../demos/quickstart/index.php?page=Controls.Samples.TDataGrid.Sample1&amp;notheme=true", "");
+
+ // verify if all required texts are present
+ $this->verifyTextPresent('id','');
+ $this->verifyTextPresent('name','');
+ $this->verifyTextPresent('quantity','');
+ $this->verifyTextPresent('price','');
+ $this->verifyTextPresent('imported','');
+ $this->verifyTextPresent('ITN001','');
+ $this->verifyTextPresent('Motherboard','');
+ $this->verifyTextPresent('100','');
+ $this->verifyTextPresent('true','');
+ $this->verifyTextPresent('ITN019','');
+ $this->verifyTextPresent('Speaker','');
+ $this->verifyTextPresent('35','');
+ $this->verifyTextPresent('65','');
+ $this->verifyTextPresent('false','');
+
+ // verify specific table tags
+ $this->verifyElementPresent("ctl0_body_DataGrid");
+ $this->verifyAttribute("ctl0_body_DataGrid@rules","all");
+ $this->verifyAttribute("ctl0_body_DataGrid@cellpadding","2");
+ $this->verifyAttribute("ctl0_body_DataGrid@cellspacing","0");
+ }
+}
+
+?> \ No newline at end of file
diff --git a/tests/FunctionalTests/quickstart/Controls/DataGrid2TestCase.php b/tests/FunctionalTests/quickstart/Controls/DataGrid2TestCase.php
new file mode 100644
index 00000000..64c44fc3
--- /dev/null
+++ b/tests/FunctionalTests/quickstart/Controls/DataGrid2TestCase.php
@@ -0,0 +1,51 @@
+<?php
+
+class DataGrid2TestCase extends SeleniumTestCase
+{
+ function test()
+ {
+ $this->open("../../demos/quickstart/index.php?page=Controls.Samples.TDataGrid.Sample2&amp;notheme=true", "");
+
+ // verify if all required texts are present
+ $this->verifyTextPresent('Book Title','');
+ $this->verifyTextPresent('Publisher','');
+ $this->verifyTextPresent('Price','');
+ $this->verifyTextPresent('In-stock','');
+ $this->verifyTextPresent('Rating','');
+
+ // verify book titles
+ $this->verifyElementPresent("//a[@href='http://www.amazon.com/gp/product/0596007124' and text()='Head First Design Patterns']",'');
+ $this->verifyElementPresent("//a[@href='http://www.amazon.com/gp/product/0321278658' and text()='Extreme Programming Explained : Embrace Change']",'');
+
+ // verify publishers
+ $this->verifyTextPresent("O'Reilly Media, Inc.",'');
+ $this->verifyTextPresent("Addison-Wesley Professional",'');
+
+ // verify prices
+ $this->verifyTextPresent("\$37.49",'');
+ $this->verifyTextPresent("\$38.49",'');
+
+ // verify in-stock
+ $this->verifyAttribute('ctl0_body_DataGrid_ctl1_ctl6@checked','regexp:true|checked');
+ $this->verifyAttribute('ctl0_body_DataGrid_ctl1_ctl6@disabled','regexp:true|disabled');
+ $this->verifyAttribute('ctl0_body_DataGrid_ctl2_ctl6@checked','regexp:true|checked');
+ $this->verifyAttribute('ctl0_body_DataGrid_ctl6_ctl6@checked','regexp:false|null');
+ $this->verifyAttribute('ctl0_body_DataGrid_ctl6_ctl6@disabled','regexp:true|disabled');
+
+ // verify ratings
+ //$this->verifyElementPresent("//img[@src='images/star5.gif']",'');
+ //$this->verifyElementPresent("//img[@src='images/star2.gif']",'');
+
+ // verify toggle column visibility
+ $this->clickAndWait("//input[@name='ctl0\$body\$ctl1\$0' and @value='Book Title']", "");
+ $this->verifyTextNotPresent('Head First Design Patterns','');
+ $this->clickAndWait("//input[@name='ctl0\$body\$ctl1\$3' and @value='In-stock']", "");
+ $this->verifyElementNotPresent('ctl0_body_DataGrid_ctl1_ctl6','');
+ $this->clickAndWait("//input[@name='ctl0\$body\$ctl1$3' and @value='In-stock']", "");
+ $this->verifyElementPresent('ctl0_body_DataGrid_ctl1_ctl6','');
+ $this->clickAndWait("//input[@name='ctl0\$body\$ctl1$0' and @value='Book Title']", "");
+ $this->verifyTextPresent('Head First Design Patterns','');
+ }
+}
+
+?> \ No newline at end of file
diff --git a/tests/FunctionalTests/quickstart/Controls/DataGrid3TestCase.php b/tests/FunctionalTests/quickstart/Controls/DataGrid3TestCase.php
new file mode 100644
index 00000000..80e1c0e4
--- /dev/null
+++ b/tests/FunctionalTests/quickstart/Controls/DataGrid3TestCase.php
@@ -0,0 +1,51 @@
+<?php
+
+class DataGrid3TestCase extends SeleniumTestCase
+{
+ function test()
+ {
+ $this->open("../../demos/quickstart/index.php?page=Controls.Samples.TDataGrid.Sample3&amp;notheme=true", "");
+
+ // verify the 2nd row of data
+ $this->verifyTextPresent("Design Patterns: Elements of Reusable Object-Oriented Software", "");
+ $this->verifyTextPresent("Addison-Wesley Professional", "");
+ $this->verifyTextPresent("$47.04", "");
+ $this->verifyAttribute('ctl0_body_DataGrid_ctl2_ctl7@checked','regexp:true|checked');
+ $this->verifyAttribute('ctl0_body_DataGrid_ctl2_ctl7@disabled','regexp:true|disabled');
+ //$this->verifyElementPresent("//img[@src='images/star5.gif']",'');
+
+ // edit the 2nd row
+ $this->clickAndWait("id=ctl0_body_DataGrid_ctl2_ctl9", "");
+ $this->type("ctl0\$body\$DataGrid\$ctl2\$ctl7", "Design Pattern: Elements of Reusable Object-Oriented Software");
+ $this->type("ctl0\$body\$DataGrid\$ctl2\$ctl8", "Addison Wesley Professional");
+ $this->type("ctl0\$body\$DataGrid\$ctl2\$ctl9", "\$57.04");
+ $this->click("//input[@name='ctl0\$body\$DataGrid\$ctl2\$ctl10' and @value='ctl0\$body\$DataGrid\$ctl2\$ctl10']", "");
+ $this->select("ctl0\$body\$DataGrid\$ctl2\$Rating", "label=1");
+ $this->clickAndWait("link=Save", "");
+
+ // verify the 2nd row is saved
+ $this->verifyTextPresent("Design Pattern: Elements of Reusable Object-Oriented Software", "");
+ $this->verifyTextPresent("Addison Wesley Professional", "");
+ $this->verifyTextPresent("$57.04", "");
+ $this->verifyAttribute('ctl0_body_DataGrid_ctl2_ctl7@checked','regexp:false|null');
+ $this->verifyAttribute('ctl0_body_DataGrid_ctl2_ctl7@disabled','regexp:true|disabled');
+ //$this->verifyElementPresent("//img[@src='images/star1.gif']",'');
+
+ // verify cancel editting the 3rd row
+ $this->clickAndWait("id=ctl0_body_DataGrid_ctl3_ctl9", "");
+ $this->clickAndWait("link=Cancel", "");
+ $this->verifyTextPresent("Design Patterns Explained : A New Perspective on Object-Oriented Design", "");
+
+ // verify deleting
+ $this->clickAndWait("id=ctl0_body_DataGrid_ctl3_ctl10", "");
+ $this->verifyConfirmation("Are you sure?");
+ $this->verifyTextNotPresent("Design Patterns Explained : A New Perspective on Object-Oriented Design", "");
+
+ $this->verifyTextPresent("Extreme Programming Explained : Embrace Change",'');
+ $this->chooseCancelOnNextConfirmation();
+ $this->click("id=ctl0_body_DataGrid_ctl5_ctl10", "");
+ $this->verifyTextPresent("Extreme Programming Explained : Embrace Change",'');
+ }
+}
+
+?> \ No newline at end of file