diff --git a/tests/cuke/delete-page.feature b/tests/cuke/delete-page.feature index d80aa2a0..c4153e3a 100644 --- a/tests/cuke/delete-page.feature +++ b/tests/cuke/delete-page.feature @@ -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" - \ No newline at end of file + Then there are 0 root pages with navigation label "delete-page.scenario4" + diff --git a/tests/cuke/step_definitions/content.rb b/tests/cuke/step_definitions/content.rb index 157bfa63..721601e7 100644 --- a/tests/cuke/step_definitions/content.rb +++ b/tests/cuke/step_definitions/content.rb @@ -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