From 5a23907143dae784a2a82ee3e0e41aac3f020db0 Mon Sep 17 00:00:00 2001 From: Sarah Mei Date: Sat, 19 Feb 2011 22:35:10 -0800 Subject: [PATCH] Fix cucumber feature for deleting posts. --- features/posts.feature | 10 ++++------ features/step_definitions/custom_web_steps.rb | 8 ++++++-- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/features/posts.feature b/features/posts.feature index 4df8fc220..70f7bfa71 100644 --- a/features/posts.feature +++ b/features/posts.feature @@ -13,14 +13,13 @@ Feature: posting And I expand the publisher When I fill in "status_message_fake_message" with "I am eating a yogurt" And I press "Share" - And I follow "Home" Then I should see "I am eating a yogurt" within ".stream_element" Scenario: delete a post Given that I am a rock star And I have no open aspects saved - Given I am signed in + And I am signed in And I have an aspect called "Family" And I am on the home page And I expand the publisher @@ -29,11 +28,10 @@ Feature: posting And I follow "Home" And I hover over the post And I preemptively confirm the alert - And I press the first ".delete" within ".stream_element" + And I click to delete the first post And I follow "Home" Then I should not see "I am eating a yogurt" - Scenario Outline: post to one aspect Given that I am a rock star And I have no open aspects saved @@ -45,11 +43,11 @@ Feature: posting And I wait for the ajax to finish And I expand the publisher And I fill in "status_message_fake_message" with "I am eating a yogurt" - And I press "Share" + And I press "Share" And I follow "Home" And I follow "" Then I should "I am eating a yogurt" - + Examples: | aspect | see | | PostTo | see | diff --git a/features/step_definitions/custom_web_steps.rb b/features/step_definitions/custom_web_steps.rb index e3a528992..4d41b52c5 100644 --- a/features/step_definitions/custom_web_steps.rb +++ b/features/step_definitions/custom_web_steps.rb @@ -15,12 +15,16 @@ And /^I hover over the post$/ do page.execute_script('$(".stream_element").first().mouseover()') end +When /^I click to delete the first post$/ do + page.execute_script('$(".stream_element").first().find(".delete").click()') +end + And /^I preemptively confirm the alert$/ do - a = page.evaluate_script("window.confirm = function() { return true; }") + page.evaluate_script("window.confirm = function() { return true; }") end And /^I preemptively reject the alert$/ do - a = page.evaluate_script("window.confirm = function() { return false; }") + page.evaluate_script("window.confirm = function() { return false; }") end When /^(.*) in the modal window$/ do |action|