From dee0c068965b26959b72eb122061a47aedf7efef Mon Sep 17 00:00:00 2001 From: Gonzalo Rodriguez Date: Sat, 1 Oct 2011 04:49:05 -0300 Subject: [PATCH] Adapt some cukes for the new aspect nav refactor --- features/comments.feature | 3 +-- features/posts_from_main_page.feature | 9 +++------ features/step_definitions/aspects_steps.rb | 14 ++++++++++++++ features/step_definitions/custom_web_steps.rb | 7 ------- 4 files changed, 18 insertions(+), 15 deletions(-) create mode 100644 features/step_definitions/aspects_steps.rb diff --git a/features/comments.feature b/features/comments.feature index 82fcbd9be..fa73d5fca 100644 --- a/features/comments.feature +++ b/features/comments.feature @@ -62,8 +62,7 @@ Feature: commenting When I focus the comment field Then the first comment field should be open - When I follow "Besties" - And I wait for the ajax to finish + When I select "Besties" aspect Then I should see "Look at this dog" Then the first comment field should be closed When I focus the comment field diff --git a/features/posts_from_main_page.feature b/features/posts_from_main_page.feature index 10d11a7df..7a8ba929b 100644 --- a/features/posts_from_main_page.feature +++ b/features/posts_from_main_page.feature @@ -26,21 +26,18 @@ Feature: posting from the main page Then I should see "I am eating a yogurt" within ".stream_element" Scenario: post a text-only message to just one aspect - When I follow "PostingTo" - And I wait for the ajax to finish + When I select "PostingTo" aspect And I expand the publisher And I fill in "status_message_fake_text" with "I am eating a yogurt" And I press "Share" And I wait for the ajax to finish When I am on the aspects page - And I follow "PostingTo" within "#aspect_nav" - And I wait for the ajax to finish + And I select "PostingTo" aspect Then I should see "I am eating a yogurt" When I am on the aspects page - And I follow "NotPostingThingsHere" within "#aspect_nav" - And I wait for the ajax to finish + And I select "NotPostingThingsHere" aspect Then I should not see "I am eating a yogurt" Scenario: post a photo with text diff --git a/features/step_definitions/aspects_steps.rb b/features/step_definitions/aspects_steps.rb new file mode 100644 index 000000000..3f6505f27 --- /dev/null +++ b/features/step_definitions/aspects_steps.rb @@ -0,0 +1,14 @@ +When /^I click on "([^"]*)" aspect edit icon$/ do |aspect_name| + When %{I hover over the "ul.sub_nav > li:contains('#{aspect_name}')"} + within("#aspect_nav") do + find(:xpath, "//a[@rel='facebox'][.//img[@title='Edit #{aspect_name}']]").click + end +end + +When /^I select "([^"]*)" aspect$/ do |aspect_name| + within('#aspect_nav') do + click_link 'Deselect all' + click_link aspect_name + end + And %{I wait for the ajax to finish} +end diff --git a/features/step_definitions/custom_web_steps.rb b/features/step_definitions/custom_web_steps.rb index 84c60bc3d..5e1d6e411 100644 --- a/features/step_definitions/custom_web_steps.rb +++ b/features/step_definitions/custom_web_steps.rb @@ -189,13 +189,6 @@ When /^I resize my window to 800x600$/ do JS end -When /^I click on "([^"]*)" aspect edit icon$/ do |aspect_name| - When %{I hover over the "ul.sub_nav > li:contains('#{aspect_name}')"} - within("#aspect_nav") do - find(:xpath, "//a[@rel='facebox'][.//img[@title='Edit #{aspect_name}']]").click - end -end - Then /^I follow Edit Profile in the same window$/ do page.execute_script("$('a[href=\"#{edit_profile_path}\"]').removeAttr('target')")