/tests/system/suite/articles/article0004Test.php

https://github.com/elinw/joomla-cms · PHP · 196 lines · 169 code · 18 blank · 9 comment · 7 complexity · 53b4402ff9eb3dd823b5840c7dce45b8 MD5 · raw file

  1. <?php
  2. /**
  3. * @package Joomla.SystemTest
  4. * @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
  5. * @license GNU General Public License version 2 or later; see LICENSE.txt
  6. * checks that all menu choices are shown in back end
  7. */
  8. require_once 'SeleniumJoomlaTestCase.php';
  9. /**
  10. * @group ControlPanel
  11. */
  12. class Article0004 extends SeleniumJoomlaTestCase
  13. {
  14. function testBatchAcessLevels()
  15. {
  16. $this->jPrint ("Starting testBatchAcessLevels\n");
  17. $this->setUp();
  18. $this->gotoAdmin();
  19. $this->doAdminLogin();
  20. $this->click("link=Article Manager");
  21. $this->waitForPageToLoad("30000");
  22. $this->jPrint ("Check that first three articles are Public Access Level\n");
  23. $this->assertEquals("Public", $this->getTable("//form[@id='adminForm']//table.1.4"));
  24. $this->assertEquals("Public", $this->getTable("//form[@id='adminForm']//table.2.4"));
  25. $this->assertEquals("Public", $this->getTable("//form[@id='adminForm']//table.3.4"));
  26. $this->jPrint ("Select first three articles\n");
  27. $this->click("cb0");
  28. $this->click("cb1");
  29. $this->click("cb2");
  30. $this->jPrint ("Batch change to Special access\n");
  31. $this->select("batch-access", "label=Special");
  32. $this->click("//button[@type='submit' and @onclick=\"Joomla.submitbutton('article.batch');\"]");
  33. $this->waitForPageToLoad("30000");
  34. $this->jPrint ("Check for success message\n");
  35. $this->assertTrue($this->isElementPresent("//div[@id=\"system-message-container\"][contains(., 'success')]"));
  36. $this->jPrint ("Check that first three articles are Special Access Level\n");
  37. $this->assertEquals("Special", $this->getTable("//form[@id='adminForm']//table.1.4"));
  38. $this->assertEquals("Special", $this->getTable("//form[@id='adminForm']//table.2.4"));
  39. $this->assertEquals("Special", $this->getTable("//form[@id='adminForm']//table.3.4"));
  40. $this->jPrint ("Change back to Public and check\n");
  41. $this->click("cb0");
  42. $this->click("cb1");
  43. $this->click("cb2");
  44. $this->select("batch-access", "label=Public");
  45. $this->click("//button[@type='submit' and @onclick=\"Joomla.submitbutton('article.batch');\"]");
  46. $this->waitForPageToLoad("30000");
  47. $this->jPrint ("Check for success message\n");
  48. $this->assertTrue($this->isElementPresent("//div[@id=\"system-message-container\"][contains(., 'success')]"));
  49. $this->assertEquals("Public", $this->getTable("//form[@id='adminForm']//table.1.4"));
  50. $this->assertEquals("Public", $this->getTable("//form[@id='adminForm']//table.2.4"));
  51. $this->assertEquals("Public", $this->getTable("//form[@id='adminForm']//table.3.4"));
  52. $this->jPrint ("Finished testBatchAcessLevels\n");
  53. $this->deleteAllVisibleCookies();
  54. }
  55. function testBatchCopy()
  56. {
  57. $this->jPrint ("Starting testBatchCopy\n");
  58. $this->setUp();
  59. $this->gotoAdmin();
  60. $this->doAdminLogin();
  61. $this->click("link=Article Manager");
  62. $this->waitForPageToLoad("30000");
  63. $this->jPrint ("Check that first three articles are as expected\n");
  64. $this->assertStringStartsWith('Administrator Components', $this->getTable("//form[@id='adminForm']//table.1.3"));
  65. $this->assertStringStartsWith('Archive Module', $this->getTable("//form[@id='adminForm']//table.2.3"));
  66. $this->assertStringStartsWith('Article Categories Module', $this->getTable("//form[@id='adminForm']//table.3.3"));
  67. $this->jPrint ("Select first three articles and batch copy to Park Site\n");
  68. $this->click("cb0");
  69. $this->click("cb1");
  70. $this->click("cb2");
  71. $this->select("batch-category-id", "label=- Park Site");
  72. $this->click("batch[move_copy]c");
  73. $this->click("//button[@type='submit' and @onclick=\"Joomla.submitbutton('article.batch');\"]");
  74. $this->waitForPageToLoad("30000");
  75. $this->jPrint ("Check for success message\n");
  76. $this->assertTrue($this->isElementPresent("//div[@id=\"system-message-container\"][contains(., 'success')]"));
  77. $this->jPrint ("Check that new articles are in Park Site category\n");
  78. $this->select("filter_category_id", "label=- Park Site");
  79. $this->waitForPageToLoad("30000");
  80. $this->assertStringStartsWith('Administrator Components', $this->getTable("//form[@id='adminForm']//table.1.3"));
  81. $this->assertStringStartsWith('Archive Module', $this->getTable("//form[@id='adminForm']//table.2.3"));
  82. $this->assertStringStartsWith('Article Categories Module', $this->getTable("//form[@id='adminForm']//table.3.3"));
  83. $this->jPrint ("Trash and delete new articles\n");
  84. $this->click("cb0");
  85. $this->click("cb1");
  86. $this->click("cb2");
  87. $this->click("//div[@id='toolbar-trash']/button");
  88. $this->waitForPageToLoad("30000");
  89. $this->select("filter_published", "label=Trashed");
  90. $this->waitForPageToLoad("30000");
  91. $this->click("checkall-toggle");
  92. $this->click("//div[@id='toolbar-delete']/button");
  93. $this->waitForPageToLoad("30000");
  94. $this->select("filter_published", "label=- Select Status -");
  95. $this->waitForPageToLoad("30000");
  96. $this->select("filter_category_id", "label=- Select Category -");
  97. $this->waitForPageToLoad("30000");
  98. $this->jPrint ("Check that first three articles are as expected\n");
  99. $this->assertStringStartsWith('Administrator Components', $this->getTable("//form[@id='adminForm']//table.1.3"));
  100. $this->assertStringStartsWith('Archive Module', $this->getTable("//form[@id='adminForm']//table.2.3"));
  101. $this->assertStringStartsWith('Article Categories Module', $this->getTable("//form[@id='adminForm']//table.3.3"));
  102. $this->jPrint ("Test copying to same category\n");
  103. $this->jPrint ("Select first article and copy to Components\n");
  104. $this->assertStringStartsWith('Administrator Components', $this->getTable("//form[@id='adminForm']//table.1.3"));
  105. $this->click("cb0");
  106. $this->click("batch[move_copy]c");
  107. $this->select("batch-category-id", "label=- - - Components");
  108. $this->click("//button[@type='submit' and @onclick=\"Joomla.submitbutton('article.batch');\"]");
  109. $this->waitForPageToLoad("30000");
  110. $this->jPrint ("Check for success message\n");
  111. $this->assertTrue($this->isElementPresent("//div[@id=\"system-message-container\"][contains(., 'success')]"));
  112. $this->jPrint ("Check that new article is created with correct name and alias\n");
  113. $this->assertStringStartsWith('Administrator Components', $this->getTable("//form[@id='adminForm']//table.2.3"));
  114. $this->jPrint ("Trash and delete new article\n");
  115. $this->click("cb1");
  116. $this->click("//div[@id='toolbar-trash']/button");
  117. $this->waitForPageToLoad("30000");
  118. $this->select("filter_published", "label=Trashed");
  119. $this->waitForPageToLoad("30000");
  120. $this->click("checkall-toggle");
  121. $this->click("//div[@id='toolbar-delete']/button");
  122. $this->waitForPageToLoad("30000");
  123. $this->select("filter_published", "label=- Select Status -");
  124. $this->waitForPageToLoad("30000");
  125. $this->jPrint ("Finished testBatchCopy\n");
  126. $this->deleteAllVisibleCookies();
  127. }
  128. function testBatchMove()
  129. {
  130. $this->jPrint ("Starting testBatchMove\n");
  131. $this->setUp();
  132. $this->gotoAdmin();
  133. $this->doAdminLogin();
  134. $this->click("link=Article Manager");
  135. $this->waitForPageToLoad("30000");
  136. $this->jPrint ("Check initial values for articles\n");
  137. $this->assertStringStartsWith('Archive Module', $this->getTable("//form[@id='adminForm']//table.2.3"));
  138. $this->assertStringStartsWith('Article Categories Module', $this->getTable("//form[@id='adminForm']//table.3.3"));
  139. $this->assertStringStartsWith('Articles Category Module', $this->getTable("//form[@id='adminForm']//table.4.3"));
  140. $this->assertTrue(strpos($this->getTable("//form[@id='adminForm']//table.2.3"), 'Category: Content Modules') > 0);
  141. $this->assertTrue(strpos($this->getTable("//form[@id='adminForm']//table.3.3"), 'Category: Content Modules') > 0);
  142. $this->assertTrue(strpos($this->getTable("//form[@id='adminForm']//table.4.3"), 'Category: Content Modules') > 0);
  143. $this->jPrint ("Move Archive Module, Content Modules, Article Categories Module to Languages Category\n");
  144. $this->click("cb1");
  145. $this->click("cb2");
  146. $this->click("cb3");
  147. $this->select("batch-category-id", "label=- - - Languages");
  148. $this->click("//button[@type='submit' and @onclick=\"Joomla.submitbutton('article.batch');\"]");
  149. $this->waitForPageToLoad("30000");
  150. $this->jPrint ("Check for success message\n");
  151. $this->assertTrue($this->isElementPresent("//div[@id=\"system-message-container\"][contains(., 'success')]"));
  152. $this->jPrint ("Check that articles moved to new category\n");
  153. $this->assertStringStartsWith('Archive Module', $this->getTable("//form[@id='adminForm']//table.2.3"));
  154. $this->assertStringStartsWith('Article Categories Module', $this->getTable("//form[@id='adminForm']//table.3.3"));
  155. $this->assertStringStartsWith('Articles Category Module', $this->getTable("//form[@id='adminForm']//table.4.3"));
  156. $this->assertTrue(strpos($this->getTable("//form[@id='adminForm']//table.2.3"), 'Category: Languages') > 0);
  157. $this->assertTrue(strpos($this->getTable("//form[@id='adminForm']//table.3.3"), 'Category: Languages') > 0);
  158. $this->assertTrue(strpos($this->getTable("//form[@id='adminForm']//table.4.3"), 'Category: Languages') > 0);
  159. $this->jPrint ("Move articles back to original category\n");
  160. $this->click("cb1");
  161. $this->click("cb2");
  162. $this->click("cb3");
  163. $this->select("batch-category-id", "label=- - - - Content Modules");
  164. $this->click("//button[@type='submit' and @onclick=\"Joomla.submitbutton('article.batch');\"]");
  165. $this->waitForPageToLoad("30000");
  166. $this->jPrint ("Check for success message\n");
  167. $this->assertTrue($this->isElementPresent("//div[@id=\"system-message-container\"][contains(., 'success')]"));
  168. $this->jPrint ("Check that articles are back to original category\n");
  169. $this->assertStringStartsWith('Archive Module', $this->getTable("//form[@id='adminForm']//table.2.3"));
  170. $this->assertStringStartsWith('Article Categories Module', $this->getTable("//form[@id='adminForm']//table.3.3"));
  171. $this->assertStringStartsWith('Articles Category Module', $this->getTable("//form[@id='adminForm']//table.4.3"));
  172. $this->assertTrue(strpos($this->getTable("//form[@id='adminForm']//table.2.3"), 'Category: Content Modules') > 0);
  173. $this->assertTrue(strpos($this->getTable("//form[@id='adminForm']//table.3.3"), 'Category: Content Modules') > 0);
  174. $this->assertTrue(strpos($this->getTable("//form[@id='adminForm']//table.4.3"), 'Category: Content Modules') > 0);
  175. $this->jPrint ("Finished testBatchMove\n");
  176. $this->deleteAllVisibleCookies();
  177. }
  178. }