From af938fe74fa4175ba65b27c7f9dc8d9b90bad99a Mon Sep 17 00:00:00 2001
From: Stephen Caudill <scaudill@gmail.com>
Date: Sat, 25 Sep 2010 13:29:08 -0400
Subject: [PATCH] Remove unused/broken Selenium tests

---
 Gemfile                           |  4 +--
 Gemfile.lock                      | 20 ++++-------
 lib/tasks/saucelabs_adapter.rake  | 59 -------------------------------
 test/performance/browsing_test.rb | 13 -------
 test/selenium/login_test.rb       | 11 ------
 test/selenium/selenium_suite.rb   | 15 --------
 test/test_helper.rb               | 17 ---------
 7 files changed, 8 insertions(+), 131 deletions(-)
 delete mode 100644 lib/tasks/saucelabs_adapter.rake
 delete mode 100644 test/performance/browsing_test.rb
 delete mode 100644 test/selenium/login_test.rb
 delete mode 100644 test/selenium/selenium_suite.rb
 delete mode 100644 test/test_helper.rb

diff --git a/Gemfile b/Gemfile
index 1525b735ac..d58183d77b 100644
--- a/Gemfile
+++ b/Gemfile
@@ -46,11 +46,9 @@ group :test do
   gem 'rspec', '>= 2.0.0.beta.17'
   gem 'rspec-rails', '2.0.0.beta.17'
   gem 'mocha'
-  gem 'webrat', '0.7.2.beta.1'
+  gem 'redgreen'
   gem 'autotest'
   gem 'database_cleaner'
-  gem 'saucelabs-adapter', '= 0.8.12'
-  gem 'selenium-rc'
   gem 'webmock'
 end
 
diff --git a/Gemfile.lock b/Gemfile.lock
index ac66e59c17..6aed3dd328 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -128,7 +128,7 @@ GEM
     highline (1.6.1)
     i18n (0.4.1)
     json (1.4.6)
-    lsof (0.3.0)
+    linecache (0.43)
     mail (2.2.6.1)
       activesupport (>= 2.3.6)
       mime-types
@@ -189,15 +189,11 @@ GEM
     rspec-rails (2.0.0.beta.17)
       rspec (>= 2.0.0.beta.14)
       webrat (>= 0.7.0)
-    saucelabs-adapter (0.8.12)
-      lsof (>= 0.3.0)
-      net-ssh (>= 2.0.12)
-      net-ssh-gateway (>= 1.0.1)
-      rest-client (>= 1.2.0)
-      selenium-client (>= 1.2.17)
-    selenium-client (1.2.18)
-    selenium-rc (2.2.4)
-      selenium-client (>= 1.2.18)
+    ruby-debug (0.10.3)
+      columnize (>= 0.1)
+      ruby-debug-base (~> 0.10.3.0)
+    ruby-debug-base (0.10.3)
+      linecache (>= 0.3)
     subexec (0.0.4)
     thin (1.2.7)
       daemons (>= 1.0.9)
@@ -247,10 +243,8 @@ DEPENDENCIES
   roxml!
   rspec (>= 2.0.0.beta.17)
   rspec-rails (= 2.0.0.beta.17)
-  saucelabs-adapter (= 0.8.12)
-  selenium-rc
+  ruby-debug
   sprinkle!
   thin
   webmock
-  webrat (= 0.7.2.beta.1)
   will_paginate (= 3.0.pre2)
diff --git a/lib/tasks/saucelabs_adapter.rake b/lib/tasks/saucelabs_adapter.rake
deleted file mode 100644
index 76f6cbbc4b..0000000000
--- a/lib/tasks/saucelabs_adapter.rake
+++ /dev/null
@@ -1,59 +0,0 @@
-#   Copyright (c) 2010, Diaspora Inc.  This file is
-#   licensed under the Affero General Public License version 3.  See
-#   the COPYRIGHT file.
-
-
-
-require 'saucelabs_adapter/run_utils'
-
-class Rake::Task
-  def self.exists?(name)
-    tasks.any? { |t| t.name == name }
-  end
-end
-
-namespace :selenium do
-
-  # Rake tasks are cumulative, and some old plugins are still defining selenium:server, so clear it.
-  Rake::Task[:'selenium:server'].clear_actions if Rake::Task.exists?('selenium:server')
-  
-  desc "Run the selenium remote-control server"
-  task :server do
-    system('bundle exec selenium-rc')
-  end
-
-  desc "Run the selenium remote-control server in the background"
-  task :server_bg do
-    system('nohup selenium-rc 2&>1 &')
-  end
-
-  desc "Runs Selenium tests locally (selenium server must already be started)"
-  task :local => [:local_env, :suite]
-
-  desc "Run Selenium tests at saucelabs.com (using configuration 'saucelabs' in config/selenium.yml)"
-  task :sauce => [:sauce_env, :suite]
-
-  desc "Run Selenium tests using configuration SELENIUM_ENV (from config/selenium.yml)"
-  task :custom => [:check_selenium_env_is_set, :suite]
-
-  task :local_env do
-    ENV['SELENIUM_ENV'] = 'local'
-  end
-
-  task :sauce_env do
-    ENV['SELENIUM_ENV'] = 'saucelabs'
-  end
-
-  task :check_selenium_env_is_set do
-    raise "SELENIUM_ENV must be set" unless ENV['SELENIUM_ENV']
-  end
-
-  task :suite do
-    if (File.exists?("test/selenium/selenium_suite.rb"))
-      RunUtils.run "ruby test/selenium/selenium_suite.rb"
-    else
-      puts "test/selenium/selenium_suite.rb not found, bailing.\nPlease create a script that will run your selenium tests."
-      exit 1
-    end
-  end
-end
diff --git a/test/performance/browsing_test.rb b/test/performance/browsing_test.rb
deleted file mode 100644
index 9cc248c9fb..0000000000
--- a/test/performance/browsing_test.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-#   Copyright (c) 2010, Diaspora Inc.  This file is
-#   licensed under the Affero General Public License version 3.  See
-#   the COPYRIGHT file.
-
-require 'test_helper'
-require 'rails/performance_test_help'
-
-# Profiling results for each test method are written to tmp/performance.
-class BrowsingTest < ActionDispatch::PerformanceTest
-  def test_homepage
-    get '/'
-  end
-end
diff --git a/test/selenium/login_test.rb b/test/selenium/login_test.rb
deleted file mode 100644
index b60d2db8c0..0000000000
--- a/test/selenium/login_test.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-#   Copyright (c) 2010, Diaspora Inc.  This file is
-#   licensed under the Affero General Public License version 3.  See
-#   the COPYRIGHT file.
-
-class SampleWebratTest < ActionController::IntegrationTest
-
-  def test_widget
-    visit "/"
-    assert_contain "sign in"
-  end
-end
diff --git a/test/selenium/selenium_suite.rb b/test/selenium/selenium_suite.rb
deleted file mode 100644
index 7f4df5e4c3..0000000000
--- a/test/selenium/selenium_suite.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-#   Copyright (c) 2010, Diaspora Inc.  This file is
-#   licensed under the Affero General Public License version 3.  See
-#   the COPYRIGHT file.
-
-require File.expand_path(File.join(File.dirname(__FILE__), '..', 'test_helper'))
-require 'test/unit/ui/console/testrunner'
-require 'webrat'
-require 'saucelabs_adapter'
-
-Webrat.configure do |config|
-  config.mode = :selenium
-  config.application_framework = :rack
-end
-
-require File.join(File.dirname(__FILE__), 'sample_webrat_test')
diff --git a/test/test_helper.rb b/test/test_helper.rb
deleted file mode 100644
index e46a0a70cb..0000000000
--- a/test/test_helper.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-#   Copyright (c) 2010, Diaspora Inc.  This file is
-#   licensed under the Affero General Public License version 3.  See
-#   the COPYRIGHT file.
-
-ENV["RAILS_ENV"] = "test"
-require File.expand_path('../../config/environment', __FILE__)
-require 'rails/test_help'
-
-class ActiveSupport::TestCase
-  # Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
-  #
-  # Note: You'll currently still have to declare fixtures explicitly in integration tests
-  # -- they do not yet inherit this setting
-  #fixtures :all
-
-  # Add more helper methods to be used by all tests here...
-end
-- 
GitLab