Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Test for Deleting Category #103

Closed

Conversation

puneet0191
Copy link
Member

No description provided.

@puneet0191 puneet0191 assigned puneet0191 and javigomez and unassigned puneet0191 Oct 29, 2015
@zero-24 zero-24 added this to the 3.4.2 milestone Oct 29, 2015
@therunnergit
Copy link
Contributor

@test works fine.

@puneet0191
Copy link
Member Author

Thanks, I will refactor this by making use of Step Object. Need some time

@puneet0191
Copy link
Member Author

The build will fail since this PR depends on joomla-projects/joomla-browser#71

@therunnergit
Copy link
Contributor

@test tested again, still working fine (after "composer install").

*
* @return void
*/
public function deleteCategory($categoryName)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work!

Just one comment. Could this method be renamed to "trashCategory" and keep the deleteCategory for when we completely delete the category from the database.

@puneet0191
Copy link
Member Author

I have updated the function name! thanks for the feedback!


$I->amGoingTo('Try to unpublish a weblink category');
$I->click(['xpath' => "//button[@onclick=\"if (document.adminForm.boxchecked.value==0){alert('Please first make a selection from the list.');}else{ Joomla.submitbutton('categories.unpublish')}\"]"]);
$I->clickToolbarButton('unpublish');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice 👍

related to joomla-projects/joomla-browser#71

@javigomez
Copy link
Contributor

@test

Worked:

vendor/bin/codecept run --steps --debug tests/acceptance/administrator/AdministratorCategoriesCest.php
Codeception PHP Testing Framework v2.1.3
Powered by PHPUnit 4.8.16 by Sebastian Bergmann and contributors.

Acceptance Tests (4) -----------------------------------------------------------
Modules: JoomlaBrowser, AcceptanceHelper
--------------------------------------------------------------------------------
Test Category  (AdministratorCategoriesCest::administratorCreateCategory)
Scenario:
* As an Administrator
* I do administrator login 

  I open Joomla Administrator Login Page
  [GET] http://joomla.box/repos/weblinks/tests/joomla-cms3/administrator/index.php
  Fill Username Text Field
  Fill Password Text Field
  I click Login button
  I wait to see Administrator Control Panel
* I am going to Navigate to Categories page in /administrator/ and create a Category
* As an Administrator
* I am on page "administrator/index.php?option=com_categories&extension=com_weblinks"
  [GET] http://joomla.box/repos/weblinks/tests/joomla-cms3/administrator/index.php?option=com_categories&extension=com_weblinks
* I wait for text "Weblinks: Categories","30",{"css":"h1"}
* I expect to see categories page
* I check for php notices or warnings 
* I am going to try to save a category with a filled title
* I click toolbar button "New"
* I wait for text "Weblinks: New Category","30",{"css":"h1"}
* I fill field {"id":"jform_title"},"automated testing19"
* I click toolbar button "Save & Close"
* I expect to see a success message after saving the category
* I see "Category successfully saved",{"id":"system-message-container"}
* I am going to Delete the Category which was created
* I am on page "administrator/index.php?option=com_categories&extension=com_weblinks"
  [GET] http://joomla.box/repos/weblinks/tests/joomla-cms3/administrator/index.php?option=com_categories&extension=com_weblinks
* I wait for text "Weblinks: Categories","30",{"css":"h1"}
* I search for item "automated testing19"
  Searching for automated testing19
* I am going to Select the weblink result
* I check all results 
  Selecting Checkall button
* I click toolbar button "Trash"
* I see "category successfully trashed.",{"id":"system-message-container"}
 PASSED 

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Test Category creation in /administrator/ without ti (AdministratorCategoriesCest::administratorCreateCategoryWithoutTitleFails)
Scenario:
* As an Administrator
* I do administrator login 

  I open Joomla Administrator Login Page
  [GET] http://joomla.box/repos/weblinks/tests/joomla-cms3/administrator/index.php
  Fill Username Text Field
  Fill Password Text Field
  I click Login button
  I wait to see Administrator Control Panel
* I am going to Navigate to Categories page in /administrator/
* I am on page "administrator/index.php?option=com_categories&extension=com_weblinks"
  [GET] http://joomla.box/repos/weblinks/tests/joomla-cms3/administrator/index.php?option=com_categories&extension=com_weblinks
* I wait for text "Weblinks: Categories","30",{"css":"h1"}
* I expect to see categories page
* I am going to try to save a category with empty title and it should fail
* I click {"xpath":"//button[@onclick="Joomla.submitbutton('category.add')"]"}
* I wait for text "Weblinks: New Category","30",{"css":"h1"}
* I click {"xpath":"//button[@onclick="Joomla.submitbutton('category.apply')"]"}
* I expect to see an error when trying to save a category without title
* I see "Invalid field:  Title",{"id":"system-message-container"}
 PASSED 

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Test Category (AdministratorCategoriesCest::administratorPublishCategory)
Scenario:
* As an Administrator
* I do administrator login 

  I open Joomla Administrator Login Page
  [GET] http://joomla.box/repos/weblinks/tests/joomla-cms3/administrator/index.php
  Fill Username Text Field
  Fill Password Text Field
  I click Login button
  I wait to see Administrator Control Panel
