diff --git a/Gemfile b/Gemfile index 5fd5f21d1..75e0e83ef 100644 --- a/Gemfile +++ b/Gemfile @@ -243,7 +243,6 @@ end group :development do # Automatic test runs gem "guard", "2.15.0", require: false - gem "guard-cucumber", "2.1.2", require: false gem "guard-rspec", "4.7.3", require: false gem "guard-rubocop", "1.3.0", require: false gem "rb-fsevent", "0.10.3", require: false @@ -284,7 +283,7 @@ group :test do # Cucumber (integration tests) - gem "capybara", "2.18.0" + gem "capybara", "3.11.1" gem "database_cleaner", "1.7.0" gem "poltergeist", "1.18.1" @@ -308,7 +307,7 @@ group :development, :test do gem "rspec-rails", "3.8.1" # Cucumber (integration tests) - gem "cucumber-rails", "1.5.0", require: false + gem "cucumber-rails", "1.6.0", require: false # Jasmine (client side application tests (JS)) gem "jasmine", "3.3.0" diff --git a/Gemfile.lock b/Gemfile.lock index bf958b8e4..162a191bc 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -67,6 +67,7 @@ GEM babel-transpiler (0.7.0) babel-source (>= 4.0, < 6) execjs (~> 2.0) + backports (3.11.4) bcrypt (3.1.12) bindata (2.4.4) bootstrap-sass (3.3.7) @@ -76,13 +77,14 @@ GEM buftok (0.2.0) builder (3.2.3) byebug (10.0.2) - capybara (2.18.0) + capybara (3.11.1) addressable mini_mime (>= 0.1.3) - nokogiri (>= 1.3.3) - rack (>= 1.0.0) - rack-test (>= 0.5.4) - xpath (>= 2.0, < 4.0) + nokogiri (~> 1.8) + rack (>= 1.6.0) + rack-test (>= 0.6.3) + regexp_parser (~> 1.2) + xpath (~> 3.2) carrierwave (1.2.3) activemodel (>= 4.0.0) activesupport (>= 4.0.0) @@ -139,25 +141,30 @@ GEM crack (0.4.3) safe_yaml (~> 1.0.0) crass (1.0.4) - cucumber (2.99.0) + cucumber (3.1.2) builder (>= 2.1.2) - cucumber-core (~> 1.5.0) + cucumber-core (~> 3.2.0) + cucumber-expressions (~> 6.0.1) cucumber-wire (~> 0.0.1) - diff-lcs (>= 1.1.3) - gherkin (~> 4.0) + diff-lcs (~> 1.3) + gherkin (~> 5.1.0) multi_json (>= 1.7.5, < 2.0) multi_test (>= 0.1.2) cucumber-api-steps (0.14.0) cucumber (>= 2.0.2) jsonpath (>= 0.1.2) - cucumber-core (1.5.0) - gherkin (~> 4.0) - cucumber-rails (1.5.0) - capybara (>= 1.1.2, < 3) - cucumber (>= 1.3.8, < 4) + cucumber-core (3.2.1) + backports (>= 3.8.0) + cucumber-tag_expressions (~> 1.1.0) + gherkin (~> 5.0) + cucumber-expressions (6.0.1) + cucumber-rails (1.6.0) + capybara (>= 1.1.2, < 4) + cucumber (>= 3.0.2, < 4) mime-types (>= 1.17, < 4) - nokogiri (~> 1.5) - railties (>= 4, < 5.2) + nokogiri (~> 1.8) + railties (>= 4, < 6) + cucumber-tag_expressions (1.1.1) cucumber-wire (0.0.1) database_cleaner (1.7.0) devise (4.5.0) @@ -250,7 +257,7 @@ GEM rspec-core (~> 3.0) ruby-progressbar (~> 1.4) get_process_mem (0.2.3) - gherkin (4.1.3) + gherkin (5.1.0) gitlab (4.7.0) httparty (>= 0.14.0) terminal-table (>= 1.5.1) @@ -270,10 +277,6 @@ GEM shellany (~> 0.0) thor (>= 0.18.1) guard-compat (1.2.1) - guard-cucumber (2.1.2) - cucumber (~> 2.0) - guard-compat (~> 1.0) - nenv (~> 0.1) guard-rspec (4.7.3) guard (~> 2.1) guard-compat (~> 1.1) @@ -594,6 +597,7 @@ GEM ffi (>= 0.5.0, < 2) redcarpet (3.4.0) redis (3.3.5) + regexp_parser (1.3.0) request_store (1.4.1) rack (>= 1.4) responders (2.4.0) @@ -780,13 +784,13 @@ DEPENDENCIES autoprefixer-rails (= 8.6.5) bootstrap-sass (= 3.3.7) bootstrap-switch-rails (= 3.3.4) - capybara (= 2.18.0) + capybara (= 3.11.1) carrierwave (= 1.2.3) compass-rails (= 3.1.0) configurate (= 0.3.1) coveralls (= 0.8.22) cucumber-api-steps (= 0.14) - cucumber-rails (= 1.5.0) + cucumber-rails (= 1.6.0) database_cleaner (= 1.7.0) devise (= 4.5.0) devise_lastseenable (= 0.0.6) @@ -805,7 +809,6 @@ DEPENDENCIES fuubar (= 2.3.2) gon (= 6.2.1) guard (= 2.15.0) - guard-cucumber (= 2.1.2) guard-rspec (= 4.7.3) guard-rubocop (= 1.3.0) haml_lint (= 0.28.0) diff --git a/Guardfile b/Guardfile index 2ecb276ed..f10147bba 100644 --- a/Guardfile +++ b/Guardfile @@ -23,17 +23,6 @@ guard :rspec, cmd: "bin/spring rspec", all_on_start: false, all_after_pass: fals watch(%r{^app/views/(.+)/.*\.(erb|haml)$}) {|m| "spec/requests/#{m[1]}_spec.rb" } end -guard(:cucumber, - cmd: "bin/spring cucumber", - all_on_start: false, - all_after_pass: false) do - watch(/^features\/.+\.feature$/) - watch(%r{^features/support/.+$}) { "features" } - watch(%r{^features/step_definitions/(.+)_steps\.rb$}) {|m| - Dir[File.join("**/#{m[1]}.feature")][0] || "features" - } -end - guard :rubocop, all_on_start: false, keep_failed: false do watch(/(?:app|config|db|lib|features|spec)\/.+\.rb$/) watch(/(config.ru|Gemfile|Guardfile|Rakefile)$/) diff --git a/config/cucumber.yml b/config/cucumber.yml index 977c9d5ae..35ca76a82 100644 --- a/config/cucumber.yml +++ b/config/cucumber.yml @@ -4,14 +4,14 @@ format = ENV['CUCUMBER_FORMAT'] || 'pretty' # option lists for the `cucumber` command rerun_opts = rerun.to_s.strip.empty? ? "--format #{format} features" : "--format #{format} #{rerun}" -std_opts = "--format #{format} --strict --tags ~@wip --tags ~@screenshots" +std_opts = "--format #{format} --strict --tags 'not @wip and not @screenshots'" screenshot_opts = "--require features --format pretty" %> # 'normal' test runs -default: <%= std_opts %> -r features --tags ~@nophantomjs +default: <%= std_opts %> -r features --tags 'not @nophantomjs' wip: -r features --tags @wip:3 --wip features -rerun: <%= rerun_opts %> --format rerun --out rerun.txt --strict --tags ~@wip --tags ~@screenshots +rerun: <%= rerun_opts %> --format rerun --out rerun.txt --strict --tags 'not @wip and not @screenshots' # screenshot feature ref_screens: "<%= screenshot_opts %> --tags @reference-screenshots" diff --git a/docker/develop/docker-compose.yml b/docker/develop/docker-compose.yml index 83fbc83fb..b2d5e9d55 100644 --- a/docker/develop/docker-compose.yml +++ b/docker/develop/docker-compose.yml @@ -20,7 +20,7 @@ services: - dia_data_tmp:/diaspora/tmp - dia_data_bundle:/diaspora/vendor/bundle ports: - - 8080:3000 + - ${DIASPORA_DOCKER_PORT:-3000}:3000 depends_on: - "${DIASPORA_DOCKER_DB}" diff --git a/features/desktop/post_with_a_poll.feature b/features/desktop/post_with_a_poll.feature index 31843c3eb..63edd85a5 100644 --- a/features/desktop/post_with_a_poll.feature +++ b/features/desktop/post_with_a_poll.feature @@ -33,7 +33,7 @@ Feature: posting with a poll And I fill in values for the first two options And I lose focus And I delete the last option - Then I should see 2 option + Then I should see 2 options And I should not see a remove icon Scenario: post with an attached poll diff --git a/features/mobile/drawer.feature b/features/mobile/drawer.feature index 41bf76976..a2f14b58b 100644 --- a/features/mobile/drawer.feature +++ b/features/mobile/drawer.feature @@ -138,7 +138,7 @@ Feature: Navigate between pages using the header menu and the drawer Then I should see "Reports overview" within "#main h1" When I click on "Admin" in the drawer And I click on "Pod network" in the drawer - Then I should see "Pod network " within "#main h2" + Then I should see "Pod network" within "#main h2" When I click on "Admin" in the drawer Then I should see "Sidekiq monitor" within "#drawer" diff --git a/features/step_definitions/aspects_steps.rb b/features/step_definitions/aspects_steps.rb index a5a61b3b3..9add74766 100644 --- a/features/step_definitions/aspects_steps.rb +++ b/features/step_definitions/aspects_steps.rb @@ -19,7 +19,7 @@ module AspectCukeHelpers def toggle_aspect_via_ui(aspect_name) aspects_dropdown = find(".aspect-membership-dropdown .dropdown-toggle", match: :first) aspects_dropdown.trigger "click" - selected_aspect_count = all(".aspect-membership-dropdown.open .dropdown-menu li.selected").length + selected_aspect_count = all(".aspect-membership-dropdown.open .dropdown-menu li.selected", wait: false).length aspect = find(".aspect-membership-dropdown.open .dropdown-menu li", text: aspect_name) aspect_selected = aspect["class"].include? "selected" aspect.trigger "click" @@ -50,7 +50,7 @@ When /^I select only "([^"]*)" aspect$/ do |aspect_name| click_link "My aspects" expect(find("#aspect-stream-container")).to have_css(".loader.hidden", visible: false) within("#aspects_list") do - all(".selected").each do |node| + all(".selected", wait: false).each do |node| aspect_item = node.find(:xpath, "..") aspect_item.click expect(aspect_item).to have_no_css ".selected" @@ -76,14 +76,14 @@ end When /^I add the first person to the aspect$/ do find(".contact_add-to-aspect", match: :first).tap do |button| button.click - button.parent.should have_css ".contact_remove-from-aspect" + button.query_scope.should have_css ".contact_remove-from-aspect" end end When /^I remove the first person from the aspect$/ do find(".contact_remove-from-aspect", match: :first).tap do |button| button.click - button.parent.should have_css ".contact_add-to-aspect" + button.query_scope.should have_css ".contact_add-to-aspect" sleep 1 # The expectation above should wait for the request to finsh, but that doesn't work for some reason end end diff --git a/features/step_definitions/custom_web_steps.rb b/features/step_definitions/custom_web_steps.rb index ef9743694..06c291c44 100644 --- a/features/step_definitions/custom_web_steps.rb +++ b/features/step_definitions/custom_web_steps.rb @@ -127,7 +127,7 @@ end When /^I click to delete the first uploaded photo$/ do page.execute_script("$('#photodropzone .x').css('display', 'block');") - image_count = all(".publisher_photo img").count + image_count = all(".publisher_photo img", wait: false).count find("#photodropzone .x", match: :first).trigger "click" page.assert_selector(".publisher_photo img", count: image_count - 1) end diff --git a/features/step_definitions/post_with_poll_steps.rb b/features/step_definitions/post_with_poll_steps.rb index 6ab1e1640..f1139c626 100644 --- a/features/step_definitions/post_with_poll_steps.rb +++ b/features/step_definitions/post_with_poll_steps.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true -Then /^I should see ([1-9]+) options?$/ do |number| - find("#poll_creator_container").all(".poll-answer").count.should eql(number.to_i) +Then "I should see {int} options" do |number| + find("#poll_creator_container").all(".poll-answer", count: number) end And /^I delete the last option$/ do diff --git a/features/support/env.rb b/features/support/env.rb index aa4efa134..794aa875c 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -24,6 +24,8 @@ Capybara.server_port = AppConfig.pod_uri.port Rails.application.routes.default_url_options[:host] = AppConfig.pod_uri.host Rails.application.routes.default_url_options[:port] = AppConfig.pod_uri.port +Capybara.server = :webrick + Capybara.register_driver :poltergeist do |app| Capybara::Poltergeist::Driver.new(app, timeout: 30) end diff --git a/features/support/publishing_cuke_helpers.rb b/features/support/publishing_cuke_helpers.rb index 2b78f8e97..349a0c542 100644 --- a/features/support/publishing_cuke_helpers.rb +++ b/features/support/publishing_cuke_helpers.rb @@ -14,7 +14,7 @@ module PublishingCukeHelpers def upload_file_with_publisher(path) page.execute_script(%q{$("input[name='qqfile']").css("opacity", '1');}) - image_count = all(".publisher_photo img").count + image_count = all(".publisher_photo img", wait: false).count with_scope("#publisher-textarea-wrapper") do attach_file("qqfile", Rails.root.join(path).to_s) # wait for the image to be ready @@ -30,7 +30,7 @@ module PublishingCukeHelpers end def visible_text_from_markdown(text) - CGI.unescapeHTML(ActionController::Base.helpers.strip_tags(Diaspora::MessageRenderer.new(text).markdownified.strip)) + CGI.unescapeHTML(ActionController::Base.helpers.strip_tags(Diaspora::MessageRenderer.new(text).markdownified)).strip end def submit_publisher diff --git a/features/support/user_cuke_helpers.rb b/features/support/user_cuke_helpers.rb index 1b24eb5b2..196080408 100644 --- a/features/support/user_cuke_helpers.rb +++ b/features/support/user_cuke_helpers.rb @@ -49,7 +49,7 @@ module UserCukeHelpers if mobile expect(page).to have_css "#menu-badge" else - expect(find("#user-menu")).to have_content "#{@me.first_name} #{@me.last_name}" + expect(find("#user-menu")).to have_content "#{@me.first_name} #{@me.last_name}".strip end end diff --git a/lib/tasks/cucumber.rake b/lib/tasks/cucumber.rake index b572086e3..0b79485bb 100644 --- a/lib/tasks/cucumber.rake +++ b/lib/tasks/cucumber.rake @@ -20,6 +20,7 @@ begin t.binary = vendored_cucumber_bin # If nil, the gem's binary is used. t.fork = true # You may get faster startup if you set this to false t.profile = 'default' + t.cucumber_opts = %w[--retry 3] end Cucumber::Rake::Task.new({:wip => 'db:test:prepare'}, 'Run features that are being worked on') do |t|