/tests/acceptance/administrator/components/com_content/ContentListCest.php

https://github.com/Kunena/Kunena-Forum · PHP · 173 lines · 42 code · 11 blank · 120 comment · 0 complexity · cc13af0427da46e5f0fe0d1fd08a53eb MD5 · raw file

  1. <?php
  2. /**
  3. * @package Joomla.Tests
  4. * @subpackage Acceptance.tests
  5. *
  6. * @copyright Copyright (C) 2005 - 2019 Open Source Matters, Inc. All rights reserved.
  7. * @license GNU General Public License version 2 or later; see LICENSE.txt
  8. */
  9. use Page\Acceptance\Administrator\ContentFormPage;
  10. use Page\Acceptance\Administrator\ContentListPage;
  11. use Step\Acceptance\Administrator\Content;
  12. /**
  13. * Tests for com_content list view
  14. *
  15. * @since 4.0.0
  16. */
  17. class ContentListCest
  18. {
  19. /**
  20. * Runs before every test
  21. *
  22. * @param AcceptanceTester $I
  23. */
  24. public function _before(AcceptanceTester $I)
  25. {
  26. $I->doAdministratorLogin();
  27. }
  28. /**
  29. * Test that it loads without php notices and warnings.
  30. *
  31. * @param AcceptanceTester $I Acceptance Helper Object
  32. *
  33. * @since 4.0.0
  34. */
  35. public function loadsWithoutPhpNoticesAndWarnings(AcceptanceTester $I)
  36. {
  37. $I->wantToTest('that it loads without php notices and warnings.');
  38. $I->amOnPage(ContentListPage::$url);
  39. $I->waitForElement(ContentListPage::$filterSearch);
  40. $I->checkForPhpNoticesOrWarnings();
  41. }
  42. /**
  43. * Test create a new arcticle
  44. *
  45. * @param Content $I
  46. *
  47. * @since 4.0.0
  48. */
  49. public function createNewArticleUsingToolbarButton(Content $I)
  50. {
  51. $I->wantToTest('that it is possible to create a new articles using "new" toolbar button.');
  52. $I->amOnPage(ContentListPage::$url);
  53. $I->waitForElement(ContentListPage::$pageTitle);
  54. $I->clickToolbarButton('New');
  55. $I->seeInCurrentUrl(ContentFormPage::$url);
  56. }
  57. /**
  58. * Test display articles
  59. *
  60. * @skip Fix: [PDOException] SQLSTATE[22007]: Invalid datetime format: 1292 Incorrect datetime value: '0000-00-00 00:00:00' for column 'created' at row 1
  61. * on drone
  62. *
  63. * @param Content $I
  64. *
  65. * @since 4.0.0
  66. */
  67. public function seeArticlesInList(Content $I)
  68. {
  69. $I->wantToTest('that articles are displayed in the list.');
  70. $testArticle = [
  71. 'title' => 'Test Article',
  72. 'alias' => 'test-article',
  73. 'state' => 1,
  74. ];
  75. $I->haveInDatabase('content', $testArticle);
  76. $I->amOnPage(ContentListPage::$url);
  77. $I->see($testArticle['title']);
  78. $I->see('Alias: ' . $testArticle['alias']);
  79. }
  80. /*
  81. * TODO publish article using toolbar button
  82. * TODO publish article using inline button
  83. * TODO unpublish article using toolbar button
  84. * TODO unpublish article using inline button
  85. */
  86. /**
  87. * Test feature articles
  88. *
  89. * @param Content $I
  90. *
  91. * @since 4.0.0
  92. */
  93. /**
  94. * public function markArticleAsFeaturedUsingToolbarButton(\Step\Acceptance\Administrator\Content $I)
  95. * {
  96. * $I->wantToTest('that it is possible to mark an article as featured using toolbar button.');
  97. *
  98. * $testArticle = [
  99. * 'title' => 'Test Article',
  100. * 'alias' => 'test-article',
  101. * 'introtext' => 'Test Article Introtext',
  102. * 'fulltext' => 'Test Article Fulltext',
  103. * 'state' => 1,
  104. * 'featured' => 0
  105. * ];
  106. * $I->haveInDatabase('content', $testArticle);
  107. *
  108. * $I->amOnPage(ContentListPage::$url);
  109. * $I->see($testArticle['title']);
  110. * $I->see('Alias: ' . $testArticle['alias']);
  111. * }
  112. * @param Content $I
  113. */
  114. /*
  115. * TODO Feature article using inline button
  116. * TODO Unfeature article using toolbar button
  117. * TODO Unfeature article using inline button
  118. * TODO archive an article
  119. * TODO check an article in
  120. * TODO changeLanguageOfMultipleArticles
  121. * TODO add Tags to multiple articles
  122. * TODO change access level of multiple articles
  123. * TODO trash an article using toolbar button
  124. * TODO open article configuration
  125. * TODO open article help
  126. * Change order of articles
  127. * Search articles
  128. * Clear the search of articles
  129. * Sorting articles
  130. * id
  131. * Filter articles
  132. * status
  133. * category
  134. * user
  135. * tag
  136. * Change limit of articles
  137. * Paginate articles
  138. */
  139. public function Article(Content $I)
  140. {
  141. /**
  142. $I->featureArticle($this->articleTitle);
  143. $I->setArticleAccessLevel($this->articleTitle, $this->articleAccessLevel);
  144. $I->unPublishArticle($this->articleTitle);
  145. $I->trashArticle($this->articleTitle);
  146. */
  147. }
  148. }