Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

[2012-12-13] BEHAT: Create a feature file and script for Asset Admin Filter #621

Open
silverstripe-issues opened this Issue · 3 comments

2 participants

@silverstripe-issues

created by: @jbridson (jbridson)
created at: 2012-12-13
original ticket: http://open.silverstripe.org/ticket/8116


As an administrator or content editor I want to be able to filter the asset records so I can find the specific asset I am looking for.

Acceptance Criteria:

  1. I can access admin/assets
  2. I can open the filter panel
  3. I can enter my filter criteria a. by "name" b. by "file type"
  4. I can limit my search to the current folder
  5. I can apply filter and see the results in the file/folder list view
  6. I can reset the filter to see all pages
Scenario: I can filter the files list view using the "Name" field
  Given there are the following "asset" records
  """
  <image "Image1">
  <image "Image2">
  <video "Video1">
  <video "Video2">
  <folder "Folder1">
    <image "ImageInFolder1">
    <video "VideoInFolder1">
  <folder "Folder2">
    <image "ImageInFolder2">
    <video "VideoInFolder2">
  """ 
    And I can see an "Form_EditForm_File" element
    And I can see an "cms-search-form" element
    And I fill in "Form_filter_q-Name" with "Image"
  When I press "Form_filter_action_doSearch"
  Then I should see "Image1" in the "Form_EditForm_File" element
    And I should not see "Video1" in the "Form_EditForm_File" element
  When I press "resetformaction"
  Then the "Form_filter_q-Name" field should not contain "Image"
     And I should see "Video1" in the "Form_EditForm_File" element
Scenario: I can filter the files list view using the "File type" field
  Given there are the following "asset" records
  """
  <image "Image1">
  <image "Image2">
  <video "Video1">
  <video "Video2">
  <folder "Folder1">
    <image "ImageInFolder1">
    <video "VideoInFolder1">
  <folder "Folder2">
    <image "ImageInFolder2">
    <video "VideoInFolder2">
  """ 
    And I can see an "Form_EditForm_File" element
    And I can see an "cms-search-form" element
    And I fill in the "Form_filter_q-AppCategory" dropdown with "Video"
  When I press "Form_filter_action_doSearch"
  Then I should see "Video1" in the "Form_EditForm_File" element
    And I should not see "Image1" in the "Form_EditForm_File" element
  When I press "resetformaction"
  Then the "Form_filter_q-AppCategory" field should not contain "Video"
     And I should see "Image1" in the "Form_EditForm_File" element
Scenario: I can limit the filtering of the files list view to only the files within the current folder
  Given there are the following "asset" records
  """
  <image "Image1">
  <image "Image2">
  <video "Video1">
  <video "Video2">
  <folder "Folder1">
    <image "ImageInFolder1">
    <video "VideoInFolder1">
  <folder "Folder2">
    <image "ImageInFolder2">
    <video "VideoInFolder2">
  """ 
    And I can see an "Form_EditForm_File" element
    And I can see an "cms-search-form" element
    And I should be in the "Folder1" folder (I am not sure of the proper way of writing this)
    And I fill in "Form_filter_q-Name" with "Image"
    And the "Form_filter_q-CurrentFolderOnly" checkbox should be checked
  When I press "Form_filter_action_doSearch"
  Then I should see "ImageInFolder1" in the "Form_EditForm_File" element
    And I should not see "VideoInFolder1" in the "Form_EditForm_File" element
    And I should not see "Image1" in the "Form_EditForm_File" element
  When I press "resetformaction"
  Then the "Form_filter_q-Name" field should not contain "Image"
     And I should see "VideoInFolder1" in the "Form_EditForm_File" element
@silverstripe-issues

comment by: @jbridson (jbridson)
created at: 2012-12-13


I think some of these could be used in this test... I didn't see them to begin with but they seem more fitting

This could be used instead of "And I can see an "cms-search-form" element"

When /^I expand the "([^"]*)" CMS Panel$/
    # SilverStripe\Framework\Test\Behaviour\CmsUiContext::iExpandTheCmsPanel()

And this could be used instead of "And I should not see "VideoInFolder1" in the "Form_EditForm_File" element"

Then /^the "([^"]*)" table should contain "([^"]*)"$/
    # SilverStripe\Framework\Test\Behaviour\CmsUiContext::theTableShouldContain()

 Then /^the "([^"]*)" table should not contain "([^"]*)"$/
    # SilverStripe\Framework\Test\Behaviour\CmsUiContext::theTableShouldNotContain()
@silverstripe-issues

comment by: @jbridson (jbridson)
created at: 2012-12-13


See framework/tests/behat/features/manage-files.feature on 3.1 branch to get ideas on formatting etc. If I find time I will redo the above code myself.

@silverstripe-issues

comment by: @chillu (ischommer)
created at: 2012-12-13


Setting milestone from beta1 to 3.1.0 final - unless some magic fairies come in and write the tests over the weekend I don't see how this would get done ;)

@simonwelsh simonwelsh added the 3.1 label
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.