BUGFIX: Fix Salad tests (from r102265)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@111652 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sam Minnee 2010-10-04 06:12:29 +00:00
parent 3a7b510127
commit 186f59b059
2 changed files with 36 additions and 23 deletions

View File

@ -2,39 +2,46 @@ Feature: Page deletion in the CMS
As a content author
I want to delete pages in the CMS
So that out of date content can be removed
Scenario: User can delete a page without making any changes
Given I log into the CMS as admin
And I create a new page
And I save the page
And there are 0 root pages with navigation label "delete-page.scenario1"
And I create a new page called "delete-page.scenario1"
And there are 1 root pages with navigation label "delete-page.scenario1"
When I delete the current page
Then there are 0 root pages with navigation label "New Page"
Then there are 0 root pages with navigation label "delete-page.scenario1"
Scenario: A deleted page can't be viewed
Given I create a new page
And I save the page
And there are 0 root pages with navigation label "delete-page.scenario2"
Given I create a new page called "delete-page.scenario2"
And there is 1 root page with navigation label "delete-page.scenario2"
When I delete the current page
And there are 0 root pages with navigation label "delete-page.scenario2"
And I log out
Then url new-page does not exist
Then url delete-page-scenario2 does not exist
Scenario: A deleted URL can be re-used
Given I log into the CMS as admin
And I create a new page
And there are 0 root pages with navigation label "delete-page.scenario3"
And I create a new page called "delete-page.scenario3"
And there are 1 root pages with navigation label "delete-page.scenario3"
And I click on the "Metadata" tab
And the "URLSegment" field is "new-page"
And I save the page
And the "URLSegment" field is "delete-page-scenario3"
And I delete the current page
When I create a new page
And there are 0 root pages with navigation label "delete-page.scenario3"
When I create a new page called "delete-page.scenario3"
And I click on the "Metadata" tab
Then the "URLSegment" field is "new-page"
Then the "URLSegment" field is "delete-page-scenario3"
Then delete the current page
Scenario: A deleted page doesn't appear after re-login
Given I create a new page
Given there are 0 root pages with navigation label "delete-page.scenario4"
And I create a new page called "delete-page.scenario4"
And there is 1 root page with navigation label "delete-page.scenario4"
And I save the page
And I delete the current page
And there are 0 root pages with navigation label "delete-page.scenario4"
When I log out
And I log into the CMS as admin
Then there are 0 root pages with navigation label "New Page"
Then there are 0 root pages with navigation label "delete-page.scenario4"

View File

@ -10,6 +10,7 @@ end
Given /a "(.*)" page called "(.*)" as a child of "(.*)"/i do |type, title, parent|
Given "I click the \"#{parent}\" link"
And 'I wait 2s'
And 'I click the "Create" button'
And "I select \"#{type}\" from \"PageType\""
And 'I click the "Go" button'
@ -20,7 +21,8 @@ end
Given /^a top\-level "(.*)" page called "(.*)"$/i do |type,title|
Given "I click the \"Site Content\" link"
And "I create a page "
And "I create a new page "
And "I click on the \"Main\" tab"
And "I put \"#{title}\" in the \"Title\" field"
And "I click \"Save\""
end
@ -43,13 +45,17 @@ Given /create a new page$/i do
Given "I create a new page using template \"Page\""
end
Given /create a new page called "(.*)"$/i do |title|
Given "I create a new page using template \"Page\""
And "I click on the \"Main\" tab"
And "I put \"#{title}\" in the \"Page name\" field"
And "I click the \"Save\" button"
end
Given /create a new page using template \"(.*)\"/i do |type|
Given 'I load the root node (ajax)'
puts "Clicking the create button"
And 'I click the "Create" button'
puts "Selecting #{type} from PageType"
And "I select \"#{type}\" from \"PageType\""
puts "done selecting"
And 'I click the "Go" button (ajax)'
And 'I click the "Create" button'
end
@ -65,7 +71,7 @@ end
## ASSERTIONS
Given /There are ([0-9]+) root pages with navigation label "(.*)"/i do |count, nav|
Given /There (?:are|is) ([0-9]+) root pages? with navigation label "(.*)"/i do |count, nav|
@browser.elements_by_xpath("//ul[@id='sitetree']/li/ul/li//a[.='#{nav}']").count.should == count.to_i
end