* I am going to Navigate to Categories page in /administrator/ and create a new Category
* As an Administrator
* I am on page "administrator/index.php?option=com_categories&extension=com_weblinks"
  [GET] http://joomla.box/repos/weblinks/tests/joomla-cms3/administrator/index.php?option=com_categories&extension=com_weblinks
* I wait for text "Weblinks: Categories","30",{"css":"h1"}
* I expect to see categories page
* I check for php notices or warnings 
* I am going to try to save a category with a filled title
* I click toolbar button "New"
* I wait for text "Weblinks: New Category","30",{"css":"h1"}
* I fill field {"id":"jform_title"},"automated testing pub88"
* I click toolbar button "Save & Close"
* I expect to see a success message after saving the category
* I see "Category successfully saved",{"id":"system-message-container"}
* I search for item "automated testing pub88"
  Searching for automated testing pub88
* I wait for text "Weblinks: Categories","30",{"css":"h1"}
* I check all results 
  Selecting Checkall button
* I am going to try to publish a weblink category
* I click toolbar button "publish"
* I wait for text "Weblinks: Categories","30",{"css":"h1"}
* I expect to see a success message after publishing the category
* I see "1 category successfully published.",{"id":"system-message-container"}
* I am going to Delete the Category which was created
* I am on page "administrator/index.php?option=com_categories&extension=com_weblinks"
  [GET] http://joomla.box/repos/weblinks/tests/joomla-cms3/administrator/index.php?option=com_categories&extension=com_weblinks
* I wait for text "Weblinks: Categories","30",{"css":"h1"}
* I search for item "automated testing pub88"
  Searching for automated testing pub88
* I am going to Select the weblink result
* I check all results 
  Selecting Checkall button
* I click toolbar button "Trash"
* I see "category successfully trashed.",{"id":"system-message-container"}
 PASSED 

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Test Catego (AdministratorCategoriesCest::administratorUnpublishCategory)
Scenario:
* As an Administrator
* I do administrator login 

  I open Joomla Administrator Login Page
  [GET] http://joomla.box/repos/weblinks/tests/joomla-cms3/administrator/index.php
  Fill Username Text Field
  Fill Password Text Field
  I click Login button
  I wait to see Administrator Control Panel
* I am going to Navigate to Categories page in /administrator/
* As an Administrator
* I am on page "administrator/index.php?option=com_categories&extension=com_weblinks"
  [GET] http://joomla.box/repos/weblinks/tests/joomla-cms3/administrator/index.php?option=com_categories&extension=com_weblinks
* I wait for text "Weblinks: Categories","30",{"css":"h1"}
* I expect to see categories page
* I check for php notices or warnings 
* I am going to try to save a category with a filled title
* I click toolbar button "New"
* I wait for text "Weblinks: New Category","30",{"css":"h1"}
* I fill field {"id":"jform_title"},"automated testing unpub16"
* I click toolbar button "Save & Close"
* I expect to see a success message after saving the category
* I see "Category successfully saved",{"id":"system-message-container"}
* I search for item "automated testing unpub16"
  Searching for automated testing unpub16
* I wait for text "Weblinks: Categories","30",{"css":"h1"}
* I check all results 
  Selecting Checkall button
* I am going to try to publish a weblink category
* I click toolbar button "publish"
* I wait for text "Weblinks: Categories","30",{"css":"h1"}
* I expect to see a success message after publishing the category
* I see "1 category successfully published.",{"id":"system-message-container"}
* I wait for text "Weblinks: Categories","30",{"css":"h1"}
* I check all results 
  Selecting Checkall button
* I am going to Try to unpublish a weblink category
* I click toolbar button "unpublish"
* I wait for text "Weblinks: Categories","30",{"css":"h1"}
* I expect to See a success message after unpublishing the category
* I see "1 category successfully unpublished",{"id":"system-message-container"}
* I am going to Delete the Category which was created
* I am on page "administrator/index.php?option=com_categories&extension=com_weblinks"
  [GET] http://joomla.box/repos/weblinks/tests/joomla-cms3/administrator/index.php?option=com_categories&extension=com_weblinks
* I wait for text "Weblinks: Categories","30",{"css":"h1"}
* I search for item "automated testing unpub16"
  Searching for automated testing unpub16
* I am going to Select the weblink result
* I check all results 
  Selecting Checkall button
* I click toolbar button "Trash"
* I see "category successfully trashed.",{"id":"system-message-container"}
 PASSED 

@javigomez javigomez added the RTC label Oct 30, 2015
@javigomez javigomez assigned Kubik-Rubik and unassigned javigomez Oct 30, 2015
@Kubik-Rubik
Copy link
Contributor

Thank you @puneet0191! Merged with d42948b

@puneet0191
Copy link
Member Author

Thanks @Kubik-Rubik 👌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants