]> git.openstreetmap.org Git - rails.git/blob - test/application_system_test_case.rb
Move system test specific sign in to system test superclass
[rails.git] / test / application_system_test_case.rb
1 require "test_helper"
2
3 ENV.delete("http_proxy")
4
5 ActiveSupport.on_load(:action_dispatch_system_test_case) do
6   ActionDispatch::SystemTesting::Server.silence_puma = true
7 end
8
9 class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
10   driven_by :selenium, :using => :headless_firefox do |options|
11     options.add_preference("intl.accept_languages", "en")
12   end
13
14   def before_setup
15     super
16     osm_website_app = create(:oauth_application, :name => "OpenStreetMap Web Site", :scopes => "write_api write_notes")
17     Settings.oauth_application = osm_website_app.uid
18   end
19
20   def after_teardown
21     Settings.reload!
22     super
23   end
24
25   private
26
27   def sign_in_as(user)
28     visit login_path
29     within "form", :text => "Email Address or Username" do
30       fill_in "username", :with => user.email
31       fill_in "password", :with => "test"
32       click_on "Login"
33     end
34   end
35
36   def within_sidebar(&block)
37     within "#sidebar_content", &block
38   end
39 end