Create a gist now

Instantly share code, notes, and snippets.

Feature: Manage Product Categories
In order to group products by categories
As an admin of the site
I want to be able to manage categories in the system
Background:
Given I am an admin user and I have logged in
And I have navigated to the manage categories screen
@UI
Scenario: adding an enabled category
Given I click the "Add category" link
And I enter "category1" into the "CategoryName" textbox
And I ensure the "Enabled" checkbox is "true"
When I click the "Save" button
Then I should see "category1" show up in the list of existing categories
And it should be enabled
Scenario: adding an disabled category
Given I click the "Add category" link
And I enter "category1" into the "CategoryName" textbox
And I ensure the "Enabled" checkbox is "false"
When I click the "Save" button
Then I should see "category1" show up in the list of existing categories
And it should be disabled
Scenario: adding a category with no name
Given I click the "Add category" link
And I enter "" into the "CategoryName" textbox
And I ensure the "Enabled" checkbox is "true"
When I click the "Save" button
Then I should be notified that the "CategoryName" field is required
And the category should not be saved
And I should stay on the edit category screen
Scenario: adding a category with a name that already exists
Given there is already a category with a name of "category1"
And I click the "Add category" link
And I enter "category1" into the "CategoryName" textbox
And I ensure the "Enabled" checkbox is "true"
When I click the "Save" button
Then I should be told that there is already a category with that name in the system
And the category should not be saved
And I should stay on the edit category screen
Scenario: Editing an existing category edit form should be pre-populated with selected category data
Given there are already 3 categories in the system
When I click the "Edit" link for the first category in the list
Then I should be see the edit category form
And it should be pre-populated with the categories data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment