I have a selenium suite in rspec.
How can I run multiple cases and keep the browser open and logged in between them?
I have a test suite in the selenium IDE that is comprised of about 20 unit cases.
I've exported both the individual test cases and the test suite file itself to ruby/rspec
I can run individual tests and they pass, e.g.
rspec spec/2day/units/set_QA_district_name_spec.rb
However when I tried to run the converted suite with either
rake spec
or
rspec spec/2day/complete_district_suite_spec.rb
it runs each spec one-by-one by bringing up (and then closing) the application for each test.
How can I run the suite and have the browser 'stay' up and logged in from test to test and not be opening and then closing down the browser window for each unit test that runs.
I have to run these tests in the standalone directory that I've created as they have to be kept separate from the rest of the applications test areas, in other words I have to avoid any use of rails itself.
I have set up the following Gemfile / spec_helper / Rake files in the root directory for these files as follows:
Gemfile:
gem 'rspec'
gem 'selenium-webdriver'
spec_runner.rb:
require "selenium-webdriver"
require 'rspec'
Rakefile
require 'rspec'
require 'rspec/core/rake_task'
desc "Run all examples"
RSpec::Core::RakeTask.new(:spec) do |t|
t.ruby_opts = %w[-w]
t.rspec_opts = %w[--color]
end
The contents of complete_district_suite.rb are:
ENV['RSPEC_COLOR'] = 'true'
require File.join(File.dirname(__FILE__), "units/set_QA_district_name_spec.rb")
require File.join(File.dirname(__FILE__), "units/set_file_uploads_source_location_spec.rb")
require File.join(File.dirname(__FILE__), "units/district_spec.rb")
require File.join(File.dirname(__FILE__), "units/select_district_spec.rb")
require File.join(File.dirname(__FILE__), "units/upload_service_types_spec.rb")
require File.join(File.dirname(__FILE__), "units/upload_services_spec.rb")
require File.join(File.dirname(__FILE__), "units/upload_grades_spec.rb")
require File.join(File.dirname(__FILE__), "units/upload_schools_spec.rb")
require File.join(File.dirname(__FILE__), "units/upload_classrooms_spec.rb")
require File.join(File.dirname(__FILE__), "units/upload_students_spec.rb")
require File.join(File.dirname(__FILE__), "units/upload_ieps_spec.rb")
require File.join(File.dirname(__FILE__), "units/upload_travel_spec.rb")
require File.join(File.dirname(__FILE__), "units/manual_add_student_spec.rb")
require File.join(File.dirname(__FILE__), "units/generate_basic_schedule_spec.rb")
require File.join(File.dirname(__FILE__), "units/wait_for_dss_to_finish_spec.rb")
require File.join(File.dirname(__FILE__), "units/view_schedules_spec.rb")
require File.join(File.dirname(__FILE__), "units/visit_first_schedule_spec.rb")
require File.join(File.dirname(__FILE__), "units/monday_1pm_new_appt_spec.rb")
require File.join(File.dirname(__FILE__), "units/tuesday_2pm_new_5_students_spec.rb")
require File.join(File.dirname(__FILE__), "units/wednesday_9am_5pm_new_1_student_spec.rb")
require File.join(File.dirname(__FILE__), "units/thursday_9am_10am_new_1_manual_add_student_spec.rb")
require File.join(File.dirname(__FILE__), "units/friday_10am_11am_new_5_students_spec.rb")