From c69853e0cf8ed12fa51180e2f864c1f1ab217863 Mon Sep 17 00:00:00 2001 From: Fabian Rodriguez Date: Mon, 12 Aug 2013 19:20:15 -0300 Subject: [PATCH 1/5] replace asserts with rspec equivalents --- features/step_definitions/custom_web_steps.rb | 6 +-- features/step_definitions/web_steps.rb | 49 +++---------------- 2 files changed, 9 insertions(+), 46 deletions(-) diff --git a/features/step_definitions/custom_web_steps.rb b/features/step_definitions/custom_web_steps.rb index ac2e49931..3918ccd2b 100644 --- a/features/step_definitions/custom_web_steps.rb +++ b/features/step_definitions/custom_web_steps.rb @@ -216,11 +216,7 @@ Then /^the "([^"]*)" field(?: within "([^"]*)")? should be filled with "([^"]*)" field = find_field(field) field_value = (field.tag_name == 'textarea') ? field.text : field.value field_value = field_value.first if field_value.is_a? Array - if field_value.respond_to? :should - field_value.should == value - else - assert_equal(value, field_value) - end + field_value.should == value end end diff --git a/features/step_definitions/web_steps.rb b/features/step_definitions/web_steps.rb index cb39b4d59..e43b12da9 100644 --- a/features/step_definitions/web_steps.rb +++ b/features/step_definitions/web_steps.rb @@ -119,22 +119,14 @@ end Then /^(?:|I )should see \/([^\/]*)\/(?: within "([^"]*)")?$/ do |regexp, selector| regexp = Regexp.new(regexp) with_scope(selector) do - if page.respond_to? :should - page.should have_xpath('//*', :text => regexp) - else - assert page.has_xpath?('//*', :text => regexp) - end + page.should have_xpath('//*', :text => regexp) end end Then /^(?:|I )should not see (\".+?\"[\s]*)(?:[\s]+within[\s]* "([^"]*)")?$/ do |vars,selector| vars.scan(/"([^"]+?)"/).flatten.each do |text| with_scope(selector) do - if page.respond_to? :should - page.should have_no_content(text) - else - assert page.has_no_content?(text) - end + page.should have_no_content(text) end end end @@ -142,11 +134,7 @@ end Then /^(?:|I )should not see \/([^\/]*)\/(?: within "([^"]*)")?$/ do |regexp, selector| regexp = Regexp.new(regexp) with_scope(selector) do - if page.respond_to? :should - page.should have_no_xpath('//*', :text => regexp) - else - assert page.has_no_xpath?('//*', :text => regexp) - end + page.should have_no_xpath('//*', :text => regexp) end end @@ -154,11 +142,7 @@ Then /^the "([^"]*)" field(?: within "([^"]*)")? should contain "([^"]*)"$/ do | with_scope(selector) do field = find_field(field) field_value = (field.tag_name == 'textarea') ? field.text : field.value - if field_value.respond_to? :should - field_value.should =~ /#{value}/ - else - assert_match(/#{value}/, field_value) - end + field_value.should =~ /#{value}/ end end @@ -166,33 +150,21 @@ Then /^the "([^"]*)" field(?: within "([^"]*)")? should not contain "([^"]*)"$/ with_scope(selector) do field = find_field(field) field_value = (field.tag_name == 'textarea') ? field.text : field.value - if field_value.respond_to? :should_not - field_value.should_not =~ /#{value}/ - else - assert_no_match(/#{value}/, field_value) - end + field_value.should_not =~ /#{value}/ end end Then /^the "([^"]*)" checkbox(?: within "([^"]*)")? should be checked$/ do |label, selector| with_scope(selector) do field_checked = find_field(label)['checked'] - if field_checked.respond_to? :should - field_checked.should be_true - else - assert field_checked - end + field_checked.should be_true end end Then /^the "([^"]*)" checkbox(?: within "([^"]*)")? should not be checked$/ do |label, selector| with_scope(selector) do field_checked = find_field(label)['checked'] - if field_checked.respond_to? :should - field_checked.should be_false - else - assert !field_checked - end + field_checked.should be_false end end @@ -206,12 +178,7 @@ Then /^(?:|I )should have the following query string:$/ do |expected_pairs| actual_params = query ? CGI.parse(query) : {} expected_params = {} expected_pairs.rows_hash.each_pair{|k,v| expected_params[k] = v.split(',')} - - if actual_params.respond_to? :should - actual_params.should == expected_params - else - assert_equal expected_params, actual_params - end + actual_params.should == expected_params end Then /^show me the page$/ do From d489dfc8e3bcab960d009fb1c1f754458ff17d31 Mon Sep 17 00:00:00 2001 From: Fabian Rodriguez Date: Mon, 12 Aug 2013 19:20:36 -0300 Subject: [PATCH 2/5] remove unused steps --- features/step_definitions/custom_web_steps.rb | 34 ---------- features/step_definitions/factory_steps.rb | 68 ------------------- features/step_definitions/posts_steps.rb | 8 --- features/step_definitions/scope_steps.rb | 28 -------- features/step_definitions/session_steps.rb | 9 +-- features/step_definitions/stream_steps.rb | 10 --- features/step_definitions/template_steps.rb | 12 ---- features/step_definitions/uri-step.rb | 26 ------- 8 files changed, 2 insertions(+), 193 deletions(-) delete mode 100644 features/step_definitions/factory_steps.rb delete mode 100644 features/step_definitions/scope_steps.rb delete mode 100644 features/step_definitions/template_steps.rb delete mode 100644 features/step_definitions/uri-step.rb diff --git a/features/step_definitions/custom_web_steps.rb b/features/step_definitions/custom_web_steps.rb index 3918ccd2b..882092e4b 100644 --- a/features/step_definitions/custom_web_steps.rb +++ b/features/step_definitions/custom_web_steps.rb @@ -75,10 +75,6 @@ And /^I expand the publisher$/ do click_publisher end -When 'I click the aspects title' do - find('.home_selector').click -end - When /^I press the aspect dropdown$/ do find('.dropdown .button').click end @@ -88,10 +84,6 @@ And /^I toggle the aspect "([^"]*)"$/ do |aspect_name| find(".dropdown li[data-aspect_id='#{aspect.id}']").click end -Then /^the publisher should be collapsed$/ do - find("#publisher")["class"].should include("closed") -end - Then /^the publisher should be expanded$/ do find("#publisher")["class"].should_not include("closed") end @@ -147,10 +139,6 @@ When /^I click to delete the first uploaded photo$/ do find("#photodropzone .x", match: :first).click end -And /^I click "([^"]*)" button$/ do |arg1| - page.execute_script('$(".button:contains('+arg1+')").click()') -end - And /^I click on selector "([^"]*)"$/ do |selector| find(selector).click end @@ -220,10 +208,6 @@ Then /^the "([^"]*)" field(?: within "([^"]*)")? should be filled with "([^"]*)" end end -Then /^I should see (\d+) posts$/ do |n_posts| - has_css?("#main_stream .stream_element", :count => n_posts.to_i).should be_true -end - Then /^I should see (\d+) contacts$/ do |n_posts| has_css?("#people_stream .stream_element", :count => n_posts.to_i).should be_true end @@ -242,12 +226,6 @@ When /^I resize my window to 800x600$/ do JS end -Then /^I follow Edit Profile in the same window$/ do - page.execute_script("$('a[href=\"#{edit_profile_path}\"]').removeAttr('target')") - - step %(I follow "Edit Profile") -end - Then 'I should see an image attached to the post' do step %{I should see a "img" within ".stream_element div.photo_attachments"} end @@ -265,22 +243,10 @@ And /^I click close on all the popovers$/ do page.should_not have_selector(".popover .close") end -Then /^I should see first post deletion link$/ do - page.should have_selector '.stream_element .delete', match: :first -end - -Then /^I should not see ajax loader on deletion link place$/ do - page.should_not have_selector '.hide_loader' -end - Then /^I should see a flash message indicating success$/ do flash_message_success?.should be_true end -Then /^I should see a flash message indicating failure$/ do - flash_message_failure?.should be_true -end - Then /^I should see a flash message containing "(.+)"$/ do |text| flash_message_containing? text end diff --git a/features/step_definitions/factory_steps.rb b/features/step_definitions/factory_steps.rb deleted file mode 100644 index a50824d25..000000000 --- a/features/step_definitions/factory_steps.rb +++ /dev/null @@ -1,68 +0,0 @@ -module FactoryMethods - def create_from_table(model_name, table, extra = {}) - factory_name = model_name.gsub(/\W+/, '_').downcase.singularize.to_sym - is_singular = model_name.to_s.singularize == model_name.to_s - hashes = if is_singular - if table.kind_of?(Hash) - [table] - else - [table.rows_hash] - end - else - table.hashes - end - klass = FactoryGirl.factories[factory_name].class_name.to_s.classify.constantize - @they = hashes.map do |hash| - hash = hash.merge(extra).inject({}) do |h,(k,v)| - k = k.gsub(/\W+/,'_') - v = v.split(/\s*,\s*/) if klass.serialized_attributes[k] == Array - h.update(k.to_sym => v) - end - object = FactoryGirl.build(factory_name, hash) - yield object if block_given? - object.save! - object - end - if is_singular - @it = @they.last - instance_variable_set("@#{factory_name}", @it) - end - end -end - -World(FactoryMethods) - -Given %r{^I have a (.+)$} do |model_name| - create_from_table(model_name, {}, 'user' => @me) -end - -Given %r{^I have the following (.+):$} do |child, table| - step "that me has the following #{child}:", table -end - -Given %r{^the following (.+):$} do |model_name, table| - create_from_table(model_name, table) -end - -Given %r{^that (.+) has the following (.+):$} do |parent, child, table| - child= child.gsub(/\W+/,'_') - parent = parent.gsub(/\W+/,'_').downcase.sub(/^_/, '') - parent_instance = instance_variable_get("@#{parent}") - parent_class = parent_instance.class - if assoc = parent_class.reflect_on_association(child.to_sym) || parent_class.reflect_on_association(child.pluralize.to_sym) - parent = (assoc.options[:as] || parent).to_s - child = (assoc.options[:class_name] || child).to_s - end - if child.classify.constantize.method_defined?(parent.pluralize) - create_from_table(child, table, parent.pluralize => [parent_instance]) - elsif child.classify.constantize.method_defined?(parent) - create_from_table(child, table, parent => parent_instance) - else - create_from_table(child, table) - if assoc.macro == :has_many - parent_instance.send("#{assoc.name}=", @they) - else - parent_instance.send("#{assoc.name}=", @they.first) - end - end -end diff --git a/features/step_definitions/posts_steps.rb b/features/step_definitions/posts_steps.rb index b410b8f09..aefe6a09e 100644 --- a/features/step_definitions/posts_steps.rb +++ b/features/step_definitions/posts_steps.rb @@ -1,7 +1,3 @@ -Then /^the post "([^"]*)" should be marked nsfw$/ do |text| - assert_nsfw(text) -end - Then /^the post should be collapsed$/ do first_post_collapsed? end @@ -38,10 +34,6 @@ And /^the post with text "([^"]*)" is reshared by "([^"]*)"$/ do |text, email| user.post(:reshare, :root_guid => root.guid, :public => true, :to => user.aspects) end -When /^The user deletes their first post$/ do - @me.posts.first.destroy -end - When /^I click on the first block button/ do find(".block_user", visible: false).click end diff --git a/features/step_definitions/scope_steps.rb b/features/step_definitions/scope_steps.rb deleted file mode 100644 index 588f62ca6..000000000 --- a/features/step_definitions/scope_steps.rb +++ /dev/null @@ -1,28 +0,0 @@ -module SectionLocator - def within_parent(content, elements = ['*'], &block) - expr = %(//*[(#{elements.join('|')})/descendant-or-self::*[contains(., "#{content}")]]) - within(expr, &block) - end -end - -World(SectionLocator) - -sections = %w(h1 h2 h3 h4 h5 h6 legend caption dt strong header) - -When /^(.*) in the "([^\"]*)" section$/ do |action, title| - within_parent(title, sections) do - step action - end -end - -When /^(.*) in the "([^\"]*)" section:$/ do |action, title, table| - within_parent(title, sections) do - step "#{action}:", table - end -end - -When /^(.*) in the "([^\"]*)" row$/ do |action, title| - within_parent(title, %w(th td)) do - step action - end -end diff --git a/features/step_definitions/session_steps.rb b/features/step_definitions/session_steps.rb index e84c72398..6b590e34c 100644 --- a/features/step_definitions/session_steps.rb +++ b/features/step_definitions/session_steps.rb @@ -1,13 +1,8 @@ - -Given /^(?:I am signed in|I sign in)$/ do +Given /^(?:I am signed in)$/ do automatic_login confirm_login end -When /^I try to sign in$/ do - automatic_login -end - When /^I try to sign in manually$/ do manual_login end @@ -62,4 +57,4 @@ end When /^I (?:log|sign) out manually$/ do manual_logout -end \ No newline at end of file +end diff --git a/features/step_definitions/stream_steps.rb b/features/step_definitions/stream_steps.rb index 5f8ac4c55..4f36c979a 100644 --- a/features/step_definitions/stream_steps.rb +++ b/features/step_definitions/stream_steps.rb @@ -1,7 +1,3 @@ -Then /^I should see an image in the publisher$/ do - photo_in_publisher.should be_present -end - Then /^I like the post "([^"]*)"$/ do |post_text| like_post(post_text) end @@ -17,9 +13,3 @@ end Then /^I should have (\d+) nsfw posts$/ do |num_posts| page.should have_css(".nsfw-shield", count: num_posts.to_i) end - -When /^I click the show page link for "([^"]*)"$/ do |post_text| - within(find_post_by_text(post_text)) do - find("time").click - end -end diff --git a/features/step_definitions/template_steps.rb b/features/step_definitions/template_steps.rb deleted file mode 100644 index d1340275f..000000000 --- a/features/step_definitions/template_steps.rb +++ /dev/null @@ -1,12 +0,0 @@ -Given /^I have posts for each type of template$/ do - generate_post_of_each_template(@me) -end - -Then /^I visit all of my posts$/ do - lambda{ @templates_seen = visit_posts_and_collect_template_names(@me)}.should_not raise_error -end - -When /^I should have seen all of my posts displayed with the correct template$/ do - pending - @templates_seen.should =~ TemplatePicker.jsonified_templates -end \ No newline at end of file diff --git a/features/step_definitions/uri-step.rb b/features/step_definitions/uri-step.rb deleted file mode 100644 index a37d737fa..000000000 --- a/features/step_definitions/uri-step.rb +++ /dev/null @@ -1,26 +0,0 @@ -When /^I visit url ([^ ]+)$/ do |url| - visit( url) -end - -Then /^I should find '([^']*)' in ([^ ]+)$/ do |pattern,file| - found = %x!fgrep -o #{pattern} #{file}! - assert_equal pattern, found.chomp, "Can't find pattern in #{file}" -end - -Then /^I should match '([^']*)' in ([^ ]+)$/ do |pattern,file| - found = `egrep -o '#{pattern}' #{file}` - assert_match /#{pattern}/, found.chomp, "Can't find #{pattern} in #{file}" -end - -When /^I retrieve ([^ ]+) into ([^ ]+)$/ do |url,file| - system( "wget -q -O #{file} #{url}") -end - -Then /^a page\-asset should be ([^ ]+)$/ do |asset_path| - page.has_content?(asset_path) -end - - - - - From cdfdf37a17a8f3a8a156feae1d0404168bb289f4 Mon Sep 17 00:00:00 2001 From: Fabian Rodriguez Date: Wed, 21 Aug 2013 21:14:03 -0300 Subject: [PATCH 3/5] use #hover instead of execute_script hacks --- features/step_definitions/aspects_steps.rb | 2 +- features/step_definitions/conversations_steps.rb | 3 ++- features/step_definitions/custom_web_steps.rb | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/features/step_definitions/aspects_steps.rb b/features/step_definitions/aspects_steps.rb index 5a9a3527f..f19e1e5bb 100644 --- a/features/step_definitions/aspects_steps.rb +++ b/features/step_definitions/aspects_steps.rb @@ -1,7 +1,7 @@ When /^I click on "([^"]*)" aspect edit icon$/ do |aspect_name| within(".all_aspects") do li = find('li', text: aspect_name) - page.execute_script("$('#aspects_list li:contains(\\'#{aspect_name}\\') .modify_aspect').css('display', 'block');") # TODO HACK please replace me by li.hover when capybara will be fixed + li.hover li.find('.modify_aspect').click end end diff --git a/features/step_definitions/conversations_steps.rb b/features/step_definitions/conversations_steps.rb index 723335d6e..a813f1f17 100644 --- a/features/step_definitions/conversations_steps.rb +++ b/features/step_definitions/conversations_steps.rb @@ -41,6 +41,7 @@ Then /^I should see "([^"]*)" as part of the participants popover$/ do |name| end Then /^I close the participants popover$/ do - find('.popover-title .close', visible: false).click + find('.popover').hover + find('.popover-title .close').click end diff --git a/features/step_definitions/custom_web_steps.rb b/features/step_definitions/custom_web_steps.rb index 882092e4b..5b42b9263 100644 --- a/features/step_definitions/custom_web_steps.rb +++ b/features/step_definitions/custom_web_steps.rb @@ -114,7 +114,7 @@ And /^I want to mention (?:him|her) from the profile$/ do end And /^I hover over the "([^"]+)"$/ do |element| - page.execute_script("$(\"#{element}\").first().addClass('hover')") + find("#{element}", match: :first).hover end When /^I prepare the deletion of the first post$/ do From e9af8d55af3805e60f4af39060717c5aa1d21a0b Mon Sep 17 00:00:00 2001 From: Fabian Rodriguez Date: Fri, 23 Aug 2013 20:09:42 -0300 Subject: [PATCH 4/5] reorganize cukes into desktop and mobile folders --- features/{ => desktop}/accepts_invitation.feature | 0 features/{ => desktop}/activity_stream.feature | 0 features/{ => desktop}/aspect_navigation.feature | 0 features/{ => desktop}/blocks_user.feature | 0 features/{ => desktop}/change_email.feature | 0 features/{ => desktop}/change_password.feature | 0 features/{ => desktop}/closes_account.feature | 0 features/{ => desktop}/comments.feature | 0 features/{ => desktop}/connects_users.feature | 0 features/{ => desktop}/contacts.feature | 0 features/{ => desktop}/conversations.feature | 0 features/{ => desktop}/donations.feature | 0 features/{ => desktop}/download_photos.feature | 0 features/{ => desktop}/edits_profile.feature | 0 features/{ => desktop}/follows_tags.feature | 0 features/{ => desktop}/hovercards.feature | 0 features/{ => desktop}/invitations.feature | 0 features/{ => desktop}/keyboard_navigation.feature | 0 features/{ => desktop}/logged_out_browsing.feature | 0 features/{ => desktop}/logs_in_and_out.feature | 0 features/{ => desktop}/manages_aspects.feature | 0 features/{ => desktop}/mentions.feature | 0 .../{ => desktop}/mentions_from_profile_page.feature | 0 features/{ => desktop}/not_safe_for_work.feature | 0 features/{ => desktop}/notifications.feature | 0 features/{ => desktop}/oembed.feature | 0 features/{ => desktop}/photo_lightbox.feature | 0 features/{ => desktop}/post_preview.feature | 0 features/{ => desktop}/posts_from_main_page.feature | 0 .../{ => desktop}/posts_from_profile_page.feature | 0 features/{ => desktop}/profile_photos.feature | 0 features/{ => desktop}/reshare.feature | 0 features/{ => desktop}/screenshots.feature | 0 features/{ => desktop}/show_more.feature | 0 features/{ => desktop}/signs_up.feature | 0 features/{ => desktop}/stops_following_users.feature | 0 features/{ => desktop}/tags.feature | 0 features/{ => desktop}/tags_and_comments.feature | 0 features/mobile.feature | 11 ----------- .../activity_stream.feature} | 0 .../conversations.feature} | 0 .../edits_profile.feature} | 0 .../getting_started.feature} | 0 .../multiphoto.feature} | 0 .../posts_from_main_page.feature} | 0 .../reactions.feature} | 0 .../reshare.feature} | 0 features/{tags_mobile.feature => mobile/tags.feature} | 0 48 files changed, 11 deletions(-) rename features/{ => desktop}/accepts_invitation.feature (100%) rename features/{ => desktop}/activity_stream.feature (100%) rename features/{ => desktop}/aspect_navigation.feature (100%) rename features/{ => desktop}/blocks_user.feature (100%) rename features/{ => desktop}/change_email.feature (100%) rename features/{ => desktop}/change_password.feature (100%) rename features/{ => desktop}/closes_account.feature (100%) rename features/{ => desktop}/comments.feature (100%) rename features/{ => desktop}/connects_users.feature (100%) rename features/{ => desktop}/contacts.feature (100%) rename features/{ => desktop}/conversations.feature (100%) rename features/{ => desktop}/donations.feature (100%) rename features/{ => desktop}/download_photos.feature (100%) rename features/{ => desktop}/edits_profile.feature (100%) rename features/{ => desktop}/follows_tags.feature (100%) rename features/{ => desktop}/hovercards.feature (100%) rename features/{ => desktop}/invitations.feature (100%) rename features/{ => desktop}/keyboard_navigation.feature (100%) rename features/{ => desktop}/logged_out_browsing.feature (100%) rename features/{ => desktop}/logs_in_and_out.feature (100%) rename features/{ => desktop}/manages_aspects.feature (100%) rename features/{ => desktop}/mentions.feature (100%) rename features/{ => desktop}/mentions_from_profile_page.feature (100%) rename features/{ => desktop}/not_safe_for_work.feature (100%) rename features/{ => desktop}/notifications.feature (100%) rename features/{ => desktop}/oembed.feature (100%) rename features/{ => desktop}/photo_lightbox.feature (100%) rename features/{ => desktop}/post_preview.feature (100%) rename features/{ => desktop}/posts_from_main_page.feature (100%) rename features/{ => desktop}/posts_from_profile_page.feature (100%) rename features/{ => desktop}/profile_photos.feature (100%) rename features/{ => desktop}/reshare.feature (100%) rename features/{ => desktop}/screenshots.feature (100%) rename features/{ => desktop}/show_more.feature (100%) rename features/{ => desktop}/signs_up.feature (100%) rename features/{ => desktop}/stops_following_users.feature (100%) rename features/{ => desktop}/tags.feature (100%) rename features/{ => desktop}/tags_and_comments.feature (100%) delete mode 100644 features/mobile.feature rename features/{activity_stream_mobile.feature => mobile/activity_stream.feature} (100%) rename features/{conversations_mobile.feature => mobile/conversations.feature} (100%) rename features/{edits_profile_mobile.feature => mobile/edits_profile.feature} (100%) rename features/{getting_started_mobile.feature => mobile/getting_started.feature} (100%) rename features/{multiphoto_mobile.feature => mobile/multiphoto.feature} (100%) rename features/{posts_from_main_page_mobile.feature => mobile/posts_from_main_page.feature} (100%) rename features/{reactions_mobile.feature => mobile/reactions.feature} (100%) rename features/{reshare_mobile.feature => mobile/reshare.feature} (100%) rename features/{tags_mobile.feature => mobile/tags.feature} (100%) diff --git a/features/accepts_invitation.feature b/features/desktop/accepts_invitation.feature similarity index 100% rename from features/accepts_invitation.feature rename to features/desktop/accepts_invitation.feature diff --git a/features/activity_stream.feature b/features/desktop/activity_stream.feature similarity index 100% rename from features/activity_stream.feature rename to features/desktop/activity_stream.feature diff --git a/features/aspect_navigation.feature b/features/desktop/aspect_navigation.feature similarity index 100% rename from features/aspect_navigation.feature rename to features/desktop/aspect_navigation.feature diff --git a/features/blocks_user.feature b/features/desktop/blocks_user.feature similarity index 100% rename from features/blocks_user.feature rename to features/desktop/blocks_user.feature diff --git a/features/change_email.feature b/features/desktop/change_email.feature similarity index 100% rename from features/change_email.feature rename to features/desktop/change_email.feature diff --git a/features/change_password.feature b/features/desktop/change_password.feature similarity index 100% rename from features/change_password.feature rename to features/desktop/change_password.feature diff --git a/features/closes_account.feature b/features/desktop/closes_account.feature similarity index 100% rename from features/closes_account.feature rename to features/desktop/closes_account.feature diff --git a/features/comments.feature b/features/desktop/comments.feature similarity index 100% rename from features/comments.feature rename to features/desktop/comments.feature diff --git a/features/connects_users.feature b/features/desktop/connects_users.feature similarity index 100% rename from features/connects_users.feature rename to features/desktop/connects_users.feature diff --git a/features/contacts.feature b/features/desktop/contacts.feature similarity index 100% rename from features/contacts.feature rename to features/desktop/contacts.feature diff --git a/features/conversations.feature b/features/desktop/conversations.feature similarity index 100% rename from features/conversations.feature rename to features/desktop/conversations.feature diff --git a/features/donations.feature b/features/desktop/donations.feature similarity index 100% rename from features/donations.feature rename to features/desktop/donations.feature diff --git a/features/download_photos.feature b/features/desktop/download_photos.feature similarity index 100% rename from features/download_photos.feature rename to features/desktop/download_photos.feature diff --git a/features/edits_profile.feature b/features/desktop/edits_profile.feature similarity index 100% rename from features/edits_profile.feature rename to features/desktop/edits_profile.feature diff --git a/features/follows_tags.feature b/features/desktop/follows_tags.feature similarity index 100% rename from features/follows_tags.feature rename to features/desktop/follows_tags.feature diff --git a/features/hovercards.feature b/features/desktop/hovercards.feature similarity index 100% rename from features/hovercards.feature rename to features/desktop/hovercards.feature diff --git a/features/invitations.feature b/features/desktop/invitations.feature similarity index 100% rename from features/invitations.feature rename to features/desktop/invitations.feature diff --git a/features/keyboard_navigation.feature b/features/desktop/keyboard_navigation.feature similarity index 100% rename from features/keyboard_navigation.feature rename to features/desktop/keyboard_navigation.feature diff --git a/features/logged_out_browsing.feature b/features/desktop/logged_out_browsing.feature similarity index 100% rename from features/logged_out_browsing.feature rename to features/desktop/logged_out_browsing.feature diff --git a/features/logs_in_and_out.feature b/features/desktop/logs_in_and_out.feature similarity index 100% rename from features/logs_in_and_out.feature rename to features/desktop/logs_in_and_out.feature diff --git a/features/manages_aspects.feature b/features/desktop/manages_aspects.feature similarity index 100% rename from features/manages_aspects.feature rename to features/desktop/manages_aspects.feature diff --git a/features/mentions.feature b/features/desktop/mentions.feature similarity index 100% rename from features/mentions.feature rename to features/desktop/mentions.feature diff --git a/features/mentions_from_profile_page.feature b/features/desktop/mentions_from_profile_page.feature similarity index 100% rename from features/mentions_from_profile_page.feature rename to features/desktop/mentions_from_profile_page.feature diff --git a/features/not_safe_for_work.feature b/features/desktop/not_safe_for_work.feature similarity index 100% rename from features/not_safe_for_work.feature rename to features/desktop/not_safe_for_work.feature diff --git a/features/notifications.feature b/features/desktop/notifications.feature similarity index 100% rename from features/notifications.feature rename to features/desktop/notifications.feature diff --git a/features/oembed.feature b/features/desktop/oembed.feature similarity index 100% rename from features/oembed.feature rename to features/desktop/oembed.feature diff --git a/features/photo_lightbox.feature b/features/desktop/photo_lightbox.feature similarity index 100% rename from features/photo_lightbox.feature rename to features/desktop/photo_lightbox.feature diff --git a/features/post_preview.feature b/features/desktop/post_preview.feature similarity index 100% rename from features/post_preview.feature rename to features/desktop/post_preview.feature diff --git a/features/posts_from_main_page.feature b/features/desktop/posts_from_main_page.feature similarity index 100% rename from features/posts_from_main_page.feature rename to features/desktop/posts_from_main_page.feature diff --git a/features/posts_from_profile_page.feature b/features/desktop/posts_from_profile_page.feature similarity index 100% rename from features/posts_from_profile_page.feature rename to features/desktop/posts_from_profile_page.feature diff --git a/features/profile_photos.feature b/features/desktop/profile_photos.feature similarity index 100% rename from features/profile_photos.feature rename to features/desktop/profile_photos.feature diff --git a/features/reshare.feature b/features/desktop/reshare.feature similarity index 100% rename from features/reshare.feature rename to features/desktop/reshare.feature diff --git a/features/screenshots.feature b/features/desktop/screenshots.feature similarity index 100% rename from features/screenshots.feature rename to features/desktop/screenshots.feature diff --git a/features/show_more.feature b/features/desktop/show_more.feature similarity index 100% rename from features/show_more.feature rename to features/desktop/show_more.feature diff --git a/features/signs_up.feature b/features/desktop/signs_up.feature similarity index 100% rename from features/signs_up.feature rename to features/desktop/signs_up.feature diff --git a/features/stops_following_users.feature b/features/desktop/stops_following_users.feature similarity index 100% rename from features/stops_following_users.feature rename to features/desktop/stops_following_users.feature diff --git a/features/tags.feature b/features/desktop/tags.feature similarity index 100% rename from features/tags.feature rename to features/desktop/tags.feature diff --git a/features/tags_and_comments.feature b/features/desktop/tags_and_comments.feature similarity index 100% rename from features/tags_and_comments.feature rename to features/desktop/tags_and_comments.feature diff --git a/features/mobile.feature b/features/mobile.feature deleted file mode 100644 index 7853344ff..000000000 --- a/features/mobile.feature +++ /dev/null @@ -1,11 +0,0 @@ -@javascript -Feature: Navigate mobile site - - In order to navigate Diaspora* - As a mobile user - I want to show mobile site of Diaspora* - - Scenario: Show mobile site - And I visit the mobile aspects page - Then I should see "LOG IN" - diff --git a/features/activity_stream_mobile.feature b/features/mobile/activity_stream.feature similarity index 100% rename from features/activity_stream_mobile.feature rename to features/mobile/activity_stream.feature diff --git a/features/conversations_mobile.feature b/features/mobile/conversations.feature similarity index 100% rename from features/conversations_mobile.feature rename to features/mobile/conversations.feature diff --git a/features/edits_profile_mobile.feature b/features/mobile/edits_profile.feature similarity index 100% rename from features/edits_profile_mobile.feature rename to features/mobile/edits_profile.feature diff --git a/features/getting_started_mobile.feature b/features/mobile/getting_started.feature similarity index 100% rename from features/getting_started_mobile.feature rename to features/mobile/getting_started.feature diff --git a/features/multiphoto_mobile.feature b/features/mobile/multiphoto.feature similarity index 100% rename from features/multiphoto_mobile.feature rename to features/mobile/multiphoto.feature diff --git a/features/posts_from_main_page_mobile.feature b/features/mobile/posts_from_main_page.feature similarity index 100% rename from features/posts_from_main_page_mobile.feature rename to features/mobile/posts_from_main_page.feature diff --git a/features/reactions_mobile.feature b/features/mobile/reactions.feature similarity index 100% rename from features/reactions_mobile.feature rename to features/mobile/reactions.feature diff --git a/features/reshare_mobile.feature b/features/mobile/reshare.feature similarity index 100% rename from features/reshare_mobile.feature rename to features/mobile/reshare.feature diff --git a/features/tags_mobile.feature b/features/mobile/tags.feature similarity index 100% rename from features/tags_mobile.feature rename to features/mobile/tags.feature From 261ac786c15d05628298843ed3d8b0b0abab857a Mon Sep 17 00:00:00 2001 From: Fabian Rodriguez Date: Sun, 25 Aug 2013 20:44:11 -0300 Subject: [PATCH 5/5] avoid use :visible option in capybara finders --- features/step_definitions/comment_steps.rb | 2 +- features/step_definitions/custom_web_steps.rb | 8 ++++---- features/step_definitions/keyboard_navigation_steps.rb | 2 +- features/step_definitions/posts_steps.rb | 5 +++-- features/support/publishing_cuke_helpers.rb | 4 ++-- 5 files changed, 11 insertions(+), 10 deletions(-) diff --git a/features/step_definitions/comment_steps.rb b/features/step_definitions/comment_steps.rb index 086cde46a..4569a92eb 100644 --- a/features/step_definitions/comment_steps.rb +++ b/features/step_definitions/comment_steps.rb @@ -8,7 +8,7 @@ end Then /^the first comment field should be closed$/ do page.should have_css(".stream_element") - find("#main_stream .stream_element .new_comment", match: :first, visible: false).should_not be_visible + page.should_not have_selector("#main_stream .stream_element .new_comment", match: :first) end When /^I comment "([^"]*)" on "([^"]*)"$/ do |comment_text, post_text| diff --git a/features/step_definitions/custom_web_steps.rb b/features/step_definitions/custom_web_steps.rb index 5b42b9263..fc2d65745 100644 --- a/features/step_definitions/custom_web_steps.rb +++ b/features/step_definitions/custom_web_steps.rb @@ -95,8 +95,6 @@ end When /^I append "([^"]*)" to the publisher$/ do |stuff| elem = find('#status_message_fake_text') elem.native.send_keys(' ' + stuff) - - find('#status_message_text', visible: false).value.should include(stuff) end When /^I append "([^"]*)" to the publisher mobile$/ do |stuff| @@ -119,7 +117,8 @@ end When /^I prepare the deletion of the first post$/ do within('.stream_element', match: :first) do - find('.remove_post', visible: false).click + find('.controls').hover + find('.remove_post').click end end @@ -130,7 +129,8 @@ end When /^I click to delete the first comment$/ do within("div.comment", match: :first) do - find(".comment_delete", visible: false).click + find(".controls").hover + find(".comment_delete").click end end diff --git a/features/step_definitions/keyboard_navigation_steps.rb b/features/step_definitions/keyboard_navigation_steps.rb index e39ed4c32..9c7a08d7c 100644 --- a/features/step_definitions/keyboard_navigation_steps.rb +++ b/features/step_definitions/keyboard_navigation_steps.rb @@ -5,7 +5,7 @@ When /^I press the "([^\"]*)" key somewhere$/ do |key| end When /^I press the "([^\"]*)" key in the publisher$/ do |key| - find("#status_message_fake_text", visible: false).native.send_keys(key) + find("#status_message_fake_text").native.send_keys(key) end Then /^post (\d+) should be highlighted$/ do |position| diff --git a/features/step_definitions/posts_steps.rb b/features/step_definitions/posts_steps.rb index aefe6a09e..ade6b1cfc 100644 --- a/features/step_definitions/posts_steps.rb +++ b/features/step_definitions/posts_steps.rb @@ -7,7 +7,7 @@ Then /^the post should be expanded$/ do end Then /^I should see an uploaded image within the photo drop zone$/ do - find("#photodropzone img", visible: false)["src"].should include("uploads/images") + find("#photodropzone img")["src"].should include("uploads/images") end Then /^I should not see an uploaded image within the photo drop zone$/ do @@ -35,7 +35,8 @@ And /^the post with text "([^"]*)" is reshared by "([^"]*)"$/ do |text, email| end When /^I click on the first block button/ do - find(".block_user", visible: false).click + find(".stream_element", match: :first).hover + find(".block_user").click end When /^I expand the post$/ do diff --git a/features/support/publishing_cuke_helpers.rb b/features/support/publishing_cuke_helpers.rb index 3e16cd73f..fe3bb6a8e 100644 --- a/features/support/publishing_cuke_helpers.rb +++ b/features/support/publishing_cuke_helpers.rb @@ -20,7 +20,7 @@ module PublishingCukeHelpers def expand_first_post within(".stream_element", match: :first) do find(".expander").click - find(".expander", visible: false).should_not be_visible + has_css?(".expander").should be_false end end @@ -30,7 +30,7 @@ module PublishingCukeHelpers end def first_post_expanded? - find(".stream_element .expander", match: :first, visible: false).should_not be_visible + has_no_css?(".stream_element .expander", match: :first).should be_true find(".stream_element .collapsible", match: :first).has_no_selector?(".collapsed") find(".stream_element .collapsible", match: :first).has_selector?(".opened") end