From 2e50375eed18526f53f2ce00f3e7ceaadb3b4a4c Mon Sep 17 00:00:00 2001 From: Raphael Date: Mon, 24 Jan 2011 18:53:15 -0800 Subject: [PATCH] Pretty sure that this delete a post feature is broken --- features/posts.feature | 20 +++++++++++++++++-- features/step_definitions/custom_web_steps.rb | 16 +++++++++++++++ 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/features/posts.feature b/features/posts.feature index 981cb8c99..12fd2d4c6 100644 --- a/features/posts.feature +++ b/features/posts.feature @@ -10,8 +10,24 @@ Feature: posting When I fill in "status_message_message" with "I am eating a yogurt" And I press "Share" - And I follow "Family" - Then I should see "I am eating a yogurt" + And I am on the home page + Then I should see "I am eating a yogurt" within ".stream_element" + + @javascript + Scenario: delete a post + Given I am signed in + And I have an aspect called "Family" + And I am on the home page + And I expand the publisher + When I fill in "status_message_message" with "I am eating a yogurt" + And I press "Share" + And I am on the home page + And I hover over the post + And I press the first ".delete" within ".stream_element" + And I confirm the alert + And I am on the home page + Then I should not see "I am eating a yoghurt" + Scenario Outline: post to one aspect Given I am signed in diff --git a/features/step_definitions/custom_web_steps.rb b/features/step_definitions/custom_web_steps.rb index d5e29c582..bca35e21a 100644 --- a/features/step_definitions/custom_web_steps.rb +++ b/features/step_definitions/custom_web_steps.rb @@ -4,6 +4,22 @@ When /^(.*) in the header$/ do |action| end end +And /^I expand the publisher$/ do + page.execute_script(' + $("#publisher").removeClass("closed"); + $("#publisher").find("textarea").focus(); + ') +end + +And /^I hover over the post$/ do + page.execute_script('$(".stream_element").first().mouseover()') +end + +And /^I confirm the alert$/ do + a = page.driver.browser.switch_to.alert + a.accept +end + When /^(.*) in the modal window$/ do |action| within('#facebox') do When action