BUGFIX: Fix Salad tests

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/branches/2.4@102265 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Luke Hudson 2010-04-09 04:00:09 +00:00 committed by Sam Minnee
parent 07ab02b29d
commit 30e6e91a81
2 changed files with 36 additions and 23 deletions

View File

@ -5,36 +5,43 @@ Feature: Page deletion in the CMS
Scenario: User can delete a page without making any changes Scenario: User can delete a page without making any changes
Given I log into the CMS as admin 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.scenario1"
And I save the page 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 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 Scenario: A deleted page can't be viewed
Given I create a new page And there are 0 root pages with navigation label "delete-page.scenario2"
And I save the page 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 When I delete the current page
And there are 0 root pages with navigation label "delete-page.scenario2"
And I log out 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 Scenario: A deleted URL can be re-used
Given I log into the CMS as admin 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 I click on the "Metadata" tab
And the "URLSegment" field is "new-page" And the "URLSegment" field is "delete-page-scenario3"
And I save the page
And I delete the current page 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 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 Then delete the current page
Scenario: A deleted page doesn't appear after re-login 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 save the page
And I delete the current page And I delete the current page
And there are 0 root pages with navigation label "delete-page.scenario4"
When I log out When I log out
And I log into the CMS as admin 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 /a "(.*)" page called "(.*)" as a child of "(.*)"/i do |type, title, parent|
Given "I click the \"#{parent}\" link" Given "I click the \"#{parent}\" link"
And 'I wait 2s'
And 'I click the "Create" button' And 'I click the "Create" button'
And "I select \"#{type}\" from \"PageType\"" And "I select \"#{type}\" from \"PageType\""
And 'I click the "Go" button' And 'I click the "Go" button'
@ -20,7 +21,8 @@ end
Given /^a top\-level "(.*)" page called "(.*)"$/i do |type,title| Given /^a top\-level "(.*)" page called "(.*)"$/i do |type,title|
Given "I click the \"Site Content\" link" 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 put \"#{title}\" in the \"Title\" field"
And "I click \"Save\"" And "I click \"Save\""
end end
@ -43,13 +45,17 @@ Given /create a new page$/i do
Given "I create a new page using template \"Page\"" Given "I create a new page using template \"Page\""
end 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 /create a new page using template \"(.*)\"/i do |type|
Given 'I load the root node (ajax)' Given 'I load the root node (ajax)'
puts "Clicking the create button"
And 'I click the "Create" button' And 'I click the "Create" button'
puts "Selecting #{type} from PageType"
And "I select \"#{type}\" from \"PageType\"" And "I select \"#{type}\" from \"PageType\""
puts "done selecting"
And 'I click the "Go" button (ajax)' And 'I click the "Go" button (ajax)'
And 'I click the "Create" button' And 'I click the "Create" button'
end end
@ -65,7 +71,7 @@ end
## ASSERTIONS ## 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 @browser.elements_by_xpath("//ul[@id='sitetree']/li/ul/li//a[.='#{nav}']").count.should == count.to_i
end end